import { html } from "https://esm.sh/common-tags@1.8.2";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=84";
import { blob } from "https://esm.town/v/std/blob?v=12";
import { createExcalidraw } from "https://jsr.io/@smallweb/excalidraw/0.3.0/mod.ts";
import { join } from "jsr:@std/path@0.225.2";
const { name } = extractValInfo(import.meta.url);
const excalidrawHandler = createExcalidraw({
store: {
get: async (key) => {
try {
const res = await blob.get(join(name, key));
return new Uint8Array(await res.arrayBuffer());
} catch (e) {
return null;
}
},
set: (key, value) => {
return blob.set(join(name, key), value);
},
},
});
export default passwordAuth((req) => {
return excalidrawHandler(req);
}, { verifyPassword: (password) => password == "iamsecret" });