feat/api-prox: add support for post requests, add 'sponsor' and 'toggles' hooks

This commit is contained in:
Kentai Radiquum 2025-07-02 16:51:16 +05:00
parent 6f45876240
commit bfe932d86c
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
5 changed files with 216 additions and 15 deletions

18
api-prox/hooks/profile.ts Normal file
View 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;
}