mirror of
https://git.lucida.su/lucida/verdana.git
synced 2026-07-26 22:42:20 +00:00
fix spotify stored creds login errors not being handled lol
This commit is contained in:
parent
40dd469d34
commit
9d844766ec
1 changed files with 7 additions and 10 deletions
|
|
@ -39,23 +39,20 @@ class Spotify implements StreamerWithLogin {
|
|||
}
|
||||
} as const
|
||||
|
||||
loggedIn = false
|
||||
username?: string
|
||||
storedCredential?: string
|
||||
|
||||
constructor(options: SpotifyOptions) {
|
||||
this.client = new Librespot(options)
|
||||
|
||||
const { username, storedCredential } = options
|
||||
if (username && storedCredential) {
|
||||
this.client.loginWithStoredCreds(username, storedCredential)
|
||||
this.loggedIn = true
|
||||
}
|
||||
this.username = username
|
||||
this.storedCredential = storedCredential
|
||||
}
|
||||
async login(username: string, password: string) {
|
||||
if (!this.loggedIn) {
|
||||
const result = await this.client.login(username, password)
|
||||
this.loggedIn = true
|
||||
return result
|
||||
}
|
||||
if (this.username && this.storedCredential)
|
||||
return await this.client.loginWithStoredCreds(this.username, this.storedCredential)
|
||||
else return await this.client.login(username, password)
|
||||
}
|
||||
getStoredCredentials() {
|
||||
return this.client.getStoredCredentials()
|
||||
|
|
|
|||
Loading…
Reference in a new issue