Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

wip: sign out button + notifications.rs

Richie McIlroy2e6459d5ca1b
diff --git a/Cargo.lock b/Cargo.lock
index 1823baf00..5842be07d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -206,6 +206,30 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "async-executor"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec"
+dependencies = [
+ "async-task",
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "slab",
+]
+
+[[package]]
+name = "async-fs"
+version = "2.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a"
+dependencies = [
+ "async-lock",
+ "blocking",
+ "futures-lite",
+]
+
[[package]]
name = "async-io"
version = "2.3.4"
@@ -1454,6 +1478,7 @@ dependencies = [
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-global-shortcut",
+ "tauri-plugin-notification",
"tauri-plugin-oauth",
"tauri-plugin-os",
"tauri-plugin-process",
@@ -1502,6 +1527,16 @@ dependencies = [
"dirs-sys",
]
+[[package]]
+name = "dirs-next"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
+dependencies = [
+ "cfg-if 1.0.0",
+ "dirs-sys-next",
+]
+
[[package]]
name = "dirs-sys"
version = "0.4.1"
@@ -1514,6 +1549,17 @@ dependencies = [
"windows-sys 0.48.0",
]
+[[package]]
+name = "dirs-sys-next"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
+dependencies = [
+ "libc",
+ "redox_users",
+ "winapi",
+]
+
[[package]]
name = "dispatch"
version = "0.2.0"
@@ -3255,6 +3301,19 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
+[[package]]
+name = "mac-notification-sys"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dce8f34f3717aa37177e723df6c1fc5fb02b2a1087374ea3fe0ea42316dc8f91"
+dependencies = [
+ "cc",
+ "dirs-next",
+ "objc-foundation",
+ "objc_id",
+ "time",
+]
+
[[package]]
name = "mach2"
version = "0.4.2"
@@ -3690,6 +3749,19 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
+[[package]]
+name = "notify-rust"
+version = "4.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5134a72dc570b178bff81b01e81ab14a6fcc015391ed4b3b14853090658cd3a3"
+dependencies = [
+ "log",
+ "mac-notification-sys",
+ "serde",
+ "tauri-winrt-notification",
+ "zbus",
+]
+
[[package]]
name = "ntapi"
version = "0.4.1"
@@ -4393,7 +4465,7 @@ checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016"
dependencies = [
"base64 0.22.1",
"indexmap 2.5.0",
- "quick-xml",
+ "quick-xml 0.32.0",
"serde",
"time",
]
@@ -4546,6 +4618,15 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
+[[package]]
+name = "quick-xml"
+version = "0.31.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "quick-xml"
version = "0.32.0"
@@ -6107,6 +6188,25 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "tauri-plugin-notification"
+version = "2.0.0-rc.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e69aaabfb7720083862ea35de37d9ad71b9465249762462ced38c2c92690a9e"
+dependencies = [
+ "log",
+ "notify-rust",
+ "rand 0.8.5",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "tauri",
+ "tauri-plugin",
+ "thiserror",
+ "time",
+ "url",
+]
+
[[package]]
name = "tauri-plugin-oauth"
version = "0.0.0-alpha.0"
@@ -6330,6 +6430,17 @@ dependencies = [
"toml 0.7.8",
]
+[[package]]
+name = "tauri-winrt-notification"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f89f5fb70d6f62381f5d9b2ba9008196150b40b75f3068eb24faeddf1c686871"
+dependencies = [
+ "quick-xml 0.31.0",
+ "windows 0.56.0",
+ "windows-version",
+]
+
[[package]]
name = "tempfile"
version = "3.12.0"
@@ -7349,6 +7460,16 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows"
+version = "0.56.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
+dependencies = [
+ "windows-core 0.56.0",
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows"
version = "0.57.0"
@@ -7409,6 +7530,18 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-core"
+version = "0.56.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6"
+dependencies = [
+ "windows-implement 0.56.0",
+ "windows-interface 0.56.0",
+ "windows-result 0.1.2",
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-core"
version = "0.57.0"
@@ -7434,6 +7567,17 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-implement"
+version = "0.56.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.75",
+]
+
[[package]]
name = "windows-implement"
version = "0.57.0"
@@ -7456,6 +7600,17 @@ dependencies = [
"syn 2.0.75",
]
+[[package]]
+name = "windows-interface"
+version = "0.56.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.75",
+]
+
[[package]]
name = "windows-interface"
version = "0.57.0"
@@ -7865,9 +8020,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b8e3d6ae3342792a6cc2340e4394334c7402f3d793b390d2c5494a4032b3030"
dependencies = [
"async-broadcast",
+ "async-executor",
+ "async-fs",
+ "async-io",
+ "async-lock",
"async-process",
"async-recursion",
+ "async-task",
"async-trait",
+ "blocking",
"derivative",
"enumflags2",
"event-listener",
diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml
index 6798c4d41..210069e4d 100644
--- a/apps/desktop/src-tauri/Cargo.toml
+++ b/apps/desktop/src-tauri/Cargo.toml
@@ -29,6 +29,7 @@ tauri-plugin-os = "2.0.0-rc.0"
tauri-plugin-process = "2.0.0-rc.0"
tauri-plugin-decorum = "1.0.0"
tauri-plugin-dialog = "2.0.0-rc.0"
+tauri-plugin-notification = "2.0.0-rc.0"
tauri-plugin-updater = "2.0.0-rc.0"
tauri-plugin-oauth = { git = "https://github.com/FabianLars/tauri-plugin-oauth", branch = "v2" }
tauri-plugin-global-shortcut = "2.0.0-rc.0"
diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json
index c478ad301..ffad27e2e 100644
--- a/apps/desktop/src-tauri/capabilities/default.json
+++ b/apps/desktop/src-tauri/capabilities/default.json
@@ -26,6 +26,7 @@
"store:default",
"process:default",
"oauth:allow-start",
- "updater:default"
+ "updater:default",
+ "notification:default"
]
}
diff --git a/apps/desktop/src-tauri/src/auth.rs b/apps/desktop/src-tauri/src/auth.rs
index 68338f723..939b9fe81 100644
--- a/apps/desktop/src-tauri/src/auth.rs
+++ b/apps/desktop/src-tauri/src/auth.rs
@@ -48,6 +48,12 @@ impl AuthStore {
.await
.map_err(|e| e.to_string())?;
+ if response.status() == reqwest::StatusCode::UNAUTHORIZED {
+ println!("Authentication expired. Please log in again.");
+ Self::set(app, None)?;
+ return Err("Authentication expired. Please log in again.".to_string());
+ }
+
if !response.status().is_success() {
let error_msg = format!("Failed to fetch plan: {}", response.status());
return Err(error_msg);
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index a05ed2230..44accbb53 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -10,6 +10,7 @@ mod flags;
mod general_settings;
mod hotkeys;
mod macos;
+mod notifications;
mod permissions;
mod playback;
mod project_recordings;
@@ -52,6 +53,7 @@ use std::{
use tauri::{AppHandle, Manager, State, WebviewUrl, WebviewWindow, WindowEvent};
use tauri_nspanel::{cocoa::appkit::NSMainMenuWindowLevel, ManagerExt};
use tauri_plugin_decorum::WebviewWindowExt;
+use tauri_plugin_notification::PermissionState;
use tauri_plugin_shell::ShellExt;
use tauri_specta::Event;
use tokio::io::AsyncWriteExt;
@@ -1413,11 +1415,14 @@ async fn list_audio_devices() -> Result<Vec<String>, ()> {
#[tauri::command(async)]
#[specta::specta]
fn open_main_window(app: AppHandle) {
+ println!("Attempting to open main window");
if let Some(window) = app.get_webview_window("main") {
+ println!("Main window already exists, setting focus");
window.set_focus().ok();
return;
}
+ println!("Creating new main window");
let Some(window) = WebviewWindow::builder(&app, "main", tauri::WebviewUrl::App("/".into()))
.title("Cap")
.inner_size(300.0, 375.0)
@@ -1432,12 +1437,21 @@ fn open_main_window(app: AppHandle) {
.build()
.ok()
else {
+ println!("Failed to create main window");
return;
};
+ println!("Creating overlay titlebar");
window.create_overlay_titlebar().unwrap();
#[cfg(target_os = "macos")]
- window.set_traffic_lights_inset(14.0, 22.0).unwrap();
+ {
+ println!("Setting traffic lights inset for macOS");
+ window.set_traffic_lights_inset(14.0, 22.0).unwrap();
+ }
+
+ println!("Showing main window");
+ window.show().unwrap();
+ println!("Main window opened successfully");
}
#[tauri::command]
@@ -1550,6 +1564,8 @@ async fn upload_rendered_video(
return Ok(UploadResult::NotAuthenticated);
};
+ notifications::send_notification(&_app, notifications::NotificationType::ShareableLinkCopied);
+
// Check if user has an upgraded plan
if !auth.is_upgraded() {
// Fetch and update plan information
@@ -2075,6 +2091,32 @@ async fn set_general_settings(
GeneralSettingsStore::set(&app, settings)
}
+#[tauri::command]
+#[specta::specta]
+async fn delete_auth_open_signin(app: AppHandle) -> Result<(), String> {
+ AuthStore::set(&app, None).map_err(|e| e.to_string())?;
+
+ if let Some(window) = app.get_webview_window("settings") {
+ window.close().ok();
+ }
+
+ if let Some(window) = app.get_webview_window("camera") {
+ window.close().ok();
+ }
+
+ if let Some(window) = app.get_webview_window("main") {
+ window.close().ok();
+ }
+
+ while app.get_webview_window("main").is_some() {
+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;
+ }
+
+ open_main_window(app.clone());
+
+ Ok(())
+}
+
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let specta_builder = tauri_specta::Builder::new()
@@ -2127,7 +2169,8 @@ pub fn run() {
check_upgraded_and_update,
open_external_link,
hotkeys::set_hotkey,
- set_general_settings
+ set_general_settings,
+ delete_auth_open_signin
])
.events(tauri_specta::collect_events![
RecordingOptionsChanged,
@@ -2168,13 +2211,27 @@ pub fn run() {
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_oauth::init())
.plugin(tauri_plugin_updater::Builder::new().build())
+ .plugin(tauri_plugin_notification::init())
.invoke_handler(specta_builder.invoke_handler())
.setup(move |app| {
specta_builder.mount_events(app);
hotkeys::init(app.handle());
general_settings::init(app.handle());
+
let app_handle = app.handle().clone();
+ #[cfg(target_os = "macos")]
+ {
+ use tauri_plugin_notification::NotificationExt;
+
+ let notification_permission = app.notification().permission_state().unwrap();
+ if notification_permission != PermissionState::Granted {
+ app.notification()
+ .request_permission()
+ .expect("failed to request notification permission");
+ }
+ }
+
if permissions::do_permissions_check(true).necessary_granted() {
open_main_window(app_handle.clone());
} else {
diff --git a/apps/desktop/src-tauri/src/notifications.rs b/apps/desktop/src-tauri/src/notifications.rs
new file mode 100644
index 000000000..58554f482
--- /dev/null
+++ b/apps/desktop/src-tauri/src/notifications.rs
@@ -0,0 +1,36 @@
+use tauri_plugin_notification::NotificationExt;
+
+pub enum NotificationType {
+ VideoSaved,
+ VideoCopiedToClipboard,
+ ShareableLinkCopied,
+}
+
+impl NotificationType {
+ fn details(&self) -> (&'static str, &'static str) {
+ match self {
+ NotificationType::VideoSaved => {
+ ("Video Saved", "Your video has been successfully saved.")
+ }
+ NotificationType::VideoCopiedToClipboard => (
+ "Video Copied",
+ "Your video has been copied to the clipboard.",
+ ),
+ NotificationType::ShareableLinkCopied => (
+ "Link Copied",
+ "Shareable link has been copied to the clipboard.",
+ ),
+ }
+ }
+}
+
+pub fn send_notification(app: &tauri::AppHandle, notification_type: NotificationType) {
+ let (title, body) = notification_type.details();
+
+ println!("Sending notification: Title: '{}', Body: '{}'", title, body);
+
+ match app.notification().builder().title(title).body(body).show() {
+ Ok(_) => println!("Notification sent successfully"),
+ Err(e) => eprintln!("Failed to send notification: {}", e),
+ }
+}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsx
index fc0b57962..516e2c112 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx
@@ -1,50 +1,63 @@
import { A, type RouteSectionProps, useLocation } from "@solidjs/router";
import { cx } from "cva";
import { For } from "solid-js";
+import { Button } from "@cap/ui-solid";
+import { commands } from "~/utils/tauri";
export default function (props: RouteSectionProps) {
const location = useLocation();
+ const handleSignOut = async () => {
+ await commands.deleteAuthOpenSignin();
+ };
+
return (
<div class="h-full flex flex-row divide-x divide-gray-200 text-[0.875rem] leading-[1.25rem]">
- <ul class="min-w-[12rem] h-full p-[0.625rem] space-y-2">
- <For
- each={[
- { href: "general", name: "General", icon: IconCapSettings },
- { href: "hotkeys", name: "Shortcuts", icon: IconCapHotkeys },
- {
- href: "recordings",
- name: "Previous Recordings",
- icon: IconLucideVideo,
- },
- {
- href: "screenshots",
- name: "Previous Screenshots",
- icon: IconLucideCamera,
- },
- ]}
- >
- {(item) => {
- const isActive = () => location.pathname.includes(item.href);
- return (
- <li>
- <A
- href={item.href}
- class={cx(
- "rounded-lg h-[2rem] px-[0.375rem] flex flex-row items-center gap-[0.375rem] transition-colors",
- isActive()
- ? "bg-blue-50 border border-blue-200 text-blue-700"
- : "hover:bg-gray-100"
- )}
- >
- <item.icon class="size-[1.25rem]" />
- <span>{item.name}</span>
- </A>
- </li>
- );
- }}
- </For>
- </ul>
+ <div class="flex flex-col">
+ <ul class="min-w-[12rem] h-full p-[0.625rem] space-y-2">
+ <For
+ each={[
+ { href: "general", name: "General", icon: IconCapSettings },
+ { href: "hotkeys", name: "Shortcuts", icon: IconCapHotkeys },
+ {
+ href: "recordings",
+ name: "Previous Recordings",
+ icon: IconLucideVideo,
+ },
+ {
+ href: "screenshots",
+ name: "Previous Screenshots",
+ icon: IconLucideCamera,
+ },
+ ]}
+ >
+ {(item) => {
+ const isActive = () => location.pathname.includes(item.href);
+ return (
+ <li>
+ <A
+ href={item.href}
+ class={cx(
+ "rounded-lg h-[2rem] px-[0.375rem] flex flex-row items-center gap-[0.375rem] transition-colors",
+ isActive()
+ ? "bg-blue-50 border border-blue-200 text-blue-700"
+ : "hover:bg-gray-100"
+ )}
+ >
+ <item.icon class="size-[1.25rem]" />
+ <span>{item.name}</span>
+ </A>
+ </li>
+ );
+ }}
+ </For>
+ </ul>
+ <div class="p-[0.625rem]">
+ <Button onClick={handleSignOut} variant="secondary" class="w-full">
+ Sign Out
+ </Button>
+ </div>
+ </div>
<div class="flex-1 bg-gray-50">{props.children}</div>
</div>
);
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 32639fd41..a4252aba7 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -1,8 +1,18 @@
-import { createResource, Show } from "solid-js";
+import { createResource, Show, For } from "solid-js";
import { createStore } from "solid-js/store";
import { generalSettingsStore } from "~/store";
import { commands, type GeneralSettingsStore } from "~/utils/tauri";
+const settingsList = [
+ {
+ key: "upload_individual_files",
+ label: "Upload individual recording files when creating shareable link",
+ description:
+ "Warning: this will cause shareable link uploads to become significantly slower, since multiple files will be uploaded.",
+ },
+ // Add more settings here as needed
+];
+
export default function GeneralSettings() {
const [store] = createResource(() => generalSettingsStore.get());
@@ -24,51 +34,70 @@ function Inner(props: { store: GeneralSettingsStore | null }) {
props.store ?? { upload_individual_files: false }
);
- const handleChange = async (uploadIndividualFiles: boolean) => {
- setSettings("upload_individual_files", uploadIndividualFiles);
+ const handleChange = async (key: string, value: boolean) => {
+ setSettings(key as keyof GeneralSettingsStore, value);
await commands.setGeneralSettings({
- upload_individual_files: uploadIndividualFiles,
+ ...settings,
+ [key]: value,
});
};
return (
<div class="flex flex-col w-full h-full divide-y divide-gray-200 pt-1 pb-12">
- <div class="flex-1 p-4 space-y-2">
- <div class="flex items-center justify-between">
- <p>Upload individual recording files when creating shareable link</p>
- <button
- type="button"
- role="switch"
- aria-checked={settings.upload_individual_files}
- data-state={
- settings.upload_individual_files ? "checked" : "unchecked"
- }
- value={settings.upload_individual_files ? "on" : "off"}
- class={`peer inline-flex h-4 w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 ${
- settings.upload_individual_files
- ? "bg-blue-400 border-blue-400"
- : "bg-gray-300 border-gray-300"
- }`}
- onClick={() => handleChange(!settings.upload_individual_files)}
- >
- <span
- data-state={
- settings.upload_individual_files ? "checked" : "unchecked"
- }
- class={`pointer-events-none block h-4 w-4 rounded-full bg-gray-50 shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 border-2 ${
- settings.upload_individual_files
- ? "border-blue-400"
- : "border-gray-300"
- }`}
- />
- </button>
- </div>
- <div>
- <p class="text-xs text-gray-400">
- Warning: this will cause shareable link uploads to become
- significantly slower, since multiple files will be uploaded.
- </p>
- </div>
+ <div class="flex-1 p-4 space-y-4">
+ <For each={settingsList}>
+ {(setting) => (
+ <div class="space-y-2">
+ <div class="flex items-center justify-between">
+ <p>{setting.label}</p>
+ <button
+ type="button"
+ role="switch"
+ aria-checked={
+ settings[setting.key as keyof GeneralSettingsStore]
+ }
+ data-state={
+ settings[setting.key as keyof GeneralSettingsStore]
+ ? "checked"
+ : "unchecked"
+ }
+ value={
+ settings[setting.key as keyof GeneralSettingsStore]
+ ? "on"
+ : "off"
+ }
+ class={`peer inline-flex h-4 w-8 shrink-0 cursor-pointer items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 ${
+ settings[setting.key as keyof GeneralSettingsStore]
+ ? "bg-blue-400 border-blue-400"
+ : "bg-gray-300 border-gray-300"
+ }`}
+ onClick={() =>
+ handleChange(
+ setting.key,
+ !settings[setting.key as keyof GeneralSettingsStore]
+ )
+ }
+ >
+ <span
+ data-state={
+ settings[setting.key as keyof GeneralSettingsStore]
+ ? "checked"
+ : "unchecked"
+ }
+ class={`pointer-events-none block h-4 w-4 rounded-full bg-gray-50 shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 border-2 ${
+ settings[setting.key as keyof GeneralSettingsStore]
+ ? "border-blue-400"
+ : "border-gray-300"
+ }`}
+ />
+ </button>
+ </div>
+ {setting.description && (
+ <p class="text-xs text-gray-400">{setting.description}</p>
+ )}
+ </div>
+ )}
+ </For>
</div>
</div>
);
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 0933344dd..33552d455 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -286,6 +286,14 @@ async setGeneralSettings(settings: GeneralSettingsStore) : Promise<Result<null,
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 };
+}
}
}