Update nixpkgs
This commit is contained in:
@@ -46,7 +46,6 @@ in
|
||||
|
||||
# hardware accelerated video playback (on intel)
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
||||
chromium = pkgs.chromium.override {
|
||||
enableWideVine = true;
|
||||
# ungoogled = true;
|
||||
@@ -61,12 +60,9 @@ in
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
||||
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
||||
# vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
nvidia-vaapi-driver
|
||||
];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ in
|
||||
config.inputs.deploy-rs.packages.${config.currentSystem}.deploy-rs
|
||||
lxqt.pavucontrol-qt
|
||||
deskflow
|
||||
file-roller
|
||||
android-tools
|
||||
|
||||
# For Nix IDE
|
||||
nixpkgs-fmt
|
||||
@@ -70,15 +72,10 @@ in
|
||||
services.avahi.enable = true;
|
||||
services.avahi.nssmdns4 = true;
|
||||
|
||||
programs.file-roller.enable = true;
|
||||
|
||||
# Security
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
security.pam.services.googlebot.enableGnomeKeyring = true;
|
||||
|
||||
# Android dev
|
||||
programs.adb.enable = true;
|
||||
|
||||
# Mount personal SMB stores
|
||||
services.mount-samba.enable = true;
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.librechat;
|
||||
cfg = config.services.librechat-container;
|
||||
in
|
||||
{
|
||||
options.services.librechat = {
|
||||
options.services.librechat-container = {
|
||||
enable = mkEnableOption "librechat";
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
@@ -21,7 +21,7 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers = {
|
||||
librechat = {
|
||||
image = "ghcr.io/danny-avila/librechat:v0.7.7";
|
||||
image = "ghcr.io/danny-avila/librechat:v0.8.1";
|
||||
environment = {
|
||||
HOST = "0.0.0.0";
|
||||
MONGO_URI = "mongodb://host.containers.internal:27017/LibreChat";
|
||||
|
||||
@@ -16,7 +16,7 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nextcloud = {
|
||||
https = true;
|
||||
package = pkgs.nextcloud31;
|
||||
package = pkgs.nextcloud32;
|
||||
hostName = nextcloudHostname;
|
||||
config.dbtype = "sqlite";
|
||||
config.adminuser = "jeremy";
|
||||
|
||||
81
flake.lock
generated
81
flake.lock
generated
@@ -14,11 +14,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1754433428,
|
||||
"narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=",
|
||||
"lastModified": 1762618334,
|
||||
"narHash": "sha256-wyT7Pl6tMFbFrs8Lk/TlEs81N6L+VSybPfiIgzU8lbQ=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d",
|
||||
"rev": "fcdea223397448d35d9b31f798479227e80183f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -101,11 +101,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1756719547,
|
||||
"narHash": "sha256-N9gBKUmjwRKPxAafXEk1EGadfk2qDZPBQp4vXWPHINQ=",
|
||||
"lastModified": 1766051518,
|
||||
"narHash": "sha256-znKOwPXQnt3o7lDb3hdf19oDo0BLP4MfBOYiWkEHoik=",
|
||||
"owner": "serokell",
|
||||
"repo": "deploy-rs",
|
||||
"rev": "125ae9e3ecf62fb2c0fd4f2d894eb971f1ecaed2",
|
||||
"rev": "d5eff7f948535b9c723d60cd8239f8f11ddc90fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -117,11 +117,11 @@
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1747046372,
|
||||
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -163,11 +163,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742649964,
|
||||
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
|
||||
"lastModified": 1763988335,
|
||||
"narHash": "sha256-QlcnByMc8KBjpU37rbq5iP7Cp97HvjRP0ucfdh+M4Qc=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
||||
"rev": "50b9238891e388c9fdc6a5c49e49c42533a1b5ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -205,16 +205,16 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1758463745,
|
||||
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
|
||||
"lastModified": 1768068402,
|
||||
"narHash": "sha256-bAXnnJZKJiF7Xr6eNW6+PhBf1lg2P1aFUO9+xgWkXfA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
|
||||
"rev": "8bc5473b6bc2b6e1529a9c4040411e1199c43b4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-25.05",
|
||||
"ref": "master",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -226,11 +226,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760241904,
|
||||
"narHash": "sha256-OD7QnaGEVNdukYEbJbUNWPsvnDrpbZOZxVIk6Pt9Jhw=",
|
||||
"lastModified": 1765267181,
|
||||
"narHash": "sha256-d3NBA9zEtBu2JFMnTBqWj7Tmi7R5OikoU2ycrdhQEws=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "c9f5ea45f25652ec2f771f9426ccacb21cbbaeaa",
|
||||
"rev": "82befcf7dc77c909b0f2a09f5da910ec95c5b78f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -241,11 +241,11 @@
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1759582739,
|
||||
"narHash": "sha256-spZegilADH0q5OngM86u6NmXxduCNv5eX9vCiUPhOYc=",
|
||||
"lastModified": 1767185284,
|
||||
"narHash": "sha256-ljDBUDpD1Cg5n3mJI81Hz5qeZAwCGxon4kQW3Ho3+6Q=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "3441b5242af7577230a78ffb03542add264179ab",
|
||||
"rev": "40b1a28dce561bea34858287fbb23052c3ee63fe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -257,44 +257,20 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1759884237,
|
||||
"narHash": "sha256-tfTIIUVKUG1pRahjhQEdp3N9PJ7+ca10HJoHF31ezxE=",
|
||||
"lastModified": 1768105724,
|
||||
"narHash": "sha256-0edMCoDc1VpuqDjy0oz8cDa4kjRuhXE3040sac2iZW4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ebea684a18162e8a4210f739fcd459a74bc8d7ff",
|
||||
"rev": "4c41b0361812441bf3b4427195e57ab271d5167f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-25.05",
|
||||
"ref": "master",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-linkwarden": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-wW3F+iRM/ATWkyq8+Romal8oFmsM/p98V96d5G0tasA=",
|
||||
"type": "file",
|
||||
"url": "https://github.com/NixOS/nixpkgs/pull/347353.diff"
|
||||
},
|
||||
"original": {
|
||||
"type": "file",
|
||||
"url": "https://github.com/NixOS/nixpkgs/pull/347353.diff"
|
||||
}
|
||||
},
|
||||
"nixpkgs-memos": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-UidUaQY+9vo90rNCVInX1E+JbJ1xKFVSTMNRYKQEKpQ=",
|
||||
"type": "file",
|
||||
"url": "https://github.com/NixOS/nixpkgs/pull/426687.diff"
|
||||
},
|
||||
"original": {
|
||||
"type": "file",
|
||||
"url": "https://github.com/NixOS/nixpkgs/pull/426687.diff"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
@@ -306,8 +282,6 @@
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-linkwarden": "nixpkgs-linkwarden",
|
||||
"nixpkgs-memos": "nixpkgs-memos",
|
||||
"simple-nixos-mailserver": "simple-nixos-mailserver",
|
||||
"systems": "systems"
|
||||
}
|
||||
@@ -321,9 +295,6 @@
|
||||
"git-hooks": "git-hooks",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-25_05": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
|
||||
19
flake.nix
19
flake.nix
@@ -1,15 +1,7 @@
|
||||
{
|
||||
inputs = {
|
||||
# nixpkgs
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/release-25.05";
|
||||
nixpkgs-linkwarden = {
|
||||
url = "https://github.com/NixOS/nixpkgs/pull/347353.diff";
|
||||
flake = false;
|
||||
};
|
||||
nixpkgs-memos = {
|
||||
url = "https://github.com/NixOS/nixpkgs/pull/426687.diff";
|
||||
flake = false;
|
||||
};
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/master";
|
||||
|
||||
# Common Utils Among flake inputs
|
||||
systems.url = "github:nix-systems/default";
|
||||
@@ -27,7 +19,7 @@
|
||||
|
||||
# Home Manager
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.05";
|
||||
url = "github:nix-community/home-manager/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
@@ -126,14 +118,7 @@
|
||||
name = "nixpkgs-patched";
|
||||
src = nixpkgs;
|
||||
patches = [
|
||||
# ./patches/gamepadui.patch
|
||||
./patches/dont-break-nix-serve.patch
|
||||
# music-assistant needs a specific custom version of librespot
|
||||
# I tried to use an overlay but my attempts to override the rust package did not work out
|
||||
# despite me following guides and examples specific to rust packages.
|
||||
./patches/librespot-pin.patch
|
||||
inputs.nixpkgs-linkwarden
|
||||
inputs.nixpkgs-memos
|
||||
];
|
||||
};
|
||||
patchedNixpkgs = nixpkgs.lib.fix (self: (import "${patchedNixpkgsSrc}/flake.nix").outputs { self = nixpkgs; });
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
system76-keyboard-configurator
|
||||
];
|
||||
|
||||
nixpkgs.config.rocmSupport = true;
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
acceleration = "rocm";
|
||||
rocmOverrideGfx = "11.0.2";
|
||||
package = pkgs.ollama-vulkan;
|
||||
host = "127.0.0.1";
|
||||
};
|
||||
|
||||
|
||||
@@ -109,6 +109,6 @@
|
||||
services.owncast.hostname = "live.neet.dev";
|
||||
|
||||
# librechat
|
||||
services.librechat.enable = true;
|
||||
services.librechat.host = "chat.neet.dev";
|
||||
services.librechat-container.enable = true;
|
||||
services.librechat-container.host = "chat.neet.dev";
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
|
||||
services.transmission = {
|
||||
enable = true;
|
||||
package = pkgs.transmission_4;
|
||||
performanceNetParameters = true;
|
||||
user = "public_data";
|
||||
group = "public_data";
|
||||
@@ -179,15 +180,10 @@
|
||||
# I could not figure out how to allow the container to access the encoder
|
||||
services.jellyfin.enable = true;
|
||||
users.users.${config.services.jellyfin.user}.extraGroups = [ "public_data" ];
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
||||
};
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
vaapiIntel
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
|
||||
];
|
||||
@@ -252,7 +248,7 @@
|
||||
(mkVirtualHost "todo.s0.neet.dev" "http://localhost:${toString config.services.vikunja.port}")
|
||||
(mkVirtualHost "budget.s0.neet.dev" "http://localhost:${toString config.services.actual.settings.port}") # actual budget
|
||||
(mkVirtualHost "linkwarden.s0.neet.dev" "http://localhost:${toString config.services.linkwarden.port}")
|
||||
(mkVirtualHost "memos.s0.neet.dev" "http://localhost:${toString config.services.memos.port}")
|
||||
(mkVirtualHost "memos.s0.neet.dev" "http://localhost:${toString config.services.memos.settings.MEMOS_PORT}")
|
||||
(mkVirtualHost "outline.s0.neet.dev" "http://localhost:${toString config.services.outline.port}")
|
||||
(mkVirtualHost "languagetool.s0.neet.dev" "http://localhost:${toString config.services.languagetool.port}")
|
||||
];
|
||||
@@ -328,15 +324,7 @@
|
||||
enableRegistration = true;
|
||||
port = 41709;
|
||||
environment.NEXTAUTH_URL = "https://linkwarden.s0.neet.dev/api/v1/auth";
|
||||
environment.FLARESOLVERR_URL = "http://localhost:${toString config.services.flaresolverr.port}/v1";
|
||||
environmentFile = "/run/agenix/linkwarden-environment";
|
||||
package = pkgs.linkwarden.overrideAttrs (oldAttrs: {
|
||||
# Add patch that adds support for flaresolverr
|
||||
patches = oldAttrs.patches or [ ] ++ [
|
||||
# https://github.com/linkwarden/linkwarden/pull/1251
|
||||
../../../patches/linkwarden-flaresolverr.patch
|
||||
];
|
||||
});
|
||||
};
|
||||
age.secrets.linkwarden-environment.file = ../../../secrets/linkwarden-environment.age;
|
||||
services.meilisearch = {
|
||||
@@ -351,8 +339,7 @@
|
||||
|
||||
services.memos = {
|
||||
enable = true;
|
||||
address = "127.0.0.1";
|
||||
port = 57643;
|
||||
settings.MEMOS_PORT = "57643";
|
||||
};
|
||||
|
||||
services.outline = {
|
||||
|
||||
@@ -84,6 +84,11 @@ lib.mkMerge [
|
||||
services.frigate = {
|
||||
enable = true;
|
||||
hostname = frigateHostname;
|
||||
|
||||
# Sadly this fails because it doesn't support frigate's var substition format
|
||||
# which is critical... so what's even the point of it then?
|
||||
checkConfig = false;
|
||||
|
||||
settings = {
|
||||
mqtt = {
|
||||
enabled = true;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
services.zigbee2mqtt = {
|
||||
enable = true;
|
||||
settings = {
|
||||
homeassistant = true;
|
||||
permit_join = false;
|
||||
serial = {
|
||||
adapter = "ember";
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
);
|
||||
services.mount-samba.enable = true;
|
||||
|
||||
# Login DE Option: RetroArch
|
||||
services.xserver.desktopManager.retroarch.enable = true;
|
||||
services.xserver.desktopManager.retroarch.package = pkgs.retroarchFull;
|
||||
|
||||
# wireless xbox controller support
|
||||
hardware.xone.enable = true;
|
||||
boot.kernelModules = [ "xone-wired" "xone-dongle" ];
|
||||
@@ -69,16 +65,15 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
config.services.xserver.desktopManager.kodi.package
|
||||
spotify
|
||||
retroarchFull
|
||||
];
|
||||
|
||||
# Command and Conquer Ports
|
||||
networking.firewall.allowedUDPPorts = [ 4321 27900 ];
|
||||
networking.firewall.allowedTCPPorts = [ 6667 28910 29900 29920 ];
|
||||
|
||||
nixpkgs.config.rocmSupport = true;
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
acceleration = "rocm";
|
||||
package = pkgs.ollama-vulkan;
|
||||
host = "127.0.0.1";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/nixos/modules/services/video/frigate.nix b/nixos/modules/services/video/frigate.nix
|
||||
index 49f8ed673816..643b59d68dde 100644
|
||||
index f8d8f64e55da..39326d094118 100644
|
||||
--- a/nixos/modules/services/video/frigate.nix
|
||||
+++ b/nixos/modules/services/video/frigate.nix
|
||||
@@ -482,10 +482,6 @@ in
|
||||
@@ -609,10 +609,6 @@ in
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix
|
||||
index 29c449c16946..f6c728eb7f0c 100644
|
||||
--- a/nixos/modules/programs/steam.nix
|
||||
+++ b/nixos/modules/programs/steam.nix
|
||||
@@ -11,7 +11,7 @@ let
|
||||
in
|
||||
pkgs.writeShellScriptBin "steam-gamescope" ''
|
||||
${builtins.concatStringsSep "\n" exports}
|
||||
- gamescope --steam ${builtins.toString cfg.gamescopeSession.args} -- steam -tenfoot -pipewire-dmabuf
|
||||
+ gamescope --steam ${builtins.toString cfg.gamescopeSession.args} -- steam -gamepadui -steamdeck -pipewire-dmabuf &> /tmp/steamlog
|
||||
'';
|
||||
|
||||
gamescopeSessionFile =
|
||||
@@ -1,27 +0,0 @@
|
||||
diff --git a/pkgs/applications/audio/librespot/default.nix b/pkgs/applications/audio/librespot/default.nix
|
||||
index f5ff221e1bfe..b85f6b53af1d 100644
|
||||
--- a/pkgs/applications/audio/librespot/default.nix
|
||||
+++ b/pkgs/applications/audio/librespot/default.nix
|
||||
@@ -25,13 +25,18 @@ rustPlatform.buildRustPackage rec {
|
||||
version = "0.6.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
- owner = "librespot-org";
|
||||
+ owner = "googlebot42";
|
||||
repo = "librespot";
|
||||
- rev = "v${version}";
|
||||
- sha256 = "sha256-dGQDRb7fgIkXelZKa+PdodIs9DxbgEMlVGJjK/hU3Mo=";
|
||||
+ rev = "ab9ecb6d936edf24b18258be981966692e705a02";
|
||||
+ sha256 = "sha256-7Wx7+2OYAczNKzqRH2v8fwNAfll27Bdr3Fo23uDtQ4Y=";
|
||||
};
|
||||
|
||||
- cargoHash = "sha256-SqvJSHkyd1IicT6c4pE96dBJNNodULhpyG14HRGVWCk=";
|
||||
+ cargoHash = "sha256-s6qUI+pDyfBRhuPuBsi2eVxH9DLXEgISf/N4ZY3zDgc=";
|
||||
+
|
||||
+ cargoBuildFlags = [
|
||||
+ "--features"
|
||||
+ "passthrough-decoder"
|
||||
+ ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
@@ -1,144 +0,0 @@
|
||||
commit 3dac9f081f267e4a528decbd9d50e1f45ea7c2ba
|
||||
Author: SteveImmanuel <steve@telepix.net>
|
||||
Date: Fri Jun 27 13:07:38 2025 +0900
|
||||
|
||||
Add flaresolverr support into linkwarden
|
||||
|
||||
diff --git a/.env.sample b/.env.sample
|
||||
index bd3abcb0..0ca96d92 100644
|
||||
--- a/.env.sample
|
||||
+++ b/.env.sample
|
||||
@@ -43,6 +43,7 @@ TEXT_CONTENT_LIMIT=
|
||||
SEARCH_FILTER_LIMIT=
|
||||
INDEX_TAKE_COUNT=
|
||||
MEILI_TIMEOUT=
|
||||
+FLARESOLVERR_URL=
|
||||
|
||||
# AI Settings
|
||||
NEXT_PUBLIC_OLLAMA_ENDPOINT_URL=
|
||||
diff --git a/apps/worker/lib/archiveHandler.ts b/apps/worker/lib/archiveHandler.ts
|
||||
index 8ae19e2c..6c8656b2 100644
|
||||
--- a/apps/worker/lib/archiveHandler.ts
|
||||
+++ b/apps/worker/lib/archiveHandler.ts
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
chromium,
|
||||
devices,
|
||||
} from "playwright";
|
||||
+import axios from 'axios';
|
||||
import { prisma } from "@linkwarden/prisma";
|
||||
import sendToWayback from "./preservationScheme/sendToWayback";
|
||||
import { AiTaggingMethod } from "@linkwarden/prisma/client";
|
||||
@@ -75,6 +76,22 @@ export default async function archiveHandler(
|
||||
});
|
||||
|
||||
const { browser, context } = await getBrowser();
|
||||
+
|
||||
+ const captchaSolve = await solveCaptcha(link.url);
|
||||
+
|
||||
+ if (captchaSolve.status === 'error') {
|
||||
+ console.error('Error solving captcha');
|
||||
+ } else if (captchaSolve.status === 'fail') {
|
||||
+ console.warn('Failed solving captcha');
|
||||
+ } else if (captchaSolve.status === 'skip') {
|
||||
+ console.info('Skip solving captcha');
|
||||
+ } else {
|
||||
+ if (captchaSolve.solution) {
|
||||
+ console.info('Solving captcha');
|
||||
+ await context.addCookies(captchaSolve.solution.cookies);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
const page = await context.newPage();
|
||||
|
||||
createFolder({ filePath: `archives/preview/${link.collectionId}` });
|
||||
@@ -105,6 +122,7 @@ export default async function archiveHandler(
|
||||
aiTag: user.aiTaggingMethod !== AiTaggingMethod.DISABLED,
|
||||
};
|
||||
|
||||
+ let newLinkName = '';
|
||||
try {
|
||||
await Promise.race([
|
||||
(async () => {
|
||||
@@ -127,6 +145,7 @@ export default async function archiveHandler(
|
||||
// archive url
|
||||
|
||||
await page.goto(link.url, { waitUntil: "domcontentloaded" });
|
||||
+ newLinkName = await page.title();
|
||||
|
||||
const metaDescription = await page.evaluate(() => {
|
||||
const description = document.querySelector(
|
||||
@@ -186,10 +205,16 @@ export default async function archiveHandler(
|
||||
where: { id: link.id },
|
||||
});
|
||||
|
||||
- if (finalLink)
|
||||
+ if (finalLink) {
|
||||
+ // Replace the captcha-blocked link name if it has not been updated by user, else keep the same name
|
||||
+ if (newLinkName === '' || finalLink.name === newLinkName || finalLink.name !== 'Just a moment...') {
|
||||
+ newLinkName = finalLink.name;
|
||||
+ }
|
||||
+
|
||||
await prisma.link.update({
|
||||
where: { id: link.id },
|
||||
data: {
|
||||
+ name: newLinkName,
|
||||
lastPreserved: new Date().toISOString(),
|
||||
readable: !finalLink.readable ? "unavailable" : undefined,
|
||||
image: !finalLink.image ? "unavailable" : undefined,
|
||||
@@ -203,6 +228,7 @@ export default async function archiveHandler(
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
+ }
|
||||
else {
|
||||
await removeFiles(link.id, link.collectionId);
|
||||
}
|
||||
@@ -271,6 +297,48 @@ export function getBrowserOptions(): LaunchOptions {
|
||||
return browserOptions;
|
||||
}
|
||||
|
||||
+async function solveCaptcha(url: string, maxTimeout: number = 60000): Promise<{
|
||||
+ status: string,
|
||||
+ solution?: {
|
||||
+ cookies: {
|
||||
+ name: string,
|
||||
+ value: string,
|
||||
+ domain: string,
|
||||
+ path: string,
|
||||
+ secure: boolean,
|
||||
+ expires?: number,
|
||||
+ httpOnly?: boolean,
|
||||
+ sameSite?: "Strict" | "Lax" | "None"
|
||||
+ }[],
|
||||
+ }
|
||||
+}> {
|
||||
+ if (process.env.FLARESOLVERR_URL) {
|
||||
+ try {
|
||||
+ const response = await axios.post(process.env.FLARESOLVERR_URL,
|
||||
+ {
|
||||
+ cmd: 'request.get',
|
||||
+ url,
|
||||
+ maxTimeout
|
||||
+ },
|
||||
+ {
|
||||
+ headers: { 'Content-Type': 'application/json' }
|
||||
+ }
|
||||
+ )
|
||||
+
|
||||
+ if (response.status !== 200) {
|
||||
+ return { status: 'fail' };
|
||||
+ }
|
||||
+
|
||||
+ return { status: response.data.status, solution: response.data.solution };
|
||||
+ } catch (error) {
|
||||
+ console.error('Error during captcha solving:', error);
|
||||
+ return { status: 'error' };
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return { status: 'skip' };
|
||||
+}
|
||||
+
|
||||
async function getBrowser(): Promise<{
|
||||
browser: Browser;
|
||||
context: BrowserContext;
|
||||
Reference in New Issue
Block a user