Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix updater (hopefully)
Brendan Allan0e919e710e8e
diff --git a/apps/desktop/src-tauri/Info.plist b/apps/desktop/src-tauri/Info.plistindex cdd60bb4c..b6bcad2c9 100644--- a/apps/desktop/src-tauri/Info.plist+++ b/apps/desktop/src-tauri/Info.plist@@ -22,10 +22,10 @@</dict></array><key>NSCameraUsageDescription</key>- <string>Request camera access for WebRTC</string>+ <string>Cap uses your camera to record you in your Caps</string><key>NSMicrophoneUsageDescription</key>- <string>Request microphone access for WebRTC</string>+ <string>Cap uses your microphone to record you in your Caps</string><key>NSScreenCaptureUsageDescription</key>- <string>Request screen capture access</string>+ <string>Cap captures your screen as part of recording your Caps</string></dict></plist>diff --git a/apps/desktop/src-tauri/src/display.rs b/apps/desktop/src-tauri/src/display.rsindex 03f595742..4918c57d9 100644--- a/apps/desktop/src-tauri/src/display.rs+++ b/apps/desktop/src-tauri/src/display.rs@@ -33,9 +33,13 @@ pub enum CaptureTarget {Window { id: u32 },}-#[tauri::command]+#[tauri::command(async)]#[specta::specta]pub fn list_capture_windows() -> Vec<CaptureWindow> {+ if !scap::has_permission() {+ return vec![];+ }+let targets = scap::get_all_targets();let windows = macos::get_on_screen_windows();diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 03c04f7b9..3b645d407 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -888,9 +888,11 @@ fn show_previous_recordings_window(app: AppHandle) {return;};- let monitor = app.primary_monitor().unwrap().unwrap();+ let Some(monitor) = app.primary_monitor().ok().flatten() else {+ return;+ };- let window = WebviewWindow::builder(+ let Some(window) = WebviewWindow::builder(&app,PREV_RECORDINGS_WINDOW,tauri::WebviewUrl::App("/prev-recordings".into()),@@ -911,7 +913,9 @@ fn show_previous_recordings_window(app: AppHandle) {).position(0.0, 0.0).build()- .unwrap();+ .ok() else {+ return;+ };use tauri_nspanel::cocoa::appkit::NSWindowCollectionBehavior;use tauri_nspanel::WebviewWindowExt as NSPanelWebviewWindowExt;@@ -1114,6 +1118,13 @@ fn open_in_finder(path: PathBuf) {#[tauri::command]#[specta::specta]async fn list_audio_devices() -> Result<Vec<String>, ()> {+ if !permissions::do_permissions_check(false)+ .microphone+ .permitted()+ {+ return Ok(vec![]);+ }+tokio::task::spawn_blocking(|| {let devices = audio::get_input_devices();@@ -1126,7 +1137,7 @@ async fn list_audio_devices() -> Result<Vec<String>, ()> {#[tauri::command(async)]#[specta::specta]fn open_main_window(app: AppHandle) {- // tokio::spawn(updater::check_for_updates(app.clone()));+ tokio::spawn(updater::check_for_updates(app.clone()));if let Some(window) = app.get_webview_window("main") {window.set_focus().ok();diff --git a/apps/desktop/src-tauri/src/permissions.rs b/apps/desktop/src-tauri/src/permissions.rsindex d6365d566..3ac81ed6c 100644--- a/apps/desktop/src-tauri/src/permissions.rs+++ b/apps/desktop/src-tauri/src/permissions.rs@@ -85,7 +85,7 @@ pub enum OSPermissionStatus {}impl OSPermissionStatus {- fn permitted(&self) -> bool {+ pub fn permitted(&self) -> bool {match self {Self::NotNeeded | Self::Granted => true,_ => false,@@ -96,9 +96,9 @@ impl OSPermissionStatus {#[derive(Serialize, Deserialize, Debug, specta::Type)]#[serde(rename_all = "camelCase")]pub struct OSPermissionsCheck {- screen_recording: OSPermissionStatus,- microphone: OSPermissionStatus,- camera: OSPermissionStatus,+ pub screen_recording: OSPermissionStatus,+ pub microphone: OSPermissionStatus,+ pub camera: OSPermissionStatus,}impl OSPermissionsCheck {diff --git a/apps/desktop/src-tauri/src/updater.rs b/apps/desktop/src-tauri/src/updater.rsindex a4eab156b..31399ec8c 100644--- a/apps/desktop/src-tauri/src/updater.rs+++ b/apps/desktop/src-tauri/src/updater.rs@@ -1,3 +1,5 @@+use std::time::Duration;+use tauri::{AppHandle, Manager};use tauri_plugin_dialog::DialogExt;use tauri_plugin_updater::UpdaterExt;@@ -16,6 +18,7 @@ pub async fn check_for_updates(app: AppHandle) -> Result<(), ()> {};let (tx, rx) = tokio::sync::oneshot::channel();+app.dialog().message(format!("Version {} of Cap is available, would you like to install it?",@@ -24,7 +27,7 @@ pub async fn check_for_updates(app: AppHandle) -> Result<(), ()> {.title("Update Cap").ok_button_label("Update").cancel_button_label("Ignore")- .show(|install| {+ .show(move |install| {tx.send(install).ok();});@@ -32,7 +35,14 @@ pub async fn check_for_updates(app: AppHandle) -> Result<(), ()> {return Ok(());}- update.download_and_install(|_, _| {}, || {}).await.unwrap();+ update+ .download_and_install(+ |_, _| {},+ || {+ },+ )+ .await+ .unwrap();let (tx, rx) = tokio::sync::oneshot::channel();app.dialog()@@ -47,10 +57,6 @@ pub async fn check_for_updates(app: AppHandle) -> Result<(), ()> {tx.send(restart).ok();});- for (_, window) in app.webview_windows() {- window.close().ok();- }-if rx.await.unwrap() {app.restart();}