Experiment to rebuild Diffuse using web applets.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: output configuration

+19 -9
+1 -1
src/components/List.astro
··· 6 6 { 7 7 items.map((item: { title: string; url: string }) => ( 8 8 <li> 9 - {item.title.startsWith("(TODO) ") || item.title.startsWith("(WIP) ") ? ( 9 + {item.title.startsWith("(TODO) ") ? ( 10 10 <span>{item.title}</span> 11 11 ) : ( 12 12 <a href={item.url}>{item.title}</a>
+9 -2
src/pages/configurator/output/_applet.astro
··· 126 126 break; 127 127 default: 128 128 const conn = await connection(method); 129 - await conn.sendAction("mount"); 130 - setActive(method); 129 + try { 130 + await conn.sendAction("mount"); 131 + setActive(method); 132 + } catch (err) { 133 + const msg: string = 134 + err && typeof err === "object" && "message" in err ? `${err.message}` : `${err}`; 135 + if (msg.startsWith("[user] ")) alert(msg.slice(7)); 136 + } 137 + break; 131 138 } 132 139 } 133 140
+1 -1
src/pages/index.astro
··· 47 47 const output = [ 48 48 { url: "output/indexed-db/", title: "IndexedDB" }, 49 49 { url: "output/native-fs/", title: "Native File System" }, 50 - { url: "output/storacha-automerge", title: "Storacha Storage + Automerge CRDT" }, 50 + { url: "output/storacha-automerge/", title: "(WIP) Storacha Storage + Automerge CRDT" }, 51 51 { url: "output/todo/", title: "(TODO) Keyhive/Beelay" }, 52 52 { url: "output/todo/", title: "(TODO) Dialog DB" }, 53 53 ];
+8 -5
src/pages/output/native-fs/_applet.astro
··· 1 1 <script> 2 2 import * as IDB from "idb-keyval"; 3 - import "wicg-file-system-access"; 3 + import type * as FSA from "wicg-file-system-access"; 4 4 5 5 import type { ManagedOutput, Track } from "@applets/core/types"; 6 6 import { jsonDecode, jsonEncode, register } from "@scripts/applets/common"; ··· 16 16 context.data = INITIAL_MANAGED_OUTPUT; 17 17 18 18 // Load initial data 19 - if (context.isMainInstance()) 20 - tracks().then((collection) => { 19 + if (context.isMainInstance() && (await IDB.get(IDB_DEVICE_KEY))) loadInitialData(); 20 + 21 + async function loadInitialData() { 22 + return tracks().then((collection) => { 21 23 context.data = { 22 24 ...context.data, 23 25 tracks: { ··· 28 30 }, 29 31 }; 30 32 }); 33 + } 31 34 32 35 //////////////////////////////////////////// 33 36 // ACTIONS ··· 48 51 49 52 async function mount() { 50 53 if (!("showDirectoryPicker" in self)) { 51 - alert("File System Access API is not supported on this platform."); 52 - return; 54 + throw new Error("[user] The File System Access API is not supported on this platform."); 53 55 } 54 56 55 57 const existingHandle = await IDB.get(IDB_DEVICE_KEY); ··· 57 59 const directoryHandle = await self.showDirectoryPicker(); 58 60 await IDB.set(IDB_DEVICE_KEY, directoryHandle); 59 61 await directoryHandle.requestPermission({ mode: "readwrite" }); 62 + loadInitialData(); 60 63 } 61 64 } 62 65