mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-06 06:23:53 +05:00
feat/api-prox: add support for post requests, add 'sponsor' and 'toggles' hooks
This commit is contained in:
parent
6f45876240
commit
bfe932d86c
5 changed files with 216 additions and 15 deletions
18
api-prox/hooks/profile.ts
Normal file
18
api-prox/hooks/profile.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
// хук включает "вечную" спонсорку, отключая рекламу после входа в профиль, в официальном приложении
|
||||
|
||||
export function match(path: string): boolean {
|
||||
const pathRe = /^\/profile\/\d+/;
|
||||
if (pathRe.test(path) || path == "/profile/info") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function get(data: any, url: URL) {
|
||||
if (data.hasOwnProperty("profile")) {
|
||||
data["profile"]["is_sponsor"] = true;
|
||||
data["profile"]["sponsorshipExpires"] = 2147483647;
|
||||
} else {
|
||||
data["is_sponsor"] = true;
|
||||
data["sponsorship_expires"] = 2147483647;
|
||||
}
|
||||
return data;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue