diff --git a/.cargo/config.toml b/.cargo/config.toml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Cargo.lock b/Cargo.lock old mode 100644 new mode 100755 diff --git a/Cargo.toml b/Cargo.toml old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rocket.toml b/Rocket.toml old mode 100644 new mode 100755 diff --git a/default.nix b/default.nix old mode 100644 new mode 100755 diff --git a/fxpixiv.service.nix b/fxpixiv.service.nix old mode 100644 new mode 100755 index ad2c40e..9b3f95c --- a/fxpixiv.service.nix +++ b/fxpixiv.service.nix @@ -34,11 +34,15 @@ in serviceConfig.ExecStart = "${fxpixivApp}/bin/fxpixiv"; # Set the port environment variable - serviceConfig.Environment = [ - "ROCKET_ENV=release" - "ROCKET_PORT=${toString config.services.fxpixiv.port}" - "PIXIV_REFRESH_TOKEN=${toString config.services.fxpixiv.refreshToken}" - ]; + serviceConfig.EnvironmentFile = pkgs.writeTextFile { + name = "fxpixiv.env"; + text = '' + "ROCKET_ENV=release" + "ROCKET_PORT=${toString config.services.fxpixiv.port}" + "PIXIV_REFRESH_TOKEN=${toString config.services.fxpixiv.refreshToken}" + ''; + meta.mode = "0600"; + }; # Restart on failure serviceConfig.WorkingDirectory = "/var/lib/fxpixiv"; diff --git a/fxpixiv/Cargo.toml b/fxpixiv/Cargo.toml old mode 100644 new mode 100755 diff --git a/fxpixiv/src/main.rs b/fxpixiv/src/main.rs old mode 100644 new mode 100755 index f582b03..d240475 --- a/fxpixiv/src/main.rs +++ b/fxpixiv/src/main.rs @@ -112,9 +112,9 @@ async fn fetch_illust( "; if illust.meta_pages.is_empty() { let _ = sqlx::query(pages_query) - .bind(illust.image_urls.square_medium) - .bind(illust.image_urls.medium) - .bind(illust.image_urls.large) + .bind(&illust.image_urls.square_medium) + .bind(&illust.image_urls.medium) + .bind(&illust.image_urls.large) .bind( &illust .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 { - image: image.as_str().replace("pximg.net", "fixiv.net"), + image: illust.image_urls.large.replace("pximg.net", "fixiv.net"), title: illust.title, desc: illust.caption, }); diff --git a/libpixiv/Cargo.toml b/libpixiv/Cargo.toml old mode 100644 new mode 100755 diff --git a/libpixiv/README.md b/libpixiv/README.md old mode 100644 new mode 100755 diff --git a/libpixiv/src/lib.rs b/libpixiv/src/lib.rs old mode 100644 new mode 100755 diff --git a/libpixiv/src/models.rs b/libpixiv/src/models.rs old mode 100644 new mode 100755