This commit is contained in:
badblocks 2026-07-10 00:21:45 -07:00
parent 6e7977997e
commit e95df30359
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
21 changed files with 290 additions and 199 deletions

View file

@ -1,16 +1,10 @@
import { ofetch } from "ofetch";
import { ProxyAgent } from "undici";
const wireguardDispatcher = new ProxyAgent("http://wireguard:8888");
const TIMEOUT = 5000;
const httpFetchClient = {
get: async (url: string, headers: Record<string, string>) => {
const response = await ofetch(url, {
method: "GET",
headers,
dispatcher: wireguardDispatcher,
timeout: TIMEOUT,
});
return response;
@ -20,8 +14,6 @@ const httpFetchClient = {
method: "POST",
headers,
body: JSON.stringify(body),
dispatcher: wireguardDispatcher,
timeout: TIMEOUT,
});
return response;
@ -31,8 +23,6 @@ const httpFetchClient = {
method: "PUT",
headers,
body: JSON.stringify(body),
dispatcher: wireguardDispatcher,
timeout: TIMEOUT,
});
return response;
@ -42,8 +32,6 @@ const httpFetchClient = {
method: "PATCH",
headers,
body: JSON.stringify(body),
dispatcher: wireguardDispatcher,
timeout: TIMEOUT,
});
return response;
@ -52,8 +40,6 @@ const httpFetchClient = {
const response = await ofetch(url, {
method: "DELETE",
headers,
dispatcher: wireguardDispatcher,
timeout: TIMEOUT,
});
return response;