Fix SubsonicPreferences creation

This commit is contained in:
CappielloAntonio 2021-07-28 13:55:05 +02:00
parent 7bd2b10165
commit ca1831d23c
3 changed files with 8 additions and 13 deletions

View file

@ -15,8 +15,7 @@ public class SubsonicPreferences {
this.serverUrl = serverUrl;
this.username = username;
if(password != null) this.authentication = new SubsonicAuthentication(password);
if(token != null) this.authentication.setToken(token);
if(salt != null) this.authentication.setSalt(salt);
if(token != null && salt != null) this.authentication = new SubsonicAuthentication(token, salt);
}
public String getServerUrl() {
@ -47,6 +46,11 @@ public class SubsonicPreferences {
update(password);
}
public SubsonicAuthentication(String token, String salt) {
this.token = token;
this.salt = salt;
}
public String getSalt() {
return salt;
}
@ -55,14 +59,6 @@ public class SubsonicPreferences {
return token;
}
public void setSalt(String salt) {
this.salt = salt;
}
public void setToken(String token) {
this.token = token;
}
void update(String password) {
this.salt = UUID.randomUUID().toString();
this.token = StringUtil.tokenize(password + salt);