Work on #587: revamped templates

This commit is contained in:
Zef Hemel
2023-12-21 18:38:02 +01:00
parent c38e6cfc25
commit 70ef6ed9da
42 changed files with 664 additions and 486 deletions
+9 -2
View File
@@ -82,7 +82,7 @@ export async function cacheFileListing(uri: string): Promise<FileMeta[]> {
const r = await nativeFetch(indexUrl, {
method: "GET",
headers: {
Accept: "application/json",
"X-Sync-Mode": "true",
"Cache-Control": "no-cache",
},
signal: fetchController.signal,
@@ -119,7 +119,13 @@ export async function readFile(
name: string,
): Promise<{ data: Uint8Array; meta: FileMeta } | undefined> {
const url = federatedPathToUrl(name);
const r = await nativeFetch(url);
console.log("Fetfching fedderated file", url);
const r = await nativeFetch(url, {
method: "GET",
headers: {
"X-Sync-Mode": "true",
},
});
if (r.status === 503) {
throw new Error("Offline");
}
@@ -195,6 +201,7 @@ export async function getFileMeta(name: string): Promise<FileMeta> {
const r = await nativeFetch(url, {
method: "GET",
headers: {
"X-Sync-Mode": "true",
"X-Get-Meta": "true",
},
});