creates video voice memos from audio clips; with bluesky integration. trill.ptr.pet
at main 1.7 kB view raw
1/* @refresh reload */ 2import { render } from "solid-js/web"; 3import "solid-devtools"; 4import "./index.css"; 5 6import type {} from "@atcute/atproto"; 7import type {} from "@atcute/bluesky"; 8import type {} from "@atcute/microcosm"; 9 10import App from "./App"; 11import { tryFinalizeLogin } from "./lib/oauth"; 12import { accounts, setAccounts } from "./lib/accounts"; 13import { AtprotoDid } from "@atcute/lexicons/syntax"; 14import { toaster } from "./components/Toaster"; 15import { autoTranscribe } from "./lib/settings"; 16import { preloadModel } from "./lib/transcribe"; 17 18const root = document.getElementById("root"); 19 20if (import.meta.env.DEV && !(root instanceof HTMLElement)) { 21 throw new Error( 22 "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?", 23 ); 24} 25 26const prefersDarkScheme = window.matchMedia( 27 "(prefers-color-scheme: dark)", 28).matches; 29document.documentElement.dataset.theme = prefersDarkScheme ? "dark" : "light"; 30 31tryFinalizeLogin() 32 .then((login) => { 33 if (!login) return; 34 let currentAccounts = accounts(); 35 currentAccounts = currentAccounts.filter((acc) => acc.did !== login.did); 36 setAccounts([ 37 ...currentAccounts, 38 { 39 did: login.did as AtprotoDid, 40 handle: login.handle === "handle.invalid" ? undefined : login.handle, 41 }, 42 ]); 43 toaster.create({ 44 title: "login success", 45 description: `logged in as ${login.handle}`, 46 type: "success", 47 }); 48 }) 49 .catch((error) => { 50 console.error(error); 51 toaster.create({ 52 title: "login error", 53 description: `${error}`, 54 type: "error", 55 }); 56 }); 57 58if (autoTranscribe.get()) preloadModel(); 59 60render(() => <App />, root!);