Browse Source

Added support for Deluge's web interface password as seperate values from the HTTP auth password and username (see issue 260).

pull/11/head
Eric Kok 12 years ago
parent
commit
5e21d397e0
  1. 3
      android/res/values/changelog.xml
  2. 2
      android/res/values/strings.xml
  3. 2
      android/src/ca/seedstuff/transdroid/preferences/SeedstuffSettings.java
  4. 3
      android/src/com/seedm8/transdroid/preferences/SeedM8Settings.java
  5. 6
      android/src/com/xirvik/transdroid/preferences/XirvikSettings.java
  6. 4
      android/src/org/transdroid/preferences/Preferences.java
  7. 20
      android/src/org/transdroid/preferences/PreferencesServer.java
  8. 8
      lib/src/org/transdroid/daemon/Daemon.java
  9. 20
      lib/src/org/transdroid/daemon/DaemonSettings.java
  10. 11
      lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java

3
android/res/values/changelog.xml

@ -2,7 +2,10 @@
<resources> <resources>
<string name="changes"> <string name="changes">
Transdroid 1.1.6\n Transdroid 1.1.6\n
- Added BitComet support, by Sergey (SeNS)\n
- Improved label support, by Alexey Rogovoy\n - Improved label support, by Alexey Rogovoy\n
- Added GZipped content support in RSS feeds\n
- Allow Deluge users to enter a password for HTTP authentication\n
\n \n
Transdroid 1.1.5\n Transdroid 1.1.5\n
- AndFTP alias:// support and file-in-root fix\n - AndFTP alias:// support and file-in-root fix\n

2
android/res/values/strings.xml

@ -138,7 +138,9 @@
<string name="pref_auth">Use authentication</string> <string name="pref_auth">Use authentication</string>
<string name="pref_auth_info">You\'ll need a username and password</string> <string name="pref_auth_info">You\'ll need a username and password</string>
<string name="pref_user">Username</string> <string name="pref_user">Username</string>
<string name="pref_user_forhttp">Username for HTTP authentication</string>
<string name="pref_pass">Password</string> <string name="pref_pass">Password</string>
<string name="pref_extrapass">Deluge web password</string>
<string name="pref_os">Server OS</string> <string name="pref_os">Server OS</string>
<string name="pref_folder">SCGI folder</string> <string name="pref_folder">SCGI folder</string>
<string name="pref_folder_info">Usually is /RPC2</string> <string name="pref_folder_info">Usually is /RPC2</string>

2
android/src/ca/seedstuff/transdroid/preferences/SeedstuffSettings.java

