diff --git a/.fallowrc.json b/.fallowrc.json index 022e0cc..320cbb5 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -1,11 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json", - "entry": [ - "src/index.{ts,tsx,js,jsx}", - "src/main.{ts,tsx,js,jsx}", - "apps/tauri/render-version.ts", - "packages/**/*.test.ts" - ], + "entry": ["src/index.{ts,tsx,js,jsx}", "src/main.{ts,tsx,js,jsx}"], "workspaces": { "packages": ["packages/*", "apps/*"] }, diff --git a/apps/electron/package.json b/apps/electron/package.json index d650270..aa4d5a0 100644 --- a/apps/electron/package.json +++ b/apps/electron/package.json @@ -9,7 +9,6 @@ "main": "dist/main/main.js", "scripts": { "clean": "rm -rf dist release", - "lint": "eslint src", "build:web": "cd ../.. && bun run build:web", "build": "tsc -p tsconfig.json && esbuild src/preload/preload.ts --bundle --platform=node --format=cjs --external:electron --outfile=dist/preload/preload.cjs", "dev:raw": "cd ../.. && bun run build:web && cd apps/electron && bun run build && electron . --verbose", @@ -27,7 +26,9 @@ "validate:raw": "bun run build && bun run package:linux:raw", "validate": "if command -v nix >/dev/null 2>&1 && [ -z \"$IN_NIX_SHELL\" ]; then nix develop --command bun run validate:raw; else bun run validate:raw; fi" }, - "dependencies": {}, + "dependencies": { + "electron-updater": "^6.6.2" + }, "devDependencies": { "@types/node": "^25.9.1", "electron": "^39.2.7", diff --git a/apps/electron/src/main/main.ts b/apps/electron/src/main/main.ts index ebda1e5..05f88fc 100644 --- a/apps/electron/src/main/main.ts +++ b/apps/electron/src/main/main.ts @@ -12,7 +12,6 @@ import { import { checkForUpdates } from "./updates.js"; import { ipcChannels, - type DesktopScreenShareAudioOutput, type DesktopScreenShareCapabilities, } from "../shared/ipc.js"; @@ -89,7 +88,7 @@ function execJson(command: string, args: string[]) { }); } -async function listAudioOutputs(): Promise { +async function listAudioOutputs() { verboseLog("listAudioOutputs", { platform: process.platform }); if (process.platform !== "linux") return []; @@ -107,9 +106,7 @@ async function listAudioOutputs(): Promise { if (!id || !name) return null; return { id, name, isDefault: false }; }) - .filter( - (output): output is DesktopScreenShareAudioOutput => output != null, - ); + .filter(Boolean); } async function listScreenShareSources() { diff --git a/apps/tauri/package.json b/apps/tauri/package.json index fb41de4..91c18bd 100644 --- a/apps/tauri/package.json +++ b/apps/tauri/package.json @@ -30,10 +30,12 @@ "@tauri-apps/api": "^2", "@tauri-apps/plugin-barcode-scanner": "~2", "@tauri-apps/plugin-deep-link": "~2", - "react-dom": "^19.2.0", + "@tauri-apps/plugin-opener": "^2", "@tensamin/ui": "*", "@tensamin/shared": "workspace:*", - "react": "^19.2.0" + "lucide-react": "^1.14.0", + "react": "^19.2.0", + "react-dom": "^19.2.0" }, "devDependencies": { "@tauri-apps/cli": "^2", diff --git a/apps/web/package.json b/apps/web/package.json index 04d731f..0748a1f 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@fontsource-variable/inter": "^5.2.8", + "@noble/curves": "^2.2.0", "@tailwindcss/vite": "^4.2.4", "@tanstack/react-router": "^1.169.1", "@tanstack/react-virtual": "^3.13.24", @@ -29,13 +30,21 @@ "@tensamin/ui": "*", "@tensamin/user": "workspace:*", "@tensamin/notifications": "workspace:*", - "tw-animate-css": "^1.4.0", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "comlink": "^4.4.2", + "framer-motion": "^12.38.0", "lucide-react": "^1.14.0", "qrcode": "^1.5.4", "react": "^19.2.0", "react-dom": "^19.2.0", - "tailwindcss": "^4.2.4", + "shadcn": "^4.6.0", + "sonner": "^2.0.7", + "tailwind-merge": "^3.5.0", "tailwind-scrollbar-hide": "^4.0.0", + "tailwindcss": "^4.2.4", + "tauri-plugin-app-events-api": "^0.2.0", + "tw-animate-css": "^1.4.0", "zod": "^4.3.6" }, "devDependencies": { diff --git a/apps/web/src/components/modals/profile.tsx b/apps/web/src/components/modals/profile.tsx index c46e4ef..6a31e36 100644 --- a/apps/web/src/components/modals/profile.tsx +++ b/apps/web/src/components/modals/profile.tsx @@ -1,62 +1,8 @@ import type { User } from "@tensamin/user/context"; -import { - Avatar, - AvatarFallback, - AvatarImage, - Button, - Tooltip, - TooltipContent, - TooltipTrigger, -} from "@tensamin/ui"; -import { toLossySixDigitCode } from "@tensamin/shared/code"; +import { Avatar, AvatarFallback, AvatarImage } from "@tensamin/ui"; import Text from "@tensamin/markdown/text"; -import { ChevronDown, ChevronUp, Info } from "lucide-react"; -import { useEffect, useState } from "react"; -import { useCrypto } from "@tensamin/crypto/context"; -import { useStorage } from "@tensamin/storage/context"; -import { useUser } from "@tensamin/user/context"; export default function Profile({ user }: { user: User }) { - const [showAdvancedInformation, setShowAdvancedInformation] = useState(false); - const [sharedSecret, setSharedSecret] = useState(""); - - const { getSharedSecret } = useCrypto(); - const { load } = useStorage(); - const { get } = useUser(); - - useEffect(() => { - let active = true; - - void (async () => { - try { - const ownId = await load("user_id"); - const privateKey = await load("private_key"); - const ownData = await get(ownId); - const secret = await getSharedSecret( - privateKey, - ownData.public_key, - user.public_key, - ); - - if (active) { - setSharedSecret(secret); - } - } catch { - if (active) { - setSharedSecret(""); - } - } - })(); - - return () => { - active = false; - }; - }, [get, getSharedSecret, load, user.public_key]); - - const sharedSecretCode = sharedSecret - ? toLossySixDigitCode(sharedSecret) - : "------"; - return (
@@ -72,42 +18,17 @@ export default function Profile({ user }: { user: User }) {
- - {showAdvancedInformation && ( -
-

- Shared Code: {sharedSecretCode}{" "} - - } /> - - You can compare this code with the conversation partner to - validate that this chat is E2EE - - -

-

- Iota ID: {user.iota_id} -

-

- User ID: {user.user_id} -

-

- Public Key: {user.public_key} -

-
- )} +
+

+ iota: {user.iota_id} +

+

+ user: {user.user_id} +

+

+ pub key: {user.public_key} +

+
); } diff --git a/apps/web/src/components/navbar.tsx b/apps/web/src/components/navbar.tsx index cb83cb6..1c48c6c 100644 --- a/apps/web/src/components/navbar.tsx +++ b/apps/web/src/components/navbar.tsx @@ -74,7 +74,7 @@ export default function Navbar({ forMobile }: { forMobile: boolean }) { userId={id} component={(user) => isMobile ? ( -

{user?.display}

+

{user?.display}

) : ( -

{user?.display}

+

{user?.display}

} /> diff --git a/apps/web/src/components/sidebar.tsx b/apps/web/src/components/sidebar.tsx index c9851a3..054aff7 100644 --- a/apps/web/src/components/sidebar.tsx +++ b/apps/web/src/components/sidebar.tsx @@ -33,7 +33,7 @@ import { useIsMobile } from "@tensamin/ui"; import { MobileNavbar } from "./navbar"; import SidebarBox from "@tensamin/call/sidebarBox"; -import { useShowMobileNavbar } from "@/routes/app/useShowMobileNavbar"; +import { useShowMobileNavbar } from "@/routes/app/layout"; import { Ellipsis, Check } from "lucide-react"; import { useState } from "react"; import type { User } from "@tensamin/user/context"; diff --git a/apps/web/src/features/legal/screen.tsx b/apps/web/src/features/legal/screen.tsx index 9859036..6d4062c 100644 --- a/apps/web/src/features/legal/screen.tsx +++ b/apps/web/src/features/legal/screen.tsx @@ -220,7 +220,7 @@ function ContinueButton({ ); } -function BigCheckbox({ +export function BigCheckbox({ id, label, checked, diff --git a/apps/web/src/features/settings/components.tsx b/apps/web/src/features/settings/components.tsx index b9f2967..7b4157b 100644 --- a/apps/web/src/features/settings/components.tsx +++ b/apps/web/src/features/settings/components.tsx @@ -1,5 +1,5 @@ import { Label } from "@tensamin/ui"; -import { Switch as UISwitch } from "@tensamin/ui"; +import { Switch as UISwitch, Input as UIInput } from "@tensamin/ui"; import { useEffect, useState } from "react"; import type { Storage } from "@tensamin/shared/data"; @@ -10,6 +10,28 @@ type BooleanStorageKey = { [K in keyof Storage]: Storage[K] extends boolean ? K : never; }[keyof Storage]; +type StringStorageKey = { + [K in keyof Storage]: Storage[K] extends string ? K : never; +}[keyof Storage]; + +type NumberStorageKey = { + [K in keyof Storage]: Storage[K] extends number ? K : never; +}[keyof Storage]; + +type InputProps = + | { + label: string; + id: StringStorageKey; + placeholder?: string; + type?: "text"; + } + | { + label: string; + id: NumberStorageKey; + placeholder?: string; + type: "number"; + }; + export function Switch({ label, id, @@ -38,3 +60,49 @@ export function Switch({ ); } + +export function Input({ label, id, placeholder, type }: InputProps) { + const { save, load } = useStorage(); + const [value, setValue] = useState( + type === "number" ? 0 : "", + ); + + useEffect(() => { + load(id).then((loadedValue) => { + if (type === "number") { + if (typeof loadedValue === "number") { + setValue(loadedValue); + } + return; + } + + if (typeof loadedValue === "string") { + setValue(loadedValue); + } + }); + }, [id, load, type]); + + return ( +
+ + { + if (type === "number") { + const nextValue = Number(e.target.value); + setValue(nextValue); + save(id, nextValue); + return; + } + + const nextValue = e.target.value; + setValue(nextValue); + save(id, nextValue); + }} + /> +
+ ); +} diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 925d401..8175c9c 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -7,8 +7,6 @@ @source "../../../packages/**/src/**/*.{ts,tsx}"; @theme { - --font-sans: "Inter Variable", sans-serif; - --animate-wiggle: wiggle 0.5s ease-in-out infinite; @keyframes wiggle { @@ -30,10 +28,6 @@ body, overflow: hidden; } -body { - font-family: "Inter Variable", sans-serif; -} - #root { min-height: 0; } diff --git a/apps/web/src/routes/app/layout.tsx b/apps/web/src/routes/app/layout.tsx index 4f5c657..a937d2f 100644 --- a/apps/web/src/routes/app/layout.tsx +++ b/apps/web/src/routes/app/layout.tsx @@ -2,12 +2,17 @@ import { type ReactNode } from "react"; import Sidebar from "@/components/sidebar"; import Navbar, { MobileNavbar } from "@/components/navbar"; -import { useShowMobileNavbar } from "./useShowMobileNavbar"; import { useIsMobile, cn, SidebarProvider } from "@tensamin/ui"; import { isTauri } from "@tauri-apps/api/core"; +import { useLocation, useMatches } from "@tanstack/react-router"; +/** + * Executes Layout. + * @param props Parameter props. + * @returns unknown. + */ export default function Layout({ children }: { children: ReactNode }) { const isMobile = useIsMobile(); const showMobileNavbar = useShowMobileNavbar(); @@ -42,3 +47,17 @@ export default function Layout({ children }: { children: ReactNode }) { ); } + +export function useShowMobileNavbar(): boolean { + const matches = useMatches(); + const location = useLocation(); + + const value = matches.some( + (match) => + match.pathname === location.pathname && + // @ts-expect-error Stuff + match.staticData?.showMobileNavbar === true, + ); + + return value; +} diff --git a/apps/web/src/routes/app/useShowMobileNavbar.ts b/apps/web/src/routes/app/useShowMobileNavbar.ts deleted file mode 100644 index 5fb039e..0000000 --- a/apps/web/src/routes/app/useShowMobileNavbar.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { useLocation, useMatches } from "@tanstack/react-router"; - -export function useShowMobileNavbar(): boolean { - const matches = useMatches(); - const location = useLocation(); - - return matches.some( - (match) => - match.pathname === location.pathname && - // Router staticData is app-defined and not typed by the route matcher here. - // @ts-expect-error App route metadata - match.staticData?.showMobileNavbar === true, - ); -} diff --git a/bun.lock b/bun.lock index 2e3a763..02db475 100644 --- a/bun.lock +++ b/bun.lock @@ -28,6 +28,9 @@ "apps/electron": { "name": "@tensamin/electron", "version": "0.0.3", + "dependencies": { + "electron-updater": "^6.6.2", + }, "devDependencies": { "@types/node": "^25.9.1", "electron": "^39.2.7", @@ -43,8 +46,10 @@ "@tauri-apps/api": "^2", "@tauri-apps/plugin-barcode-scanner": "~2", "@tauri-apps/plugin-deep-link": "~2", + "@tauri-apps/plugin-opener": "^2", "@tensamin/shared": "workspace:*", "@tensamin/ui": "*", + "lucide-react": "^1.14.0", "react": "^19.2.0", "react-dom": "^19.2.0", }, @@ -58,6 +63,7 @@ "version": "0.0.0", "dependencies": { "@fontsource-variable/inter": "^5.2.8", + "@noble/curves": "^2.2.0", "@tailwindcss/vite": "^4.2.4", "@tanstack/react-router": "^1.169.1", "@tanstack/react-virtual": "^3.13.24", @@ -74,12 +80,20 @@ "@tensamin/ttp": "workspace:*", "@tensamin/ui": "*", "@tensamin/user": "workspace:*", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "comlink": "^4.4.2", + "framer-motion": "^12.38.0", "lucide-react": "^1.14.0", "qrcode": "^1.5.4", "react": "^19.2.0", "react-dom": "^19.2.0", + "shadcn": "^4.6.0", + "sonner": "^2.0.7", + "tailwind-merge": "^3.5.0", "tailwind-scrollbar-hide": "^4.0.0", "tailwindcss": "^4.2.4", + "tauri-plugin-app-events-api": "^0.2.0", "tw-animate-css": "^1.4.0", "zod": "^4.3.6", }, @@ -102,11 +116,15 @@ "version": "0.0.0", "dependencies": { "@livekit/components-react": "^2.9.20", + "@tanstack/react-query": "^5.100.7", "@tanstack/react-router": "^1.169.1", + "@tanstack/react-virtual": "^3.13.24", "@tauri-apps/api": "^2", "@tensamin/crypto": "workspace:*", + "@tensamin/markdown": "workspace:*", "@tensamin/shared": "workspace:*", "@tensamin/storage": "workspace:*", + "@tensamin/tauri": "workspace:*", "@tensamin/ttp": "workspace:*", "@tensamin/ui": "*", "@tensamin/user": "workspace:*", @@ -116,6 +134,7 @@ "react": "^19.2.0", "react-dom": "^19.2.0", "recharts": "^3.8.1", + "sonner": "^2.0.7", "zod": "^4.3.6", "zustand": "^5.0.8", }, @@ -158,6 +177,7 @@ "@codemirror/lang-markdown": "^6.5.0", "@codemirror/state": "^6.5.4", "@codemirror/view": "^6.41.1", + "@tensamin/ui": "*", "react": "^19.2.0", "react-dom": "^19.2.0", }, @@ -173,11 +193,9 @@ "@tensamin/shared": "workspace:*", "@tensamin/storage": "workspace:*", "@tensamin/ttp": "workspace:*", - "@tensamin/ui": "*", "@tensamin/user": "workspace:*", "react": "^19.2.0", "react-dom": "^19.2.0", - "sonner": "^2.0.7", "zod": "^4.3.6", }, }, @@ -189,6 +207,7 @@ "lucide-react": "^1.14.0", "react": "^19.2.0", "react-dom": "^19.2.0", + "sonner": "^2.0.7", "zod": "^4.3.6", }, }, @@ -219,6 +238,8 @@ "lucide-react": "^1.8.0", "react": "^19.2.0", "react-dom": "^19.2.0", + "sonner": "^2.0.7", + "zod": "^4.3.6", }, }, "packages/ttp": { @@ -235,6 +256,7 @@ "react": "^19.2.0", "react-dom": "^19.2.0", "tauri-plugin-app-events-api": "^0.2.0", + "zod": "^4.3.6", }, "devDependencies": { "eslint": "^10.0.3", @@ -718,6 +740,8 @@ "@tauri-apps/plugin-deep-link": ["@tauri-apps/plugin-deep-link@2.4.9", "", { "dependencies": { "@tauri-apps/api": "^2.11.0" } }, "sha512-u0SKOUHnJ1wqeqXsDFq2+kASCBj9xxbG0g9XZWPy9SOmU4wXtp6b/wiYpm6oH6/5fBTQsLqnLhIvqLBRpgHJlA=="], + "@tauri-apps/plugin-opener": ["@tauri-apps/plugin-opener@2.5.4", "", { "dependencies": { "@tauri-apps/api": "^2.11.0" } }, "sha512-1HnPkb+AmgO29HBazm4uPLKB+r7zzcTBW1d0fyYp1uP+jwtpoiNDGKMMzz58SFp49nOIrxdE3aUJtT57lfO9CQ=="], + "@tensamin/call": ["@tensamin/call@workspace:packages/call"], "@tensamin/chat": ["@tensamin/chat@workspace:packages/chat"], @@ -1098,6 +1122,8 @@ "electron-to-chromium": ["electron-to-chromium@1.5.349", "", {}, "sha512-QsWVGyRuY07Aqb234QytTfwd5d9AJlfNIQ5wIOl1L+PZDzI9d9+Fn0FRale/QYlFxt/bUnB0/nLd1jFPGxGK1A=="], + "electron-updater": ["electron-updater@6.8.3", "", { "dependencies": { "builder-util-runtime": "9.5.1", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lazy-val": "^1.0.5", "lodash.escaperegexp": "^4.1.2", "lodash.isequal": "^4.5.0", "semver": "~7.7.3", "tiny-typed-emitter": "^2.1.0" } }, "sha512-Z6sgw3jgbikWKXei1ENdqFOxBP0WlXg3TtKfz0rgw2vIZFJUyI4pD7ZN7jrkm7EoMK+tcm/qTnPUdqfZukBlBQ=="], + "electron-winstaller": ["electron-winstaller@5.4.0", "", { "dependencies": { "@electron/asar": "^3.2.1", "debug": "^4.1.1", "fs-extra": "^7.0.1", "lodash": "^4.17.21", "temp": "^0.9.0" }, "optionalDependencies": { "@electron/windows-sign": "^1.1.2" } }, "sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg=="], "embla-carousel": ["embla-carousel@8.6.0", "", {}, "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA=="], @@ -1230,6 +1256,8 @@ "forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="], + "framer-motion": ["framer-motion@12.38.0", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="], + "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], "fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], @@ -1448,6 +1476,10 @@ "lodash.debounce": ["lodash.debounce@4.0.8", "", {}, "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow=="], + "lodash.escaperegexp": ["lodash.escaperegexp@4.1.2", "", {}, "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw=="], + + "lodash.isequal": ["lodash.isequal@4.5.0", "", {}, "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="], + "log-symbols": ["log-symbols@6.0.0", "", { "dependencies": { "chalk": "^5.3.0", "is-unicode-supported": "^1.3.0" } }, "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw=="], "loglevel": ["loglevel@1.9.2", "", {}, "sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg=="], @@ -1496,6 +1528,10 @@ "mkdirp": ["mkdirp@0.5.6", "", { "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw=="], + "motion-dom": ["motion-dom@12.38.0", "", { "dependencies": { "motion-utils": "^12.36.0" } }, "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA=="], + + "motion-utils": ["motion-utils@12.36.0", "", {}, "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg=="], + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], "msw": ["msw@2.14.2", "", { "dependencies": { "@inquirer/confirm": "^6.0.11", "@mswjs/interceptors": "^0.41.3", "@open-draft/deferred-promise": "^3.0.0", "@types/statuses": "^2.0.6", "cookie": "^1.1.1", "graphql": "^16.13.2", "headers-polyfill": "^5.0.1", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "path-to-regexp": "^6.3.0", "picocolors": "^1.1.1", "rettime": "^0.11.7", "statuses": "^2.0.2", "strict-event-emitter": "^0.5.1", "tough-cookie": "^6.0.1", "type-fest": "^5.5.0", "until-async": "^3.0.2", "yargs": "^17.7.2" }, "peerDependencies": { "typescript": ">= 4.8.x" }, "optionalPeers": ["typescript"], "bin": { "msw": "cli/index.js" } }, "sha512-D2bTe0tpuf9nw4DA39wFaqUD/hRPKj0DKpo2lAqu+A47Ifg4+h0hbfn6QxVOsiUY2uhgEN6TTpGSHDsc+ysYNg=="], @@ -1734,7 +1770,7 @@ "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], - "shadcn": ["shadcn@3.8.5", "", { "dependencies": { "@antfu/ni": "^25.0.0", "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-jPRx44e+eyeV7xwY3BLJXcfrks00+M0h5BGB9l6DdcBW4BpAj4x3lVmVy0TXPEs2iHEisxejr62sZAAw6B1EVA=="], + "shadcn": ["shadcn@4.6.0", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-4XeMwFf8ZZxmqQQp+U+Nsq2M+cY4Da8Joo/EaMdHVc4uVuWSTJoeidlZ3gDjyxXCjYB1FLcxYwR4lYQAH8emOg=="], "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], @@ -1814,6 +1850,8 @@ "tiny-invariant": ["tiny-invariant@1.3.3", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="], + "tiny-typed-emitter": ["tiny-typed-emitter@2.1.0", "", {}, "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA=="], + "tinyexec": ["tinyexec@1.1.2", "", {}, "sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA=="], "tinyglobby": ["tinyglobby@0.2.16", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg=="], @@ -2016,6 +2054,8 @@ "@tensamin/ui/recharts": ["recharts@3.8.0", "", { "dependencies": { "@reduxjs/toolkit": "^1.9.0 || 2.x.x", "clsx": "^2.1.1", "decimal.js-light": "^2.5.1", "es-toolkit": "^1.39.3", "eventemitter3": "^5.0.1", "immer": "^10.1.1", "react-redux": "8.x.x || 9.x.x", "reselect": "5.1.1", "tiny-invariant": "^1.3.3", "use-sync-external-store": "^1.2.2", "victory-vendor": "^37.0.2" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Z/m38DX3L73ExO4Tpc9/iZWHmHnlzWG4njQbxsF5aSjwqmHNDDIm0rdEBArkwsBvR8U6EirlEHiQNYWCVh9sGQ=="], + "@tensamin/ui/shadcn": ["shadcn@3.8.5", "", { "dependencies": { "@antfu/ni": "^25.0.0", "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-jPRx44e+eyeV7xwY3BLJXcfrks00+M0h5BGB9l6DdcBW4BpAj4x3lVmVy0TXPEs2iHEisxejr62sZAAw6B1EVA=="], + "@types/cacheable-request/@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="], "@types/fs-extra/@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="], @@ -2140,6 +2180,10 @@ "@tensamin/tauri/@types/node/undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="], + "@tensamin/ui/shadcn/fs-extra": ["fs-extra@11.3.4", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA=="], + + "@tensamin/ui/shadcn/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], + "@types/cacheable-request/@types/node/undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="], "@types/fs-extra/@types/node/undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="], diff --git a/flake.nix b/flake.nix index c1ae625..41b621a 100644 --- a/flake.nix +++ b/flake.nix @@ -6,8 +6,8 @@ outputs = {nixpkgs, ...}: let systems = ["x86_64-linux"]; forAllSystems = nixpkgs.lib.genAttrs systems; - version = "0.0.8"; - x86_64DebHash = "sha256-xC8YHVk+JpeMvXHB1dZihYLFyzFDXne4bkV6TZiOFrE="; + version = "0.0.7"; + x86_64DebHash = "sha256-gRkUEx1T7mrCgFEVp0X/ZiaGrKWzO+cCvv33DKCkB+o="; forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}"; in { packages = forAllSystems (system: let diff --git a/packages/call/package.json b/packages/call/package.json index 080dd15..c60a47d 100644 --- a/packages/call/package.json +++ b/packages/call/package.json @@ -16,11 +16,15 @@ }, "dependencies": { "@livekit/components-react": "^2.9.20", + "@tanstack/react-query": "^5.100.7", "@tanstack/react-router": "^1.169.1", + "@tanstack/react-virtual": "^3.13.24", "@tauri-apps/api": "^2", "@tensamin/crypto": "workspace:*", + "@tensamin/markdown": "workspace:*", "@tensamin/shared": "workspace:*", "@tensamin/storage": "workspace:*", + "@tensamin/tauri": "workspace:*", "@tensamin/ttp": "workspace:*", "@tensamin/ui": "*", "@tensamin/user": "workspace:*", @@ -30,6 +34,7 @@ "react": "^19.2.0", "react-dom": "^19.2.0", "recharts": "^3.8.1", + "sonner": "^2.0.7", "zod": "^4.3.6", "zustand": "^5.0.8" } diff --git a/packages/call/src/components/buttons/deaf.tsx b/packages/call/src/components/buttons/deaf.tsx index 6d0ede0..42dd3f4 100644 --- a/packages/call/src/components/buttons/deaf.tsx +++ b/packages/call/src/components/buttons/deaf.tsx @@ -1,14 +1,18 @@ -import { Button } from "@tensamin/ui"; +import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui"; import { toggleDeaf, useCall } from "../../store"; import { HeadphoneOff, Headphones } from "lucide-react"; -import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton"; export default function DeafButton({ className, iconSize, tooltip, portalContainer, -}: CallButtonProps) { +}: { + className?: string; + iconSize?: number; + tooltip?: string; + portalContainer?: HTMLElement; +}) { const deaf = useCall((state) => state.deaf); const button = ( @@ -18,12 +22,27 @@ export default function DeafButton({ className={className} > {deaf ? ( - + ) : ( - + )} ); - return withTooltip(button, tooltip, portalContainer); + if (!tooltip) { + return button; + } + + return ( + + + + {tooltip} + + + ); } diff --git a/packages/call/src/components/buttons/leave.tsx b/packages/call/src/components/buttons/leave.tsx index d4f0371..364b4be 100644 --- a/packages/call/src/components/buttons/leave.tsx +++ b/packages/call/src/components/buttons/leave.tsx @@ -1,14 +1,18 @@ import { LeaveIcon } from "@livekit/components-react"; -import { Button } from "@tensamin/ui"; +import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui"; import { disconnect, useCall } from "../../store"; -import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton"; export default function LeaveButton({ className, iconSize, tooltip, portalContainer, -}: CallButtonProps) { +}: { + className?: string; + iconSize?: number; + tooltip?: string; + portalContainer?: HTMLElement; +}) { const state = useCall((store) => store.state); const button = ( @@ -18,9 +22,20 @@ export default function LeaveButton({ disabled={state === "closing" || state === "closed"} variant="destructive" > - + ); - return withTooltip(button, tooltip, portalContainer); + if (!tooltip) { + return button; + } + + return ( + + + + {tooltip} + + + ); } diff --git a/packages/call/src/components/buttons/mute.tsx b/packages/call/src/components/buttons/mute.tsx index 3067a2b..c8f2ba0 100644 --- a/packages/call/src/components/buttons/mute.tsx +++ b/packages/call/src/components/buttons/mute.tsx @@ -1,14 +1,18 @@ -import { Button } from "@tensamin/ui"; +import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui"; import { toggleMute, useCall } from "../../store"; import { Mic, MicOff } from "lucide-react"; -import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton"; export default function MuteButton({ className, iconSize, tooltip, portalContainer, -}: CallButtonProps) { +}: { + className?: string; + iconSize?: number; + tooltip?: string; + portalContainer?: HTMLElement; +}) { const micEnabled = useCall((state) => state.micEnabled); const button = ( @@ -18,12 +22,23 @@ export default function MuteButton({ onClick={() => void toggleMute()} > {micEnabled ? ( - + ) : ( - + )} ); - return withTooltip(button, tooltip, portalContainer); + if (!tooltip) { + return button; + } + + return ( + + + + {tooltip} + + + ); } diff --git a/packages/call/src/components/buttons/tooltipButton.tsx b/packages/call/src/components/buttons/tooltipButton.tsx deleted file mode 100644 index 72110f8..0000000 --- a/packages/call/src/components/buttons/tooltipButton.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { type ReactElement } from "react"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui"; - -export type CallButtonProps = { - className?: string; - iconSize?: number; - tooltip?: string; - portalContainer?: HTMLElement; -}; - -export function iconScale(iconSize?: number) { - return { scale: (iconSize ? iconSize + 100 : 100) + "%" }; -} - -export function withTooltip( - button: ReactElement, - tooltip?: string, - portalContainer?: HTMLElement, -) { - if (!tooltip) { - return button; - } - - return ( - - - - {tooltip} - - - ); -} diff --git a/packages/call/src/components/modals/base.tsx b/packages/call/src/components/modals/base.tsx index 47e47cf..768f6f5 100644 --- a/packages/call/src/components/modals/base.tsx +++ b/packages/call/src/components/modals/base.tsx @@ -18,7 +18,7 @@ import { import { Track, type Participant } from "livekit-client"; import { useEffect, useRef, useState } from "react"; import { useUser, type User } from "@tensamin/user/context"; -import { useIsSpeaking } from "../../speakingState"; +import { useIsSpeaking } from "../../speakingIndicator"; import VideoViewer from "../videoViewer"; import { HeadphoneOff, MicOff, Monitor, Plus, Shield } from "lucide-react"; diff --git a/packages/call/src/speakingIndicator.ts b/packages/call/src/speakingIndicator.ts index 8f05eb8..0c4f5a5 100644 --- a/packages/call/src/speakingIndicator.ts +++ b/packages/call/src/speakingIndicator.ts @@ -1,10 +1,5 @@ import { log } from "@tensamin/shared/log"; -import { - clearSpeakingParticipants, - removeSpeakingParticipant, - setMicGated, - updateSpeakingParticipants, -} from "./speakingState"; +import { useCall } from "./store"; const SPEAKING_THRESHOLD = 0.01; const SPEAKING_HANGTIME_MS = 500; @@ -90,7 +85,12 @@ class SpeakingDetector { } this.entries.delete(participantId); - removeSpeakingParticipant(participantId); + useCall.setState((state) => { + if (!state.speakingParticipantIds.has(participantId)) return state; + const next = new Set(state.speakingParticipantIds); + next.delete(participantId); + return { speakingParticipantIds: next }; + }); if (participantId === this.localParticipantId && this.localMicGateClosed) { this.muteLocalTrack(false); @@ -104,7 +104,7 @@ class SpeakingDetector { entry.isSpeaking = false; entry.lastSpeakingTime = 0; } - clearSpeakingParticipants(); + useCall.setState({ speakingParticipantIds: new Set() }); } } @@ -131,7 +131,7 @@ class SpeakingDetector { } this.localMicGateClosed = muted; - setMicGated(muted); + useCall.setState({ micGated: muted }); } private applyNoiseGate(rms: number) { @@ -197,7 +197,24 @@ class SpeakingDetector { } if (changed.size > 0) { - updateSpeakingParticipants(changed); + useCall.setState((state) => { + let hasDiff = false; + const next = new Set(state.speakingParticipantIds); + for (const [id, speaking] of changed) { + if (speaking) { + if (!next.has(id)) { + next.add(id); + hasDiff = true; + } + } else { + if (next.has(id)) { + next.delete(id); + hasDiff = true; + } + } + } + return hasDiff ? { speakingParticipantIds: next } : state; + }); } } @@ -229,3 +246,7 @@ export function disposeSpeakingDetector(): void { detectorInstance = null; } } + +export function useIsSpeaking(participantId: number): boolean { + return useCall((state) => state.speakingParticipantIds.has(participantId)); +} diff --git a/packages/call/src/speakingState.ts b/packages/call/src/speakingState.ts deleted file mode 100644 index 8f9e815..0000000 --- a/packages/call/src/speakingState.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { create } from "zustand"; - -type SpeakingState = { - speakingParticipantIds: Set; - micGated: boolean; -}; - -const useSpeakingState = create(() => ({ - speakingParticipantIds: new Set(), - micGated: false, -})); - -export function setMicGated(micGated: boolean) { - useSpeakingState.setState({ micGated }); -} - -export function clearSpeakingParticipants() { - useSpeakingState.setState({ speakingParticipantIds: new Set() }); -} - -export function removeSpeakingParticipant(participantId: number) { - useSpeakingState.setState((state) => { - if (!state.speakingParticipantIds.has(participantId)) return state; - const next = new Set(state.speakingParticipantIds); - next.delete(participantId); - return { speakingParticipantIds: next }; - }); -} - -export function updateSpeakingParticipants(changed: Map) { - useSpeakingState.setState((state) => { - let hasDiff = false; - const next = new Set(state.speakingParticipantIds); - - for (const [id, speaking] of changed) { - if (speaking) { - if (!next.has(id)) { - next.add(id); - hasDiff = true; - } - } else if (next.has(id)) { - next.delete(id); - hasDiff = true; - } - } - - return hasDiff ? { speakingParticipantIds: next } : state; - }); -} - -export function useIsSpeaking(participantId: number): boolean { - return useSpeakingState((state) => - state.speakingParticipantIds.has(participantId), - ); -} diff --git a/packages/call/src/store.tsx b/packages/call/src/store.tsx index 7d3e609..6f3955c 100644 --- a/packages/call/src/store.tsx +++ b/packages/call/src/store.tsx @@ -109,6 +109,8 @@ type CallStore = { layoutVersion: number; screenRef: React.RefObject | null; runtime: Runtime | null; + speakingParticipantIds: Set; + micGated: boolean; }; let _keyProvider: ExternalE2EEKeyProvider | null = null; @@ -855,6 +857,7 @@ export async function disconnect() { watchedStreamParticipantIds: [], pendingWatchedParticipantIds: [], activeScreenShareParticipantIds: [], + micGated: false, }); getRoom().remoteParticipants.forEach((participant) => { @@ -1076,6 +1079,8 @@ export const useCall = create(() => ({ layoutVersion: 0, screenRef: null, runtime: null, + speakingParticipantIds: new Set(), + micGated: false, })); // Register app-level call listeners and wire React dependencies into the store. diff --git a/packages/call/src/values.ts b/packages/call/src/values.ts new file mode 100644 index 0000000..0564800 --- /dev/null +++ b/packages/call/src/values.ts @@ -0,0 +1,11 @@ +import { z } from "zod"; +import { ttp } from "@tensamin/shared/data"; + +export type RawMessages = z.infer["messages"]; + +export type RawMessage = RawMessages[number]; + +export type LiveMessage = RawMessage & { + failed?: boolean; + localId: string; +}; diff --git a/packages/crypto/src/worker.ts b/packages/crypto/src/worker.ts index f22fe42..da393f6 100644 --- a/packages/crypto/src/worker.ts +++ b/packages/crypto/src/worker.ts @@ -395,12 +395,49 @@ export async function getSharedSecret( return out; }; + /** + * Returns WebCrypto subtle API when available. + * @returns SubtleCrypto instance or undefined. + */ const getSubtle = () => globalThis.crypto?.subtle; + { + /* + const hkdfAesGcmFromShared = async ( + sharedSecret: BufferSource, + infoStr: string + ): Promise => { + const subtle = getSubtle(); + if (!subtle) throw new Error("WebCrypto subtle not available"); + const info = textEncoder.encode(infoStr); + const baseKey = await subtle.importKey( + "raw", + sharedSecret, + "HKDF", + false, + ["deriveKey"] + ); + return await subtle.deriveKey( + { + name: "HKDF", + hash: "SHA-256", + salt: new Uint8Array(0), + info, + }, + baseKey, + { name: "AES-GCM", length: 256 }, + false, + ["encrypt", "decrypt"] + ); + }; + */ + } + const myJwk: JWK = normalizeOkpX448Jwk(ownJwk, "own_jwk"); const peerJwk: JWK = normalizeOkpX448Jwk(otherJwk, "other_jwk"); const subtle = getSubtle(); + //const infoStr = `ECDH-X448-AES-GCM-v1|my=${myJwk.x}|peer=${peerJwk.x}`; if (subtle) { const algorithms = [{ name: "ECDH", namedCurve: "X448" }, { name: "X448" }]; diff --git a/packages/markdown/package.json b/packages/markdown/package.json index b82d265..5090799 100644 --- a/packages/markdown/package.json +++ b/packages/markdown/package.json @@ -17,6 +17,7 @@ "@codemirror/lang-markdown": "^6.5.0", "@codemirror/state": "^6.5.4", "@codemirror/view": "^6.41.1", + "@tensamin/ui": "*", "react": "^19.2.0", "react-dom": "^19.2.0" } diff --git a/packages/markdown/src/markdown.tsx b/packages/markdown/src/markdown.tsx index 976301a..46ebb92 100644 --- a/packages/markdown/src/markdown.tsx +++ b/packages/markdown/src/markdown.tsx @@ -80,7 +80,7 @@ const INLINE_TOKEN_REGEX = * @param input Parameter input. * @returns InlineNode[]. */ -function parseInlineNodes(input: string): InlineNode[] { +export function parseInlineNodes(input: string): InlineNode[] { const nodes: InlineNode[] = []; let cursor = 0; @@ -369,7 +369,7 @@ export function parseMarkdownBlocks(markdown: string): MarkdownBlock[] { * @param nodes Parameter nodes. * @returns React.ReactNode[]. */ -function renderInline(nodes: InlineNode[]): React.ReactNode[] { +export function renderInline(nodes: InlineNode[]): React.ReactNode[] { return nodes.map((node, index) => { if (node.type === "text") { return node.value; @@ -636,7 +636,7 @@ function readTable( }; } -const markdownStyles = ` +export const markdownStyles = ` .tm-md-root { color: hsl(var(--foreground)); line-height: 1.55; font-size: 0.95rem; } .tm-md-heading { margin: 0.2rem 0 0.35rem; font-weight: 700; line-height: 1.25; } .tm-md-h1 { font-size: 1.65rem; } diff --git a/packages/notifications/package.json b/packages/notifications/package.json index cfd540a..a6b06be 100644 --- a/packages/notifications/package.json +++ b/packages/notifications/package.json @@ -19,11 +19,9 @@ "@tensamin/chat": "workspace:*", "@tensamin/storage": "workspace:*", "@tensamin/ttp": "workspace:*", - "@tensamin/ui": "*", "@tensamin/user": "workspace:*", "react": "^19.2.0", "react-dom": "^19.2.0", - "sonner": "^2.0.7", "zod": "^4.3.6" } } diff --git a/packages/shared/package.json b/packages/shared/package.json index 26c0d9f..c009c34 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -4,7 +4,6 @@ "version": "0.0.0", "type": "module", "exports": { - "./code": "./src/code.ts", "./data": "./src/data.ts", "./desktopMedia": "./src/desktopMedia.tsx", "./log": "./src/log.tsx", @@ -22,6 +21,7 @@ "lucide-react": "^1.14.0", "react": "^19.2.0", "react-dom": "^19.2.0", + "sonner": "^2.0.7", "zod": "^4.3.6" } } diff --git a/packages/shared/src/code.ts b/packages/shared/src/code.ts deleted file mode 100644 index 1f1d10e..0000000 --- a/packages/shared/src/code.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function toLossySixDigitCode(input: string): string { - let firstHash = 0xdeadbeef; - let secondHash = 0x41c6ce57; - - for (let index = 0; index < input.length; index += 1) { - const character = input.charCodeAt(index); - - firstHash = Math.imul(firstHash ^ character, 2654435761); - secondHash = Math.imul(secondHash ^ character, 1597334677); - } - - firstHash = Math.imul(firstHash ^ (firstHash >>> 16), 2246822507); - firstHash ^= Math.imul(secondHash ^ (secondHash >>> 13), 3266489909); - secondHash = Math.imul(secondHash ^ (secondHash >>> 16), 2246822507); - secondHash ^= Math.imul(firstHash ^ (firstHash >>> 13), 3266489909); - - const hash = 4294967296 * (2097151 & secondHash) + (firstHash >>> 0); - - return String(hash % 1_000_000).padStart(6, "0"); -} diff --git a/packages/storage/src/session.tsx b/packages/storage/src/session.tsx index 46f36d6..892f3e6 100644 --- a/packages/storage/src/session.tsx +++ b/packages/storage/src/session.tsx @@ -25,15 +25,9 @@ export default function SessionProvider({ children }: { children: ReactNode }) { const { load, save } = useStorage(); const [contacts, setContacts] = useState([]); const [communities, setCommunities] = useState([]); - const [localCalls, setLocalCalls] = useState([]); - const calls = [ - ...freshCalls, - ...localCalls.filter( - (call) => !freshCalls.some((fresh) => fresh.call_id === call.call_id), - ), - ]; + const [calls, setCalls] = useState([]); - // Cached session data fills in items the server did not return freshly. + // Get cached data and merge fresh data useEffect(() => { load("cached_contacts").then((cachedData) => { setContacts([ @@ -59,6 +53,16 @@ export default function SessionProvider({ children }: { children: ReactNode }) { }); }, [load, freshContacts, freshCommunities]); + useEffect(() => { + setCalls((prevCalls) => [ + ...freshCalls, + ...prevCalls.filter( + (call) => !freshCalls.some((fresh) => fresh.call_id === call.call_id), + ), + ]); + }, [freshCalls]); + + // Save data useEffect(() => { save("cached_contacts", contacts); }, [contacts, save]); @@ -94,7 +98,7 @@ export default function SessionProvider({ children }: { children: ReactNode }) { }; const insertCall = (call: Calls[number]) => { - setLocalCalls((prevCalls) => { + setCalls((prevCalls) => { if (prevCalls.some((prevCall) => prevCall.call_id === call.call_id)) { return prevCalls; } diff --git a/packages/tauth/package.json b/packages/tauth/package.json index 2e9adf2..3f5044a 100644 --- a/packages/tauth/package.json +++ b/packages/tauth/package.json @@ -23,6 +23,8 @@ "@tensamin/user": "workspace:*", "lucide-react": "^1.8.0", "react": "^19.2.0", - "react-dom": "^19.2.0" + "react-dom": "^19.2.0", + "sonner": "^2.0.7", + "zod": "^4.3.6" } } diff --git a/packages/ttp/package.json b/packages/ttp/package.json index 7243f25..ed09f35 100644 --- a/packages/ttp/package.json +++ b/packages/ttp/package.json @@ -21,7 +21,8 @@ "@tauri-apps/api": "^2", "react": "^19.2.0", "react-dom": "^19.2.0", - "tauri-plugin-app-events-api": "^0.2.0" + "tauri-plugin-app-events-api": "^0.2.0", + "zod": "^4.3.6" }, "devDependencies": { "eslint": "^10.0.3"