This commit is contained in:
theBreadCompany 2024-10-15 16:17:29 +02:00
parent 28784d627d
commit c36f125437
15 changed files with 13 additions and 15 deletions

0
.cargo/config.toml Normal file → Executable file
View file

0
.gitignore vendored Normal file → Executable file
View file

0
Cargo.lock generated Normal file → Executable file
View file

0
Cargo.toml Normal file → Executable file
View file

0
LICENSE Normal file → Executable file
View file

0
README.md Normal file → Executable file
View file

0
Rocket.toml Normal file → Executable file
View file

0
default.nix Normal file → Executable file
View file

14
fxpixiv.service.nix Normal file → Executable file
View file

@ -34,11 +34,15 @@ in
serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv"; serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv";
# Set the port environment variable # Set the port environment variable
serviceConfig.Environment = [ serviceConfig.EnvironmentFile = pkgs.writeTextFile {
"ROCKET_ENV=release" name = "fxpixiv.env";
"ROCKET_PORT=${toString config.services.fxpixiv.port}" text = ''
"PIXIV_REFRESH_TOKEN=${toString config.services.fxpixiv.refreshToken}" "ROCKET_ENV=release"
]; "ROCKET_PORT=${toString config.services.fxpixiv.port}"
"PIXIV_REFRESH_TOKEN=${toString config.services.fxpixiv.refreshToken}"
'';
meta.mode = "0600";
};
# Restart on failure # Restart on failure
serviceConfig.WorkingDirectory = "/var/lib/fxpixiv"; serviceConfig.WorkingDirectory = "/var/lib/fxpixiv";

0
fxpixiv/Cargo.toml Normal file → Executable file
View file

14
fxpixiv/src/main.rs Normal file → Executable file
View file

@ -112,9 +112,9 @@ async fn fetch_illust(
"; ";
if illust.meta_pages.is_empty() { if illust.meta_pages.is_empty() {
let _ = sqlx::query(pages_query) let _ = sqlx::query(pages_query)
.bind(illust.image_urls.square_medium) .bind(&illust.image_urls.square_medium)
.bind(illust.image_urls.medium) .bind(&illust.image_urls.medium)
.bind(illust.image_urls.large) .bind(&illust.image_urls.large)
.bind( .bind(
&illust &illust
.meta_single_page .meta_single_page
@ -144,14 +144,8 @@ async fn fetch_illust(
}); });
} }
let image = if illust.page_count == 1 {
illust.meta_single_page.unwrap().original_image_url.unwrap()
} else {
illust.meta_pages[0].image_urls.original.clone()
};
return Some(Metadata { return Some(Metadata {
image: image.as_str().replace("pximg.net", "fixiv.net"), image: illust.image_urls.large.replace("pximg.net", "fixiv.net"),
title: illust.title, title: illust.title,
desc: illust.caption, desc: illust.caption,
}); });

0
libpixiv/Cargo.toml Normal file → Executable file
View file

0
libpixiv/README.md Normal file → Executable file
View file

0
libpixiv/src/lib.rs Normal file → Executable file
View file

0
libpixiv/src/models.rs Normal file → Executable file
View file