fix soundcloud account validation, bump version

This commit is contained in:
uh wot 2024-10-09 02:04:22 +02:00
parent b6a9ac9ca3
commit 29719ef5d9
No known key found for this signature in database
GPG Key ID: CB2454984587B781
2 changed files with 17 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "lucida", "name": "lucida",
"version": "2.0.0-50", "version": "2.0.0-51",
"description": "A modular music downloader tool", "description": "A modular music downloader tool",
"main": "build/index.js", "main": "build/index.js",
"type": "module", "type": "module",

View File

@ -278,20 +278,23 @@ export default class Soundcloud implements Streamer {
return { ...api, id } return { ...api, id }
} }
async getAccountInfo(): Promise<StreamerAccount> { async getAccountInfo(): Promise<StreamerAccount> {
if (!this.oauthToken) return { valid: false }
const client = this.client || (await this.#getClient()) const client = this.client || (await this.#getClient())
const subscriptionQuery = <SoundCloudSubscriptionData>await ( const response = await fetch(
await fetch( this.#formatURL(
this.#formatURL( `https://api-v2.soundcloud.com/payments/quotations/consumer-subscription`,
`https://api-v2.soundcloud.com/payments/quotations/consumer-subscription`, client
client ),
), {
{ method: 'get',
method: 'get', headers: headers(this.oauthToken),
headers: headers(this.oauthToken), dispatcher: this.dispatcher
dispatcher: this.dispatcher }
} )
) if (response.status != 200) return { valid: false }
).json()
const subscriptionQuery = <SoundCloudSubscriptionData>await response.json()
return { return {
valid: true, valid: true,