Federated URL backend handling

This commit is contained in:
Zef Hemel
2023-07-29 17:06:32 +02:00
parent 7442aac7e0
commit 21c8cd6e7a
3 changed files with 22 additions and 1 deletions
+10
View File
@@ -147,6 +147,16 @@ async function handleLocalFileRequest(
},
},
);
} else if (path.startsWith("!")) {
// Federated URL handling
let url = path.slice(1);
if (url.startsWith("localhost")) {
url = `http://${url}`;
} else {
url = `https://${url}`;
}
console.info("Proxying federated URL", path, "to", url);
return fetch(url, { method: "GET", headers: request.headers });
} else {
console.error(
"Did not find file in locally synced space",