Real-time collaboration within space (#411)

This commit is contained in:
Zef Hemel
2023-06-13 20:47:05 +02:00
committed by GitHub
parent 063a8e4767
commit 8e0a7cf177
54 changed files with 1358 additions and 187 deletions
+12 -7
View File
@@ -41,14 +41,19 @@ export async function ensureSettingsAndIndex(
settingsText = new TextDecoder().decode(
(await space.readFile("SETTINGS.md")).data,
);
} catch {
await space.writeFile(
"SETTINGS.md",
new TextEncoder().encode(SETTINGS_TEMPLATE),
true,
);
} catch (e: any) {
if (e.message === "Not found") {
await space.writeFile(
"SETTINGS.md",
new TextEncoder().encode(SETTINGS_TEMPLATE),
true,
);
} else {
console.error("Error reading settings", e.message);
console.error("Falling back to default settings");
}
settingsText = SETTINGS_TEMPLATE;
// Ok, then let's also write the index page
// Ok, then let's also check the index page
try {
await space.getFileMeta("index.md");
} catch {