feat/api-prox: add POST proxy

This commit is contained in:
Kentai Radiquum 2025-09-06 19:44:49 +05:00
parent deb92f1480
commit a24371cf24
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
6 changed files with 95 additions and 57 deletions

View file

@ -1,13 +1,15 @@
function match(url: URL): boolean {
return url.pathname == "/profile/1";
const priority = 0;
function match(url: URL, method: "GET" | "POST"): boolean {
return url.pathname == "/profile/1" && method == "GET";
}
function hook(data: any, _: URL) {
function hook(data: any, _: URL, __: "GET" | "POST") {
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;
const entrypoint = { priority, match, hook };
export default entrypoint;