diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..a659325 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +PIXIV_REFRESH_TOKEN = "" \ No newline at end of file diff --git a/README.md b/README.md index 3f61d54..ed28af3 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ The pixiv embed fixer This project is still in development, please be patient until this project is actually usable. +## build + +Simply use `cargo build` and/or `cargo run`. + +**Mind that you need a refresh token from pixiv to get API access.** + + ## nix build As this mainly runs on my NixOS server for now, so build and service files are included. diff --git a/Rocket.toml b/Rocket.toml index a1e25bd..21ab8be 100644 --- a/Rocket.toml +++ b/Rocket.toml @@ -4,4 +4,7 @@ port = 5470 [production] address = "0.0.0.0" -port = 5470 \ No newline at end of file +port = 5470 + +[default.databases] +illustrations = { url = "sqlite:fxpixiv.db" } \ No newline at end of file diff --git a/default.nix b/default.nix index 1b6db06..4078a55 100644 --- a/default.nix +++ b/default.nix @@ -10,6 +10,10 @@ rustPlatform.buildRustPackage rec { lockFile = ./Cargo.lock; }; + checkFlags = [ + "--skip=client_tests::login --skip=client_tests::illust_details" + ]; + cargoSha256 = lib.fakeSha256; # Replace with the actual hash nativeBuildInputs = [ pkgs.pkg-config ]; diff --git a/fxpixiv.service.nix b/fxpixiv.service.nix index 98270b6..d22d8c7 100644 --- a/fxpixiv.service.nix +++ b/fxpixiv.service.nix @@ -15,9 +15,14 @@ in port = mkOption { type = types.int; - default = 8000; description = "Port on which the fxpixiv embed helper listens."; }; + + refreshToken = mkOption { + type = types.str; + default = ""; + description = "Allows access to the Pixiv API."; + }; }; config = mkIf config.services.fxpixiv.enable { @@ -29,7 +34,10 @@ in serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv"; # Set the port environment variable - serviceConfig.Environment = [ "ROCKET_PORT=${toString config.services.fxpixiv.port}" ]; + serviceConfig.Environment = [ + "ROCKET_PORT=${toString config.services.fxpixiv.port}" + "PIXIV_REFRESH_TOKEN=${toString config.services.fxpixiv.refreshToken}" + ]; # Restart on failure serviceConfig.Restart = "always";