creates video voice memos from audio clips; with bluesky integration.
trill.ptr.pet
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";
17import { Text } from "~/components/ui/text";
18import { Link } from "~/components/ui/link";
19import { HStack } from "styled-system/jsx";
20
21const root = document.getElementById("root");
22
23if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
24 throw new Error(
25 "Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?",
26 );
27}
28
29const prefersDarkScheme = window.matchMedia(
30 "(prefers-color-scheme: dark)",
31).matches;
32document.documentElement.dataset.theme = prefersDarkScheme ? "dark" : "light";
33
34tryFinalizeLogin()
35 .then((login) => {
36 if (!login) return;
37 let currentAccounts = accounts();
38 currentAccounts = currentAccounts.filter((acc) => acc.did !== login.did);
39 setAccounts([
40 ...currentAccounts,
41 {
42 did: login.did as AtprotoDid,
43 handle: login.handle === "handle.invalid" ? undefined : login.handle,
44 },
45 ]);
46 toaster.create({
47 title: "login success",
48 description: `logged in as ${login.handle}`,
49 type: "success",
50 });
51 })
52 .catch((error) => {
53 console.error(error);
54 toaster.create({
55 title: "login error",
56 description: `${error}`,
57 type: "error",
58 });
59 });
60
61if (autoTranscribe.get()) preloadModel();
62
63render(() => <App />, root!);