@ -80,7 +80,7 @@ public class SeedstuffSettings {
List<DaemonSettings> daemons = new ArrayList<DaemonSettings>(); List<DaemonSettings> daemons = new ArrayList<DaemonSettings>();
// rTorrent // rTorrent
daemons.add(new DaemonSettings(getName(), Daemon.rTorrent, getServer(), RTORRENT_PORT, true, true, null, daemons.add(new DaemonSettings(getName(), Daemon.rTorrent, getServer(), RTORRENT_PORT, true, true, null,
RTORRENT_FOLDER_PART + getUsername(), true, getUsername(), getPassword(), OS.Linux, RTORRENT_FOLDER_PART + getUsername(), true, getUsername(), getPassword(), null, OS.Linux,
"/rtorrent/downloads/", "ftp://" + getName() + "@" + getServer() + FTP_PORT + "/rtorrents/downloads/", "/rtorrent/downloads/", "ftp://" + getName() + "@" + getServer() + FTP_PORT + "/rtorrents/downloads/",
getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(), getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(),
shouldAlarmOnNewTorrent(), "" + startID++, true)); shouldAlarmOnNewTorrent(), "" + startID++, true));

3
android/src/com/seedm8/transdroid/preferences/SeedM8Settings.java

@ -111,6 +111,7 @@ public class SeedM8Settings {
true, true,
getUsername(), getUsername(),
getDelugePassword(), getDelugePassword(),
getDelugePassword(),
OS.Linux, OS.Linux,
null, null,
"sftp://" + getServer() + "/home/" + getUsername() + "/private/deluge/data/", "sftp://" + getServer() + "/home/" + getUsername() + "/private/deluge/data/",
@ -134,6 +135,7 @@ public class SeedM8Settings {
true, true,
getUsername(), getUsername(),
getTransmissionPassword(), getTransmissionPassword(),
null,
OS.Linux, OS.Linux,
null, null,
"sftp://" + getServer() + "/home/" + getUsername() + "/private/transmission/data/", "sftp://" + getServer() + "/home/" + getUsername() + "/private/transmission/data/",
@ -157,6 +159,7 @@ public class SeedM8Settings {
true, true,
"rutorrent", "rutorrent",
getRtorrentPassword(), getRtorrentPassword(),
null,
OS.Linux, OS.Linux,
null, null,
"sftp://" + getUsername() + "@" + getServer() + "/home/" + getUsername() + "/private/rtorrent/data/", "sftp://" + getUsername() + "@" + getServer() + "/home/" + getUsername() + "/private/rtorrent/data/",

6
android/src/com/xirvik/transdroid/preferences/XirvikSettings.java

@ -93,7 +93,7 @@ public class XirvikSettings {
getName() + (isDedi? " Torrentflux-b4rt": ""), getName() + (isDedi? " Torrentflux-b4rt": ""),
Daemon.Tfb4rt, getServer(), TFB4RT_PORT, Daemon.Tfb4rt, getServer(), TFB4RT_PORT,
true, true, null, true, true, null,
TFB4RT_FOLDER, true, getUsername(), getPassword(), TFB4RT_FOLDER, true, getUsername(), getPassword(), null,
OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/", OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/",
getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(), getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(),
shouldAlarmOnNewTorrent(), "" + startID++, true)); shouldAlarmOnNewTorrent(), "" + startID++, true));
@ -104,7 +104,7 @@ public class XirvikSettings {
getName() + (isDedi? " rTorrent": ""), getName() + (isDedi? " rTorrent": ""),
Daemon.rTorrent, getServer(), RTORRENT_PORT, Daemon.rTorrent, getServer(), RTORRENT_PORT,
true, true, null, true, true, null,
getFolder(), true, getUsername(), getPassword(), getFolder(), true, getUsername(), getPassword(), null,
OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/", OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/",
getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(), getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(),
shouldAlarmOnNewTorrent(), "" + startID++, true)); shouldAlarmOnNewTorrent(), "" + startID++, true));
@ -115,7 +115,7 @@ public class XirvikSettings {
getName() + " uTorrent", getName() + " uTorrent",
Daemon.uTorrent, getServer(), UTORRENT_PORT, Daemon.uTorrent, getServer(), UTORRENT_PORT,
false, false, null, false, false, null,
null, true, getUsername(), getPassword(), null, true, getUsername(), getPassword(), null,
OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/", OS.Linux, "/", "ftp://" + getName() + ":" + getServer() + "/",
getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(), getPassword(), HttpHelper.DEFAULT_CONNECTION_TIMEOUT, shouldAlarmOnFinishedDownload(),
shouldAlarmOnNewTorrent(), "" + startID++, true)); shouldAlarmOnNewTorrent(), "" + startID++, true));

4
android/src/org/transdroid/preferences/Preferences.java

