Login procedure fix

This commit is contained in:
CappielloAntonio 2021-07-28 18:28:47 +02:00
parent cb8597db66
commit b380ae160a
6 changed files with 31 additions and 39 deletions

View file

@ -13,11 +13,10 @@ import java.util.HashMap;
import java.util.Map;
public class Subsonic {
private final SubsonicPreferences preferences;
private static final Version API_MAX_VERSION = Version.of("1.15.0");
private Version apiVersion = API_MAX_VERSION;
private SubsonicPreferences preferences;
private SystemClient systemClient;
private BrowsingClient browsingClient;
@ -30,10 +29,6 @@ public class Subsonic {
this.preferences = preferences;
}
public SubsonicPreferences getPreferences() {
return preferences;
}
public Version getApiVersion() {
return apiVersion;
}

View file

@ -8,16 +8,8 @@ public class SubsonicPreferences {
private String serverUrl;
private String username;
private String clientName = "Play for Subsonic";
private SubsonicAuthentication authentication;
public SubsonicPreferences(String serverUrl, String username, String password, String token, String salt) {
this.serverUrl = serverUrl;
this.username = username;
if(password != null) this.authentication = new SubsonicAuthentication(password);
if(token != null && salt != null) this.authentication = new SubsonicAuthentication(token, salt);
}
public String getServerUrl() {
return serverUrl;
}
@ -34,8 +26,21 @@ public class SubsonicPreferences {
return authentication;
}
public void setPassword(String password) {
authentication.update(password);
public void setServerUrl(String serverUrl) {
this.serverUrl = serverUrl;
}
public void setUsername(String username) {
this.username = username;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public void setAuthentication(String password, String token, String salt) {
if(password != null) this.authentication = new SubsonicAuthentication(password);
if(token != null && salt != null) this.authentication = new SubsonicAuthentication(token, salt);
}
public static class SubsonicAuthentication {