deluge: patch deluge-web to try logging in with a fixed password first

This commit is contained in:
Luke Granger-Brown 2020-12-28 20:04:27 +00:00
parent 9fc4be6a9c
commit 7d0493cacd
4 changed files with 55 additions and 0 deletions

View file

@ -16,4 +16,5 @@
intermec-cups-driver = pkgs.callPackage ./intermec-cups-driver.nix {}; intermec-cups-driver = pkgs.callPackage ./intermec-cups-driver.nix {};
pomerium = import ./pomerium args; pomerium = import ./pomerium args;
envoy = import ./envoy args; envoy = import ./envoy args;
deluge = import ./deluge args;
} // (import ./heptapod-runner.nix args) } // (import ./heptapod-runner.nix args)

View file

@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
pkgs.deluge.overrideAttrs ({ patches ? [], ... }: {
patches = patches ++ [
./deluge-web-try-empty-login-first.patch
];
})

View file

@ -0,0 +1,43 @@
diff -ru deluge-2.0.3-orig/deluge/ui/web/js/deluge-all/LoginWindow.js deluge-2.0.3/deluge/ui/web/js/deluge-all/LoginWindow.js
--- deluge-2.0.3-orig/deluge/ui/web/js/deluge-all/LoginWindow.js 2019-06-06 16:23:52.000000000 +0000
+++ deluge-2.0.3/deluge/ui/web/js/deluge-all/LoginWindow.js 2020-12-28 20:02:59.829316173 +0000
@@ -66,6 +66,25 @@
});
},
+ tryLoginThenShow: function() {
+ // HACK(lukegb): try logging in with no password.
+ deluge.client.auth.login('fixedSingleSignOnPassword!', {
+ success: function(result) {
+ if (!result) {
+ this.show(true);
+ return;
+ }
+ deluge.events.fire('login');
+ this.hide();
+ passwordField.setRawValue('');
+ },
+ failure: function(result) {
+ this.show(true);
+ },
+ scope: this,
+ });
+ },
+
show: function(skipCheck) {
if (this.firstShow) {
deluge.client.on('error', this.onClientError, this);
@@ -81,11 +100,11 @@
if (result) {
deluge.events.fire('login');
} else {
- this.show(true);
+ this.tryLoginThenShow();
}
},
failure: function(result) {
- this.show(true);
+ this.tryLoginThenShow();
},
scope: this,
});

View file

@ -159,6 +159,7 @@ in {
authFile = machineSecrets.delugeAuthFile; authFile = machineSecrets.delugeAuthFile;
web.enable = true; web.enable = true;
package = depot.pkgs.deluge;
}; };
services.sonarr = { services.sonarr = {
enable = true; enable = true;