@ -100,6 +100,7 @@ public class Preferences {
public static final String KEY_PREF_AUTH = "transdroid_server_auth"; public static final String KEY_PREF_AUTH = "transdroid_server_auth";
public static final String KEY_PREF_USER = "transdroid_server_user"; public static final String KEY_PREF_USER = "transdroid_server_user";
public static final String KEY_PREF_PASS = "transdroid_server_pass"; public static final String KEY_PREF_PASS = "transdroid_server_pass";
public static final String KEY_PREF_EXTRAPASS = "transdroid_server_extrapass";
public static final String KEY_PREF_OS = "transdroid_server_os"; public static final String KEY_PREF_OS = "transdroid_server_os";
public static final String KEY_PREF_DOWNLOADDIR = "transdroid_server_downloaddir"; public static final String KEY_PREF_DOWNLOADDIR = "transdroid_server_downloaddir";
public static final String KEY_PREF_FTPURL = "transdroid_server_ftpurl"; public static final String KEY_PREF_FTPURL = "transdroid_server_ftpurl";
@ -186,6 +187,7 @@ public class Preferences {
editor.putBoolean(KEY_PREF_AUTH + toId, prefs.getBoolean(KEY_PREF_AUTH + fromId, false)); editor.putBoolean(KEY_PREF_AUTH + toId, prefs.getBoolean(KEY_PREF_AUTH + fromId, false));
editor.putString(KEY_PREF_USER + toId, prefs.getString(KEY_PREF_USER + fromId, null)); editor.putString(KEY_PREF_USER + toId, prefs.getString(KEY_PREF_USER + fromId, null));
editor.putString(KEY_PREF_PASS + toId, prefs.getString(KEY_PREF_PASS + fromId, null)); editor.putString(KEY_PREF_PASS + toId, prefs.getString(KEY_PREF_PASS + fromId, null));
editor.putString(KEY_PREF_EXTRAPASS + toId, prefs.getString(KEY_PREF_EXTRAPASS + fromId, null));
editor.putString(KEY_PREF_OS + toId, prefs.getString(KEY_PREF_OS + fromId, "type_windows")); editor.putString(KEY_PREF_OS + toId, prefs.getString(KEY_PREF_OS + fromId, "type_windows"));
editor.putString(KEY_PREF_DOWNLOADDIR + toId, prefs.getString(KEY_PREF_DOWNLOADDIR + fromId, null)); editor.putString(KEY_PREF_DOWNLOADDIR + toId, prefs.getString(KEY_PREF_DOWNLOADDIR + fromId, null));
editor.putString(KEY_PREF_FTPURL + toId, prefs.getString(KEY_PREF_FTPURL + fromId, null)); editor.putString(KEY_PREF_FTPURL + toId, prefs.getString(KEY_PREF_FTPURL + fromId, null));
@ -204,6 +206,7 @@ public class Preferences {
editor.remove(KEY_PREF_AUTH + delId); editor.remove(KEY_PREF_AUTH + delId);
editor.remove(KEY_PREF_USER + delId); editor.remove(KEY_PREF_USER + delId);
editor.remove(KEY_PREF_PASS + delId); editor.remove(KEY_PREF_PASS + delId);
editor.remove(KEY_PREF_EXTRAPASS + delId);
editor.remove(KEY_PREF_OS + delId); editor.remove(KEY_PREF_OS + delId);
editor.remove(KEY_PREF_DOWNLOADDIR + delId); editor.remove(KEY_PREF_DOWNLOADDIR + delId);
editor.remove(KEY_PREF_FTPURL + delId); editor.remove(KEY_PREF_FTPURL + delId);
@ -928,6 +931,7 @@ public class Preferences {
prefs.getBoolean(KEY_PREF_AUTH + postfix, false), prefs.getBoolean(KEY_PREF_AUTH + postfix, false),
prefs.getString(KEY_PREF_USER + postfix, null), prefs.getString(KEY_PREF_USER + postfix, null),
prefs.getString(KEY_PREF_PASS + postfix, null), prefs.getString(KEY_PREF_PASS + postfix, null),
prefs.getString(KEY_PREF_EXTRAPASS + postfix, null),
OS.fromCode(prefs.getString(KEY_PREF_OS + postfix, "type_windows")), OS.fromCode(prefs.getString(KEY_PREF_OS + postfix, "type_windows")),
prefs.getString(KEY_PREF_DOWNLOADDIR + postfix, null), prefs.getString(KEY_PREF_DOWNLOADDIR + postfix, null),
prefs.getString(KEY_PREF_FTPURL + postfix, null), prefs.getString(KEY_PREF_FTPURL + postfix, null),

20
android/src/org/transdroid/preferences/PreferencesServer.java

@ -60,6 +60,7 @@ public class PreferencesServer extends PreferenceActivity {
private TransdroidCheckBoxPreference auth; private TransdroidCheckBoxPreference auth;
private TransdroidEditTextPreference user; private TransdroidEditTextPreference user;
private TransdroidEditTextPreference pass; private TransdroidEditTextPreference pass;
private TransdroidEditTextPreference extraPass;
private TransdroidListPreference os; private TransdroidListPreference os;
private TransdroidEditTextPreference downloadDir; private TransdroidEditTextPreference downloadDir;
private TransdroidEditTextPreference ftpUrl; private TransdroidEditTextPreference ftpUrl;
@ -75,6 +76,7 @@ public class PreferencesServer extends PreferenceActivity {
private boolean authValue = false; private boolean authValue = false;
private String userValue = null; private String userValue = null;
//private String passValue = null; //private String passValue = null;
//private String extraPassValue = null;
private boolean sslValue = false; private boolean sslValue = false;
private boolean sslTAValue = false; private boolean sslTAValue = false;
@ -107,6 +109,7 @@ public class PreferencesServer extends PreferenceActivity {
authValue = prefs.getBoolean(Preferences.KEY_PREF_AUTH + serverPostfix, false); authValue = prefs.getBoolean(Preferences.KEY_PREF_AUTH + serverPostfix, false);
userValue = prefs.getString(Preferences.KEY_PREF_USER + serverPostfix, null); userValue = prefs.getString(Preferences.KEY_PREF_USER + serverPostfix, null);
//passValue = prefs.getString(Preferences.KEY_PREF_PASS + serverPostfix, null); //passValue = prefs.getString(Preferences.KEY_PREF_PASS + serverPostfix, null);
//extraPassValue = prefs.getString(Preferences.KEY_PREF_EXTRAPASS + serverPostfix, null);
sslValue = prefs.getBoolean(Preferences.KEY_PREF_SSL + serverPostfix, false); sslValue = prefs.getBoolean(Preferences.KEY_PREF_SSL + serverPostfix, false);
//sslTAValue = prefs.getBoolean(Preferences.KEY_PREF_SSL_TRUST_ALL + serverPostfix, false); //sslTAValue = prefs.getBoolean(Preferences.KEY_PREF_SSL_TRUST_ALL + serverPostfix, false);
@ -204,6 +207,16 @@ public class PreferencesServer extends PreferenceActivity {
folder.setDialogTitle(R.string.pref_folder); folder.setDialogTitle(R.string.pref_folder);
folder.setOnPreferenceChangeListener(updateHandler); folder.setOnPreferenceChangeListener(updateHandler);
getPreferenceScreen().addItemFromInflater(folder); getPreferenceScreen().addItemFromInflater(folder);
// ExtraUser
extraPass = new TransdroidEditTextPreference(this);
extraPass.setTitle(R.string.pref_extrapass);
extraPass.setKey(Preferences.KEY_PREF_EXTRAPASS + serverPostfix);
extraPass.getEditText().setSingleLine();
extraPass.getEditText().setInputType(EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
extraPass.getEditText().setTransformationMethod(new PasswordTransformationMethod());
extraPass.setDialogTitle(R.string.pref_extrapass);
extraPass.setOnPreferenceChangeListener(updateHandler);
getPreferenceScreen().addItemFromInflater(extraPass);
// Advanced // Advanced
PreferenceCategory advanced = new PreferenceCategory(this); PreferenceCategory advanced = new PreferenceCategory(this);
@ -322,6 +335,8 @@ public class PreferencesServer extends PreferenceActivity {
userValue = (String) newValue; userValue = (String) newValue;
} else if (preference == pass) { } else if (preference == pass) {
//passValue = (String) newValue; //passValue = (String) newValue;
} else if (preference == extraPass) {
//extraPassValue = (String) newValue;
} else if (preference == ssl) { } else if (preference == ssl) {
sslValue = (Boolean) newValue; sslValue = (Boolean) newValue;
} else if (preference == sslTrustAll) { } else if (preference == sslTrustAll) {
@ -391,8 +406,9 @@ public class PreferencesServer extends PreferenceActivity {
// Use daemon factory to see if the newly selected daemon supports the feature // Use daemon factory to see if the newly selected daemon supports the feature
// Then set the availability of the options according to the (other) settings // Then set the availability of the options according to the (other) settings
Daemon daemonType = Daemon.fromCode(daemonValue); Daemon daemonType = Daemon.fromCode(daemonValue);
user.setEnabled(authValue && (daemonType == null? true: Daemon.supportsUsername(Daemon.fromCode(daemonValue)))); user.setEnabled(authValue);
pass.setEnabled(authValue); pass.setEnabled(authValue);
extraPass.setEnabled(Daemon.supportsExtraPassword(Daemon.fromCode(daemonValue)));
sslTrustAll.setEnabled(sslValue); sslTrustAll.setEnabled(sslValue);
folder.setEnabled(daemonType == null? false: Daemon.supportsCustomFolder(daemonType)); folder.setEnabled(daemonType == null? false: Daemon.supportsCustomFolder(daemonType));
downloadDir.setEnabled(daemonType == null? false: Daemon.needsManualPathSpecified(daemonType)); downloadDir.setEnabled(daemonType == null? false: Daemon.needsManualPathSpecified(daemonType));
@ -410,6 +426,8 @@ public class PreferencesServer extends PreferenceActivity {
port.setSummary(portValue == null? getText(R.string.pref_port_info).toString().trim() + " " + Daemon.getDefaultPortNumber(daemonType, sslValue): portValue); port.setSummary(portValue == null? getText(R.string.pref_port_info).toString().trim() + " " + Daemon.getDefaultPortNumber(daemonType, sslValue): portValue);
auth.setSummary(R.string.pref_auth_info); auth.setSummary(R.string.pref_auth_info);
user.setTitle(daemonType != null && Daemon.supportsUsernameForHttp(Daemon.fromCode(daemonValue)) ? getString(R.string.pref_user_forhttp)
: getString(R.string.pref_user));
user.setSummary(userValue == null? "": userValue); user.setSummary(userValue == null? "": userValue);
if (daemonType == Daemon.rTorrent) { if (daemonType == Daemon.rTorrent) {

8
lib/src/org/transdroid/daemon/Daemon.java

@ -270,8 +270,12 @@ public enum Daemon {
return type == uTorrent || type == BitTorrent || type == Deluge; return type == uTorrent || type == BitTorrent || type == Deluge;
} }
public static boolean supportsUsername(Daemon type) { public static boolean supportsExtraPassword(Daemon type) {
return !(type == Deluge); return type == Deluge;
}
public static boolean supportsUsernameForHttp(Daemon type) {
return type == Deluge;
} }
} }

20
lib/src/org/transdroid/daemon/DaemonSettings.java

@ -38,6 +38,7 @@ public final class DaemonSettings {
final private boolean useAuthentication; final private boolean useAuthentication;
final private String username; final private String username;
final private String password; final private String password;
final private String extraPass;
final private OS os; final private OS os;
final private String downloadDir; final private String downloadDir;
final private String ftpUrl; final private String ftpUrl;
@ -49,7 +50,7 @@ public final class DaemonSettings {
final private boolean isAutoGenerated; final private boolean isAutoGenerated;
protected DaemonSettings() { protected DaemonSettings() {
this(null, null, null, 0, false, false, null, null, false, null, null, this(null, null, null, 0, false, false, null, null, false, null, null, null,
null, null, null, null, 0, false, false, null, false); null, null, null, null, 0, false, false, null, false);
} }
@ -64,6 +65,7 @@ public final class DaemonSettings {
* @param useAuthentication Whether to use basic authentication * @param useAuthentication Whether to use basic authentication
* @param username The user name to provide during authentication * @param username The user name to provide during authentication
* @param password The password to provide during authentication * @param password The password to provide during authentication
* @param extraPass The Deluge web interface password
* @param downloadDir The default download directory (which may also be used as base directory for file paths) * @param downloadDir The default download directory (which may also be used as base directory for file paths)
* @param ftpUrl The partial URL to connect to when requesting FTP-style transfers * @param ftpUrl The partial URL to connect to when requesting FTP-style transfers
* @param timeout The number of seconds to wait before timing out a connection attempt * @param timeout The number of seconds to wait before timing out a connection attempt
@ -72,7 +74,7 @@ public final class DaemonSettings {
*/ */
public DaemonSettings(String name, Daemon type, String address, int port, boolean ssl, public DaemonSettings(String name, Daemon type, String address, int port, boolean ssl,
boolean sslTrustAll, String sslTrustKey, String folder, boolean useAuthentication, boolean sslTrustAll, String sslTrustKey, String folder, boolean useAuthentication,
String username, String password, OS os, String downloadDir, String ftpUrl, String ftpPassword, int timeout, String username, String password, String extraPass, OS os, String downloadDir, String ftpUrl, String ftpPassword, int timeout,
boolean alarmOnFinishedDownload, boolean alarmOnNewTorrent, String idString, boolean isAutoGenerated) boolean alarmOnFinishedDownload, boolean alarmOnNewTorrent, String idString, boolean isAutoGenerated)
{ {
this.name = name; this.name = name;
@ -86,6 +88,7 @@ public final class DaemonSettings {
this.useAuthentication = useAuthentication; this.useAuthentication = useAuthentication;
this.username = username; this.username = username;
this.password = password; this.password = password;
this.extraPass = extraPass;
this.os = os; this.os = os;
this.downloadDir = downloadDir; this.downloadDir = downloadDir;
this.ftpUrl = ftpUrl; this.ftpUrl = ftpUrl;
@ -130,6 +133,9 @@ public final class DaemonSettings {
public String getPassword() { public String getPassword() {
return password; return password;
} }
public String getExtraPassword() {
return extraPass;
}
public OS getOS() { public OS getOS() {
return os; return os;
} }
@ -165,11 +171,13 @@ public final class DaemonSettings {
public String getHumanReadableIdentifier() { public String getHumanReadableIdentifier() {
if (isAutoGenerated) { if (isAutoGenerated) {
// Hide the 'implementation details'; just give the username and server // Hide the 'implementation details'; just give the username and server
return (this.shouldUseAuthentication() && Daemon.supportsUsername(getType())? this.getUsername() + "@": "") + getAddress(); return (this.shouldUseAuthentication() && this.getUsername() != null && !this.getUsername().isEmpty() ? this
.getUsername() + "@" : "") + getAddress();
} }
return (this.ssl ? "https://" : "http://") + ((this.shouldUseAuthentication() && Daemon.supportsUsername(getType()))? this.getUsername() + "@": "") + return (this.ssl ? "https://" : "http://")
getAddress() + ":" + getPort() + + (this.shouldUseAuthentication() && this.getUsername() != null && !this.getUsername().isEmpty() ? this
(Daemon.supportsCustomFolder(getType()) && getFolder() != null? getFolder(): ""); .getUsername() + "@" : "") + getAddress() + ":" + getPort()
+ (Daemon.supportsCustomFolder(getType()) && getFolder() != null ? getFolder() : "");
} }
@Override @Override

11
lib/src/org/transdroid/daemon/Deluge/DelugeAdapter.java

@ -430,9 +430,13 @@ public class DelugeAdapter implements IDaemonAdapter {
if (sessionCookie == null) { if (sessionCookie == null) {
// Build login object // Build login object
String extraPass = settings.getExtraPassword();
if (extraPass == null || extraPass.isEmpty()) {
extraPass = settings.getPassword();
}
JSONObject loginRequest = new JSONObject(); JSONObject loginRequest = new JSONObject();
loginRequest.put(RPC_METHOD, RPC_METHOD_LOGIN); loginRequest.put(RPC_METHOD, RPC_METHOD_LOGIN);
loginRequest.put(RPC_PARAMS, (new JSONArray()).put(settings.getPassword())); loginRequest.put(RPC_PARAMS, (new JSONArray()).put(extraPass));
loginRequest.put(RPC_ID, 1); loginRequest.put(RPC_ID, 1);
// Set POST URL and data // Set POST URL and data
@ -520,7 +524,7 @@ public class DelugeAdapter implements IDaemonAdapter {
*/ */
private void initialise() throws DaemonException { private void initialise() throws DaemonException {
httpclient = HttpHelper.createStandardHttpClient(settings, false); httpclient = HttpHelper.createStandardHttpClient(settings, settings.getUsername() != null && !settings.getUsername().isEmpty());
httpclient.addRequestInterceptor(HttpHelper.gzipRequestInterceptor); httpclient.addRequestInterceptor(HttpHelper.gzipRequestInterceptor);
httpclient.addResponseInterceptor(HttpHelper.gzipResponseInterceptor); httpclient.addResponseInterceptor(HttpHelper.gzipResponseInterceptor);
@ -624,9 +628,10 @@ public class DelugeAdapter implements IDaemonAdapter {
return 2; return 2;
case High: case High:
return 3; return 3;
} default:
return 1; return 1;
} }
}
private TorrentStatus convertDelugeState(String state) { private TorrentStatus convertDelugeState(String state) {
// Deluge sends a string with status code // Deluge sends a string with status code

Loading…
Cancel
Save