Skip to content

Commit

Permalink
Added token rotation support for VK
Browse files Browse the repository at this point in the history
  • Loading branch information
Azarattum committed Apr 21, 2024
1 parent 09c84c1 commit f3650a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions plugins/vk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
import { array, optional } from "@amadeus-music/core";
import { safeFetch } from "./captcha";

init(function* ({ vk: { token } }) {
if (!token) throw "No token found!";
init(function* ({ vk: { tokens } }) {
if (!tokens.length) throw "No token found!";
this.fetch.baseURL = "https://api.vk.me/method/";
this.fetch.params = { v: "5.190", access_token: token };
this.fetch.params = { v: "5.190", access_token: tokens };
this.fetch.headers = {
"User-Agent": "Mrs.ia/1520 CFNetwork/1331.0.7 Darwin/21.4.0",
};
Expand Down
10 changes: 8 additions & 2 deletions plugins/vk/plugin.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -17,6 +23,6 @@ export const {
name,
version,
config: {
vk: defaulted(object({ token: defaulted(string(), "") }), {}),
vk: defaulted(object({ tokens: defaulted(array(string()), []) }), {}),
},
});

0 comments on commit f3650a1

Please sign in to comment.