This commit is contained in:
Zef Hemel
2022-12-05 12:14:21 +01:00
parent b24c2996be
commit e780a838b6
8 changed files with 38 additions and 41 deletions
+7 -21
View File
@@ -8,28 +8,14 @@ import { SilverBulletHooks } from "../common/manifest.ts";
import { System } from "../plugos/system.ts";
safeRun(async () => {
let password: string | undefined = localStorage.getItem("password") ||
undefined;
let httpPrimitives = new HttpSpacePrimitives("", password);
const httpPrimitives = new HttpSpacePrimitives("");
let settingsPageText = "";
while (true) {
try {
settingsPageText = (
await httpPrimitives.readFile("SETTINGS.md", "string")
).data as string;
break;
} catch (e: any) {
if (e.message === "Unauthorized") {
password = prompt("Password: ") || undefined;
if (!password) {
alert("Sorry, need a password");
return;
}
localStorage.setItem("password", password!);
httpPrimitives = new HttpSpacePrimitives("", password);
}
}
try {
settingsPageText = (
await httpPrimitives.readFile("SETTINGS.md", "string")
).data as string;
} catch (e: any) {
console.error("No settings page found", e.message);
}
// Instantiate a PlugOS system for the client