feat(usage): implement timeout and error handling for antigravity usage and subscription requests

- Add a 10-second timeout for fetch requests in getAntigravityUsage and getAntigravitySubscriptionInfo functions.
- Include error logging for fetch failures in both functions.
- Update headers to include "x-request-source" for MITM bypass.
- Enhance proxyFetch with DNS resolution and MITM bypass capabilities.
- Ensure proxyFetch is loaded in the API route for proper fetch patching.
This commit is contained in:
decolua
2026-02-28 12:12:49 +07:00
parent 04ba66bc1e
commit 2f4b813c5b
5 changed files with 147 additions and 10 deletions
+1 -4
View File
@@ -201,20 +201,17 @@ const server = https.createServer(sslOptions, async (req, res) => {
}
const model = extractModel(req.url, bodyBuffer);
console.log(`📡 intercepted: ${req.url} | model: ${model}`);
const mappedModel = getMappedModel(model);
if (!mappedModel) {
return passthrough(req, res, bodyBuffer);
}
console.log(`🔀 ${model}${mappedModel}`);
return intercept(req, res, bodyBuffer, mappedModel);
});
server.listen(LOCAL_PORT, () => {
console.log(`🚀 MITM ready on :${LOCAL_PORT}${ROUTER_URL}`);
console.log(`📡 Intercepting: ${TARGET_HOSTS.join(", ")}`);
console.log(`🚀 MITM ready on :${LOCAL_PORT}`);
});
server.on("error", (error) => {