disable tests, add instructions and create config stub for token

This commit is contained in:
theBreadCompany 2024-09-25 05:44:29 +02:00
parent 129d60f07f
commit aa5d4aeacd
5 changed files with 27 additions and 3 deletions

2
.cargo/config.toml Normal file
View file

@ -0,0 +1,2 @@
[env]
PIXIV_REFRESH_TOKEN = ""

View file

@ -6,6 +6,13 @@ The pixiv embed fixer
This project is still in development, please be patient until this project is actually usable. 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 ## nix build
As this mainly runs on my NixOS server for now, so build and service files are included. As this mainly runs on my NixOS server for now, so build and service files are included.

View file

@ -4,4 +4,7 @@ port = 5470
[production] [production]
address = "0.0.0.0" address = "0.0.0.0"
port = 5470 port = 5470
[default.databases]
illustrations = { url = "sqlite:fxpixiv.db" }

View file

@ -10,6 +10,10 @@ rustPlatform.buildRustPackage rec {
lockFile = ./Cargo.lock; lockFile = ./Cargo.lock;
}; };
checkFlags = [
"--skip=client_tests::login --skip=client_tests::illust_details"
];
cargoSha256 = lib.fakeSha256; # Replace with the actual hash cargoSha256 = lib.fakeSha256; # Replace with the actual hash
nativeBuildInputs = [ pkgs.pkg-config ]; nativeBuildInputs = [ pkgs.pkg-config ];

View file

@ -15,9 +15,14 @@ in
port = mkOption { port = mkOption {
type = types.int; type = types.int;
default = 8000;
description = "Port on which the fxpixiv embed helper listens."; 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 { config = mkIf config.services.fxpixiv.enable {
@ -29,7 +34,10 @@ in
serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv"; serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv";
# Set the port environment variable # 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 # Restart on failure
serviceConfig.Restart = "always"; serviceConfig.Restart = "always";