Turns form data into JSON and opens a pull request. https://fediblock.org/
This repository has been archived on 2021-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
tastytea 3af723abd8
All checks were successful
continuous-integration/drone/push Build is passing
Use unordered lists in HTML/RSS generators.
2020-10-17 05:26:17 +02:00
cmake Update FindFilesystem, re-enable support for CMake 3.10. 2020-07-08 06:13:09 +02:00
src Use unordered lists in HTML/RSS generators. 2020-10-17 05:26:17 +02:00
tests Fix test. 2020-07-14 17:55:35 +02:00
.clang-format Update clang-format config. 2020-07-05 12:06:37 +02:00
.drone.yml Fix CI. 2020-10-15 06:04:43 +02:00
.editorconfig Add skeleton. 2020-06-29 03:07:46 +02:00
.gitignore Add skeleton. 2020-06-29 03:07:46 +02:00
AUTHORS Add skeleton. 2020-06-29 03:07:46 +02:00
CMakeLists.txt Add support for RSS tags. Also add cgi::tolower(). 2020-10-15 04:45:43 +02:00
CODE_OF_CONDUCT.adoc Add skeleton. 2020-06-29 03:07:46 +02:00
CONTRIBUTING.adoc Fix URIs in contributing guidelines. 2020-06-29 06:24:56 +02:00
CREDITS Add ICU to credits. 2020-10-17 02:31:37 +02:00
LICENSE Add skeleton. 2020-06-29 03:07:46 +02:00
README.adoc Add lockfile locations to readme. 2020-10-17 03:07:37 +02:00

fediblock-backend

fediblock-backend turns form data into JSON and opens a pull request on FediBlock/data. Also included are tools to generate a HTML list and (soon) an RSS generator.

Usage

nginx config
# […]

expires 2h;

location /add {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass    unix:/var/run/cgi-fcgiwrap.socket-1;
    fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend;
    fastcgi_param HOME "/var/lib/nginx"; # When I didn't set it, HOME was /root.
}

location /rss {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass    unix:/var/run/cgi-fcgiwrap.socket-1;
    fastcgi_param SCRIPT_FILENAME /usr/bin/fediblock-backend-gen_rss;
    fastcgi_param HOME "/var/lib/nginx";
}
Generate SSH key
sudo -u nginx ssh-keygen -t ed25519 -f ~nginx/.local/share/fediblock-backend/ssh_id

Dont forget to add the key to the data repo.

Generate an access token and save it in ~nginx/.local/share/fediblock-backend/gitea_access_token.

Note
On non-Linux systems the data path is ~nginx/.fediblock-backend unless XDG_DATA_HOME is set.

Make sure the user that runs the CGI programs can create lockfiles. In Linux, the locations are /run/user/<UID> or /run/lock, on UNIX the location is /var/run. If none of these locations exist, /tmp is used as a fallback.

Generate HTML blocklist

After compiling, run src/generators/gen_html in your build dir. The screenshots will be copied into the target directory and the output will be the HTML file.

Example: Generate the HTML blocklist in ~/blocklist/
./src/generators/gen_html ~/blocklist > ~/blocklist/index.html

Existing screenshots will not be overwritten.

Note
The RSS generator expects the blocklist to be in http(s)://your-domain/blocklist/.

Install

From source

Dependencies

  • Tested OS: Linux

  • C++ compiler with C++17 support (tested: GCC 7/8/9/10, clang 6/7/10)

  • CMake (at least: 3.10)

  • cgicc (tested: 3.2)

  • nlohmann-json (tested: 3.7 / 2.1)

  • libgit2 with SSH support (tested: 1.0 / 0.26)

  • libcurl (at least: 7.56)

  • ICU (tested: 67.1 / 60.2)

  • Optional

    • Tests: Catch (tested: 2.5 / 1.10)

    • DEB package: dpkg (tested: 1.19)

    • RPM package: rpm-build (tested: 4.11)

Get sourcecode

git clone https://schlomp.space/FediBlock/backend.git

Compile

mkdir -p build && cd build
cmake ..
cmake --build . -- --jobs=$(nproc --ignore=1)
CMake options:
  • -DCMAKE_BUILD_TYPE=Debug for a debug build.

  • -DWITH_TESTS=YES if you want to compile the tests.

  • -DWITH_CLANG-TIDY=YES to check the sourcecode with clang-tidy while compiling.

  • One of:

    • -DWITH_DEB=YES if you want to be able to generate a deb-package.

    • -DWITH_RPM=YES if you want to be able to generate an rpm-package.

To create a deb or rpm package, run make package after compiling.