mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-08 23:43:55 +05:00
refactor/api-prox: hook loading and running
This commit is contained in:
parent
32e830cae1
commit
deb92f1480
10 changed files with 4409 additions and 26 deletions
13
api-prox/src/hooks/test.ts
Normal file
13
api-prox/src/hooks/test.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
function match(url: URL): boolean {
|
||||
return url.pathname == "/profile/1";
|
||||
}
|
||||
|
||||
function hook(data: any, _: URL) {
|
||||
const newUname = "Anixartiki";
|
||||
if (!data.hasOwnProperty("profile") || !data.profile) return data;
|
||||
data["profile"]["login"] = newUname;
|
||||
return data;
|
||||
}
|
||||
|
||||
const entrypoint = { priority: 1, match, hook }
|
||||
export default entrypoint;
|
Loading…
Add table
Add a link
Reference in a new issue