mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-05 22:15:36 +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;
|
||||
}
|
66
api-prox/hooks/toggles.ts
Normal file
66
api-prox/hooks/toggles.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
// хук изменяет ответ config/toggles
|
||||
|
||||
export interface Toggles {
|
||||
minVersionCode: number;
|
||||
lastVersionCode: number;
|
||||
whatsNew: string;
|
||||
downloadLink: string;
|
||||
minGPVersionCode: number;
|
||||
lastGPVersionCode: number;
|
||||
gpWhatsNew: string;
|
||||
gpDownloadLink: string;
|
||||
overrideGPVersion: boolean;
|
||||
inAppUpdates: boolean;
|
||||
inAppUpdatesImmediate: boolean;
|
||||
inAppUpdatesFlexibleDelay: number;
|
||||
impMessageEnabled: boolean;
|
||||
impMessageText: string;
|
||||
impMessageBackgroundColor: string;
|
||||
impMessageTextColor: string;
|
||||
impMessageLink: string;
|
||||
adBannerBlockId: string;
|
||||
adBannerSizeType: number;
|
||||
adInterstitialBlockId: string;
|
||||
adBannerDelay: number;
|
||||
adInterstitialDelay: number;
|
||||
kodikVideoLinksUrl: string;
|
||||
kodikIframeAd: boolean;
|
||||
sibnetRandUserAgent: boolean;
|
||||
sibnetUserAgent: string;
|
||||
torlookUrl: string;
|
||||
baseUrl: string;
|
||||
apiUrl: string;
|
||||
apiAltUrl: string;
|
||||
apiAltAvailable: boolean;
|
||||
iframeEmbedUrl: string;
|
||||
kodikAdIframeUrl: string;
|
||||
sponsorshipPromotion: boolean;
|
||||
sponsorshipText: string;
|
||||
sponsorshipAvailable: boolean;
|
||||
pageNoConnectionUrl: string;
|
||||
snowfall: boolean;
|
||||
searchBarIconUrl: string;
|
||||
searchBarIconTint: string;
|
||||
searchBarIconAction: string;
|
||||
searchBarIconValue: string;
|
||||
min_blog_create_rating_score: number;
|
||||
}
|
||||
|
||||
export function match(path: string): boolean {
|
||||
if (path == "/config/toggles") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function get(data: Toggles, url: URL) {
|
||||
data.lastVersionCode = 25062200;
|
||||
|
||||
data.impMessageEnabled = true;
|
||||
data.impMessageText = "разработчик AniX / Api-Prox-Svc";
|
||||
data.impMessageLink = "https://bento.me/radiquum";
|
||||
data.impMessageBackgroundColor = "ffb3d0"
|
||||
data.impMessageTextColor = "ffffff"
|
||||
|
||||
data.apiAltAvailable = false;
|
||||
data.apiAltUrl = "";
|
||||
return data;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue