Something went wrong. Try again.
A music player that connects to your cloud/distributed storage. forked from tokono.ma/diffuse
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import foundation from "~/common/foundation.js";import * as CID from "~/common/cid.js";import * as Output from "~/common/output.js";import { createLoader, renderError } from "~/common/loader.js";import { insertPreludes } from "~/common/facets/prelude.js";
// Output elementconst output = await foundation.orchestrator.output();
// Contaienrconst container = /** @type {HTMLDivElement} */ ( document.querySelector("#container"));
// Preludesconst facets = await Output.data(output.facets);let preludesInserted = false;
// LoadcreateLoader({ $type: "sh.diffuse.output.facet", label: "Facet", source: () => output.facets, async render(facet) { if (facet.cid) { const valid = await CID.verify( new TextEncoder().encode(facet.html ?? ""), facet.cid, );
if (!valid) { renderError( container, "CID mismatch: HTML content does not match the CID", ); return; } }
if (!preludesInserted) { preludesInserted = true; await insertPreludes(facets, document.body); }
const range = document.createRange(); range.selectNode(container); const documentFragment = range.createContextualFragment(facet.html ?? ""); container.append(documentFragment); },});