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",
"version": "2.0.0-50",
"version": "2.0.0-51",
"description": "A modular music downloader tool",
"main": "build/index.js",
"type": "module",

View File

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