mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Fix app asking for credential on every startup
This commit is contained in:
parent
a21a051cb5
commit
7bd2b10165
6 changed files with 116 additions and 52 deletions
|
|
@ -7,16 +7,16 @@ import java.util.UUID;
|
|||
public class SubsonicPreferences {
|
||||
private String serverUrl;
|
||||
private String username;
|
||||
private String clientName = "SubsonicJavaClient";
|
||||
private int streamBitRate = 320;
|
||||
private String streamFormat = "mp3";
|
||||
private String clientName = "Play for Subsonic";
|
||||
|
||||
private final SubsonicAuthentication authentication;
|
||||
private SubsonicAuthentication authentication;
|
||||
|
||||
public SubsonicPreferences(String serverUrl, String username, String password) {
|
||||
public SubsonicPreferences(String serverUrl, String username, String password, String token, String salt) {
|
||||
this.serverUrl = serverUrl;
|
||||
this.username = username;
|
||||
this.authentication = new SubsonicAuthentication(password);
|
||||
if(password != null) this.authentication = new SubsonicAuthentication(password);
|
||||
if(token != null) this.authentication.setToken(token);
|
||||
if(salt != null) this.authentication.setSalt(salt);
|
||||
}
|
||||
|
||||
public String getServerUrl() {
|
||||
|
|
@ -31,14 +31,6 @@ public class SubsonicPreferences {
|
|||
return clientName;
|
||||
}
|
||||
|
||||
public int getStreamBitRate() {
|
||||
return streamBitRate;
|
||||
}
|
||||
|
||||
public String getStreamFormat() {
|
||||
return streamFormat;
|
||||
}
|
||||
|
||||
public SubsonicAuthentication getAuthentication() {
|
||||
return authentication;
|
||||
}
|
||||
|
|
@ -63,6 +55,14 @@ 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue