Skip to content

Commit f3650a1

Browse files
committed
Added token rotation support for VK
1 parent 09c84c1 commit f3650a1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

plugins/vk/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import {
2020
import { array, optional } from "@amadeus-music/core";
2121
import { safeFetch } from "./captcha";
2222

23-
init(function* ({ vk: { token } }) {
24-
if (!token) throw "No token found!";
23+
init(function* ({ vk: { tokens } }) {
24+
if (!tokens.length) throw "No token found!";
2525
this.fetch.baseURL = "https://api.vk.me/method/";
26-
this.fetch.params = { v: "5.190", access_token: token };
26+
this.fetch.params = { v: "5.190", access_token: tokens };
2727
this.fetch.headers = {
2828
"User-Agent": "Mrs.ia/1520 CFNetwork/1331.0.7 Darwin/21.4.0",
2929
};

plugins/vk/plugin.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { string, defaulted, object, register } from "@amadeus-music/core";
1+
import {
2+
defaulted,
3+
register,
4+
string,
5+
object,
6+
array,
7+
} from "@amadeus-music/core";
28
import { name, version } from "./package.json";
39

410
export const {
@@ -17,6 +23,6 @@ export const {
1723
name,
1824
version,
1925
config: {
20-
vk: defaulted(object({ token: defaulted(string(), "") }), {}),
26+
vk: defaulted(object({ tokens: defaulted(array(string()), []) }), {}),
2127
},
2228
});

0 commit comments

Comments
 (0)