mirror of
https://git.gay/lucida/lucida
synced 2025-12-11 20:15:14 +01:00
fix spotify stored creds login errors not being handled lol
This commit is contained in:
parent
40dd469d34
commit
9d844766ec
@ -39,23 +39,20 @@ class Spotify implements StreamerWithLogin {
|
|||||||
}
|
}
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
loggedIn = false
|
username?: string
|
||||||
|
storedCredential?: string
|
||||||
|
|
||||||
constructor(options: SpotifyOptions) {
|
constructor(options: SpotifyOptions) {
|
||||||
this.client = new Librespot(options)
|
this.client = new Librespot(options)
|
||||||
|
|
||||||
const { username, storedCredential } = options
|
const { username, storedCredential } = options
|
||||||
if (username && storedCredential) {
|
this.username = username
|
||||||
this.client.loginWithStoredCreds(username, storedCredential)
|
this.storedCredential = storedCredential
|
||||||
this.loggedIn = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async login(username: string, password: string) {
|
async login(username: string, password: string) {
|
||||||
if (!this.loggedIn) {
|
if (this.username && this.storedCredential)
|
||||||
const result = await this.client.login(username, password)
|
return await this.client.loginWithStoredCreds(this.username, this.storedCredential)
|
||||||
this.loggedIn = true
|
else return await this.client.login(username, password)
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getStoredCredentials() {
|
getStoredCredentials() {
|
||||||
return this.client.getStoredCredentials()
|
return this.client.getStoredCredentials()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user