diff --git a/plugins/yandex/index.ts b/plugins/yandex/index.ts index fd1707b5..698e3791 100644 --- a/plugins/yandex/index.ts +++ b/plugins/yandex/index.ts @@ -26,16 +26,16 @@ import { auth, header, transform } from "./meta"; import { array } from "@amadeus-music/core"; import { createHash } from "node:crypto"; -init(function* ({ yandex: { token } }) { - if (!token) throw "No token found!"; +init(function* ({ yandex: { tokens } }) { + if (!tokens.length) throw "No token found!"; this.connect.baseURL = "wss://uniproxy.alice.yandex.net/uni.ws"; this.fetch.baseURL = "https://api.music.yandex.net/"; this.fetch.params = { page: "0" }; this.fetch.tls = "TLSv1.2"; this.fetch.headers = { "X-Yandex-Music-Client": "YandexMusicAndroid/24023621", + Authorization: tokens.map((x) => `OAuth ${x}`), "User-Agent": "Yandex-Music-API", - Authorization: `OAuth ${token}`, }; }); diff --git a/plugins/yandex/plugin.ts b/plugins/yandex/plugin.ts index 1bb185ff..924190c8 100644 --- a/plugins/yandex/plugin.ts +++ b/plugins/yandex/plugin.ts @@ -1,4 +1,10 @@ -import { string, defaulted, object, register } from "@amadeus-music/core"; +import { + defaulted, + register, + string, + object, + array, +} from "@amadeus-music/core"; import { name, version } from "./package.json"; export const { @@ -21,6 +27,6 @@ export const { name, version, config: { - yandex: defaulted(object({ token: defaulted(string(), "") }), {}), + yandex: defaulted(object({ tokens: defaulted(array(string()), []) }), {}), }, });