Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix microphone select

Brendan Allan046a696ef277
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 3a9cb5a15..716311190 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,10 +1,9 @@
---
name: Bug report
about: Report a crash, error, or other unusual behaviour by Cap
-title: ''
+title: ""
labels: bug
-assignees: ''
-
+assignees: ""
---
### Description
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index d9d122f6e..46cb06071 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -29,6 +29,7 @@ use cap_project::{
};
use cap_rendering::ProjectUniforms;
use cap_utils::create_named_pipe;
+use cocoa::foundation::{NSBundle, NSString};
// use display::{list_capture_windows, Bounds, CaptureTarget, FPS};
use general_settings::GeneralSettingsStore;
use image::{ImageBuffer, Rgba};
@@ -43,6 +44,7 @@ use scap::frame::Frame;
use serde::{Deserialize, Serialize};
use serde_json::json;
use specta::Type;
+use std::ffi::{CStr, OsStr};
use std::fs::File;
use std::io::BufWriter;
use std::io::{BufReader, Write};
@@ -2300,7 +2302,7 @@ async fn reset_camera_permissions(_app: AppHandle) -> Result<(), ()> {
#[specta::specta]
async fn reset_microphone_permissions(_app: AppHandle) -> Result<(), ()> {
#[cfg(debug_assertions)]
- let bundle_id = "com.apple.Terminal";
+ let bundle_id = "dev.warp.Warp-Stable";
#[cfg(not(debug_assertions))]
let bundle_id = "so.cap.desktop";
@@ -2401,6 +2403,7 @@ pub async fn run() {
open_main_window,
permissions::open_permission_settings,
permissions::do_permissions_check,
+ permissions::request_permission,
upload_rendered_video,
upload_screenshot,
get_recording_meta,
@@ -2668,8 +2671,6 @@ pub async fn remove_editor_instance(
let mut map = map.lock().await;
-
-
if let Some(editor) = map.remove(&video_id) {
editor.dispose().await;
Some(editor)
diff --git a/apps/desktop/src/auto-imports.d.ts b/apps/desktop/src/auto-imports.d.ts
index fc54ca398..984e9de67 100644
--- a/apps/desktop/src/auto-imports.d.ts
+++ b/apps/desktop/src/auto-imports.d.ts
@@ -5,50 +5,50 @@
// Generated by unplugin-auto-import
export {}
declare global {
- const IconHugeiconsDashedLine02: typeof import('~icons/hugeicons/dashed-line02.jsx')['default']
- const IconIcRoundBlurOn: typeof import('~icons/ic/round-blur-on.jsx')['default']
- const IconLucideCamera: typeof import('~icons/lucide/camera.jsx')['default']
- const IconLucideCheck: typeof import('~icons/lucide/check.jsx')['default']
- const IconLucideCheckIcon: typeof import('~icons/lucide/check-icon.jsx')['default']
- const IconLucideChevronDown: typeof import('~icons/lucide/chevron-down.jsx')['default']
- const IconLucideCircle: typeof import('~icons/lucide/circle.jsx')['default']
- const IconLucideCircleCheck: typeof import('~icons/lucide/circle-check.jsx')['default']
- const IconLucideCircleDashed: typeof import('~icons/lucide/circle-dashed.jsx')['default']
- const IconLucideCircleFastForward: typeof import('~icons/lucide/circle-fast-forward.jsx')['default']
- const IconLucideCircleForward: typeof import('~icons/lucide/circle-forward.jsx')['default']
- const IconLucideCirclePlus: typeof import('~icons/lucide/circle-plus.jsx')['default']
- const IconLucideCircleStop: typeof import('~icons/lucide/circle-stop.jsx')['default']
- const IconLucideCommand: typeof import('~icons/lucide/command.jsx')['default']
- const IconLucideCopy: typeof import('~icons/lucide/copy.jsx')['default']
- const IconLucideCrop: typeof import('~icons/lucide/crop.jsx')['default']
- const IconLucideEye: typeof import('~icons/lucide/eye.jsx')['default']
- const IconLucideFaceTime: typeof import('~icons/lucide/face-time.jsx')['default']
- const IconLucideFastForward: typeof import('~icons/lucide/fast-forward.jsx')['default']
- const IconLucideImage: typeof import('~icons/lucide/image.jsx')['default']
- const IconLucideLayoutDashboard: typeof import('~icons/lucide/layout-dashboard.jsx')['default']
- const IconLucideLoaderCircle: typeof import('~icons/lucide/loader-circle.jsx')['default']
- const IconLucideMessageSquareMore: typeof import('~icons/lucide/message-square-more.jsx')['default']
- const IconLucideMousePointer2: typeof import('~icons/lucide/mouse-pointer2.jsx')['default']
- const IconLucidePencil: typeof import('~icons/lucide/pencil.jsx')['default']
- const IconLucidePenicl: typeof import('~icons/lucide/penicl.jsx')['default']
- const IconLucidePlay: typeof import('~icons/lucide/play.jsx')['default']
- const IconLucidePlus: typeof import('~icons/lucide/plus.jsx')['default']
- const IconLucideRedo: typeof import('~icons/lucide/redo.jsx')['default']
- const IconLucideRedo2: typeof import('~icons/lucide/redo2.jsx')['default']
- const IconLucideRewind: typeof import('~icons/lucide/rewind.jsx')['default']
- const IconLucideScissors: typeof import('~icons/lucide/scissors.jsx')['default']
- const IconLucideSettings: typeof import('~icons/lucide/settings.jsx')['default']
- const IconLucideShare: typeof import('~icons/lucide/share.jsx')['default']
- const IconLucideSquare: typeof import('~icons/lucide/square.jsx')['default']
- const IconLucideStop: typeof import('~icons/lucide/stop.jsx')['default']
- const IconLucideUndo: typeof import('~icons/lucide/undo.jsx')['default']
- const IconLucideUndo2: typeof import('~icons/lucide/undo2.jsx')['default']
- const IconLucideVideo: typeof import('~icons/lucide/video.jsx')['default']
- const IconLucideVolume1: typeof import('~icons/lucide/volume1.jsx')['default']
- const IconLucideWandSparkles: typeof import('~icons/lucide/wand-sparkles.jsx')['default']
- const IconLucideWbecam: typeof import('~icons/lucide/wbecam.jsx')['default']
- const IconLucideWebcam: typeof import('~icons/lucide/webcam.jsx')['default']
- const IconMdiBlur: typeof import('~icons/mdi/blur.jsx')['default']
- const IconMiExpand: typeof import('~icons/mi/expand.jsx')['default']
- const IconTablerShadow: typeof import('~icons/tabler/shadow.jsx')['default']
+ const IconHugeiconsDashedLine02: typeof import("~icons/hugeicons/dashed-line02.jsx")["default"];
+ const IconIcRoundBlurOn: typeof import("~icons/ic/round-blur-on.jsx")["default"];
+ const IconLucideCamera: typeof import("~icons/lucide/camera.jsx")["default"];
+ const IconLucideCheck: typeof import("~icons/lucide/check.jsx")["default"];
+ const IconLucideCheckIcon: typeof import("~icons/lucide/check-icon.jsx")["default"];
+ const IconLucideChevronDown: typeof import("~icons/lucide/chevron-down.jsx")["default"];
+ const IconLucideCircle: typeof import("~icons/lucide/circle.jsx")["default"];
+ const IconLucideCircleCheck: typeof import("~icons/lucide/circle-check.jsx")["default"];
+ const IconLucideCircleDashed: typeof import("~icons/lucide/circle-dashed.jsx")["default"];
+ const IconLucideCircleFastForward: typeof import("~icons/lucide/circle-fast-forward.jsx")["default"];
+ const IconLucideCircleForward: typeof import("~icons/lucide/circle-forward.jsx")["default"];
+ const IconLucideCirclePlus: typeof import("~icons/lucide/circle-plus.jsx")["default"];
+ const IconLucideCircleStop: typeof import("~icons/lucide/circle-stop.jsx")["default"];
+ const IconLucideCommand: typeof import("~icons/lucide/command.jsx")["default"];
+ const IconLucideCopy: typeof import("~icons/lucide/copy.jsx")["default"];
+ const IconLucideCrop: typeof import("~icons/lucide/crop.jsx")["default"];
+ const IconLucideEye: typeof import("~icons/lucide/eye.jsx")["default"];
+ const IconLucideFaceTime: typeof import("~icons/lucide/face-time.jsx")["default"];
+ const IconLucideFastForward: typeof import("~icons/lucide/fast-forward.jsx")["default"];
+ const IconLucideImage: typeof import("~icons/lucide/image.jsx")["default"];
+ const IconLucideLayoutDashboard: typeof import("~icons/lucide/layout-dashboard.jsx")["default"];
+ const IconLucideLoaderCircle: typeof import("~icons/lucide/loader-circle.jsx")["default"];
+ const IconLucideMessageSquareMore: typeof import("~icons/lucide/message-square-more.jsx")["default"];
+ const IconLucideMousePointer2: typeof import("~icons/lucide/mouse-pointer2.jsx")["default"];
+ const IconLucidePencil: typeof import("~icons/lucide/pencil.jsx")["default"];
+ const IconLucidePenicl: typeof import("~icons/lucide/penicl.jsx")["default"];
+ const IconLucidePlay: typeof import("~icons/lucide/play.jsx")["default"];
+ const IconLucidePlus: typeof import("~icons/lucide/plus.jsx")["default"];
+ const IconLucideRedo: typeof import("~icons/lucide/redo.jsx")["default"];
+ const IconLucideRedo2: typeof import("~icons/lucide/redo2.jsx")["default"];
+ const IconLucideRewind: typeof import("~icons/lucide/rewind.jsx")["default"];
+ const IconLucideScissors: typeof import("~icons/lucide/scissors.jsx")["default"];
+ const IconLucideSettings: typeof import("~icons/lucide/settings.jsx")["default"];
+ const IconLucideShare: typeof import("~icons/lucide/share.jsx")["default"];
+ const IconLucideSquare: typeof import("~icons/lucide/square.jsx")["default"];
+ const IconLucideStop: typeof import("~icons/lucide/stop.jsx")["default"];
+ const IconLucideUndo: typeof import("~icons/lucide/undo.jsx")["default"];
+ const IconLucideUndo2: typeof import("~icons/lucide/undo2.jsx")["default"];
+ const IconLucideVideo: typeof import("~icons/lucide/video.jsx")["default"];
+ const IconLucideVolume1: typeof import("~icons/lucide/volume1.jsx")["default"];
+ const IconLucideWandSparkles: typeof import("~icons/lucide/wand-sparkles.jsx")["default"];
+ const IconLucideWbecam: typeof import("~icons/lucide/wbecam.jsx")["default"];
+ const IconLucideWebcam: typeof import("~icons/lucide/webcam.jsx")["default"];
+ const IconMdiBlur: typeof import("~icons/mdi/blur.jsx")["default"];
+ const IconMiExpand: typeof import("~icons/mi/expand.jsx")["default"];
+ const IconTablerShadow: typeof import("~icons/tabler/shadow.jsx")["default"];
}
diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsx
new file mode 100644
index 000000000..6feb6b9c1
--- /dev/null
+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx
@@ -0,0 +1,666 @@
+import { Button } from "@cap/ui-solid";
+import { Select as KSelect } from "@kobalte/core/select";
+import { cache, createAsync, redirect, useNavigate } from "@solidjs/router";
+import {
+ createMutation,
+ createQuery,
+ useQueryClient,
+} from "@tanstack/solid-query";
+import { getVersion } from "@tauri-apps/api/app";
+import { cx } from "cva";
+import {
+ Show,
+ type ValidComponent,
+ createEffect,
+ createMemo,
+ createResource,
+ createSignal,
+ onMount,
+} from "solid-js";
+import { createStore } from "solid-js/store";
+import { fetch } from "@tauri-apps/plugin-http";
+
+import { authStore } from "~/store";
+import { clientEnv } from "~/utils/env";
+import {
+ createCurrentRecordingQuery,
+ createOptionsQuery,
+ listWindows,
+ listAudioDevices,
+ getPermissions,
+ createVideoDevicesQuery,
+ listScreens,
+} from "~/utils/queries";
+import {
+ CaptureScreen,
+ type CaptureWindow,
+ commands,
+ events,
+} from "~/utils/tauri";
+import {
+ MenuItem,
+ MenuItemList,
+ PopperContent,
+ topLeftAnimateClasses,
+ topRightAnimateClasses,
+} from "../editor/ui";
+
+const getAuth = cache(async () => {
+ const value = await authStore.get();
+ if (!value) return redirect("/signin");
+ const res = await fetch(`${clientEnv.VITE_SERVER_URL}/api/desktop/plan`, {
+ headers: { authorization: `Bearer ${value.token}` },
+ });
+ if (res.status !== 200) return redirect("/signin");
+ return value;
+}, "getAuth");
+
+export const route = {
+ load: () => getAuth(),
+};
+
+export default function () {
+ const { options, setOptions } = createOptionsQuery();
+ const currentRecording = createCurrentRecordingQuery();
+
+ events.showCapturesPanel.listen(() => {
+ commands.showPreviousRecordingsWindow();
+ });
+
+ onMount(async () => {
+ await commands.showPreviousRecordingsWindow();
+ // await commands.showNotificationsWindow();
+ });
+
+ const isRecording = () => !!currentRecording.data;
+
+ const toggleRecording = createMutation(() => ({
+ mutationFn: async () => {
+ if (!isRecording()) {
+ await commands.startRecording();
+ } else {
+ await commands.stopRecording();
+ }
+ },
+ }));
+
+ createAsync(() => getAuth());
+
+ createUpdateCheck();
+
+ onMount(async () => {
+ if (options.data?.cameraLabel && options.data.cameraLabel !== "No Camera") {
+ const cameraWindowActive = await commands.isCameraWindowOpen();
+
+ if (!cameraWindowActive) {
+ console.log("cameraWindow not found");
+ setOptions({
+ ...options.data,
+ });
+ }
+ }
+ });
+
+ return (
+ <div class="flex justify-center flex-col p-[1rem] gap-[0.75rem] text-[0.875rem] font-[400] bg-gray-50 h-full">
+ <div class="absolute top-3 right-3">
+ <div class="flex items-center gap-[0.25rem]">
+ <Button
+ variant="secondary"
+ size="xs"
+ onClick={() => {
+ commands.openFeedbackWindow();
+ }}
+ >
+ Feedback
+ </Button>
+ <div>
+ <ChangelogButton />
+ </div>
+ </div>
+ </div>
+ <div class="flex items-center justify-between pb-[0.25rem]">
+ <IconCapLogoFull class="w-[90px] h-auto" />
+ <button
+ type="button"
+ onClick={() => commands.openSettingsWindow("general")}
+ >
+ <IconCapSettings class="w-[1.25rem] h-[1.25rem] text-gray-400 hover:text-gray-500" />
+ </button>
+ </div>
+ <TargetSelects options={options.data} />
+ <CameraSelect options={options.data} setOptions={setOptions} />
+ <MicrophoneSelect options={options.data} setOptions={setOptions} />
+ <div class="w-full flex items-center space-x-1">
+ <Button
+ disabled={toggleRecording.isPending}
+ variant={isRecording() ? "destructive" : "primary"}
+ size="md"
+ onClick={() => toggleRecording.mutate()}
+ class="flex-grow"
+ >
+ {isRecording() ? "Stop Recording" : "Start Recording"}
+ </Button>
+ <Button
+ disabled={isRecording()}
+ variant="secondary"
+ size="md"
+ onClick={() => commands.takeScreenshot()}
+ >
+ <IconLucideCamera class="w-[1rem] h-[1rem]" />
+ </Button>
+ </div>
+ <a
+ href={`${import.meta.env.VITE_SERVER_URL}/dashboard`}
+ target="_blank"
+ rel="noreferrer"
+ class="text-gray-400 text-[0.875rem] mx-auto hover:text-gray-500 hover:underline"
+ >
+ Open Cap on Web
+ </a>
+ </div>
+ );
+}
+
+function useRequestPermission() {
+ const queryClient = useQueryClient();
+
+ async function requestPermission(type: "camera" | "microphone") {
+ try {
+ if (type === "camera") {
+ await commands.resetCameraPermissions();
+ } else if (type === "microphone") {
+ console.log("wowzers");
+ await commands.resetMicrophonePermissions();
+ }
+ await commands.requestPermission(type);
+ await queryClient.refetchQueries(getPermissions);
+ } catch (error) {
+ console.error(`Failed to get ${type} permission:`, error);
+ }
+ }
+
+ return requestPermission;
+}
+
+import * as dialog from "@tauri-apps/plugin-dialog";
+import * as updater from "@tauri-apps/plugin-updater";
+import { makePersisted } from "@solid-primitives/storage";
+
+let hasChecked = false;
+function createUpdateCheck() {
+ if (import.meta.env.DEV) return;
+
+ const navigate = useNavigate();
+
+ onMount(async () => {
+ if (hasChecked) return;
+ hasChecked = true;
+
+ await new Promise((res) => setTimeout(res, 1000));
+
+ const update = await updater.check();
+ if (!update) return;
+
+ const shouldUpdate = await dialog.confirm(
+ `Version ${update.version} of Cap is available, would you like to install it?`,
+ { title: "Update Cap", okLabel: "Update", cancelLabel: "Ignore" }
+ );
+
+ if (!shouldUpdate) return;
+ navigate("/update");
+ });
+}
+
+function TargetSelects(props: {
+ options: ReturnType<typeof createOptionsQuery>["options"]["data"];
+}) {
+ const screens = createQuery(() => listScreens);
+ const windows = createQuery(() => listWindows);
+
+ return (
+ <div class="flex flex-row items-center rounded-[0.5rem] relative border">
+ <div
+ class="w-1/2 absolute flex p-px inset-0 transition-transform peer-focus-visible:outline outline-2 outline-blue-300 outline-offset-2 rounded-[0.6rem] overflow-hidden"
+ style={{
+ transform:
+ props.options?.captureTarget.variant === "window"
+ ? "translateX(100%)"
+ : undefined,
+ }}
+ >
+ <div class="bg-gray-100 flex-1" />
+ </div>
+ <TargetSelect<CaptureScreen>
+ options={screens.data ?? []}
+ onChange={(value) => {
+ if (!value || !props.options) return;
+
+ commands.setRecordingOptions({
+ ...props.options,
+ captureTarget: { ...value, variant: "screen" },
+ });
+ }}
+ value={
+ props.options?.captureTarget.variant === "screen"
+ ? props.options.captureTarget
+ : null
+ }
+ placeholder="Screen"
+ optionsEmptyText="No screens found"
+ selected={props.options?.captureTarget.variant === "screen"}
+ />
+ <TargetSelect<CaptureWindow>
+ options={windows.data ?? []}
+ onChange={(value) => {
+ if (!props.options) return;
+
+ commands.setRecordingOptions({
+ ...props.options,
+ captureTarget: { ...value, variant: "window" },
+ });
+ }}
+ value={
+ props.options?.captureTarget.variant === "window"
+ ? props.options.captureTarget
+ : null
+ }
+ placeholder="Window"
+ optionsEmptyText="No windows found"
+ selected={props.options?.captureTarget.variant === "window"}
+ />
+ </div>
+ );
+}
+
+function CameraSelect(props: {
+ options: ReturnType<typeof createOptionsQuery>["options"]["data"];
+ setOptions: ReturnType<typeof createOptionsQuery>["setOptions"];
+}) {
+ const videoDevices = createVideoDevicesQuery();
+ const currentRecording = createCurrentRecordingQuery();
+ const permissions = createQuery(() => getPermissions);
+ const requestPermission = useRequestPermission();
+
+ const [open, setOpen] = createSignal(false);
+
+ const permissionGranted = () =>
+ permissions?.data?.camera === "granted" ||
+ permissions?.data?.camera === "notNeeded";
+
+ type Option = { isCamera: boolean; name: string };
+
+ const onChange = async (item: Option | null) => {
+ if (!item && permissions?.data?.camera !== "granted") {
+ return requestPermission("camera");
+ }
+ if (!props.options) return;
+
+ if (!item || !item.isCamera) {
+ props.setOptions({
+ ...props.options,
+ cameraLabel: null,
+ });
+ } else {
+ props.setOptions({
+ ...props.options,
+ cameraLabel: item.name,
+ });
+ }
+ };
+
+ const selectOptions = createMemo(() => [
+ { name: "No Camera", isCamera: false },
+ ...videoDevices.map((d) => ({ isCamera: true, name: d })),
+ ]);
+
+ const value = () =>
+ selectOptions()?.find((o) => o.name === props.options?.cameraLabel) ?? null;
+
+ return (
+ <div class="flex flex-col gap-[0.25rem] items-stretch">
+ <label class="text-gray-400 text-[0.875rem]">Camera</label>
+ <KSelect<Option>
+ options={selectOptions()}
+ optionValue="name"
+ optionTextValue="name"
+ placeholder="No Camera"
+ value={value()}
+ disabled={!!currentRecording.data}
+ onChange={onChange}
+ itemComponent={(props) => (
+ <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
+ <KSelect.ItemLabel class="flex-1">
+ {props.item.rawValue.name}
+ </KSelect.ItemLabel>
+ </MenuItem>
+ )}
+ open={open()}
+ onOpenChange={(isOpen) => {
+ if (!permissionGranted()) {
+ requestPermission("microphone");
+ return;
+ }
+
+ setOpen(isOpen);
+ }}
+ >
+ <KSelect.Trigger class="flex flex-row items-center h-[2rem] px-[0.375rem] gap-[0.375rem] border rounded-lg border-gray-200 w-full disabled:text-gray-400 transition-colors KSelect">
+ <IconCapCamera class="text-gray-400 size-[1.25rem]" />
+ <KSelect.Value<Option> class="flex-1 text-left truncate">
+ {(state) => <span>{state.selectedOption().name}</span>}
+ </KSelect.Value>
+ <TargetSelectInfoPill
+ value={props.options?.cameraLabel ?? null}
+ permissionGranted={permissionGranted()}
+ requestPermission={() => requestPermission("camera")}
+ onClear={() => {
+ if (!props.options) return;
+ props.setOptions({
+ ...props.options,
+ cameraLabel: null,
+ });
+ }}
+ />
+ </KSelect.Trigger>
+ <KSelect.Portal>
+ <PopperContent<typeof KSelect.Content>
+ as={KSelect.Content}
+ class={topLeftAnimateClasses}
+ >
+ <MenuItemList<typeof KSelect.Listbox>
+ class="max-h-36 overflow-y-auto"
+ as={KSelect.Listbox}
+ />
+ </PopperContent>
+ </KSelect.Portal>
+ </KSelect>
+ </div>
+ );
+}
+
+function MicrophoneSelect(props: {
+ options: ReturnType<typeof createOptionsQuery>["options"]["data"];
+ setOptions: ReturnType<typeof createOptionsQuery>["setOptions"];
+}) {
+ const devices = createQuery(() => listAudioDevices);
+ const permissions = createQuery(() => getPermissions);
+ const currentRecording = createCurrentRecordingQuery();
+
+ const [open, setOpen] = createSignal(false);
+
+ const value = () =>
+ devices?.data?.find((d) => d.name === props.options?.audioInputName) ??
+ null;
+
+ const requestPermission = useRequestPermission();
+
+ const permissionGranted = () =>
+ permissions?.data?.microphone === "granted" ||
+ permissions?.data?.microphone === "notNeeded";
+
+ type Option = { name: string; deviceId: string };
+
+ const handleMicrophoneChange = async (item: Option | null) => {
+ if (!item || !props.options) return;
+
+ props.setOptions({
+ ...props.options,
+ audioInputName: item.deviceId !== "" ? item.name : null,
+ });
+ };
+
+ return (
+ <div class="flex flex-col gap-[0.25rem] items-stretch">
+ <label class="text-gray-400">Microphone</label>
+ <KSelect<Option>
+ options={[{ name: "No Audio", deviceId: "" }, ...(devices.data ?? [])]}
+ optionValue="deviceId"
+ optionTextValue="name"
+ placeholder="No Audio"
+ value={value()}
+ disabled={!!currentRecording.data}
+ onChange={handleMicrophoneChange}
+ itemComponent={(props) => (
+ <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
+ <KSelect.ItemLabel class="flex-1">
+ {props.item.rawValue.name}
+ </KSelect.ItemLabel>
+ </MenuItem>
+ )}
+ open={open()}
+ onOpenChange={(isOpen) => {
+ if (!permissionGranted()) {
+ requestPermission("microphone");
+ return;
+ }
+
+ setOpen(isOpen);
+ }}
+ >
+ <KSelect.Trigger class="flex flex-row items-center h-[2rem] px-[0.375rem] gap-[0.375rem] border rounded-lg border-gray-200 w-full disabled:text-gray-400 transition-colors KSelect">
+ <IconCapMicrophone class="text-gray-400 size-[1.25rem]" />
+ <KSelect.Value<{
+ name: string;
+ }> class="flex-1 text-left truncate">
+ {(state) => (
+ <span>{state.selectedOption()?.name ?? "No Audio"}</span>
+ )}
+ </KSelect.Value>
+ <TargetSelectInfoPill
+ value={props.options?.audioInputName ?? null}
+ permissionGranted={permissionGranted()}
+ requestPermission={() => requestPermission("microphone")}
+ onClear={() => {
+ if (!props.options) return;
+ props.setOptions({
+ ...props.options,
+ audioInputName: null,
+ });
+ }}
+ />
+ </KSelect.Trigger>
+ <KSelect.Portal>
+ <PopperContent<typeof KSelect.Content>
+ as={KSelect.Content}
+ class={topLeftAnimateClasses}
+ >
+ <MenuItemList<typeof KSelect.Listbox>
+ class="max-h-36 overflow-y-auto"
+ as={KSelect.Listbox}
+ />
+ </PopperContent>
+ </KSelect.Portal>
+ </KSelect>
+ </div>
+ );
+}
+
+function TargetSelect<T extends { id: number; name: string }>(props: {
+ options: Array<T>;
+ onChange: (value: T) => void;
+ value: T | null;
+ selected: boolean;
+ optionsEmptyText: string;
+ placeholder: string;
+}) {
+ return (
+ <KSelect<T | null>
+ options={props.options ?? []}
+ optionValue="id"
+ optionTextValue="name"
+ gutter={8}
+ itemComponent={(props) => (
+ <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
+ <KSelect.ItemLabel class="flex-1">
+ {props.item.rawValue?.name}
+ </KSelect.ItemLabel>
+ </MenuItem>
+ )}
+ placement="bottom"
+ class="max-w-[50%] w-full z-10"
+ placeholder={props.placeholder}
+ onChange={(value) => {
+ if (!value) return;
+ props.onChange(value);
+ }}
+ value={props.value}
+ >
+ <KSelect.Trigger<ValidComponent>
+ as={
+ props.options.length === 1
+ ? (p) => (
+ <button
+ onClick={() => {
+ props.onChange(props.options[0]);
+ }}
+ data-selected={props.selected}
+ class={p.class}
+ >
+ <span class="truncate">{props.options[0].name}</span>
+ </button>
+ )
+ : undefined
+ }
+ class="flex-1 text-gray-400 py-1 z-10 data-[selected='true']:text-gray-500 peer focus:outline-none transition-colors duration-100 w-full text-nowrap overflow-hidden px-2 flex gap-2 items-center justify-center"
+ data-selected={props.selected}
+ onClick={(e) => {
+ if (props.options.length === 1) {
+ e.preventDefault();
+ props.onChange(props.options[0]);
+ }
+ }}
+ >
+ <KSelect.Value<CaptureScreen | undefined> class="truncate">
+ {(value) => value.selectedOption()?.name}
+ </KSelect.Value>
+ {props.options.length > 1 && (
+ <KSelect.Icon class="ui-expanded:-rotate-180 transition-transform">
+ <IconCapChevronDown class="size-4 shrink-0 transform transition-transform" />
+ </KSelect.Icon>
+ )}
+ </KSelect.Trigger>
+ <KSelect.Portal>
+ <PopperContent<typeof KSelect.Content>
+ as={KSelect.Content}
+ class={topRightAnimateClasses}
+ >
+ <Show
+ when={props.options.length > 0}
+ fallback={
+ <div class="p-2 text-gray-500">{props.optionsEmptyText}</div>
+ }
+ >
+ <KSelect.Listbox class="max-h-52 max-w-64" as={MenuItemList} />
+ </Show>
+ </PopperContent>
+ </KSelect.Portal>
+ </KSelect>
+ );
+}
+
+function TargetSelectInfoPill<T>(props: {
+ value: T | null;
+ permissionGranted: boolean;
+ requestPermission: () => void;
+ onClear: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ class={cx(
+ "px-[0.375rem] rounded-full text-[0.75rem]",
+ props.value !== null && props.permissionGranted
+ ? "bg-blue-50 text-blue-300"
+ : "bg-red-50 text-red-300"
+ )}
+ onPointerDown={(e) => {
+ if (!props.permissionGranted || props.value === null) return;
+
+ e.stopPropagation();
+ }}
+ onClick={(e) => {
+ e.stopPropagation();
+
+ if (!props.permissionGranted) {
+ props.requestPermission();
+ return;
+ }
+
+ props.onClear();
+ }}
+ >
+ {!props.permissionGranted
+ ? "Request Permission"
+ : props.value !== null
+ ? "On"
+ : "Off"}
+ </button>
+ );
+}
+
+function ChangelogButton() {
+ const [changelogState, setChangelogState] = makePersisted(
+ createStore({
+ hasUpdate: false,
+ lastOpenedVersion: "",
+ changelogClicked: false,
+ }),
+ { name: "changelogState" }
+ );
+
+ const [currentVersion] = createResource(() => getVersion());
+
+ const [changelogStatus] = createResource(
+ () => currentVersion(),
+ async (version) => {
+ if (!version) {
+ return { hasUpdate: false };
+ }
+ const response = await fetch(
+ `${clientEnv.VITE_SERVER_URL}/api/changelog/status?version=${version}`
+ );
+ return await response.json();
+ }
+ );
+
+ const handleChangelogClick = () => {
+ commands.openChangelogWindow();
+ const version = currentVersion();
+ if (version) {
+ setChangelogState({
+ hasUpdate: false,
+ lastOpenedVersion: version,
+ changelogClicked: true,
+ });
+ }
+ };
+
+ createEffect(() => {
+ if (changelogStatus.state === "ready" && currentVersion()) {
+ const hasUpdate = changelogStatus()?.hasUpdate || false;
+ if (
+ hasUpdate === true &&
+ changelogState.lastOpenedVersion !== currentVersion()
+ ) {
+ setChangelogState({
+ hasUpdate: true,
+ lastOpenedVersion: currentVersion(),
+ changelogClicked: false,
+ });
+ }
+ }
+ });
+
+ return (
+ <button type="button" onClick={handleChangelogClick} class="relative">
+ <IconLucideBell class="w-[1.15rem] h-[1.15rem] text-gray-400 hover:text-gray-500" />
+ {changelogState.hasUpdate && (
+ <div
+ style={{ "background-color": "#FF4747" }}
+ class="block z-10 absolute top-0 right-0 w-2 h-2 rounded-full animate-bounce"
+ />
+ )}
+ </button>
+ );
+}
diff --git a/apps/desktop/src/routes/(window-chrome)/index.tsx b/apps/desktop/src/routes/(window-chrome)/index.tsx
deleted file mode 100644
index 60acc1db4..000000000
--- a/apps/desktop/src/routes/(window-chrome)/index.tsx
+++ /dev/null
@@ -1,639 +0,0 @@
-import { Button } from "@cap/ui-solid";
-import { Select as KSelect } from "@kobalte/core/select";
-import { cache, createAsync, redirect, useNavigate } from "@solidjs/router";
-import { createMutation, createQuery } from "@tanstack/solid-query";
-import { getVersion } from "@tauri-apps/api/app";
-import { cx } from "cva";
-import {
- Show,
- type ValidComponent,
- createEffect,
- createMemo,
- createResource,
- createSignal,
- onMount,
-} from "solid-js";
-import { createStore } from "solid-js/store";
-import { fetch } from "@tauri-apps/plugin-http";
-
-import { authStore } from "~/store";
-import { clientEnv } from "~/utils/env";
-import {
- createCurrentRecordingQuery,
- createOptionsQuery,
- listWindows,
- listAudioDevices,
- getPermissions,
- createVideoDevicesQuery,
- listScreens,
-} from "~/utils/queries";
-import {
- CaptureScreen,
- type CaptureWindow,
- commands,
- events,
-} from "~/utils/tauri";
-import {
- MenuItem,
- MenuItemList,
- PopperContent,
- topLeftAnimateClasses,
- topRightAnimateClasses,
-} from "../editor/ui";
-
-const getAuth = cache(async () => {
- const value = await authStore.get();
- if (!value) return redirect("/signin");
- const res = await fetch(`${clientEnv.VITE_SERVER_URL}/api/desktop/plan`, {
- headers: { authorization: `Bearer ${value.token}` },
- });
- if (res.status !== 200) return redirect("/signin");
- return value;
-}, "getAuth");
-
-export const route = {
- load: () => getAuth(),
-};
-
-export default function () {
- const screens = createQuery(() => listScreens);
- const { options, setOptions } = createOptionsQuery();
- const windows = createQuery(() => listWindows);
- const videoDevices = createVideoDevicesQuery();
- const audioDevices = createQuery(() => listAudioDevices);
- const currentRecording = createCurrentRecordingQuery();
-
- const permissions = createQuery(() => getPermissions);
-
- const [microphoneSelectOpen, setMicrophoneSelectOpen] = createSignal(false);
-
- events.showCapturesPanel.listen(() => {
- commands.showPreviousRecordingsWindow();
- });
-
- onMount(async () => {
- await commands.showPreviousRecordingsWindow();
- // await commands.showNotificationsWindow();
- });
-
- const isRecording = () => !!currentRecording.data;
-
- const toggleRecording = createMutation(() => ({
- mutationFn: async () => {
- if (!isRecording()) {
- await commands.startRecording();
- } else {
- await commands.stopRecording();
- }
- },
- }));
-
- createAsync(() => getAuth());
-
- createUpdateCheck();
-
- const [changelogState, setChangelogState] = makePersisted(
- createStore({
- hasUpdate: false,
- lastOpenedVersion: "",
- changelogClicked: false,
- }),
- { name: "changelogState" }
- );
-
- const [currentVersion] = createResource(() => getVersion());
-
- const [changelogStatus] = createResource(
- () => currentVersion(),
- async (version) => {
- if (!version) {
- return { hasUpdate: false };
- }
- const response = await fetch(
- `${clientEnv.VITE_SERVER_URL}/api/changelog/status?version=${version}`
- );
- return await response.json();
- }
- );
-
- createEffect(() => {
- if (changelogStatus.state === "ready" && currentVersion()) {
- const hasUpdate = changelogStatus()?.hasUpdate || false;
- if (
- hasUpdate === true &&
- changelogState.lastOpenedVersion !== currentVersion()
- ) {
- setChangelogState({
- hasUpdate: true,
- lastOpenedVersion: currentVersion(),
- changelogClicked: false,
- });
- }
- }
- });
-
- const handleChangelogClick = () => {
- commands.openChangelogWindow();
- const version = currentVersion();
- if (version) {
- setChangelogState({
- hasUpdate: false,
- lastOpenedVersion: version,
- changelogClicked: true,
- });
- }
- };
-
- const audioDevice = () =>
- audioDevices?.data?.find(
- (d) => d.name === options.data?.audioInputName
- ) ?? { name: "No Audio", deviceId: "" };
-
- const requestPermission = async (type: "camera" | "microphone") => {
- try {
- if (type === "camera") {
- await commands.resetCameraPermissions();
- } else if (type === "microphone") {
- await commands.resetMicrophonePermissions();
- }
- await commands.requestPermission(type);
- // Refresh permissions after request
- await permissions.refetch();
- } catch (error) {
- console.error(`Failed to get ${type} permission:`, error);
- }
- };
-
- const handleMicrophoneChange = async (
- item: { name: string; deviceId: string } | null
- ) => {
- if (!item && permissions?.data?.microphone !== "granted") {
- return requestPermission("microphone");
- }
-
- if (!item || !options.data) return;
-
- setOptions({
- ...options.data,
- audioInputName: item.name !== "No Audio" ? item.name : null,
- });
- };
-
- onMount(async () => {
- if (options.data?.cameraLabel && options.data.cameraLabel !== "No Camera") {
- const cameraWindowActive = await commands.isCameraWindowOpen();
-
- if (!cameraWindowActive) {
- console.log("cameraWindow not found");
- setOptions({
- ...options.data,
- });
- }
- }
- });
-
- return (
- <div class="flex justify-center flex-col p-[1rem] gap-[0.75rem] text-[0.875rem] font-[400] bg-gray-50 h-full">
- <div class="absolute top-3 right-3">
- <div class="flex items-center gap-[0.25rem]">
- <Button
- variant="secondary"
- size="xs"
- onClick={() => {
- commands.openFeedbackWindow();
- }}
- >
- Feedback
- </Button>
- <div>
- <button
- type="button"
- onClick={handleChangelogClick}
- class="relative"
- >
- <IconLucideBell class="w-[1.15rem] h-[1.15rem] text-gray-400 hover:text-gray-500" />
- {changelogState.hasUpdate && (
- <div
- style={{ "background-color": "#FF4747" }}
- class="block z-10 absolute top-0 right-0 w-2 h-2 rounded-full animate-bounce"
- />
- )}
- </button>
- </div>
- </div>
- </div>
- <div class="flex items-center justify-between pb-[0.25rem]">
- <IconCapLogoFull class="w-[90px] h-auto" />
- <button
- type="button"
- onClick={() => commands.openSettingsWindow("general")}
- >
- <IconCapSettings class="w-[1.25rem] h-[1.25rem] text-gray-400 hover:text-gray-500" />
- </button>
- </div>
- <div class="flex flex-row items-center rounded-[0.5rem] relative border">
- <div
- class="w-1/2 absolute flex p-px inset-0 transition-transform peer-focus-visible:outline outline-2 outline-blue-300 outline-offset-2 rounded-[0.6rem] overflow-hidden"
- style={{
- transform:
- options.data?.captureTarget.variant === "window"
- ? "translateX(100%)"
- : undefined,
- }}
- >
- <div class="bg-gray-100 flex-1" />
- </div>
- <TargetSelect<CaptureScreen>
- options={screens.data ?? []}
- onChange={(value) => {
- if (!value || !options.data) return;
-
- commands.setRecordingOptions({
- ...options.data,
- captureTarget: { ...value, variant: "screen" },
- });
- }}
- value={
- options.data?.captureTarget.variant === "screen"
- ? options.data.captureTarget
- : null
- }
- placeholder="Screen"
- optionsEmptyText="No screens found"
- selected={options.data?.captureTarget.variant === "screen"}
- />
- <TargetSelect<CaptureWindow>
- options={windows.data ?? []}
- onChange={(value) => {
- if (!options.data) return;
-
- commands.setRecordingOptions({
- ...options.data,
- captureTarget: { ...value, variant: "window" },
- });
- }}
- value={
- options.data?.captureTarget.variant === "window"
- ? options.data.captureTarget
- : null
- }
- placeholder="Window"
- optionsEmptyText="No windows found"
- selected={options.data?.captureTarget.variant === "window"}
- />
- </div>
- <div class="flex flex-col gap-[0.25rem] items-stretch">
- <label class="text-gray-400 text-[0.875rem]">Camera</label>
- <Show when>
- {(_) => {
- type Option = { isCamera: boolean; name: string };
-
- const onChange = async (item: Option | null) => {
- if (!item && permissions?.data?.camera !== "granted") {
- return requestPermission("camera");
- }
-
- if (!options.data) return;
-
- if (!item || !item.isCamera) {
- setOptions({
- ...options.data,
- cameraLabel: null,
- });
- } else {
- setOptions({
- ...options.data,
- cameraLabel: item.name,
- });
- }
- };
- const selectOptions = createMemo(() => [
- { name: "No Camera", isCamera: false },
- ...videoDevices.map((d) => ({ isCamera: true, name: d })),
- ]);
-
- const value = () =>
- selectOptions()?.find(
- (o) => o.name === options.data?.cameraLabel
- ) ?? null;
-
- return (
- <KSelect<Option>
- options={selectOptions()}
- optionValue="name"
- optionTextValue="name"
- placeholder="No Camera"
- value={value()}
- disabled={isRecording()}
- onChange={onChange}
- itemComponent={(props) => (
- <MenuItem<typeof KSelect.Item>
- as={KSelect.Item}
- item={props.item}
- >
- <KSelect.ItemLabel class="flex-1">
- {props.item.rawValue.name}
- </KSelect.ItemLabel>
- </MenuItem>
- )}
- >
- <KSelect.Trigger
- class="flex flex-row items-center h-[2rem] px-[0.375rem] gap-[0.375rem] border rounded-lg border-gray-200 w-full disabled:text-gray-400 transition-colors KSelect"
- onClick={(e) => {
- if (permissions?.data?.camera !== "granted") {
- requestPermission("camera");
- }
- }}
- >
- <IconCapCamera class="text-gray-400 size-[1.25rem]" />
- <KSelect.Value<Option> class="flex-1 text-left truncate">
- {(state) => <span>{state.selectedOption().name}</span>}
- </KSelect.Value>
- <button
- type="button"
- class={cx(
- "px-[0.375rem] rounded-full text-[0.75rem]",
- options.data?.cameraLabel
- ? "bg-blue-50 text-blue-300"
- : "bg-red-50 text-red-300"
- )}
- onPointerDown={(e) => {
- e.stopPropagation();
- }}
- onClick={(e) => {
- e.stopPropagation();
- if (permissions?.data?.camera !== "granted") {
- console.log("requesting permission");
- return requestPermission("camera");
- }
- if (!options.data?.cameraLabel) return;
- setOptions({
- ...options.data,
- cameraLabel: null,
- });
- }}
- >
- {permissions?.data?.camera !== "granted"
- ? "Request Permission"
- : options.data?.cameraLabel
- ? "On"
- : "Off"}
- </button>
- </KSelect.Trigger>
- <KSelect.Portal>
- <PopperContent<typeof KSelect.Content>
- as={KSelect.Content}
- class={topLeftAnimateClasses}
- >
- <MenuItemList<typeof KSelect.Listbox>
- class="max-h-36 overflow-y-auto"
- as={KSelect.Listbox}
- />
- </PopperContent>
- </KSelect.Portal>
- </KSelect>
- );
- }}
- </Show>
- </div>
- <div class="flex flex-col gap-[0.25rem] items-stretch">
- <label class="text-gray-400">Microphone</label>
- <KSelect<{ name: string; deviceId: string }>
- options={[
- { name: "No Audio", deviceId: "" },
- ...(audioDevices.data ?? []),
- ]}
- optionValue="deviceId"
- optionTextValue="name"
- placeholder="No Audio"
- value={audioDevice()}
- disabled={isRecording()}
- onChange={handleMicrophoneChange}
- itemComponent={(props) => (
- <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
- <KSelect.ItemLabel class="flex-1">
- {props.item.rawValue.name}
- </KSelect.ItemLabel>
- </MenuItem>
- )}
- open={microphoneSelectOpen()}
- onOpenChange={async (isOpen: boolean) => {
- if (isOpen) {
- if (audioDevice().name === "No Audio") {
- setMicrophoneSelectOpen(false);
- await audioDevices.refetch();
- }
- setMicrophoneSelectOpen(true);
- } else {
- setMicrophoneSelectOpen(false);
- }
- }}
- >
- <KSelect.Trigger
- class="flex flex-row items-center h-[2rem] px-[0.375rem] gap-[0.375rem] border rounded-lg border-gray-200 w-full disabled:text-gray-400 transition-colors KSelect"
- onClick={(e) => {
- if (permissions?.data?.microphone !== "granted") {
- requestPermission("microphone");
- }
- }}
- >
- <IconCapMicrophone class="text-gray-400 size-[1.25rem]" />
- <KSelect.Value<{
- name: string;
- }> class="flex-1 text-left truncate">
- {(state) => (
- <span>{state.selectedOption()?.name ?? "No Audio"}</span>
- )}
- </KSelect.Value>
- <button
- type="button"
- class={cx(
- "px-[0.375rem] rounded-full text-[0.75rem]",
- options.data?.audioInputName
- ? "bg-blue-50 text-blue-300"
- : "bg-red-50 text-red-300"
- )}
- onClick={async (e) => {
- e.stopPropagation();
- if (permissions?.data?.microphone !== "granted") {
- await requestPermission("microphone");
- if (permissions?.data?.microphone === "granted") {
- setOptions({
- ...options.data!,
- audioInputName: audioDevice().name,
- });
- }
- } else {
- if (!options.data?.audioInputName) return;
- setOptions({
- ...options.data,
- audioInputName: null,
- });
- }
- }}
- >
- {permissions?.data?.microphone !== "granted"
- ? "Request Permission"
- : options.data?.audioInputName
- ? "On"
- : "Off"}
- </button>
- </KSelect.Trigger>
- <KSelect.Portal>
- <PopperContent<typeof KSelect.Content>
- as={KSelect.Content}
- class={topLeftAnimateClasses}
- >
- <MenuItemList<typeof KSelect.Listbox>
- class="max-h-36 overflow-y-auto"
- as={KSelect.Listbox}
- />
- </PopperContent>
- </KSelect.Portal>
- </KSelect>
- </div>
- <div class="w-full flex items-center space-x-1">
- <Button
- disabled={toggleRecording.isPending}
- variant={isRecording() ? "destructive" : "primary"}
- size="md"
- onClick={() => toggleRecording.mutate()}
- class="flex-grow"
- >
- {isRecording() ? "Stop Recording" : "Start Recording"}
- </Button>
- <Button
- disabled={isRecording()}
- variant="secondary"
- size="md"
- onClick={() => commands.takeScreenshot()}
- >
- <IconLucideCamera class="w-[1rem] h-[1rem]" />
- </Button>
- </div>
- <a
- href={`${import.meta.env.VITE_SERVER_URL}/dashboard`}
- target="_blank"
- rel="noreferrer"
- class="text-gray-400 text-[0.875rem] mx-auto hover:text-gray-500 hover:underline"
- >
- Open Cap on Web
- </a>
- </div>
- );
-}
-
-export const searchParams = "hello!!!";
-
-import * as dialog from "@tauri-apps/plugin-dialog";
-import * as updater from "@tauri-apps/plugin-updater";
-import { makePersisted } from "@solid-primitives/storage";
-import { createEventListener } from "@solid-primitives/event-listener";
-
-let hasChecked = false;
-function createUpdateCheck() {
- if (import.meta.env.DEV) return;
-
- const navigate = useNavigate();
-
- onMount(async () => {
- if (hasChecked) return;
- hasChecked = true;
-
- await new Promise((res) => setTimeout(res, 1000));
-
- const update = await updater.check();
- if (!update) return;
-
- const shouldUpdate = await dialog.confirm(
- `Version ${update.version} of Cap is available, would you like to install it?`,
- { title: "Update Cap", okLabel: "Update", cancelLabel: "Ignore" }
- );
-
- if (!shouldUpdate) return;
- navigate("/update");
- });
-}
-
-function TargetSelect<T extends { id: number; name: string }>(props: {
- options: Array<T>;
- onChange: (value: T) => void;
- value: T | null;
- selected: boolean;
- optionsEmptyText: string;
- placeholder: string;
-}) {
- return (
- <KSelect<T | null>
- options={props.options ?? []}
- optionValue="id"
- optionTextValue="name"
- gutter={8}
- itemComponent={(props) => (
- <MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
- <KSelect.ItemLabel class="flex-1">
- {props.item.rawValue?.name}
- </KSelect.ItemLabel>
- </MenuItem>
- )}
- placement="bottom"
- class="max-w-[50%] w-full z-10"
- placeholder={props.placeholder}
- onChange={(value) => {
- if (!value) return;
- props.onChange(value);
- }}
- value={props.value}
- >
- <KSelect.Trigger<ValidComponent>
- as={
- props.options.length === 1
- ? (p) => (
- <button
- onClick={() => {
- props.onChange(props.options[0]);
- }}
- data-selected={props.selected}
- class={p.class}
- >
- <span class="truncate">{props.options[0].name}</span>
- </button>
- )
- : undefined
- }
- class="flex-1 text-gray-400 py-1 z-10 data-[selected='true']:text-gray-500 peer focus:outline-none transition-colors duration-100 w-full text-nowrap overflow-hidden px-2 flex gap-2 items-center justify-center"
- data-selected={props.selected}
- onClick={(e) => {
- if (props.options.length === 1) {
- e.preventDefault();
- props.onChange(props.options[0]);
- }
- }}
- >
- <KSelect.Value<CaptureScreen | undefined> class="truncate">
- {(value) => value.selectedOption()?.name}
- </KSelect.Value>
- {props.options.length > 1 && (
- <KSelect.Icon class="ui-expanded:-rotate-180 transition-transform">
- <IconCapChevronDown class="size-4 shrink-0 transform transition-transform" />
- </KSelect.Icon>
- )}
- </KSelect.Trigger>
- <KSelect.Portal>
- <PopperContent<typeof KSelect.Content>
- as={KSelect.Content}
- class={topRightAnimateClasses}
- >
- <Show
- when={props.options.length > 0}
- fallback={
- <div class="p-2 text-gray-500">{props.optionsEmptyText}</div>
- }
- >
- <KSelect.Listbox class="max-h-52 max-w-64" as={MenuItemList} />
- </Show>
- </PopperContent>
- </KSelect.Portal>
- </KSelect>
- );
-}
diff --git a/apps/desktop/src/routes/permissions.tsx b/apps/desktop/src/routes/permissions.tsx
index c142ae35d..0d31e4d7d 100644
--- a/apps/desktop/src/routes/permissions.tsx
+++ b/apps/desktop/src/routes/permissions.tsx
@@ -44,10 +44,11 @@ export default function (props: RouteSectionProps) {
const neededStep = steps.findIndex((step) => !isPermitted(c?.[step.key]));
if (neededStep === -1) {
- // All permissions now granted
- commands.openMainWindow();
- const window = getCurrentWindow();
- window.close();
+ // We wait for the window to open as closing immediately after seems to cause an unlabeled crash
+ commands.openMainWindow().then(() => {
+ const window = getCurrentWindow();
+ window.close();
+ });
} else {
setCurrentStepIndex(neededStep);
}
diff --git a/apps/desktop/src/utils/plans.ts b/apps/desktop/src/utils/plans.ts
index dec332013..0ddb16760 100644
--- a/apps/desktop/src/utils/plans.ts
+++ b/apps/desktop/src/utils/plans.ts
@@ -10,7 +10,10 @@ const planIds = {
};
export const getProPlanId = (billingCycle: "yearly" | "monthly") => {
- const environment = import.meta.env.VITE_ENVIRONMENT === "development" ? "development" : "production";
+ const environment =
+ import.meta.env.VITE_ENVIRONMENT === "development"
+ ? "development"
+ : "production";
return planIds[environment]?.[billingCycle] || "";
};
@@ -29,4 +32,4 @@ export const isUserOnProPlan = ({
}
return false;
-};
\ No newline at end of file
+};
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 5077916ab..29302a97a 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -1,491 +1,739 @@
-
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
/** user-defined commands **/
-
export const commands = {
-async getRecordingOptions() : Promise<Result<RecordingOptions, null>> {
+ async getRecordingOptions(): Promise<Result<RecordingOptions, null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("get_recording_options") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async setRecordingOptions(options: RecordingOptions) : Promise<Result<null, null>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("get_recording_options"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async setRecordingOptions(
+ options: RecordingOptions
+ ): Promise<Result<null, null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("set_recording_options", { options }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async startRecording() : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("set_recording_options", { options }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async startRecording(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("start_recording") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async stopRecording() : Promise<Result<null, string>> {
+ return { status: "ok", data: await TAURI_INVOKE("start_recording") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async stopRecording(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("stop_recording") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async pauseRecording() : Promise<Result<null, string>> {
+ return { status: "ok", data: await TAURI_INVOKE("stop_recording") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async pauseRecording(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("pause_recording") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async resumeRecording() : Promise<Result<null, string>> {
+ return { status: "ok", data: await TAURI_INVOKE("pause_recording") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async resumeRecording(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("resume_recording") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async takeScreenshot() : Promise<Result<null, string>> {
+ return { status: "ok", data: await TAURI_INVOKE("resume_recording") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async takeScreenshot(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("take_screenshot") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async listCameras() : Promise<string[]> {
+ return { status: "ok", data: await TAURI_INVOKE("take_screenshot") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async listCameras(): Promise<string[]> {
return await TAURI_INVOKE("list_cameras");
-},
-async listCaptureWindows() : Promise<CaptureWindow[]> {
+ },
+ async listCaptureWindows(): Promise<CaptureWindow[]> {
return await TAURI_INVOKE("list_capture_windows");
-},
-async listCaptureScreens() : Promise<CaptureScreen[]> {
+ },
+ async listCaptureScreens(): Promise<CaptureScreen[]> {
return await TAURI_INVOKE("list_capture_screens");
-},
-async listAudioDevices() : Promise<Result<string[], null>> {
+ },
+ async listAudioDevices(): Promise<Result<string[], null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("list_audio_devices") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async showPreviousRecordingsWindow() : Promise<void> {
+ return { status: "ok", data: await TAURI_INVOKE("list_audio_devices") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async showPreviousRecordingsWindow(): Promise<void> {
await TAURI_INVOKE("show_previous_recordings_window");
-},
-async closePreviousRecordingsWindow() : Promise<void> {
+ },
+ async closePreviousRecordingsWindow(): Promise<void> {
await TAURI_INVOKE("close_previous_recordings_window");
-},
-async setFakeWindowBounds(name: string, bounds: Bounds) : Promise<Result<null, string>> {
+ },
+ async setFakeWindowBounds(
+ name: string,
+ bounds: Bounds
+ ): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("set_fake_window_bounds", { name, bounds }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async removeFakeWindow(name: string) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("set_fake_window_bounds", { name, bounds }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async removeFakeWindow(name: string): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("remove_fake_window", { name }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async focusCapturesPanel() : Promise<void> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("remove_fake_window", { name }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async focusCapturesPanel(): Promise<void> {
await TAURI_INVOKE("focus_captures_panel");
-},
-async getCurrentRecording() : Promise<Result<JsonValue<InProgressRecording | null>, null>> {
+ },
+ async getCurrentRecording(): Promise<
+ Result<JsonValue<InProgressRecording | null>, null>
+ > {
try {
- return { status: "ok", data: await TAURI_INVOKE("get_current_recording") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async renderToFile(outputPath: string, videoId: string, project: ProjectConfiguration, progressChannel: TAURI_CHANNEL<RenderProgress>) : Promise<void> {
- await TAURI_INVOKE("render_to_file", { outputPath, videoId, project, progressChannel });
-},
-async getRenderedVideo(videoId: string, project: ProjectConfiguration) : Promise<Result<string, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("get_current_recording"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async renderToFile(
+ outputPath: string,
+ videoId: string,
+ project: ProjectConfiguration,
+ progressChannel: TAURI_CHANNEL<RenderProgress>
+ ): Promise<void> {
+ await TAURI_INVOKE("render_to_file", {
+ outputPath,
+ videoId,
+ project,
+ progressChannel,
+ });
+ },
+ async getRenderedVideo(
+ videoId: string,
+ project: ProjectConfiguration
+ ): Promise<Result<string, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("get_rendered_video", { videoId, project }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async copyFileToPath(src: string, dst: string) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("get_rendered_video", { videoId, project }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async copyFileToPath(
+ src: string,
+ dst: string
+ ): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("copy_file_to_path", { src, dst }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async copyRenderedVideoToClipboard(videoId: string, project: ProjectConfiguration) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("copy_file_to_path", { src, dst }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async copyRenderedVideoToClipboard(
+ videoId: string,
+ project: ProjectConfiguration
+ ): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("copy_rendered_video_to_clipboard", { videoId, project }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async copyScreenshotToClipboard(path: string) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("copy_rendered_video_to_clipboard", {
+ videoId,
+ project,
+ }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async copyScreenshotToClipboard(path: string): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("copy_screenshot_to_clipboard", { path }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async openFilePath(path: string) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("copy_screenshot_to_clipboard", { path }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async openFilePath(path: string): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("open_file_path", { path }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async getVideoMetadata(videoId: string, videoType: VideoType | null) : Promise<Result<[number, number], string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("open_file_path", { path }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async getVideoMetadata(
+ videoId: string,
+ videoType: VideoType | null
+ ): Promise<Result<[number, number], string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("get_video_metadata", { videoId, videoType }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async createEditorInstance(videoId: string) : Promise<Result<SerializedEditorInstance, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("get_video_metadata", { videoId, videoType }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async createEditorInstance(
+ videoId: string
+ ): Promise<Result<SerializedEditorInstance, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("create_editor_instance", { videoId }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async startPlayback(videoId: string) : Promise<void> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("create_editor_instance", { videoId }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async startPlayback(videoId: string): Promise<void> {
await TAURI_INVOKE("start_playback", { videoId });
-},
-async stopPlayback(videoId: string) : Promise<void> {
+ },
+ async stopPlayback(videoId: string): Promise<void> {
await TAURI_INVOKE("stop_playback", { videoId });
-},
-async setPlayheadPosition(videoId: string, frameNumber: number) : Promise<void> {
+ },
+ async setPlayheadPosition(
+ videoId: string,
+ frameNumber: number
+ ): Promise<void> {
await TAURI_INVOKE("set_playhead_position", { videoId, frameNumber });
-},
-async openInFinder(path: string) : Promise<void> {
+ },
+ async openInFinder(path: string): Promise<void> {
await TAURI_INVOKE("open_in_finder", { path });
-},
-async setProjectConfig(videoId: string, config: ProjectConfiguration) : Promise<void> {
+ },
+ async setProjectConfig(
+ videoId: string,
+ config: ProjectConfiguration
+ ): Promise<void> {
await TAURI_INVOKE("set_project_config", { videoId, config });
-},
-async openEditor(id: string) : Promise<void> {
+ },
+ async openEditor(id: string): Promise<void> {
await TAURI_INVOKE("open_editor", { id });
-},
-async openMainWindow() : Promise<void> {
+ },
+ async openMainWindow(): Promise<void> {
await TAURI_INVOKE("open_main_window");
-},
-async openPermissionSettings(permission: OSPermission) : Promise<void> {
+ },
+ async openPermissionSettings(permission: OSPermission): Promise<void> {
await TAURI_INVOKE("open_permission_settings", { permission });
-},
-async doPermissionsCheck(initialCheck: boolean) : Promise<OSPermissionsCheck> {
+ },
+ async doPermissionsCheck(initialCheck: boolean): Promise<OSPermissionsCheck> {
return await TAURI_INVOKE("do_permissions_check", { initialCheck });
-},
-async uploadRenderedVideo(videoId: string, project: ProjectConfiguration, preCreatedVideo: PreCreatedVideo | null) : Promise<Result<UploadResult, string>> {
+ },
+ async requestPermission(permission: OSPermission): Promise<void> {
+ await TAURI_INVOKE("request_permission", { permission });
+ },
+ async uploadRenderedVideo(
+ videoId: string,
+ project: ProjectConfiguration,
+ preCreatedVideo: PreCreatedVideo | null
+ ): Promise<Result<UploadResult, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("upload_rendered_video", { videoId, project, preCreatedVideo }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async uploadScreenshot(screenshotPath: string) : Promise<Result<UploadResult, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("upload_rendered_video", {
+ videoId,
+ project,
+ preCreatedVideo,
+ }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async uploadScreenshot(
+ screenshotPath: string
+ ): Promise<Result<UploadResult, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("upload_screenshot", { screenshotPath }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async getRecordingMeta(id: string, fileType: string) : Promise<RecordingMeta> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("upload_screenshot", { screenshotPath }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async getRecordingMeta(id: string, fileType: string): Promise<RecordingMeta> {
return await TAURI_INVOKE("get_recording_meta", { id, fileType });
-},
-async openFeedbackWindow() : Promise<void> {
+ },
+ async openFeedbackWindow(): Promise<void> {
await TAURI_INVOKE("open_feedback_window");
-},
-async openSettingsWindow(page: string) : Promise<void> {
+ },
+ async openSettingsWindow(page: string): Promise<void> {
await TAURI_INVOKE("open_settings_window", { page });
-},
-async openChangelogWindow() : Promise<void> {
+ },
+ async openChangelogWindow(): Promise<void> {
await TAURI_INVOKE("open_changelog_window");
-},
-async openUpgradeWindow() : Promise<void> {
+ },
+ async openUpgradeWindow(): Promise<void> {
await TAURI_INVOKE("open_upgrade_window");
-},
-async saveFileDialog(fileName: string, fileType: string) : Promise<Result<string | null, string>> {
+ },
+ async saveFileDialog(
+ fileName: string,
+ fileType: string
+ ): Promise<Result<string | null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("save_file_dialog", { fileName, fileType }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async listRecordings() : Promise<Result<([string, string, RecordingMeta])[], string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("save_file_dialog", { fileName, fileType }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async listRecordings(): Promise<
+ Result<[string, string, RecordingMeta][], string>
+ > {
try {
- return { status: "ok", data: await TAURI_INVOKE("list_recordings") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async listScreenshots() : Promise<Result<([string, string, RecordingMeta])[], string>> {
+ return { status: "ok", data: await TAURI_INVOKE("list_recordings") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async listScreenshots(): Promise<
+ Result<[string, string, RecordingMeta][], string>
+ > {
try {
- return { status: "ok", data: await TAURI_INVOKE("list_screenshots") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async checkUpgradedAndUpdate() : Promise<Result<boolean, string>> {
+ return { status: "ok", data: await TAURI_INVOKE("list_screenshots") };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async checkUpgradedAndUpdate(): Promise<Result<boolean, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("check_upgraded_and_update") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async openExternalLink(url: string) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("check_upgraded_and_update"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async openExternalLink(url: string): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("open_external_link", { url }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async setHotkey(action: HotkeyAction, hotkey: Hotkey | null) : Promise<Result<null, null>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("open_external_link", { url }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async setHotkey(
+ action: HotkeyAction,
+ hotkey: Hotkey | null
+ ): Promise<Result<null, null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("set_hotkey", { action, hotkey }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async setGeneralSettings(settings: GeneralSettingsStore) : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("set_hotkey", { action, hotkey }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async setGeneralSettings(
+ settings: GeneralSettingsStore
+ ): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("set_general_settings", { settings }) };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async deleteAuthOpenSignin() : Promise<Result<null, string>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("set_general_settings", { settings }),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async deleteAuthOpenSignin(): Promise<Result<null, string>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("delete_auth_open_signin") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async resetCameraPermissions() : Promise<Result<null, null>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("delete_auth_open_signin"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async resetCameraPermissions(): Promise<Result<null, null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("reset_camera_permissions") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async resetMicrophonePermissions() : Promise<Result<null, null>> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("reset_camera_permissions"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async resetMicrophonePermissions(): Promise<Result<null, null>> {
try {
- return { status: "ok", data: await TAURI_INVOKE("reset_microphone_permissions") };
-} catch (e) {
- if(e instanceof Error) throw e;
- else return { status: "error", error: e as any };
-}
-},
-async isCameraWindowOpen() : Promise<boolean> {
+ return {
+ status: "ok",
+ data: await TAURI_INVOKE("reset_microphone_permissions"),
+ };
+ } catch (e) {
+ if (e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+ }
+ },
+ async isCameraWindowOpen(): Promise<boolean> {
return await TAURI_INVOKE("is_camera_window_open");
-},
-async seekTo(videoId: string, frameNumber: number) : Promise<void> {
+ },
+ async seekTo(videoId: string, frameNumber: number): Promise<void> {
await TAURI_INVOKE("seek_to", { videoId, frameNumber });
-}
-}
+ },
+};
/** user-defined events **/
-
export const events = __makeEvents__<{
-authenticationInvalid: AuthenticationInvalid,
-currentRecordingChanged: CurrentRecordingChanged,
-editorStateChanged: EditorStateChanged,
-newNotification: NewNotification,
-newRecordingAdded: NewRecordingAdded,
-newScreenshotAdded: NewScreenshotAdded,
-recordingMetaChanged: RecordingMetaChanged,
-recordingOptionsChanged: RecordingOptionsChanged,
-recordingStarted: RecordingStarted,
-recordingStopped: RecordingStopped,
-renderFrameEvent: RenderFrameEvent,
-requestNewScreenshot: RequestNewScreenshot,
-requestOpenSettings: RequestOpenSettings,
-requestRestartRecording: RequestRestartRecording,
-requestStartRecording: RequestStartRecording,
-requestStopRecording: RequestStopRecording,
-showCapturesPanel: ShowCapturesPanel
+ authenticationInvalid: AuthenticationInvalid;
+ currentRecordingChanged: CurrentRecordingChanged;
+ editorStateChanged: EditorStateChanged;
+ newNotification: NewNotification;
+ newRecordingAdded: NewRecordingAdded;
+ newScreenshotAdded: NewScreenshotAdded;
+ recordingMetaChanged: RecordingMetaChanged;
+ recordingOptionsChanged: RecordingOptionsChanged;
+ recordingStarted: RecordingStarted;
+ recordingStopped: RecordingStopped;
+ renderFrameEvent: RenderFrameEvent;
+ requestNewScreenshot: RequestNewScreenshot;
+ requestOpenSettings: RequestOpenSettings;
+ requestRestartRecording: RequestRestartRecording;
+ requestStartRecording: RequestStartRecording;
+ requestStopRecording: RequestStopRecording;
+ showCapturesPanel: ShowCapturesPanel;
}>({
-authenticationInvalid: "authentication-invalid",
-currentRecordingChanged: "current-recording-changed",
-editorStateChanged: "editor-state-changed",
-newNotification: "new-notification",
-newRecordingAdded: "new-recording-added",
-newScreenshotAdded: "new-screenshot-added",
-recordingMetaChanged: "recording-meta-changed",
-recordingOptionsChanged: "recording-options-changed",
-recordingStarted: "recording-started",
-recordingStopped: "recording-stopped",
-renderFrameEvent: "render-frame-event",
-requestNewScreenshot: "request-new-screenshot",
-requestOpenSettings: "request-open-settings",
-requestRestartRecording: "request-restart-recording",
-requestStartRecording: "request-start-recording",
-requestStopRecording: "request-stop-recording",
-showCapturesPanel: "show-captures-panel"
-})
+ authenticationInvalid: "authentication-invalid",
+ currentRecordingChanged: "current-recording-changed",
+ editorStateChanged: "editor-state-changed",
+ newNotification: "new-notification",
+ newRecordingAdded: "new-recording-added",
+ newScreenshotAdded: "new-screenshot-added",
+ recordingMetaChanged: "recording-meta-changed",
+ recordingOptionsChanged: "recording-options-changed",
+ recordingStarted: "recording-started",
+ recordingStopped: "recording-stopped",
+ renderFrameEvent: "render-frame-event",
+ requestNewScreenshot: "request-new-screenshot",
+ requestOpenSettings: "request-open-settings",
+ requestRestartRecording: "request-restart-recording",
+ requestStartRecording: "request-start-recording",
+ requestStopRecording: "request-stop-recording",
+ showCapturesPanel: "show-captures-panel",
+});
/** user-defined constants **/
-
-
/** user-defined types **/
-export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall"
-export type Audio = { duration: number; sample_rate: number; channels: number }
-export type AudioConfiguration = { mute: boolean; improve: boolean }
-export type AudioMeta = { path: string }
-export type AuthStore = { token: string; expires: number; plan: Plan | null }
-export type AuthenticationInvalid = null
-export type BackgroundConfiguration = { source: BackgroundSource; blur: number; padding: number; rounding: number; inset: number; crop: Crop | null }
-export type BackgroundSource = { type: "wallpaper"; id: number } | { type: "image"; path: string | null } | { type: "color"; value: [number, number, number] } | { type: "gradient"; from: [number, number, number]; to: [number, number, number]; angle?: number }
-export type Bounds = { x: number; y: number; width: number; height: number }
-export type CameraConfiguration = { hide: boolean; mirror: boolean; position: CameraPosition; rounding: number; shadow: number; size: number }
-export type CameraMeta = { path: string }
-export type CameraPosition = { x: CameraXPosition; y: CameraYPosition }
-export type CameraXPosition = "left" | "center" | "right"
-export type CameraYPosition = "top" | "bottom"
-export type CaptureScreen = { id: number; name: string }
-export type CaptureWindow = { id: number; name: string; bounds: Bounds }
-export type Crop = { position: XY<number>; size: XY<number> }
-export type CurrentRecordingChanged = JsonValue<InProgressRecording | null>
-export type CursorConfiguration = { hideWhenIdle: boolean; size: number; type: CursorType }
-export type CursorType = "pointer" | "circle"
-export type Display = { path: string }
-export type EditorStateChanged = { playhead_position: number }
-export type Flags = { recordMouse: boolean; split: boolean; pauseResume: boolean; zoom: boolean }
-export type GeneralSettingsStore = { upload_individual_files: boolean; open_editor_after_recording: boolean; hide_dock_icon?: boolean; auto_create_shareable_link?: boolean; enable_notifications?: boolean }
-export type Hotkey = { code: string; meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }
-export type HotkeyAction = "startRecording" | "stopRecording" | "restartRecording" | "takeScreenshot"
-export type HotkeysConfiguration = { show: boolean }
-export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } }
-export type InProgressRecording = { recordingDir: string; displaySource: ScreenCaptureTarget; segments: number[] }
-export type JsonValue<T> = [T]
-export type NewNotification = { title: string; body: string; is_error: boolean }
-export type NewRecordingAdded = { path: string }
-export type NewScreenshotAdded = { path: string }
-export type OSPermission = "screenRecording" | "camera" | "microphone" | "accessibility"
-export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied"
-export type OSPermissionsCheck = { screenRecording: OSPermissionStatus; microphone: OSPermissionStatus; camera: OSPermissionStatus; accessibility: OSPermissionStatus }
-export type Plan = { upgraded: boolean; last_checked: number }
-export type PreCreatedVideo = { id: string; link: string; config: S3UploadMeta }
-export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: CameraConfiguration; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null }
-export type ProjectRecordings = { display: Video; camera: Video | null; audio: Audio | null }
-export type RecordingMeta = { pretty_name: string; sharing?: SharingMeta | null; display: Display; camera?: CameraMeta | null; audio?: AudioMeta | null; segments?: RecordingSegment[]; cursor: string | null }
-export type RecordingMetaChanged = { id: string }
-export type RecordingOptions = { captureTarget: ScreenCaptureTarget; cameraLabel: string | null; audioInputName: string | null }
-export type RecordingOptionsChanged = null
-export type RecordingSegment = { start: number; end: number }
-export type RecordingStarted = null
-export type RecordingStopped = { path: string }
-export type RenderFrameEvent = { frame_number: number }
-export type RenderProgress = { type: "Starting"; total_frames: number } | { type: "EstimatedTotalFrames"; total_frames: number } | { type: "FrameRendered"; current_frame: number }
-export type RequestNewScreenshot = null
-export type RequestOpenSettings = { page: string }
-export type RequestRestartRecording = null
-export type RequestStartRecording = null
-export type RequestStopRecording = null
-export type S3UploadMeta = { id: string; user_id: string; aws_region: string; aws_bucket: string }
-export type ScreenCaptureTarget = ({ variant: "window" } & CaptureWindow) | ({ variant: "screen" } & CaptureScreen)
-export type SerializedEditorInstance = { framesSocketUrl: string; recordingDuration: number; savedProjectConfig: ProjectConfiguration; recordings: ProjectRecordings; path: string; prettyName: string }
-export type SharingMeta = { id: string; link: string }
-export type ShowCapturesPanel = null
-export type TimelineConfiguration = { segments: TimelineSegment[]; zoomSegments?: ZoomSegment[] }
-export type TimelineSegment = { timescale: number; start: number; end: number }
-export type UploadResult = { Success: string } | "NotAuthenticated" | "PlanCheckFailed" | "UpgradeRequired"
-export type Video = { duration: number; width: number; height: number; fps: number }
-export type VideoType = "screen" | "output"
-export type XY<T> = { x: T; y: T }
-export type ZoomSegment = { start: number; end: number; amount: number }
+export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall";
+export type Audio = { duration: number; sample_rate: number; channels: number };
+export type AudioConfiguration = { mute: boolean; improve: boolean };
+export type AudioMeta = { path: string };
+export type AuthStore = { token: string; expires: number; plan: Plan | null };
+export type AuthenticationInvalid = null;
+export type BackgroundConfiguration = {
+ source: BackgroundSource;
+ blur: number;
+ padding: number;
+ rounding: number;
+ inset: number;
+ crop: Crop | null;
+};
+export type BackgroundSource =
+ | { type: "wallpaper"; id: number }
+ | { type: "image"; path: string | null }
+ | { type: "color"; value: [number, number, number] }
+ | {
+ type: "gradient";
+ from: [number, number, number];
+ to: [number, number, number];
+ angle?: number;
+ };
+export type Bounds = { x: number; y: number; width: number; height: number };
+export type CameraConfiguration = {
+ hide: boolean;
+ mirror: boolean;
+ position: CameraPosition;
+ rounding: number;
+ shadow: number;
+ size: number;
+};
+export type CameraMeta = { path: string };
+export type CameraPosition = { x: CameraXPosition; y: CameraYPosition };
+export type CameraXPosition = "left" | "center" | "right";
+export type CameraYPosition = "top" | "bottom";
+export type CaptureScreen = { id: number; name: string };
+export type CaptureWindow = { id: number; name: string; bounds: Bounds };
+export type Crop = { position: XY<number>; size: XY<number> };
+export type CurrentRecordingChanged = JsonValue<InProgressRecording | null>;
+export type CursorConfiguration = {
+ hideWhenIdle: boolean;
+ size: number;
+ type: CursorType;
+};
+export type CursorType = "pointer" | "circle";
+export type Display = { path: string };
+export type EditorStateChanged = { playhead_position: number };
+export type Flags = {
+ recordMouse: boolean;
+ split: boolean;
+ pauseResume: boolean;
+ zoom: boolean;
+};
+export type GeneralSettingsStore = {
+ upload_individual_files: boolean;
+ open_editor_after_recording: boolean;
+ hide_dock_icon?: boolean;
+ auto_create_shareable_link?: boolean;
+ enable_notifications?: boolean;
+};
+export type Hotkey = {
+ code: string;
+ meta: boolean;
+ ctrl: boolean;
+ alt: boolean;
+ shift: boolean;
+};
+export type HotkeyAction =
+ | "startRecording"
+ | "stopRecording"
+ | "restartRecording"
+ | "takeScreenshot";
+export type HotkeysConfiguration = { show: boolean };
+export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } };
+export type InProgressRecording = {
+ recordingDir: string;
+ displaySource: ScreenCaptureTarget;
+ segments: number[];
+};
+export type JsonValue<T> = [T];
+export type NewNotification = {
+ title: string;
+ body: string;
+ is_error: boolean;
+};
+export type NewRecordingAdded = { path: string };
+export type NewScreenshotAdded = { path: string };
+export type OSPermission =
+ | "screenRecording"
+ | "camera"
+ | "microphone"
+ | "accessibility";
+export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied";
+export type OSPermissionsCheck = {
+ screenRecording: OSPermissionStatus;
+ microphone: OSPermissionStatus;
+ camera: OSPermissionStatus;
+ accessibility: OSPermissionStatus;
+};
+export type Plan = { upgraded: boolean; last_checked: number };
+export type PreCreatedVideo = {
+ id: string;
+ link: string;
+ config: S3UploadMeta;
+};
+export type ProjectConfiguration = {
+ aspectRatio: AspectRatio | null;
+ background: BackgroundConfiguration;
+ camera: CameraConfiguration;
+ audio: AudioConfiguration;
+ cursor: CursorConfiguration;
+ hotkeys: HotkeysConfiguration;
+ timeline?: TimelineConfiguration | null;
+};
+export type ProjectRecordings = {
+ display: Video;
+ camera: Video | null;
+ audio: Audio | null;
+};
+export type RecordingMeta = {
+ pretty_name: string;
+ sharing?: SharingMeta | null;
+ display: Display;
+ camera?: CameraMeta | null;
+ audio?: AudioMeta | null;
+ segments?: RecordingSegment[];
+ cursor: string | null;
+};
+export type RecordingMetaChanged = { id: string };
+export type RecordingOptions = {
+ captureTarget: ScreenCaptureTarget;
+ cameraLabel: string | null;
+ audioInputName: string | null;
+};
+export type RecordingOptionsChanged = null;
+export type RecordingSegment = { start: number; end: number };
+export type RecordingStarted = null;
+export type RecordingStopped = { path: string };
+export type RenderFrameEvent = { frame_number: number };
+export type RenderProgress =
+ | { type: "Starting"; total_frames: number }
+ | { type: "EstimatedTotalFrames"; total_frames: number }
+ | { type: "FrameRendered"; current_frame: number };
+export type RequestNewScreenshot = null;
+export type RequestOpenSettings = { page: string };
+export type RequestRestartRecording = null;
+export type RequestStartRecording = null;
+export type RequestStopRecording = null;
+export type S3UploadMeta = {
+ id: string;
+ user_id: string;
+ aws_region: string;
+ aws_bucket: string;
+};
+export type ScreenCaptureTarget =
+ | ({ variant: "window" } & CaptureWindow)
+ | ({ variant: "screen" } & CaptureScreen);
+export type SerializedEditorInstance = {
+ framesSocketUrl: string;
+ recordingDuration: number;
+ savedProjectConfig: ProjectConfiguration;
+ recordings: ProjectRecordings;
+ path: string;
+ prettyName: string;
+};
+export type SharingMeta = { id: string; link: string };
+export type ShowCapturesPanel = null;
+export type TimelineConfiguration = {
+ segments: TimelineSegment[];
+ zoomSegments?: ZoomSegment[];
+};
+export type TimelineSegment = { timescale: number; start: number; end: number };
+export type UploadResult =
+ | { Success: string }
+ | "NotAuthenticated"
+ | "PlanCheckFailed"
+ | "UpgradeRequired";
+export type Video = {
+ duration: number;
+ width: number;
+ height: number;
+ fps: number;
+};
+export type VideoType = "screen" | "output";
+export type XY<T> = { x: T; y: T };
+export type ZoomSegment = { start: number; end: number; amount: number };
/** tauri-specta globals **/
import {
- invoke as TAURI_INVOKE,
- Channel as TAURI_CHANNEL,
+ invoke as TAURI_INVOKE,
+ Channel as TAURI_CHANNEL,
} from "@tauri-apps/api/core";
import * as TAURI_API_EVENT from "@tauri-apps/api/event";
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
type __EventObj__<T> = {
- listen: (
- cb: TAURI_API_EVENT.EventCallback<T>,
- ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
- once: (
- cb: TAURI_API_EVENT.EventCallback<T>,
- ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
- emit: null extends T
- ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
- : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
+ listen: (
+ cb: TAURI_API_EVENT.EventCallback<T>
+ ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
+ once: (
+ cb: TAURI_API_EVENT.EventCallback<T>
+ ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
+ emit: null extends T
+ ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
+ : (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
};
export type Result<T, E> =
- | { status: "ok"; data: T }
- | { status: "error"; error: E };
+ | { status: "ok"; data: T }
+ | { status: "error"; error: E };
function __makeEvents__<T extends Record<string, any>>(
- mappings: Record<keyof T, string>,
+ mappings: Record<keyof T, string>
) {
- return new Proxy(
- {} as unknown as {
- [K in keyof T]: __EventObj__<T[K]> & {
- (handle: __WebviewWindow__): __EventObj__<T[K]>;
- };
- },
- {
- get: (_, event) => {
- const name = mappings[event as keyof T];
+ return new Proxy(
+ {} as unknown as {
+ [K in keyof T]: __EventObj__<T[K]> & {
+ (handle: __WebviewWindow__): __EventObj__<T[K]>;
+ };
+ },
+ {
+ get: (_, event) => {
+ const name = mappings[event as keyof T];
- return new Proxy((() => {}) as any, {
- apply: (_, __, [window]: [__WebviewWindow__]) => ({
- listen: (arg: any) => window.listen(name, arg),
- once: (arg: any) => window.once(name, arg),
- emit: (arg: any) => window.emit(name, arg),
- }),
- get: (_, command: keyof __EventObj__<any>) => {
- switch (command) {
- case "listen":
- return (arg: any) => TAURI_API_EVENT.listen(name, arg);
- case "once":
- return (arg: any) => TAURI_API_EVENT.once(name, arg);
- case "emit":
- return (arg: any) => TAURI_API_EVENT.emit(name, arg);
- }
- },
- });
- },
- },
- );
+ return new Proxy((() => {}) as any, {
+ apply: (_, __, [window]: [__WebviewWindow__]) => ({
+ listen: (arg: any) => window.listen(name, arg),
+ once: (arg: any) => window.once(name, arg),
+ emit: (arg: any) => window.emit(name, arg),
+ }),
+ get: (_, command: keyof __EventObj__<any>) => {
+ switch (command) {
+ case "listen":
+ return (arg: any) => TAURI_API_EVENT.listen(name, arg);
+ case "once":
+ return (arg: any) => TAURI_API_EVENT.once(name, arg);
+ case "emit":
+ return (arg: any) => TAURI_API_EVENT.emit(name, arg);
+ }
+ },
+ });
+ },
+ }
+ );
}
diff --git a/apps/tasks/src/interfaces/ErrorResponse.ts b/apps/tasks/src/interfaces/ErrorResponse.ts
index 170768a21..d01a26682 100644
--- a/apps/tasks/src/interfaces/ErrorResponse.ts
+++ b/apps/tasks/src/interfaces/ErrorResponse.ts
@@ -1,5 +1,5 @@
-import MessageResponse from './MessageResponse';
+import MessageResponse from "./MessageResponse";
export default interface ErrorResponse extends MessageResponse {
stack?: string;
-}
\ No newline at end of file
+}
diff --git a/apps/tasks/src/middlewares.ts b/apps/tasks/src/middlewares.ts
index 249ff67cc..a8c9aec18 100644
--- a/apps/tasks/src/middlewares.ts
+++ b/apps/tasks/src/middlewares.ts
@@ -1,6 +1,6 @@
-import { NextFunction, Request, Response } from 'express';
+import { NextFunction, Request, Response } from "express";
-import ErrorResponse from './interfaces/ErrorResponse';
+import ErrorResponse from "./interfaces/ErrorResponse";
export function notFound(req: Request, res: Response, next: NextFunction) {
res.status(404);
@@ -9,11 +9,16 @@ export function notFound(req: Request, res: Response, next: NextFunction) {
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export function errorHandler(err: Error, req: Request, res: Response<ErrorResponse>, next: NextFunction) {
+export function errorHandler(
+ err: Error,
+ req: Request,
+ res: Response<ErrorResponse>,
+ next: NextFunction
+) {
const statusCode = res.statusCode !== 200 ? res.statusCode : 500;
res.status(statusCode);
res.json({
message: err.message,
- stack: process.env.NODE_ENV === 'production' ? '🥞' : err.stack,
+ stack: process.env.NODE_ENV === "production" ? "🥞" : err.stack,
});
}
diff --git a/apps/web/app/api/caps/share/route.ts b/apps/web/app/api/caps/share/route.ts
index 26a4c6c2d..e596bbf66 100644
--- a/apps/web/app/api/caps/share/route.ts
+++ b/apps/web/app/api/caps/share/route.ts
@@ -58,6 +58,9 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ success: true });
} catch (error) {
console.error("Error updating shared spaces:", error);
- return NextResponse.json({ error: "Internal server error" }, { status: 500 });
+ return NextResponse.json(
+ { error: "Internal server error" },
+ { status: 500 }
+ );
}
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/changelog/route.ts b/apps/web/app/api/changelog/route.ts
index 7a256b604..568ba5175 100644
--- a/apps/web/app/api/changelog/route.ts
+++ b/apps/web/app/api/changelog/route.ts
@@ -1,38 +1,38 @@
-import { NextResponse } from 'next/server';
+import { NextResponse } from "next/server";
import { getChangelogPosts } from "../../../utils/changelog";
-export const dynamic = 'force-dynamic';
+export const dynamic = "force-dynamic";
export const revalidate = 0;
export async function GET() {
const allUpdates = getChangelogPosts();
const changelogs = allUpdates
- .map(post => ({
+ .map((post) => ({
metadata: post.metadata,
content: post.content,
- slug: parseInt(post.slug)
+ slug: parseInt(post.slug),
}))
.sort((a, b) => b.slug - a.slug)
.map(({ metadata, content }) => ({ ...metadata, content }));
const response = NextResponse.json(changelogs);
-
+
// Set CORS headers
- response.headers.set('Access-Control-Allow-Origin', '*');
- response.headers.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
- response.headers.set('Access-Control-Allow-Headers', 'Content-Type');
+ response.headers.set("Access-Control-Allow-Origin", "*");
+ response.headers.set("Access-Control-Allow-Methods", "GET, OPTIONS");
+ response.headers.set("Access-Control-Allow-Headers", "Content-Type");
return response;
}
export async function OPTIONS() {
const response = new NextResponse(null, { status: 204 });
-
+
// Set CORS headers for preflight requests
- response.headers.set('Access-Control-Allow-Origin', '*');
- response.headers.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
- response.headers.set('Access-Control-Allow-Headers', 'Content-Type');
-
+ response.headers.set("Access-Control-Allow-Origin", "*");
+ response.headers.set("Access-Control-Allow-Methods", "GET, OPTIONS");
+ response.headers.set("Access-Control-Allow-Headers", "Content-Type");
+
return response;
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/changelog/status/route.ts b/apps/web/app/api/changelog/status/route.ts
index 353424edf..d794e16ee 100644
--- a/apps/web/app/api/changelog/status/route.ts
+++ b/apps/web/app/api/changelog/status/route.ts
@@ -1,20 +1,20 @@
-import { NextResponse } from 'next/server';
+import { NextResponse } from "next/server";
import { getChangelogPosts } from "../../../../utils/changelog";
-export const dynamic = 'force-dynamic';
+export const dynamic = "force-dynamic";
export const revalidate = 0;
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
- const version = searchParams.get('version');
+ const version = searchParams.get("version");
const allUpdates = getChangelogPosts();
const changelogs = allUpdates
- .map(post => ({
+ .map((post) => ({
metadata: post.metadata,
content: post.content,
- slug: parseInt(post.slug)
+ slug: parseInt(post.slug),
}))
.sort((a, b) => b.slug - a.slug)
.map(({ metadata, content }) => ({ ...metadata, content }));
@@ -23,22 +23,22 @@ export async function GET(request: Request) {
const hasUpdate = version ? latestVersion === version : false;
const response = NextResponse.json({ hasUpdate });
-
+
// Set CORS headers
- response.headers.set('Access-Control-Allow-Origin', '*');
- response.headers.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
- response.headers.set('Access-Control-Allow-Headers', 'Content-Type');
+ response.headers.set("Access-Control-Allow-Origin", "*");
+ response.headers.set("Access-Control-Allow-Methods", "GET, OPTIONS");
+ response.headers.set("Access-Control-Allow-Headers", "Content-Type");
return response;
}
export async function OPTIONS() {
const response = new NextResponse(null, { status: 204 });
-
+
// Set CORS headers for preflight requests
- response.headers.set('Access-Control-Allow-Origin', '*');
- response.headers.set('Access-Control-Allow-Methods', 'GET, OPTIONS');
- response.headers.set('Access-Control-Allow-Headers', 'Content-Type');
-
+ response.headers.set("Access-Control-Allow-Origin", "*");
+ response.headers.set("Access-Control-Allow-Methods", "GET, OPTIONS");
+ response.headers.set("Access-Control-Allow-Headers", "Content-Type");
+
return response;
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/desktop/feedback/route.ts b/apps/web/app/api/desktop/feedback/route.ts
index a9d339581..b10c8d983 100644
--- a/apps/web/app/api/desktop/feedback/route.ts
+++ b/apps/web/app/api/desktop/feedback/route.ts
@@ -27,13 +27,13 @@ export async function OPTIONS(req: NextRequest) {
: "null",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "POST, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization, sentry-trace, baggage",
+ "Access-Control-Allow-Headers":
+ "Content-Type, Authorization, sentry-trace, baggage",
},
});
}
export async function POST(req: NextRequest) {
-
const token = req.headers.get("authorization")?.split(" ")[1];
if (token) {
cookies().set({
@@ -51,7 +51,6 @@ export async function POST(req: NextRequest) {
const origin = params.get("origin") || null;
const originalOrigin = req.nextUrl.origin;
-
if (!user) {
return new Response(JSON.stringify({ error: "User not authenticated" }), {
status: 401,
@@ -71,21 +70,23 @@ export async function POST(req: NextRequest) {
const formData = await req.formData();
const feedbackText = formData.get("feedback") as string;
-
if (!feedbackText) {
- return new Response(JSON.stringify({ error: "Feedback text is required" }), {
- status: 400,
- headers: {
- "Content-Type": "application/json",
- "Access-Control-Allow-Origin":
- origin && allowedOrigins.includes(origin)
- ? origin
- : allowedOrigins.includes(originalOrigin)
- ? originalOrigin
- : "null",
- "Access-Control-Allow-Credentials": "true",
- },
- });
+ return new Response(
+ JSON.stringify({ error: "Feedback text is required" }),
+ {
+ status: 400,
+ headers: {
+ "Content-Type": "application/json",
+ "Access-Control-Allow-Origin":
+ origin && allowedOrigins.includes(origin)
+ ? origin
+ : allowedOrigins.includes(originalOrigin)
+ ? originalOrigin
+ : "null",
+ "Access-Control-Allow-Credentials": "true",
+ },
+ }
+ );
}
try {
@@ -96,9 +97,9 @@ export async function POST(req: NextRequest) {
}
const response = await fetch(discordWebhookUrl, {
- method: 'POST',
+ method: "POST",
headers: {
- 'Content-Type': 'application/json',
+ "Content-Type": "application/json",
},
body: JSON.stringify({
content: `New feedback from ${user.email}:\n${feedbackText}`,
@@ -106,35 +107,46 @@ export async function POST(req: NextRequest) {
});
if (!response.ok) {
- throw new Error(`Failed to send feedback to Discord: ${response.statusText}`);
+ throw new Error(
+ `Failed to send feedback to Discord: ${response.statusText}`
+ );
}
- return new Response(JSON.stringify({ success: true, message: "Feedback submitted successfully" }), {
- status: 200,
- headers: {
- "Content-Type": "application/json",
- "Access-Control-Allow-Origin":
- origin && allowedOrigins.includes(origin)
- ? origin
- : allowedOrigins.includes(originalOrigin)
- ? originalOrigin
- : "null",
- "Access-Control-Allow-Credentials": "true",
- },
- });
+ return new Response(
+ JSON.stringify({
+ success: true,
+ message: "Feedback submitted successfully",
+ }),
+ {
+ status: 200,
+ headers: {
+ "Content-Type": "application/json",
+ "Access-Control-Allow-Origin":
+ origin && allowedOrigins.includes(origin)
+ ? origin
+ : allowedOrigins.includes(originalOrigin)
+ ? originalOrigin
+ : "null",
+ "Access-Control-Allow-Credentials": "true",
+ },
+ }
+ );
} catch (error) {
- return new Response(JSON.stringify({ error: "Failed to submit feedback" }), {
- status: 500,
- headers: {
- "Content-Type": "application/json",
- "Access-Control-Allow-Origin":
- origin && allowedOrigins.includes(origin)
- ? origin
- : allowedOrigins.includes(originalOrigin)
- ? originalOrigin
- : "null",
- "Access-Control-Allow-Credentials": "true",
- },
- });
+ return new Response(
+ JSON.stringify({ error: "Failed to submit feedback" }),
+ {
+ status: 500,
+ headers: {
+ "Content-Type": "application/json",
+ "Access-Control-Allow-Origin":
+ origin && allowedOrigins.includes(origin)
+ ? origin
+ : allowedOrigins.includes(originalOrigin)
+ ? originalOrigin
+ : "null",
+ "Access-Control-Allow-Credentials": "true",
+ },
+ }
+ );
}
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/invite/accept/route.ts b/apps/web/app/api/invite/accept/route.ts
index c2087ef4c..404f32dce 100644
--- a/apps/web/app/api/invite/accept/route.ts
+++ b/apps/web/app/api/invite/accept/route.ts
@@ -3,66 +3,72 @@ import { db } from "@cap/database";
import { getCurrentUser } from "@cap/database/auth/session";
import { spaceInvites, spaceMembers, users } from "@cap/database/schema";
import { eq } from "drizzle-orm";
-import { nanoId } from "@cap/database/helpers"
+import { nanoId } from "@cap/database/helpers";
export async function POST(request: NextRequest) {
- const user = await getCurrentUser();
- if (!user) {
- return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
+ const user = await getCurrentUser();
+ if (!user) {
+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
+ }
+
+ const { inviteId } = await request.json();
+
+ try {
+ // Find the invite
+ const [invite] = await db
+ .select()
+ .from(spaceInvites)
+ .where(eq(spaceInvites.id, inviteId));
+
+ if (!invite) {
+ return NextResponse.json({ error: "Invite not found" }, { status: 404 });
}
-
- const { inviteId } = await request.json();
-
- try {
- // Find the invite
- const [invite] = await db
- .select()
- .from(spaceInvites)
- .where(eq(spaceInvites.id, inviteId));
-
- if (!invite) {
- return NextResponse.json({ error: "Invite not found" }, { status: 404 });
- }
-
- // Check if the user's email matches the invited email
- if (user.email !== invite.invitedEmail) {
- return NextResponse.json({ error: "Email mismatch" }, { status: 403 });
- }
-
- // Get the space owner's subscription ID
- const [spaceOwner] = await db
- .select({
- stripeSubscriptionId: users.stripeSubscriptionId,
- })
- .from(users)
- .where(eq(users.id, invite.invitedByUserId));
-
- if (!spaceOwner || !spaceOwner.stripeSubscriptionId) {
- return NextResponse.json({ error: "Space owner not found or has no subscription" }, { status: 404 });
- }
-
- // Create a new space member
- await db.insert(spaceMembers).values({
- id: nanoId(),
- spaceId: invite.spaceId,
- userId: user.id,
- role: invite.role,
- });
-
- // Update the user's thirdPartyStripeSubscriptionId
- await db
- .update(users)
- .set({
- thirdPartyStripeSubscriptionId: spaceOwner.stripeSubscriptionId,
- })
- .where(eq(users.id, user.id));
-
- // Delete the invite
- await db.delete(spaceInvites).where(eq(spaceInvites.id, inviteId));
-
- return NextResponse.json({ success: true });
- } catch (error) {
- console.error("Error accepting invite:", error);
- return NextResponse.json({ error: "Internal server error" }, { status: 500 });
+
+ // Check if the user's email matches the invited email
+ if (user.email !== invite.invitedEmail) {
+ return NextResponse.json({ error: "Email mismatch" }, { status: 403 });
}
- }
\ No newline at end of file
+
+ // Get the space owner's subscription ID
+ const [spaceOwner] = await db
+ .select({
+ stripeSubscriptionId: users.stripeSubscriptionId,
+ })
+ .from(users)
+ .where(eq(users.id, invite.invitedByUserId));
+
+ if (!spaceOwner || !spaceOwner.stripeSubscriptionId) {
+ return NextResponse.json(
+ { error: "Space owner not found or has no subscription" },
+ { status: 404 }
+ );
+ }
+
+ // Create a new space member
+ await db.insert(spaceMembers).values({
+ id: nanoId(),
+ spaceId: invite.spaceId,
+ userId: user.id,
+ role: invite.role,
+ });
+
+ // Update the user's thirdPartyStripeSubscriptionId
+ await db
+ .update(users)
+ .set({
+ thirdPartyStripeSubscriptionId: spaceOwner.stripeSubscriptionId,
+ })
+ .where(eq(users.id, user.id));
+
+ // Delete the invite
+ await db.delete(spaceInvites).where(eq(spaceInvites.id, inviteId));
+
+ return NextResponse.json({ success: true });
+ } catch (error) {
+ console.error("Error accepting invite:", error);
+ return NextResponse.json(
+ { error: "Internal server error" },
+ { status: 500 }
+ );
+ }
+}
diff --git a/apps/web/app/api/invite/decline/route.ts b/apps/web/app/api/invite/decline/route.ts
index b4a392479..b0b995b64 100644
--- a/apps/web/app/api/invite/decline/route.ts
+++ b/apps/web/app/api/invite/decline/route.ts
@@ -13,6 +13,9 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ success: true });
} catch (error) {
console.error("Error declining invite:", error);
- return NextResponse.json({ error: "Internal server error" }, { status: 500 });
+ return NextResponse.json(
+ { error: "Internal server error" },
+ { status: 500 }
+ );
}
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/settings/workspace/invite/remove/route.ts b/apps/web/app/api/settings/workspace/invite/remove/route.ts
index 9dd2ff79f..f30048575 100644
--- a/apps/web/app/api/settings/workspace/invite/remove/route.ts
+++ b/apps/web/app/api/settings/workspace/invite/remove/route.ts
@@ -22,7 +22,11 @@ export async function POST(request: NextRequest) {
console.log(`User found: ${user.id}`);
- const space = await db.select().from(spaces).where(eq(spaces.id, spaceId)).limit(1);
+ const space = await db
+ .select()
+ .from(spaces)
+ .where(eq(spaces.id, spaceId))
+ .limit(1);
console.log(`Space query result:`, space);
if (!space || space.length === 0) {
@@ -45,12 +49,10 @@ export async function POST(request: NextRequest) {
});
}
- const result = await db.delete(spaceInvites)
+ const result = await db
+ .delete(spaceInvites)
.where(
- and(
- eq(spaceInvites.id, inviteId),
- eq(spaceInvites.spaceId, spaceId)
- )
+ and(eq(spaceInvites.id, inviteId), eq(spaceInvites.spaceId, spaceId))
);
if (result.rowsAffected === 0) {
@@ -64,13 +66,10 @@ export async function POST(request: NextRequest) {
}
console.log("Workspace invite removed successfully");
- return new Response(
- JSON.stringify({ success: true }),
- {
- status: 200,
- headers: {
- "Content-Type": "application/json",
- },
- }
- );
+ return new Response(JSON.stringify({ success: true }), {
+ status: 200,
+ headers: {
+ "Content-Type": "application/json",
+ },
+ });
}
diff --git a/apps/web/app/api/settings/workspace/invite/send/route.ts b/apps/web/app/api/settings/workspace/invite/send/route.ts
index 4131bd4c4..5d438a58f 100644
--- a/apps/web/app/api/settings/workspace/invite/send/route.ts
+++ b/apps/web/app/api/settings/workspace/invite/send/route.ts
@@ -49,7 +49,9 @@ export async function POST(request: NextRequest) {
}
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
- const validEmails = invitedEmails.filter((email: string) => emailRegex.test(email.trim()));
+ const validEmails = invitedEmails.filter((email: string) =>
+ emailRegex.test(email.trim())
+ );
for (const email of validEmails) {
const inviteId = nanoId();
diff --git a/apps/web/app/api/video/individual/route.ts b/apps/web/app/api/video/individual/route.ts
index 363b8ed48..b5d76ac08 100644
--- a/apps/web/app/api/video/individual/route.ts
+++ b/apps/web/app/api/video/individual/route.ts
@@ -82,7 +82,7 @@ export async function GET(request: NextRequest) {
const individualFiles = objects.Contents.map((object) => {
const key = object.Key as string;
- const fileName = key.split('/').pop();
+ const fileName = key.split("/").pop();
return {
fileName,
url: `https://v.cap.so/${key}`,
@@ -103,4 +103,4 @@ export async function GET(request: NextRequest) {
{ status: 500, headers: getHeaders(origin) }
);
}
-}
\ No newline at end of file
+}
diff --git a/apps/web/app/api/video/transcribe/route.ts b/apps/web/app/api/video/transcribe/route.ts
index f78f12602..8fbb9e30f 100644
--- a/apps/web/app/api/video/transcribe/route.ts
+++ b/apps/web/app/api/video/transcribe/route.ts
@@ -122,7 +122,10 @@ export async function GET(request: NextRequest) {
if (!awsRegion || !awsBucket) {
console.error("AWS region or bucket information is missing");
return new Response(
- JSON.stringify({ error: true, message: "AWS region or bucket information is missing" }),
+ JSON.stringify({
+ error: true,
+ message: "AWS region or bucket information is missing",
+ }),
{
status: 500,
headers: getHeaders(origin),
diff --git a/apps/web/app/api/webhooks/stripe/route.ts b/apps/web/app/api/webhooks/stripe/route.ts
index 12f372781..3b497c4ff 100644
--- a/apps/web/app/api/webhooks/stripe/route.ts
+++ b/apps/web/app/api/webhooks/stripe/route.ts
@@ -45,7 +45,7 @@ export const POST = async (req: Request) => {
.from(users)
.where(eq(users.email, customer.email))
.limit(1);
-
+
if (userByEmail && userByEmail.length > 0 && userByEmail[0]) {
foundUserId = userByEmail[0].id;
console.log(`User found by email: ${foundUserId}`);
@@ -73,14 +73,21 @@ export const POST = async (req: Request) => {
.where(eq(users.id, foundUserId));
if (!user) {
- console.log("No user found in database for checkout.session.completed event");
+ console.log(
+ "No user found in database for checkout.session.completed event"
+ );
return new Response("No user found", {
status: 400,
});
}
- const subscription = await stripe.subscriptions.retrieve(event.data.object.subscription as string);
- const inviteQuota = subscription.items.data.reduce((total, item) => total + (item.quantity || 1), 0);
+ const subscription = await stripe.subscriptions.retrieve(
+ event.data.object.subscription as string
+ );
+ const inviteQuota = subscription.items.data.reduce(
+ (total, item) => total + (item.quantity || 1),
+ 0
+ );
await db
.update(users)
@@ -90,7 +97,9 @@ export const POST = async (req: Request) => {
inviteQuota: inviteQuota,
})
.where(eq(users.id, foundUserId));
- console.log("User updated successfully for checkout.session.completed event");
+ console.log(
+ "User updated successfully for checkout.session.completed event"
+ );
}
if (event.type === "customer.subscription.updated") {
@@ -110,7 +119,7 @@ export const POST = async (req: Request) => {
.from(users)
.where(eq(users.email, customer.email))
.limit(1);
-
+
if (userByEmail && userByEmail.length > 0 && userByEmail[0]) {
foundUserId = userByEmail[0].id;
console.log(`User found by email: ${foundUserId}`);
@@ -138,14 +147,19 @@ export const POST = async (req: Request) => {
.where(eq(users.id, foundUserId));
if (!user) {
- console.log("No user found in database for customer.subscription.updated event");
+ console.log(
+ "No user found in database for customer.subscription.updated event"
+ );
return new Response("No user found", {
status: 400,
});
}
const subscription = event.data.object as Stripe.Subscription;
- const inviteQuota = subscription.items.data.reduce((total, item) => total + (item.quantity || 1), 0);
+ const inviteQuota = subscription.items.data.reduce(
+ (total, item) => total + (item.quantity || 1),
+ 0
+ );
await db
.update(users)
@@ -155,7 +169,9 @@ export const POST = async (req: Request) => {
inviteQuota: inviteQuota,
})
.where(eq(users.id, foundUserId));
- console.log("User updated successfully for customer.subscription.updated event");
+ console.log(
+ "User updated successfully for customer.subscription.updated event"
+ );
}
if (event.type === "customer.subscription.deleted") {
@@ -175,7 +191,7 @@ export const POST = async (req: Request) => {
.from(users)
.where(eq(users.email, customer.email))
.limit(1);
-
+
if (userByEmail && userByEmail.length > 0 && userByEmail[0]) {
foundUserId = userByEmail[0].id;
console.log(`User found by email: ${foundUserId}`);
@@ -203,7 +219,9 @@ export const POST = async (req: Request) => {
.where(eq(users.id, foundUserId));
if (!user) {
- console.log("No user found in database for customer.subscription.deleted event");
+ console.log(
+ "No user found in database for customer.subscription.deleted event"
+ );
return new Response("No user found", {
status: 400,
});
@@ -217,10 +235,12 @@ export const POST = async (req: Request) => {
inviteQuota: 1, // Reset to default quota when subscription is deleted
})
.where(eq(users.id, foundUserId));
- console.log("User updated successfully for customer.subscription.deleted event");
+ console.log(
+ "User updated successfully for customer.subscription.deleted event"
+ );
}
} catch (error) {
- console.log('❌ Webhook handler failed. View logs.');
+ console.log("❌ Webhook handler failed. View logs.");
return new Response(
'Webhook error: "Webhook handler failed. View logs."',
{
diff --git a/apps/web/app/sitemap.ts b/apps/web/app/sitemap.ts
index da4ac2510..e6ef90850 100644
--- a/apps/web/app/sitemap.ts
+++ b/apps/web/app/sitemap.ts
@@ -1,59 +1,71 @@
-import { promises as fs } from 'fs';
-import path from 'path';
+import { promises as fs } from "fs";
+import path from "path";
import { getBlogPosts } from "@/utils/updates";
-async function getPagePaths(dir: string): Promise<{ path: string; lastModified: string }[]> {
- const entries = await fs.readdir(dir, { withFileTypes: true });
- const paths: { path: string; lastModified: string }[] = [];
-
- for (const entry of entries) {
- const fullPath = path.join(dir, entry.name);
- if (entry.isDirectory() && entry.name !== 'dashboard' && !entry.name.startsWith('s') && entry.name !== 'updates') {
- const subPaths = await getPagePaths(fullPath);
- paths.push(...subPaths);
- } else if (entry.isFile() && (entry.name === 'page.tsx' || entry.name === 'page.mdx')) {
- const relativePath = path.relative(process.cwd(), dir);
- const routePath = '/' + relativePath.split(path.sep).slice(1).join('/');
- if (!routePath.includes('/dashboard') && !routePath.split('/').some(segment => segment.startsWith('s'))) {
- const stats = await fs.stat(fullPath);
- paths.push({
- path: routePath === '/app' ? '/' : routePath,
- lastModified: stats.mtime.toISOString()
- });
- }
+async function getPagePaths(
+ dir: string
+): Promise<{ path: string; lastModified: string }[]> {
+ const entries = await fs.readdir(dir, { withFileTypes: true });
+ const paths: { path: string; lastModified: string }[] = [];
+
+ for (const entry of entries) {
+ const fullPath = path.join(dir, entry.name);
+ if (
+ entry.isDirectory() &&
+ entry.name !== "dashboard" &&
+ !entry.name.startsWith("s") &&
+ entry.name !== "updates"
+ ) {
+ const subPaths = await getPagePaths(fullPath);
+ paths.push(...subPaths);
+ } else if (
+ entry.isFile() &&
+ (entry.name === "page.tsx" || entry.name === "page.mdx")
+ ) {
+ const relativePath = path.relative(process.cwd(), dir);
+ const routePath = "/" + relativePath.split(path.sep).slice(1).join("/");
+ if (
+ !routePath.includes("/dashboard") &&
+ !routePath.split("/").some((segment) => segment.startsWith("s"))
+ ) {
+ const stats = await fs.stat(fullPath);
+ paths.push({
+ path: routePath === "/app" ? "/" : routePath,
+ lastModified: stats.mtime.toISOString(),
+ });
}
}
-
- return paths;
}
-
- export default async function sitemap() {
- const appDirectory = path.join(process.cwd(), 'app');
- const pagePaths = await getPagePaths(appDirectory);
-
- // Add blog post routes
- const blogPosts = getBlogPosts();
- const blogRoutes = blogPosts.map(post => {
- const publishDate = new Date(post.metadata.publishedAt);
- publishDate.setHours(9, 0, 0, 0); // Set time to 9:00 AM
- return {
- path: `/updates/${post.slug}`,
- lastModified: publishDate.toISOString()
- };
- });
-
- // Combine routes and ensure '/' is first
- const allRoutes = [...pagePaths, ...blogRoutes];
- const homeRoute = allRoutes.find(route => route.path === '/');
- const otherRoutes = allRoutes.filter(route => route.path !== '/');
-
- const routes = [
- ...(homeRoute ? [homeRoute] : []),
- ...otherRoutes
- ].map((route) => ({
+
+ return paths;
+}
+
+export default async function sitemap() {
+ const appDirectory = path.join(process.cwd(), "app");
+ const pagePaths = await getPagePaths(appDirectory);
+
+ // Add blog post routes
+ const blogPosts = getBlogPosts();
+ const blogRoutes = blogPosts.map((post) => {
+ const publishDate = new Date(post.metadata.publishedAt);
+ publishDate.setHours(9, 0, 0, 0); // Set time to 9:00 AM
+ return {
+ path: `/updates/${post.slug}`,
+ lastModified: publishDate.toISOString(),
+ };
+ });
+
+ // Combine routes and ensure '/' is first
+ const allRoutes = [...pagePaths, ...blogRoutes];
+ const homeRoute = allRoutes.find((route) => route.path === "/");
+ const otherRoutes = allRoutes.filter((route) => route.path !== "/");
+
+ const routes = [...(homeRoute ? [homeRoute] : []), ...otherRoutes].map(
+ (route) => ({
url: `https://cap.so${route.path}`,
lastModified: route.lastModified,
- }));
-
- return routes;
- }
\ No newline at end of file
+ })
+ );
+
+ return routes;
+}
diff --git a/packages/database/schema.ts b/packages/database/schema.ts
index 9e89df903..20da9568e 100644
--- a/packages/database/schema.ts
+++ b/packages/database/schema.ts
@@ -163,7 +163,9 @@ export const spaceInvites = mysqlTable(
(table) => ({
spaceIdIndex: index("space_id_idx").on(table.spaceId),
invitedEmailIndex: index("invited_email_idx").on(table.invitedEmail),
- invitedByUserIdIndex: index("invited_by_user_id_idx").on(table.invitedByUserId),
+ invitedByUserIdIndex: index("invited_by_user_id_idx").on(
+ table.invitedByUserId
+ ),
statusIndex: index("status_idx").on(table.status),
})
);
diff --git a/packages/ui-solid/src/auto-imports.d.ts b/packages/ui-solid/src/auto-imports.d.ts
index 9d90f041c..b85717c51 100644
--- a/packages/ui-solid/src/auto-imports.d.ts
+++ b/packages/ui-solid/src/auto-imports.d.ts
@@ -6,58 +6,58 @@
// biome-ignore lint: disable
export {}
declare global {
- const IconCapArrows: typeof import('~icons/cap/arrows.jsx')['default']
- const IconCapAudioOn: typeof import('~icons/cap/audio-on.jsx')['default']
- const IconCapBell: typeof import('~icons/cap/bell.jsx')['default']
- const IconCapBlur: typeof import('~icons/cap/blur.jsx')['default']
- const IconCapCamera: typeof import('~icons/cap/camera.jsx')['default']
- const IconCapChevronDown: typeof import('~icons/cap/chevron-down.jsx')['default']
- const IconCapCircle: typeof import('~icons/cap/circle.jsx')['default']
- const IconCapCircleCheck: typeof import('~icons/cap/circle-check.jsx')['default']
- const IconCapCirclePlus: typeof import('~icons/cap/circle-plus.jsx')['default']
- const IconCapCircleX: typeof import('~icons/cap/circle-x.jsx')['default']
- const IconCapCopy: typeof import('~icons/cap/copy.jsx')['default']
- const IconCapCorners: typeof import('~icons/cap/corners.jsx')['default']
- const IconCapCrop: typeof import('~icons/cap/crop.jsx')['default']
- const IconCapCursor: typeof import('~icons/cap/cursor.jsx')['default']
- const IconCapEditor: typeof import('~icons/cap/editor.jsx')['default']
- const IconCapEnlarge: typeof import('~icons/cap/enlarge.jsx')['default']
- const IconCapEye: typeof import('~icons/cap/eye.jsx')['default']
- const IconCapFrameFirst: typeof import('~icons/cap/frame-first.jsx')['default']
- const IconCapFrameLast: typeof import('~icons/cap/frame-last.jsx')['default']
- const IconCapHotkeys: typeof import('~icons/cap/hotkeys.jsx')['default']
- const IconCapImage: typeof import('~icons/cap/image.jsx')['default']
- const IconCapInset: typeof import('~icons/cap/inset.jsx')['default']
- const IconCapLayout: typeof import('~icons/cap/layout.jsx')['default']
- const IconCapLogo: typeof import('~icons/cap/logo.jsx')['default']
- const IconCapLogoFull: typeof import('~icons/cap/logo-full.jsx')['default']
- const IconCapMessageBubble: typeof import('~icons/cap/message-bubble.jsx')['default']
- const IconCapMicrophone: typeof import('~icons/cap/microphone.jsx')['default']
- const IconCapMoreVertical: typeof import('~icons/cap/more-vertical.jsx')['default']
- const IconCapPadding: typeof import('~icons/cap/padding.jsx')['default']
- const IconCapPauseCircle: typeof import('~icons/cap/pause-circle.jsx')['default']
- const IconCapPlayCircle: typeof import('~icons/cap/play-circle.jsx')['default']
- const IconCapPresets: typeof import('~icons/cap/presets.jsx')['default']
- const IconCapRedo: typeof import('~icons/cap/redo.jsx')['default']
- const IconCapRestart: typeof import('~icons/cap/restart.jsx')['default']
- const IconCapScissors: typeof import('~icons/cap/scissors.jsx')['default']
- const IconCapSettings: typeof import('~icons/cap/settings.jsx')['default']
- const IconCapShadow: typeof import('~icons/cap/shadow.jsx')['default']
- const IconCapSquare: typeof import('~icons/cap/square.jsx')['default']
- const IconCapStopCircle: typeof import('~icons/cap/stop-circle.jsx')['default']
- const IconCapTrash: typeof import('~icons/cap/trash.jsx')['default']
- const IconCapUndo: typeof import('~icons/cap/undo.jsx')['default']
- const IconCapUpload: typeof import('~icons/cap/upload.jsx')['default']
- const IconLucideBell: typeof import('~icons/lucide/bell.jsx')['default']
- const IconLucideCamera: typeof import('~icons/lucide/camera.jsx')['default']
- const IconLucideCheck: typeof import('~icons/lucide/check.jsx')['default']
- const IconLucideEdit: typeof import('~icons/lucide/edit.jsx')['default']
- const IconLucideEye: typeof import('~icons/lucide/eye.jsx')['default']
- const IconLucideFolder: typeof import('~icons/lucide/folder.jsx')['default']
- const IconLucideFoler: typeof import('~icons/lucide/foler.jsx')['default']
- const IconLucideLoaderCircle: typeof import('~icons/lucide/loader-circle.jsx')['default']
- const IconLucideRewind: typeof import('~icons/lucide/rewind.jsx')['default']
- const IconLucideSettings: typeof import('~icons/lucide/settings.jsx')['default']
- const IconLucideSmile: typeof import('~icons/lucide/smile.jsx')['default']
- const IconLucideVideo: typeof import('~icons/lucide/video.jsx')['default']
+ const IconCapArrows: typeof import("~icons/cap/arrows.jsx")["default"];
+ const IconCapAudioOn: typeof import("~icons/cap/audio-on.jsx")["default"];
+ const IconCapBell: typeof import("~icons/cap/bell.jsx")["default"];
+ const IconCapBlur: typeof import("~icons/cap/blur.jsx")["default"];
+ const IconCapCamera: typeof import("~icons/cap/camera.jsx")["default"];
+ const IconCapChevronDown: typeof import("~icons/cap/chevron-down.jsx")["default"];
+ const IconCapCircle: typeof import("~icons/cap/circle.jsx")["default"];
+ const IconCapCircleCheck: typeof import("~icons/cap/circle-check.jsx")["default"];
+ const IconCapCirclePlus: typeof import("~icons/cap/circle-plus.jsx")["default"];
+ const IconCapCircleX: typeof import("~icons/cap/circle-x.jsx")["default"];
+ const IconCapCopy: typeof import("~icons/cap/copy.jsx")["default"];
+ const IconCapCorners: typeof import("~icons/cap/corners.jsx")["default"];
+ const IconCapCrop: typeof import("~icons/cap/crop.jsx")["default"];
+ const IconCapCursor: typeof import("~icons/cap/cursor.jsx")["default"];
+ const IconCapEditor: typeof import("~icons/cap/editor.jsx")["default"];
+ const IconCapEnlarge: typeof import("~icons/cap/enlarge.jsx")["default"];
+ const IconCapEye: typeof import("~icons/cap/eye.jsx")["default"];
+ const IconCapFrameFirst: typeof import("~icons/cap/frame-first.jsx")["default"];
+ const IconCapFrameLast: typeof import("~icons/cap/frame-last.jsx")["default"];
+ const IconCapHotkeys: typeof import("~icons/cap/hotkeys.jsx")["default"];
+ const IconCapImage: typeof import("~icons/cap/image.jsx")["default"];
+ const IconCapInset: typeof import("~icons/cap/inset.jsx")["default"];
+ const IconCapLayout: typeof import("~icons/cap/layout.jsx")["default"];
+ const IconCapLogo: typeof import("~icons/cap/logo.jsx")["default"];
+ const IconCapLogoFull: typeof import("~icons/cap/logo-full.jsx")["default"];
+ const IconCapMessageBubble: typeof import("~icons/cap/message-bubble.jsx")["default"];
+ const IconCapMicrophone: typeof import("~icons/cap/microphone.jsx")["default"];
+ const IconCapMoreVertical: typeof import("~icons/cap/more-vertical.jsx")["default"];
+ const IconCapPadding: typeof import("~icons/cap/padding.jsx")["default"];
+ const IconCapPauseCircle: typeof import("~icons/cap/pause-circle.jsx")["default"];
+ const IconCapPlayCircle: typeof import("~icons/cap/play-circle.jsx")["default"];
+ const IconCapPresets: typeof import("~icons/cap/presets.jsx")["default"];
+ const IconCapRedo: typeof import("~icons/cap/redo.jsx")["default"];
+ const IconCapRestart: typeof import("~icons/cap/restart.jsx")["default"];
+ const IconCapScissors: typeof import("~icons/cap/scissors.jsx")["default"];
+ const IconCapSettings: typeof import("~icons/cap/settings.jsx")["default"];
+ const IconCapShadow: typeof import("~icons/cap/shadow.jsx")["default"];
+ const IconCapSquare: typeof import("~icons/cap/square.jsx")["default"];
+ const IconCapStopCircle: typeof import("~icons/cap/stop-circle.jsx")["default"];
+ const IconCapTrash: typeof import("~icons/cap/trash.jsx")["default"];
+ const IconCapUndo: typeof import("~icons/cap/undo.jsx")["default"];
+ const IconCapUpload: typeof import("~icons/cap/upload.jsx")["default"];
+ const IconLucideBell: typeof import("~icons/lucide/bell.jsx")["default"];
+ const IconLucideCamera: typeof import("~icons/lucide/camera.jsx")["default"];
+ const IconLucideCheck: typeof import("~icons/lucide/check.jsx")["default"];
+ const IconLucideEdit: typeof import("~icons/lucide/edit.jsx")["default"];
+ const IconLucideEye: typeof import("~icons/lucide/eye.jsx")["default"];
+ const IconLucideFolder: typeof import("~icons/lucide/folder.jsx")["default"];
+ const IconLucideFoler: typeof import("~icons/lucide/foler.jsx")["default"];
+ const IconLucideLoaderCircle: typeof import("~icons/lucide/loader-circle.jsx")["default"];
+ const IconLucideRewind: typeof import("~icons/lucide/rewind.jsx")["default"];
+ const IconLucideSettings: typeof import("~icons/lucide/settings.jsx")["default"];
+ const IconLucideSmile: typeof import("~icons/lucide/smile.jsx")["default"];
+ const IconLucideVideo: typeof import("~icons/lucide/video.jsx")["default"];
}
diff --git a/packages/utils/src/types/database.ts b/packages/utils/src/types/database.ts
index 5a68e8cae..4e07a9d3d 100644
--- a/packages/utils/src/types/database.ts
+++ b/packages/utils/src/types/database.ts
@@ -4,299 +4,299 @@ export type Json =
| boolean
| null
| { [key: string]: Json | undefined }
- | Json[]
+ | Json[];
export interface Database {
public: {
Tables: {
shared_videos: {
Row: {
- shared_at: string
- shared_by_user_id: string | null
- space_id: string
- video_id: string
- }
+ shared_at: string;
+ shared_by_user_id: string | null;
+ space_id: string;
+ video_id: string;
+ };
Insert: {
- shared_at?: string
- shared_by_user_id?: string | null
- space_id: string
- video_id: string
- }
+ shared_at?: string;
+ shared_by_user_id?: string | null;
+ space_id: string;
+ video_id: string;
+ };
Update: {
- shared_at?: string
- shared_by_user_id?: string | null
- space_id?: string
- video_id?: string
- }
+ shared_at?: string;
+ shared_by_user_id?: string | null;
+ space_id?: string;
+ video_id?: string;
+ };
Relationships: [
{
- foreignKeyName: "shared_videos_shared_by_user_id_fkey"
- columns: ["shared_by_user_id"]
- isOneToOne: false
- referencedRelation: "users"
- referencedColumns: ["id"]
+ foreignKeyName: "shared_videos_shared_by_user_id_fkey";
+ columns: ["shared_by_user_id"];
+ isOneToOne: false;
+ referencedRelation: "users";
+ referencedColumns: ["id"];
},
{
- foreignKeyName: "shared_videos_space_id_fkey"
- columns: ["space_id"]
- isOneToOne: false
- referencedRelation: "spaces"
- referencedColumns: ["id"]
+ foreignKeyName: "shared_videos_space_id_fkey";
+ columns: ["space_id"];
+ isOneToOne: false;
+ referencedRelation: "spaces";
+ referencedColumns: ["id"];
},
{
- foreignKeyName: "shared_videos_video_id_fkey"
- columns: ["video_id"]
- isOneToOne: false
- referencedRelation: "videos"
- referencedColumns: ["id"]
+ foreignKeyName: "shared_videos_video_id_fkey";
+ columns: ["video_id"];
+ isOneToOne: false;
+ referencedRelation: "videos";
+ referencedColumns: ["id"];
}
- ]
- }
+ ];
+ };
space_members: {
Row: {
- role: Database["public"]["Enums"]["user_role"]
- space_id: string
- user_id: string
- }
+ role: Database["public"]["Enums"]["user_role"];
+ space_id: string;
+ user_id: string;
+ };
Insert: {
- role: Database["public"]["Enums"]["user_role"]
- space_id: string
- user_id: string
- }
+ role: Database["public"]["Enums"]["user_role"];
+ space_id: string;
+ user_id: string;
+ };
Update: {
- role?: Database["public"]["Enums"]["user_role"]
- space_id?: string
- user_id?: string
- }
+ role?: Database["public"]["Enums"]["user_role"];
+ space_id?: string;
+ user_id?: string;
+ };
Relationships: [
{
- foreignKeyName: "space_members_space_id_fkey"
- columns: ["space_id"]
- isOneToOne: false
- referencedRelation: "spaces"
- referencedColumns: ["id"]
+ foreignKeyName: "space_members_space_id_fkey";
+ columns: ["space_id"];
+ isOneToOne: false;
+ referencedRelation: "spaces";
+ referencedColumns: ["id"];
},
{
- foreignKeyName: "space_members_user_id_fkey"
- columns: ["user_id"]
- isOneToOne: false
- referencedRelation: "users"
- referencedColumns: ["id"]
+ foreignKeyName: "space_members_user_id_fkey";
+ columns: ["user_id"];
+ isOneToOne: false;
+ referencedRelation: "users";
+ referencedColumns: ["id"];
}
- ]
- }
+ ];
+ };
spaces: {
Row: {
- created_at: string
- id: string
- metadata: Json | null
- name: string
- owner_id: string | null
- updated_at: string
- }
+ created_at: string;
+ id: string;
+ metadata: Json | null;
+ name: string;
+ owner_id: string | null;
+ updated_at: string;
+ };
Insert: {
- created_at?: string
- id?: string
- metadata?: Json | null
- name: string
- owner_id?: string | null
- updated_at?: string
- }
+ created_at?: string;
+ id?: string;
+ metadata?: Json | null;
+ name: string;
+ owner_id?: string | null;
+ updated_at?: string;
+ };
Update: {
- created_at?: string
- id?: string
- metadata?: Json | null
- name?: string
- owner_id?: string | null
- updated_at?: string
- }
+ created_at?: string;
+ id?: string;
+ metadata?: Json | null;
+ name?: string;
+ owner_id?: string | null;
+ updated_at?: string;
+ };
Relationships: [
{
- foreignKeyName: "spaces_owner_id_fkey"
- columns: ["owner_id"]
- isOneToOne: false
- referencedRelation: "users"
- referencedColumns: ["id"]
+ foreignKeyName: "spaces_owner_id_fkey";
+ columns: ["owner_id"];
+ isOneToOne: false;
+ referencedRelation: "users";
+ referencedColumns: ["id"];
}
- ]
- }
+ ];
+ };
users: {
Row: {
- active_space_id: string | null
- avatar_url: string | null
- created_at: string
- email: string
- full_name: string | null
- id: string
- onboarding_questions: Json | null
- stripe_customer_id: string | null
- stripe_subscription_id: string | null
- stripe_subscription_price_id: string | null
- stripe_subscription_status: string | null
- updated_at: string
- video_quota: number
- videos_created: number
- }
+ active_space_id: string | null;
+ avatar_url: string | null;
+ created_at: string;
+ email: string;
+ full_name: string | null;
+ id: string;
+ onboarding_questions: Json | null;
+ stripe_customer_id: string | null;
+ stripe_subscription_id: string | null;
+ stripe_subscription_price_id: string | null;
+ stripe_subscription_status: string | null;
+ updated_at: string;
+ video_quota: number;
+ videos_created: number;
+ };
Insert: {
- active_space_id?: string | null
- avatar_url?: string | null
- created_at?: string
- email: string
- full_name?: string | null
- id?: string
- onboarding_questions?: Json | null
- stripe_customer_id?: string | null
- stripe_subscription_id?: string | null
- stripe_subscription_price_id?: string | null
- stripe_subscription_status?: string | null
- updated_at?: string
- video_quota?: number
- videos_created?: number
- }
+ active_space_id?: string | null;
+ avatar_url?: string | null;
+ created_at?: string;
+ email: string;
+ full_name?: string | null;
+ id?: string;
+ onboarding_questions?: Json | null;
+ stripe_customer_id?: string | null;
+ stripe_subscription_id?: string | null;
+ stripe_subscription_price_id?: string | null;
+ stripe_subscription_status?: string | null;
+ updated_at?: string;
+ video_quota?: number;
+ videos_created?: number;
+ };
Update: {
- active_space_id?: string | null
- avatar_url?: string | null
- created_at?: string
- email?: string
- full_name?: string | null
- id?: string
- onboarding_questions?: Json | null
- stripe_customer_id?: string | null
- stripe_subscription_id?: string | null
- stripe_subscription_price_id?: string | null
- stripe_subscription_status?: string | null
- updated_at?: string
- video_quota?: number
- videos_created?: number
- }
+ active_space_id?: string | null;
+ avatar_url?: string | null;
+ created_at?: string;
+ email?: string;
+ full_name?: string | null;
+ id?: string;
+ onboarding_questions?: Json | null;
+ stripe_customer_id?: string | null;
+ stripe_subscription_id?: string | null;
+ stripe_subscription_price_id?: string | null;
+ stripe_subscription_status?: string | null;
+ updated_at?: string;
+ video_quota?: number;
+ videos_created?: number;
+ };
Relationships: [
{
- foreignKeyName: "users_active_space_id_fkey"
- columns: ["active_space_id"]
- isOneToOne: false
- referencedRelation: "spaces"
- referencedColumns: ["id"]
+ foreignKeyName: "users_active_space_id_fkey";
+ columns: ["active_space_id"];
+ isOneToOne: false;
+ referencedRelation: "spaces";
+ referencedColumns: ["id"];
}
- ]
- }
+ ];
+ };
videos: {
Row: {
- aws_bucket: string | null
- aws_region: string | null
- complete: boolean
- created_at: string
- duration: number | null
- id: string
- is_public: boolean
- metadata: Json | null
- name: string
- owner_id: string | null
- s3_url: string | null
- thumbnail_url: string | null
- updated_at: string
- }
+ aws_bucket: string | null;
+ aws_region: string | null;
+ complete: boolean;
+ created_at: string;
+ duration: number | null;
+ id: string;
+ is_public: boolean;
+ metadata: Json | null;
+ name: string;
+ owner_id: string | null;
+ s3_url: string | null;
+ thumbnail_url: string | null;
+ updated_at: string;
+ };
Insert: {
- aws_bucket?: string | null
- aws_region?: string | null
- complete?: boolean
- created_at?: string
- duration?: number | null
- id?: string
- is_public?: boolean
- metadata?: Json | null
- name?: string
- owner_id?: string | null
- s3_url?: string | null
- thumbnail_url?: string | null
- updated_at?: string
- }
+ aws_bucket?: string | null;
+ aws_region?: string | null;
+ complete?: boolean;
+ created_at?: string;
+ duration?: number | null;
+ id?: string;
+ is_public?: boolean;
+ metadata?: Json | null;
+ name?: string;
+ owner_id?: string | null;
+ s3_url?: string | null;
+ thumbnail_url?: string | null;
+ updated_at?: string;
+ };
Update: {
- aws_bucket?: string | null
- aws_region?: string | null
- complete?: boolean
- created_at?: string
- duration?: number | null
- id?: string
- is_public?: boolean
- metadata?: Json | null
- name?: string
- owner_id?: string | null
- s3_url?: string | null
- thumbnail_url?: string | null
- updated_at?: string
- }
+ aws_bucket?: string | null;
+ aws_region?: string | null;
+ complete?: boolean;
+ created_at?: string;
+ duration?: number | null;
+ id?: string;
+ is_public?: boolean;
+ metadata?: Json | null;
+ name?: string;
+ owner_id?: string | null;
+ s3_url?: string | null;
+ thumbnail_url?: string | null;
+ updated_at?: string;
+ };
Relationships: [
{
- foreignKeyName: "videos_owner_id_fkey"
- columns: ["owner_id"]
- isOneToOne: false
- referencedRelation: "users"
- referencedColumns: ["id"]
+ foreignKeyName: "videos_owner_id_fkey";
+ columns: ["owner_id"];
+ isOneToOne: false;
+ referencedRelation: "users";
+ referencedColumns: ["id"];
}
- ]
- }
- }
+ ];
+ };
+ };
Views: {
- [_ in never]: never
- }
+ [_ in never]: never;
+ };
Functions: {
citext:
| {
Args: {
- "": boolean
- }
- Returns: string
+ "": boolean;
+ };
+ Returns: string;
}
| {
Args: {
- "": string
- }
- Returns: string
+ "": string;
+ };
+ Returns: string;
}
| {
Args: {
- "": unknown
- }
- Returns: string
- }
+ "": unknown;
+ };
+ Returns: string;
+ };
citext_hash: {
Args: {
- "": string
- }
- Returns: number
- }
+ "": string;
+ };
+ Returns: number;
+ };
citextin: {
Args: {
- "": unknown
- }
- Returns: string
- }
+ "": unknown;
+ };
+ Returns: string;
+ };
citextout: {
Args: {
- "": string
- }
- Returns: unknown
- }
+ "": string;
+ };
+ Returns: unknown;
+ };
citextrecv: {
Args: {
- "": unknown
- }
- Returns: string
- }
+ "": unknown;
+ };
+ Returns: string;
+ };
citextsend: {
Args: {
- "": string
- }
- Returns: string
- }
- }
+ "": string;
+ };
+ Returns: string;
+ };
+ };
Enums: {
- user_role: "owner" | "admin" | "member"
- }
+ user_role: "owner" | "admin" | "member";
+ };
CompositeTypes: {
- [_ in never]: never
- }
- }
+ [_ in never]: never;
+ };
+ };
}
export type Tables<
@@ -310,7 +310,7 @@ export type Tables<
> = PublicTableNameOrOptions extends { schema: keyof Database }
? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
- Row: infer R
+ Row: infer R;
}
? R
: never
@@ -318,11 +318,11 @@ export type Tables<
Database["public"]["Views"])
? (Database["public"]["Tables"] &
Database["public"]["Views"])[PublicTableNameOrOptions] extends {
- Row: infer R
+ Row: infer R;
}
? R
: never
- : never
+ : never;
export type TablesInsert<
PublicTableNameOrOptions extends
@@ -333,17 +333,17 @@ export type TablesInsert<
: never = never
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
- Insert: infer I
+ Insert: infer I;
}
? I
: never
: PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
- Insert: infer I
+ Insert: infer I;
}
? I
: never
- : never
+ : never;
export type TablesUpdate<
PublicTableNameOrOptions extends
@@ -354,17 +354,17 @@ export type TablesUpdate<
: never = never
> = PublicTableNameOrOptions extends { schema: keyof Database }
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
- Update: infer U
+ Update: infer U;
}
? U
: never
: PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
- Update: infer U
+ Update: infer U;
}
? U
: never
- : never
+ : never;
export type Enums<
PublicEnumNameOrOptions extends
@@ -377,4 +377,4 @@ export type Enums<
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
: PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]
? Database["public"]["Enums"][PublicEnumNameOrOptions]
- : never
+ : never;