Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

add recording stop behaviour picker

Brendan Allan76f205d93a82
diff --git a/Cargo.lock b/Cargo.lock
index 6ba26026e..f7524d7c7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1222,9 +1222,9 @@ dependencies = [
[[package]]
name = "cargo_toml"
-version = "0.21.0"
+version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fbd1fe9db3ebf71b89060adaf7b0504c2d6a425cf061313099547e382c2e472"
+checksum = "02260d489095346e5cafd04dea8e8cb54d1d74fcd759022a9b72986ebe9a1257"
dependencies = [
"serde",
"toml",
@@ -5143,9 +5143,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.19.0"
+version = "1.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+checksum = "c2806eaa3524762875e21c3dcd057bc4b7bfa01ce4da8d46be1cd43649e1cc6b"
[[package]]
name = "open"
@@ -7260,9 +7260,9 @@ dependencies = [
[[package]]
name = "tao"
-version = "0.32.4"
+version = "0.32.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86e71522de6a4537e8f6a5750984dacdb231df3494c5ffbf065b76b9108a457e"
+checksum = "63c8b1020610b9138dd7b1e06cf259ae91aa05c30f3bd0d6b42a03997b92dec1"
dependencies = [
"bitflags 2.6.0",
"core-foundation 0.10.0",
@@ -7339,9 +7339,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f32eadd4a507f1b61e4fd1f792d0ed4184127a3241ff5bcb1848b9a574a58d6"
+checksum = "511dd38065a5d3b36c33cdba4362b99a40a5103bebcd4aebb930717e7c8ba292"
dependencies = [
"anyhow",
"bytes",
@@ -7392,9 +7392,9 @@ dependencies = [
[[package]]
name = "tauri-build"
-version = "2.0.6"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51a2e96f3c0baa0581656bb58e6fdd0f7c9c31eaf6721a0c08689d938fe85f2d"
+checksum = "7ffa8732a66f90903f5a585215f3cf1e87988d0359bc88c18a502efe7572c1de"
dependencies = [
"anyhow",
"cargo_toml",
@@ -7414,9 +7414,9 @@ dependencies = [
[[package]]
name = "tauri-codegen"
-version = "2.0.5"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e357ec3daf8faad1029bc7109e7f5b308ceb63b6073d110d7388923a4cce5e55"
+checksum = "c266a247f14d63f40c6282c2653a8bac5cc3d482ca562a003a88513653ea817a"
dependencies = [
"base64 0.22.1",
"brotli",
@@ -7441,9 +7441,9 @@ dependencies = [
[[package]]
name = "tauri-macros"
-version = "2.0.5"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "447ee4dd94690d77f1422f2b57e783c654ba75c535ad6f6e727887330804fff2"
+checksum = "f47a1cf94b3bd6c4dc37dce1a43fc96120ff29a91757f0ab3cf713c7ad846e7c"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -7455,8 +7455,8 @@ dependencies = [
[[package]]
name = "tauri-nspanel"
-version = "2.0.0-beta"
-source = "git+https://github.com/ahkohd/tauri-nspanel?branch=v2#07b1a04efee07c10b5eb4bfe3af71e32957d2d7a"
+version = "2.0.1"
+source = "git+https://github.com/ahkohd/tauri-nspanel?branch=v2#356843c8433f89feea4f0f666be8b8d73715a57a"
dependencies = [
"bitflags 2.6.0",
"block",
@@ -7471,9 +7471,9 @@ dependencies = [
[[package]]
name = "tauri-plugin"
-version = "2.0.2"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fa4e6c94cb1d635f65a770c69e23de1bc054b0e4c554fa037a7cc7676333d39"
+checksum = "9972871fcbddf16618f70412d965d4d845cd4b76d03fff168709961ef71e5cdf"
dependencies = [
"anyhow",
"glob",
@@ -7798,10 +7798,11 @@ dependencies = [
[[package]]
name = "tauri-runtime"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e758a405ab39e25f4d1235c5f06fe563f44b01ee18bbe38ddec5356d4f581908"
+checksum = "9e9c7bce5153f1ca7bc45eba37349b31ba50e975e28edc8b5766c5ec02b0b63a"
dependencies = [
+ "cookie",
"dpi",
"gtk",
"http",
@@ -7817,9 +7818,9 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ef46e0c9c30d3524990cb10556f82cde0aa2281e9600e7ed2f499842db8b080"
+checksum = "087188020fd6facb8578fe9b38e81fa0fe5fb85744c73da51a299f94a530a1e3"
dependencies = [
"gtk",
"http",
@@ -7828,6 +7829,7 @@ dependencies = [
"objc2 0.6.0",
"objc2-app-kit 0.3.0",
"objc2-foundation 0.3.0",
+ "once_cell",
"percent-encoding",
"raw-window-handle",
"softbuffer",
@@ -7871,10 +7873,11 @@ dependencies = [
[[package]]
name = "tauri-utils"
-version = "2.2.0"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "107a959dbd5ff53d89a98f6f2e3e987c611334141a43630caae1d80e79446dd6"
+checksum = "82dcced4014e59af9790cc22f5d271df3be09ecd6728ec68861642553c8d01b7"
dependencies = [
+ "anyhow",
"brotli",
"cargo_metadata",
"ctor",
@@ -9092,7 +9095,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -9800,9 +9803,8 @@ dependencies = [
[[package]]
name = "wry"
-version = "0.50.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a5eabce267929af61619166232d5221aeec2d7af8712bc33cf54a78416ad711"
+version = "0.50.5"
+source = "git+https://github.com/CapSoftware/wry?rev=293f510#293f510b4096444025110ab3b68722ddc5bc0b4d"
dependencies = [
"base64 0.22.1",
"block2 0.6.0",
diff --git a/Cargo.toml b/Cargo.toml
index a43b204ab..8b425a3f9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ tokio = { version = "1.39.3", features = [
"rt-multi-thread",
"time",
] }
-tauri = { version = "2.3.0", features = ["specta"] }
+tauri = { version = "2.4.0", features = ["specta"] }
specta = { version = "=2.0.0-rc.20", features = [
"derive",
"serde_json",
@@ -48,4 +48,5 @@ windows-sys = "0.59.0"
windows-capture = "1.4.2"
[patch.crates-io]
-screencapturekit = { git = "https://github.com/CapSoftware/screencapturekit-rs", rev = "7ff1e103742e56c8f6c2e940b5e52684ed0bed69" }
+screencapturekit = { git = "https://github.com/CapSoftware/screencapturekit-rs", rev = "7ff1e103742e56c8f6c2e940b5e52684ed0bed69" } # branch = "cap-main"
+wry = { git = "https://github.com/CapSoftware/wry", rev = "293f510" } # branch = "cap"
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index fdbc9c435..fa8694bee 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -47,7 +47,7 @@
"@tauri-apps/plugin-shell": ">=2.0.1",
"@tauri-apps/plugin-store": "2.1.0",
"@tauri-apps/plugin-updater": "2.0.0",
- "@ts-rest/core": "^3.51.0",
+ "@ts-rest/core": "^3.52.1",
"@types/react-tooltip": "^4.2.4",
"cva": "npm:class-variance-authority@^0.7.0",
"effect": "^3.7.2",
diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml
index d2cd299e6..97bd864d2 100644
--- a/apps/desktop/src-tauri/Cargo.toml
+++ b/apps/desktop/src-tauri/Cargo.toml
@@ -12,7 +12,7 @@ name = "cap_desktop"
crate-type = ["lib", "cdylib", "staticlib"]
[build-dependencies]
-tauri-build = { version = "2.0.5", features = [] }
+tauri-build = { version = "2.1.0", features = [] }
[target.'cfg(target_os = "macos")'.build-dependencies]
swift-rs = { version = "1.0.6", features = ["build"] }
@@ -42,6 +42,7 @@ tauri-plugin-window-state = "2.2.0"
tauri-plugin-positioner = "2.2.0"
tauri-plugin-deep-link = "2.2.0"
tauri-plugin-clipboard-manager = "2.2.1"
+tauri-plugin-opener = "2.2.6"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.111"
@@ -89,7 +90,6 @@ relative-path = "1.9.3"
cap-fail = { version = "0.1.0", path = "../../../crates/fail" }
tokio-stream = { version = "0.1.17", features = ["sync"] }
md5 = "0.7.0"
-tauri-plugin-opener = "2.2.6"
[target.'cfg(target_os = "macos")'.dependencies]
core-graphics = "0.24.0"
diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rs
index 6caa5651d..3446b4699 100644
--- a/apps/desktop/src-tauri/src/general_settings.rs
+++ b/apps/desktop/src-tauri/src/general_settings.rs
@@ -1,11 +1,26 @@
use serde::{Deserialize, Serialize};
use serde_json::json;
use specta::Type;
-use std::sync::Mutex;
-use tauri::{AppHandle, Manager, Wry};
+use tauri::{AppHandle, Wry};
use tauri_plugin_store::StoreExt;
use uuid::Uuid;
+#[derive(Default, Serialize, Deserialize, Type, Debug)]
+#[serde(rename_all = "camelCase")]
+pub enum PostStudioRecordingBehaviour {
+ #[default]
+ OpenEditor,
+ ShowOverlay,
+}
+
+#[derive(Default, Serialize, Deserialize, Type, Debug)]
+#[serde(rename_all = "camelCase")]
+pub enum MainWindowRecordingStartBehaviour {
+ #[default]
+ Close,
+ Minimise,
+}
+
#[derive(Serialize, Deserialize, Type, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GeneralSettingsStore {
@@ -14,8 +29,6 @@ pub struct GeneralSettingsStore {
#[serde(default)]
pub upload_individual_files: bool,
#[serde(default)]
- pub open_editor_after_recording: bool,
- #[serde(default)]
pub hide_dock_icon: bool,
#[serde(default = "true_b")]
pub haptics_enabled: bool,
@@ -36,6 +49,13 @@ pub struct GeneralSettingsStore {
pub last_version: Option<String>,
#[serde(default)]
pub window_transparency: bool,
+ #[serde(default)]
+ pub post_studio_recording_behaviour: PostStudioRecordingBehaviour,
+ #[serde(default)]
+ pub main_window_recording_start_behaviour: MainWindowRecordingStartBehaviour,
+ #[serde(default, alias = "open_editor_after_recording")]
+ #[deprecated]
+ _open_editor_after_recording: bool,
}
#[derive(Serialize, Deserialize, Type, Debug)]
@@ -52,7 +72,6 @@ impl Default for GeneralSettingsStore {
Self {
instance_id: uuid::Uuid::new_v4(),
upload_individual_files: false,
- open_editor_after_recording: false,
hide_dock_icon: false,
haptics_enabled: true,
auto_create_shareable_link: false,
@@ -63,6 +82,9 @@ impl Default for GeneralSettingsStore {
commercial_license: None,
last_version: None,
window_transparency: false,
+ post_studio_recording_behaviour: PostStudioRecordingBehaviour::OpenEditor,
+ main_window_recording_start_behaviour: MainWindowRecordingStartBehaviour::Close,
+ _open_editor_after_recording: false,
}
}
}
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index aa3674f17..7fb602b61 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1076,6 +1076,12 @@ fn close_recordings_overlay_window(app: AppHandle) {
panel.close();
}
}
+ #[cfg(not(target_os = "macos"))]
+ {
+ if let Some(window) = CapWindowId::RecordingsOverlay.get() {
+ let _ = window.close();
+ }
+ }
}
#[tauri::command(async)]
@@ -2243,8 +2249,6 @@ pub async fn run(recording_logging_handle: LoggingHandle) {
ShowCapWindow::Main.show(&app).ok();
}
- ShowCapWindow::RecordingsOverlay.show(&app).ok();
-
audio_meter::spawn_event_emitter(app.clone(), audio_input_rx);
tray::create_tray(&app).unwrap();
diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs
index 58d394313..0a589249a 100644
--- a/apps/desktop/src-tauri/src/main.rs
+++ b/apps/desktop/src-tauri/src/main.rs
@@ -8,9 +8,9 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
fn main() {
// We have to hold onto the ClientInitGuard until the very end
- let _guard = if dotenvy_macro::dotenv!("CAP_DESKTOP_SENTRY_URL") != "" {
+ let _guard = std::option_env!("CAP_DESKTOP_SENTRY_URL").map(|url| {
Some(sentry::init((
- dotenvy_macro::dotenv!("CAP_DESKTOP_SENTRY_URL"),
+ url,
sentry::ClientOptions {
release: sentry::release_name!(),
debug: cfg!(debug_assertions),
@@ -36,9 +36,7 @@ fn main() {
..Default::default()
},
)))
- } else {
- None
- };
+ });
let (layer, handle) = tracing_subscriber::reload::Layer::new(None::<DynLoggingLayer>);
diff --git a/apps/desktop/src-tauri/src/recording.rs b/apps/desktop/src-tauri/src/recording.rs
index 114f40ead..f6cbcac32 100644
--- a/apps/desktop/src-tauri/src/recording.rs
+++ b/apps/desktop/src-tauri/src/recording.rs
@@ -1,10 +1,12 @@
-use std::{path::PathBuf, sync::Arc};
+use std::{path::PathBuf, sync::Arc, time::Duration};
use crate::{
audio::AppSounds,
auth::AuthStore,
create_screenshot,
- general_settings::GeneralSettingsStore,
+ general_settings::{
+ GeneralSettingsStore, MainWindowRecordingStartBehaviour, PostStudioRecordingBehaviour,
+ },
open_editor, open_external_link,
presets::PresetsStore,
upload::{get_s3_config, prepare_screenshot_upload, upload_video, InstantMultipartUpload},
@@ -313,7 +315,19 @@ pub async fn start_recording(
});
if let Some(window) = CapWindowId::Main.get(&app) {
- window.minimize().ok();
+ match GeneralSettingsStore::get(&app)
+ .ok()
+ .flatten()
+ .map(|s| s.main_window_recording_start_behaviour)
+ .unwrap_or_default()
+ {
+ MainWindowRecordingStartBehaviour::Close => {
+ let _ = window.close();
+ }
+ MainWindowRecordingStartBehaviour::Minimise => {
+ let _ = window.minimize();
+ }
+ }
}
if let Some(window) = CapWindowId::InProgressRecording.get(&app) {
@@ -379,32 +393,23 @@ async fn handle_recording_end(
// Clear current recording, just in case :)
state.current_recording.take();
+ if let Some(recording) = recording {
+ handle_recording_finish(&app, recording).await?;
+ };
+
+ let _ = state.recording_logging_handle.reload(None);
+
if let Some(window) = CapWindowId::InProgressRecording.get(&app) {
- window.hide().unwrap();
+ let _ = window.close();
}
if let Some(window) = CapWindowId::Main.get(&app) {
window.unminimize().ok();
}
- // Store the link for opening later if we have one from an instant recording
- let mut shareable_link = None;
-
- if let Some(recording) = recording {
- shareable_link = handle_recording_finish(&app, recording).await?;
- };
-
- state.recording_logging_handle.reload(None);
-
// Play sound to indicate recording has stopped
AppSounds::StopRecording.play();
- // Now that recording has fully stopped and sound has played, open the link if available
- if let Some(link) = shareable_link {
- // Open link after sound plays, giving user clear indication recording has ended
- open_external_link(app.clone(), link).ok();
- }
-
CurrentRecordingChanged.emit(&app).ok();
Ok(())
@@ -414,7 +419,7 @@ async fn handle_recording_end(
async fn handle_recording_finish(
app: &AppHandle,
completed_recording: CompletedRecording,
-) -> Result<Option<String>, String> {
+) -> Result<(), String> {
let recording_dir = completed_recording.project_path().clone();
let id = completed_recording.id().clone();
@@ -438,8 +443,6 @@ async fn handle_recording_finish(
let display_screenshot = screenshots_dir.join("display.jpg");
create_screenshot(display_output_path, display_screenshot.clone(), None).await?;
- let mut shareable_link = None;
-
let (meta_inner, sharing) = match completed_recording {
CompletedRecording::Studio(recording) => {
let recordings = ProjectRecordings::new(&recording_dir, &recording.meta);
@@ -452,19 +455,6 @@ async fn handle_recording_finish(
config.write(&recording_dir).map_err(|e| e.to_string())?;
- if let Some(settings) = GeneralSettingsStore::get(&app).ok().flatten() {
- if settings.open_editor_after_recording {
- open_editor(app.clone(), id.clone());
- }
- };
-
- ShowCapWindow::RecordingsOverlay.show(&app).ok();
-
- let _ = NewStudioRecordingAdded {
- path: recording_dir.clone(),
- }
- .emit(app);
-
(RecordingMetaInner::Studio(recording.meta), None)
}
CompletedRecording::Instant {
@@ -472,13 +462,16 @@ async fn handle_recording_finish(
progressive_upload,
video_upload_info,
} => {
- shareable_link = Some(video_upload_info.link.clone());
+ // shareable_link = Some(video_upload_info.link.clone());
let app = app.clone();
let output_path = recording_dir.join("content/output.mp4");
- {
+ let _ = open_external_link(app.clone(), video_upload_info.link.clone());
+
+ spawn_actor({
let video_upload_info = video_upload_info.clone();
- spawn_actor(async move {
+
+ async move {
if let Some(progressive_upload) = progressive_upload {
let video_upload_succeeded = match progressive_upload
.handle
@@ -544,12 +537,14 @@ async fn handle_recording_finish(
"Final video upload with screenshot completed successfully"
)
}
- Err(e) => error!("Error in final upload with screenshot: {}", e),
+ Err(e) => {
+ error!("Error in final upload with screenshot: {}", e)
+ }
}
}
}
- });
- }
+ }
+ });
(
RecordingMetaInner::Instant(recording.meta),
@@ -567,7 +562,7 @@ async fn handle_recording_finish(
.emit(app);
let meta = RecordingMeta {
- project_path: recording_dir,
+ project_path: recording_dir.clone(),
sharing,
pretty_name: format!(
"Cap {}",
@@ -579,7 +574,33 @@ async fn handle_recording_finish(
meta.save_for_project()
.map_err(|e| format!("Failed to save recording meta: {e}"))?;
- Ok(shareable_link)
+ if let RecordingMetaInner::Studio(_) = meta.inner {
+ match GeneralSettingsStore::get(&app)
+ .ok()
+ .flatten()
+ .map(|v| v.post_studio_recording_behaviour)
+ .unwrap_or(PostStudioRecordingBehaviour::OpenEditor)
+ {
+ PostStudioRecordingBehaviour::OpenEditor => {
+ open_editor(app.clone(), id.clone());
+ }
+ PostStudioRecordingBehaviour::ShowOverlay => {
+ ShowCapWindow::RecordingsOverlay.show(&app).ok();
+
+ let app = AppHandle::clone(app);
+ tokio::spawn(async move {
+ tokio::time::sleep(Duration::from_millis(1000)).await;
+
+ let _ = NewStudioRecordingAdded {
+ path: recording_dir.clone(),
+ }
+ .emit(&app);
+ });
+ }
+ };
+ }
+
+ Ok(())
}
fn generate_zoom_segments_from_clicks(
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 8053767a8..e9e439960 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -1,4 +1,4 @@
-import { createResource, For, Show } from "solid-js";
+import { createResource, For, ParentProps, Show } from "solid-js";
import { createStore } from "solid-js/store";
import {
isPermissionGranted,
@@ -8,63 +8,17 @@ import { type OsType, type } from "@tauri-apps/plugin-os";
import "@total-typescript/ts-reset/filter-boolean";
import { generalSettingsStore } from "~/store";
-import type { AppTheme, GeneralSettingsStore } from "~/utils/tauri";
+import type {
+ AppTheme,
+ GeneralSettingsStore,
+ MainWindowRecordingStartBehaviour,
+ PostStudioRecordingBehaviour,
+} from "~/utils/tauri";
// import { themeStore } from "~/store/theme";
import themePreviewAuto from "~/assets/theme-previews/auto.jpg";
import themePreviewDark from "~/assets/theme-previews/dark.jpg";
import themePreviewLight from "~/assets/theme-previews/light.jpg";
-
-const settingsList: Array<{
- key: keyof GeneralSettingsStore;
- label: string;
- description: string;
- platforms?: OsType[];
- requiresPermission?: boolean;
- pro?: boolean;
- onChange?: (value: boolean) => Promise<void>;
-}> = (
- [
- {
- key: "openEditorAfterRecording",
- label: "Open editor automatically after recording stops",
- description:
- "The editor will be shown immediately after you finish recording.",
- },
- {
- key: "hideDockIcon",
- label: "Hide dock icon",
- platforms: ["macos"],
- description:
- "The dock icon will be hidden when there are no windows available to close.",
- },
- {
- key: "hapticsEnabled",
- label: "Enable Haptics",
- platforms: ["macos"],
- description: "Use haptics on Force Touch™ trackpads",
- },
- {
- key: "disableAutoOpenLinks",
- label: "Disable automatic link opening",
- description:
- "When enabled, Cap will not automatically open links in your browser (e.g. after creating a shareable link).",
- pro: true,
- },
- {
- key: "enableNotifications",
- label: "Enable System Notifications",
- description:
- "Show system notifications for events like copying to clipboard, saving files, and more. You may need to manually allow Cap access via your system's notification settings.",
- requiresPermission: true,
- },
- // type() === "macos" && {
- // key: "windowTransparency",
- // label: "Enable Window Transparency",
- // description:
- // "Make the background of some windows (eg. the Editor) transparent",
- // },
- ] as const
-).filter(Boolean);
+import { CheckMenuItem, Menu, MenuItem } from "@tauri-apps/api/menu";
export default function GeneralSettings() {
const [store] = createResource(() => generalSettingsStore.get());
@@ -145,37 +99,11 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
}
);
- const handleChange = async (key: string, value: boolean) => {
+ const handleChange = async <K extends keyof typeof settings>(
+ key: K,
+ value: (typeof settings)[K]
+ ) => {
console.log(`Handling settings change for ${key}: ${value}`);
- // Special handling for notifications permission
- if (key === "enable_notifications") {
- if (value) {
- // Check current permission state
- console.log("Checking notification permission status");
- const permissionGranted = await isPermissionGranted();
- console.log(`Current permission status: ${permissionGranted}`);
-
- if (!permissionGranted) {
- // Request permission if not granted
- console.log("Permission not granted, requesting permission");
- const permission = await requestPermission();
- console.log(`Permission request result: ${permission}`);
- if (permission !== "granted") {
- // If permission denied, don't enable the setting
- console.log("Permission denied, aborting setting change");
- return;
- }
- }
- }
- }
-
- // Find the setting once and store it
- const setting = settingsList.find((s) => s.key === key);
-
- // If setting exists and has onChange handler, call it
- if (setting?.onChange) {
- await setting.onChange(value);
- }
setSettings(key as keyof GeneralSettingsStore, value);
generalSettingsStore.set({ [key]: value });
@@ -194,59 +122,189 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
generalSettingsStore.set({ theme: newTheme });
}}
/>
- <For each={settingsList}>
- {(setting) => {
- const value = () => !!settings[setting.key];
+ {ostype === "macos" && (
+ <>
+ <ToggleSetting
+ label="Hide dock icon"
+ description="The dock icon will be hidden when there are no windows available to close."
+ value={!!settings.hideDockIcon}
+ onChange={(value) => handleChange("hideDockIcon", value)}
+ />
+ <ToggleSetting
+ label="Enable haptics"
+ description="Use haptics on Force Touch™ trackpads"
+ value={!!settings.hapticsEnabled}
+ onChange={(value) => handleChange("hapticsEnabled", value)}
+ />
+ </>
+ )}
+ <ToggleSetting
+ pro
+ label="Disable automatic link opening"
+ description="When enabled, Cap will not automatically open links in your browser (e.g. after creating a shareable link)."
+ value={!!settings.disableAutoOpenLinks}
+ onChange={(value) => handleChange("disableAutoOpenLinks", value)}
+ />
+ <ToggleSetting
+ label="Enable system notifications"
+ description="Show system notifications for events like copying to clipboard, saving files, and more. You may need to manually allow Cap access via your system's notification settings."
+ value={!!settings.enableNotifications}
+ onChange={async (value) => {
+ if (value) {
+ // Check current permission state
+ console.log("Checking notification permission status");
+ const permissionGranted = await isPermissionGranted();
+ console.log(`Current permission status: ${permissionGranted}`);
- return (
- <Show
- when={
- !setting.platforms || setting.platforms.includes(ostype)
+ if (!permissionGranted) {
+ // Request permission if not granted
+ console.log("Permission not granted, requesting permission");
+ const permission = await requestPermission();
+ console.log(`Permission request result: ${permission}`);
+ if (permission !== "granted") {
+ // If permission denied, don't enable the setting
+ console.log("Permission denied, aborting setting change");
+ return;
}
- >
- <div class="py-3 space-y-2">
- {setting.pro && (
- <span class="px-2 py-1 text-xs font-medium text-gray-50 bg-blue-400 rounded-lg">
- Cap Pro
- </span>
- )}
- <div class="flex justify-between items-center">
- <div class="flex gap-2 items-center">
- <p class="text-[--text-primary]">{setting.label}</p>
- </div>
- <button
- type="button"
- role="switch"
- aria-checked={value()}
- data-state={value() ? "checked" : "unchecked"}
- value={value() ? "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 ${
- value()
- ? "bg-blue-400 border-blue-400"
- : "bg-gray-300 border-gray-300"
- }`}
- onClick={() => handleChange(setting.key, !value())}
- >
- <span
- data-state={value() ? "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 ${
- value() ? "border-blue-400" : "border-gray-300"
- }`}
- />
- </button>
- </div>
- {setting.description && (
- <p class="text-xs text-[--text-tertiary]">
- {setting.description}
- </p>
- )}
- </div>
- </Show>
- );
+ }
+ }
+
+ handleChange("enableNotifications", value);
}}
- </For>
+ />
+ {/* <ToggleSetting
+ label="Enable window transparency"
+ description="Make the background of some windows (eg. the Editor) transparent."
+ value={!!settings.windowTransparency}
+ onChange={(value) => handleChange("windowTransparency", value)}
+ /> */}
+ <Setting
+ label="Studio recording finish behaviour"
+ description="What should happen when a studio recording finishes"
+ >
+ <button
+ class="border border-gray-300 rounded-md px-2 py-1 flex flex-row items-center gap-1"
+ onClick={async () => {
+ const item = (
+ text: string,
+ value: PostStudioRecordingBehaviour
+ ) =>
+ CheckMenuItem.new({
+ text,
+ checked: settings.postStudioRecordingBehaviour === value,
+ action: () =>
+ handleChange("postStudioRecordingBehaviour", value),
+ });
+ const menu = await Menu.new({
+ items: await Promise.all([
+ item("Open editor", "openEditor"),
+ item("Show in overlay", "showOverlay"),
+ ]),
+ });
+ menu.popup();
+ }}
+ >
+ {settings.postStudioRecordingBehaviour === "showOverlay"
+ ? "Show in overlay"
+ : "Open editor"}
+ <IconCapChevronDown class="size-4" />
+ </button>
+ </Setting>
+ <Setting
+ label="Main window recording start behaviour"
+ description="What should the main window do when starting a recording"
+ >
+ <button
+ class="border border-gray-300 rounded-md px-2 py-1 flex flex-row items-center gap-1"
+ onClick={async () => {
+ const item = (
+ text: string,
+ value: MainWindowRecordingStartBehaviour
+ ) =>
+ CheckMenuItem.new({
+ text,
+ checked:
+ settings.mainWindowRecordingStartBehaviour === value,
+ action: () =>
+ handleChange("mainWindowRecordingStartBehaviour", value),
+ });
+ const menu = await Menu.new({
+ items: await Promise.all([
+ item("Close", "close"),
+ item("Minimise", "minimise"),
+ ]),
+ });
+ menu.popup();
+ }}
+ >
+ {settings.mainWindowRecordingStartBehaviour === "close"
+ ? "Close"
+ : "Minimise"}
+ <IconCapChevronDown class="size-4" />
+ </button>
+ </Setting>
</div>
</div>
</div>
);
}
+
+function Setting(
+ props: {
+ pro?: boolean;
+ label: string;
+ description?: string;
+ } & ParentProps
+) {
+ return (
+ <div class="py-3 flex flex-row justify-between items-start text-sm">
+ <div class="flex justify-between items-start space-y-2 flex-col">
+ {props.pro && (
+ <span class="px-2 py-1 text-xs font-medium text-gray-50 bg-blue-400 rounded-lg">
+ Cap Pro
+ </span>
+ )}
+ <div class="flex gap-2 items-center">
+ <p class="text-[--text-primary]">{props.label}</p>
+ </div>
+ {props.description && (
+ <p class="text-xs text-[--text-tertiary]">{props.description}</p>
+ )}
+ </div>
+ {props.children}
+ </div>
+ );
+}
+
+function ToggleSetting(props: {
+ pro?: boolean;
+ label: string;
+ description?: string;
+ value: boolean;
+ onChange(v: boolean): void;
+}) {
+ return (
+ <Setting {...props}>
+ <button
+ type="button"
+ role="switch"
+ aria-checked={props.value}
+ data-state={props.value ? "checked" : "unchecked"}
+ value={props.value ? "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 ${
+ props.value
+ ? "bg-blue-400 border-blue-400"
+ : "bg-gray-300 border-gray-300"
+ }`}
+ onClick={() => props.onChange(!props.value)}
+ >
+ <span
+ data-state={props.value ? "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 ${
+ props.value ? "border-blue-400" : "border-gray-300"
+ }`}
+ />
+ </button>
+ </Setting>
+ );
+}
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
index 770fdb226..3b8021fd5 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/recordings.tsx
@@ -221,12 +221,6 @@ function RecordingItem(props: {
>
<IconLucideEdit class="size-4" />
</TooltipIconButton>
- <TooltipIconButton
- tooltipText="Show recordings overlay"
- onClick={() => props.onClick()}
- >
- <IconLucideEye class="size-4" />
- </TooltipIconButton>
<Show when={props.recording.meta.sharing}>
{(sharing) => (
<TooltipIconButton
diff --git a/apps/desktop/src/routes/editor/Editor.tsx b/apps/desktop/src/routes/editor/Editor.tsx
index 7771ee454..49dddfed5 100644
--- a/apps/desktop/src/routes/editor/Editor.tsx
+++ b/apps/desktop/src/routes/editor/Editor.tsx
@@ -75,7 +75,7 @@ export function Editor() {
}
function Inner() {
- const { project, playbackTime, setPlaybackTime, playing } =
+ const { project, previewTime, playbackTime, setPlaybackTime, playing } =
useEditorContext();
onMount(() => {
@@ -98,8 +98,8 @@ function Inner() {
}, 1000 / FPS);
const frameNumberToRender = createMemo(() => {
- // const preview = previewTime();
- // if (preview !== undefined) return preview;
+ const preview = previewTime();
+ if (preview !== undefined) return preview;
return playbackTime();
});
diff --git a/apps/desktop/src/routes/in-progress-recording.tsx b/apps/desktop/src/routes/in-progress-recording.tsx
index 293247915..becabf1fb 100644
--- a/apps/desktop/src/routes/in-progress-recording.tsx
+++ b/apps/desktop/src/routes/in-progress-recording.tsx
@@ -144,7 +144,7 @@ export default function () {
<div class="flex flex-row justify-between p-[0.25rem] flex-1">
<button
disabled={stopRecording.isPending}
- class="py-[0.25rem] px-[0.5rem] text-red-300 dark:text-red-300 gap-[0.25rem] flex flex-row items-center rounded-lg"
+ class="py-[0.25rem] px-[0.5rem] text-red-300 gap-[0.25rem] flex flex-row items-center rounded-lg transition-opacity disabled:opacity-60"
type="button"
onClick={() => stopRecording.mutate()}
>
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index aca0599ac..2158274b2 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -260,7 +260,11 @@ export type Cursors = { [key in string]: string } | { [key in string]: CursorMet
export type EditorStateChanged = { playhead_position: number }
export type ExportEstimates = { duration_seconds: number; estimated_time_seconds: number; estimated_size_mb: number }
export type Flags = { recordMouseState: boolean; systemAudioRecording: boolean; split: boolean }
-export type GeneralSettingsStore = { instanceId?: string; uploadIndividualFiles?: boolean; openEditorAfterRecording?: boolean; hideDockIcon?: boolean; hapticsEnabled?: boolean; autoCreateShareableLink?: boolean; enableNotifications?: boolean; disableAutoOpenLinks?: boolean; hasCompletedStartup?: boolean; theme?: AppTheme; commercialLicense?: CommercialLicense | null; lastVersion?: string | null; windowTransparency?: boolean }
+export type GeneralSettingsStore = { instanceId?: string; uploadIndividualFiles?: boolean; hideDockIcon?: boolean; hapticsEnabled?: boolean; autoCreateShareableLink?: boolean; enableNotifications?: boolean; disableAutoOpenLinks?: boolean; hasCompletedStartup?: boolean; theme?: AppTheme; commercialLicense?: CommercialLicense | null; lastVersion?: string | null; windowTransparency?: boolean; postStudioRecordingBehaviour?: PostStudioRecordingBehaviour; mainWindowRecordingStartBehaviour?: MainWindowRecordingStartBehaviour;
+/**
+ * @deprecated
+ */
+openEditorAfterRecording?: boolean }
export type HapticPattern = "Alignment" | "LevelChange" | "Generic"
export type HapticPerformanceTime = "Default" | "Now" | "DrawCompleted"
export type Hotkey = { code: string; meta: boolean; ctrl: boolean; alt: boolean; shift: boolean }
@@ -269,6 +273,7 @@ export type HotkeysConfiguration = { show: boolean }
export type HotkeysStore = { hotkeys: { [key in HotkeyAction]: Hotkey } }
export type InstantRecordingMeta = { fps: number; sample_rate: number | null }
export type JsonValue<T> = [T]
+export type MainWindowRecordingStartBehaviour = "close" | "minimise"
export type MultipleSegment = { display: VideoMeta; camera?: VideoMeta | null; audio?: AudioMeta | null; system_audio?: AudioMeta | null; cursor?: string | null }
export type MultipleSegments = { segments: MultipleSegment[]; cursors: Cursors }
export type NewNotification = { title: string; body: string; is_error: boolean }
@@ -278,6 +283,7 @@ export type OSPermission = "screenRecording" | "camera" | "microphone" | "access
export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied"
export type OSPermissionsCheck = { screenRecording: OSPermissionStatus; microphone: OSPermissionStatus; camera: OSPermissionStatus; accessibility: OSPermissionStatus }
export type Plan = { upgraded: boolean; manual: boolean; last_checked: number }
+export type PostStudioRecordingBehaviour = "openEditor" | "showOverlay"
export type Preset = { name: string; config: ProjectConfiguration }
export type PresetsStore = { presets: Preset[]; default: number | null }
export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null }
diff --git a/apps/web/package.json b/apps/web/package.json
index a7b4a012e..5e0fdbc94 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -39,7 +39,7 @@
"@tanstack/react-query": "^5.51.11",
"@tanstack/react-store": "^0.5.5",
"@tanstack/store": "^0.5.5",
- "@ts-rest/core": "^3.51.0",
+ "@ts-rest/core": "^3.52.1",
"@uidotdev/usehooks": "^2.4.1",
"@workos-inc/node": "^7.34.0",
"aws-sdk": "^2.1530.0",
@@ -80,7 +80,7 @@
"tailwind-merge": "^2.1.0",
"uuid": "^9.0.1",
"video.js": "^8.17.3",
- "zod": "^3.24.1"
+ "zod": "^3.24.2"
},
"devDependencies": {
"@types/file-saver": "^2.0.7",
diff --git a/packages/env/package.json b/packages/env/package.json
index ee1a61866..d10976715 100644
--- a/packages/env/package.json
+++ b/packages/env/package.json
@@ -5,7 +5,7 @@
"types": "./index.ts",
"dependencies": {
"@t3-oss/env-nextjs": "^0.12.0",
- "zod": "^3.24.1"
+ "zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^22.12.0"
diff --git a/packages/web-api-contract/package.json b/packages/web-api-contract/package.json
index 093ad0ee0..425c62d86 100644
--- a/packages/web-api-contract/package.json
+++ b/packages/web-api-contract/package.json
@@ -5,7 +5,7 @@
"types": "./src/index.ts",
"type": "module",
"dependencies": {
- "@ts-rest/core": "^3.51.0",
- "zod": "^3.24.1"
+ "@ts-rest/core": "^3.52.1",
+ "zod": "^3.24.2"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index aaf64d415..a5b0bdce5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -158,8 +158,8 @@ importers:
specifier: 2.0.0
version: 2.0.0
'@ts-rest/core':
- specifier: ^3.51.0
- version: 3.51.0(@types/[email protected])([email protected])
+ specifier: ^3.52.1
+ version: 3.52.1(@types/[email protected])([email protected])
'@types/react-tooltip':
specifier: ^4.2.4
@@ -460,7 +460,7 @@ importers:
'@hono/zod-validator':
specifier: ^0.4.3
'@hookform/resolvers':
specifier: ^3.3.2
@@ -487,7 +487,7 @@ importers:
version: 3.5.0
'@t3-oss/env-nextjs':
specifier: ^0.12.0
'@tanstack/react-query':
specifier: ^5.51.11
version: 5.56.2([email protected])
@@ -498,8 +498,8 @@ importers:
specifier: ^0.5.5
version: 0.5.5
'@ts-rest/core':
- specifier: ^3.51.0
- version: 3.51.0(@types/[email protected])([email protected])
+ specifier: ^3.52.1
+ version: 3.52.1(@types/[email protected])([email protected])
'@uidotdev/usehooks':
specifier: ^2.4.1
@@ -526,7 +526,7 @@ importers:
version: 0.30.9(@cloudflare/[email protected])(@opentelemetry/[email protected])(@planetscale/[email protected])(@types/[email protected])([email protected])([email protected])
dub:
specifier: ^0.33.1
- version: 0.33.1([email protected])
+ version: 0.33.1([email protected])
file-saver:
specifier: ^2.0.5
version: 2.0.5
@@ -621,8 +621,8 @@ importers:
specifier: ^8.17.3
version: 8.17.4
zod:
- specifier: ^3.24.1
- version: 3.24.1
+ specifier: ^3.24.2
+ version: 3.24.2
devDependencies:
'@types/file-saver':
specifier: ^2.0.7
@@ -803,10 +803,10 @@ importers:
dependencies:
'@t3-oss/env-nextjs':
specifier: ^0.12.0
zod:
- specifier: ^3.24.1
- version: 3.24.1
+ specifier: ^3.24.2
+ version: 3.24.2
devDependencies:
'@types/node':
specifier: ^22.12.0
@@ -1014,11 +1014,11 @@ importers:
packages/web-api-contract:
dependencies:
'@ts-rest/core':
- specifier: ^3.51.0
- version: 3.51.0(@types/[email protected])([email protected])
+ specifier: ^3.52.1
+ version: 3.52.1(@types/[email protected])([email protected])
zod:
- specifier: ^3.24.1
- version: 3.24.1
+ specifier: ^3.24.2
+ version: 3.24.2
packages:
@@ -4866,10 +4866,10 @@ packages:
react-dom:
optional: true
- '@storybook/[email protected]':
- resolution: {integrity: sha512-gPpW5WcxvtH1aTY5KqtUMtsExjxuHRvuD+Fsw+n6HLOGVZsBs8m/uJ7ujZMnUmSsR2w/DJI5mk9uWEB01Vasdw==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-yAboTqP1lxZiy7id5o8V2oyaPl7rkRgKzNArDI8nO5Qamie9cOwgORP6r0pOExw6PM/ClskSJRFOCrE5uoHN8Q==}
peerDependencies:
- storybook: ^9.0.0-alpha.10
+ storybook: ^9.0.0-alpha.11
vite: ^4.0.0 || ^5.0.0 || ^6.0.0
'@storybook/[email protected]':
@@ -4880,10 +4880,10 @@ packages:
peerDependencies:
storybook: ^8.3.3
- '@storybook/[email protected]':
- resolution: {integrity: sha512-p8ho/3H07TYXn+hY9uExhXy4DyNr154PmB6kSJ/7vLZkWnHXzeP54xDq4/WT9FNCF8FwwtDzRDSoJRiPqTP0kQ==}
+ '@storybook/[email protected]':
+ resolution: {integrity: sha512-SxLvKUlcJkpBTRP4/PHNlRZWPFrTmOWDpr3ZKdIhEkEC+KI97+SWNNps3SlV2BX4gDUl4JekFGrCH+ekbmJ7OQ==}
peerDependencies:
- storybook: ^9.0.0-alpha.10
+ storybook: ^9.0.0-alpha.11
'@storybook/[email protected]':
resolution: {integrity: sha512-dHYFQH3mA+EtnCkHXzicbLgsvzYjcDJ1JWsogbItZogkPHgSJM/Wr71uMkcvw8v9mmCyP4NpXJuu6bPoVsOnzg==}
@@ -5202,8 +5202,8 @@ packages:
'@total-typescript/[email protected]':
resolution: {integrity: sha512-cka47fVSo6lfQDIATYqb/vO1nvFfbPw7uWLayIXIhGETj0wcOOlrlkobOMDNQOFr9QOafegUPq13V2+6vtD7yg==}
- '@ts-rest/[email protected]':
- resolution: {integrity: sha512-v6lnWEcpZj1UgN9wb84XQ+EORP1QEtncFumoXMJjno5ZUV6vdjKze3MYcQN0C6vjBpIJPQEaI/gab2jr4/0KzQ==}
+ '@ts-rest/[email protected]':
+ resolution: {integrity: sha512-tAjz7Kxq/grJodcTA1Anop4AVRDlD40fkksEV5Mmal88VoZeRKAG8oMHsDwdwPZz+B/zgnz0q2sF+cm5M7Bc7g==}
peerDependencies:
'@types/node': ^18.18.7 || >=20.8.4
zod: ^3.22.3
@@ -5807,6 +5807,11 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
+ resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==}
+ engines: {node: '>=0.4.0'}
+ hasBin: true
+
resolution: {integrity: sha512-H1nh/P9VZXUf17AA5NQfJML88CFjVBDuGkp5zDHa7oEhYN9TTpNLJknRY1ie0iSKWlDf6JRnJKaZVDSQdPy6Cg==}
@@ -11822,8 +11827,8 @@ packages:
resolution: {integrity: sha512-jqbIpTsa/KKTJYWgPNsFNbLVpwCgzXfFJ1ukNn4I8hMwyQzHMJnk/BqWzggB0xpkILuKzaO/aMYhS0SkaJyKXg==}
- resolution: {integrity: sha512-d4IxJUXROL5NCa3amvMg6VQW2HVtZYmUTPfvVtO7zJWGYLJ+mry9v2OmYm+z67aniQoQ8/yFNadiEwtNS9qQiw==}
+ resolution: {integrity: sha512-0/FvIG4g3kNkYgbNwBBW5pZBkfpeYQnH+2AA3xmjkCAit/DSDPKmgwC3fKof4oYUq6gupClVOJlFl+939VRBMg==}
resolution: {integrity: sha512-ulNZP1SVpRDesxeMLON/LtWM8HIgAJEIVpVVhBM6gsmvQ8+Rh+ZG7FWGvHh7Ah3pRABwVJWklWCr/BTZSv0xnQ==}
@@ -13699,7 +13704,7 @@ snapshots:
gray-matter: 4.0.3
imagescript: 1.3.0
micromatch: 4.0.8
- ts-pattern: 5.6.2
+ ts-pattern: 5.7.0
unified: 11.0.5
yaml: 2.7.0
zod: 3.24.2
@@ -14438,15 +14443,15 @@ snapshots:
hono: 4.7.1
valibot: 1.0.0-rc.1([email protected])
dependencies:
hono: 4.7.1
- zod: 3.24.1
+ zod: 3.24.2
dependencies:
hono: 4.7.1
- zod: 3.24.1
+ zod: 3.24.2
dependencies:
@@ -17087,9 +17092,9 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
dependencies:
- '@storybook/csf-plugin': 9.0.0-alpha.10([email protected])
+ '@storybook/csf-plugin': 9.0.0-alpha.11([email protected])
browser-assert: 1.2.1
storybook: 8.3.3
ts-dedent: 2.2.0
@@ -17120,7 +17125,7 @@ snapshots:
storybook: 8.3.3
unplugin: 1.16.1
dependencies:
storybook: 8.3.3
unplugin: 1.16.1
@@ -17189,19 +17194,19 @@ snapshots:
dependencies:
defer-to-connect: 2.0.1
optionalDependencies:
typescript: 5.7.2
valibot: 1.0.0-rc.1([email protected])
- zod: 3.24.1
+ zod: 3.24.2
dependencies:
optionalDependencies:
typescript: 5.7.2
valibot: 1.0.0-rc.1([email protected])
- zod: 3.24.1
+ zod: 3.24.2
dependencies:
@@ -17430,17 +17435,12 @@ snapshots:
'@total-typescript/[email protected]': {}
optionalDependencies:
'@types/node': 20.16.9
- zod: 3.24.1
-
- optionalDependencies:
- '@types/node': 22.12.0
- zod: 3.24.1
+ zod: 3.24.2
optionalDependencies:
'@types/node': 22.12.0
zod: 3.24.2
@@ -18222,6 +18222,10 @@ snapshots:
dependencies:
acorn: 8.14.0
+ dependencies:
+ acorn: 8.14.1
+
dependencies:
acorn: 8.14.0
@@ -18242,6 +18246,8 @@ snapshots:
+
dependencies:
'@babel/runtime': 7.25.6
@@ -19535,7 +19541,7 @@ snapshots:
dependencies:
'@esbuild-kit/esm-loader': 2.6.5
'@hono/node-server': 1.13.1([email protected])
- '@hono/zod-validator': 0.2.2([email protected])([email protected])
+ '@hono/zod-validator': 0.2.2([email protected])([email protected])
camelcase: 7.0.1
chalk: 5.3.0
commander: 9.5.0
@@ -19549,7 +19555,7 @@ snapshots:
minimatch: 7.4.6
semver: 7.6.3
superjson: 2.2.1
- zod: 3.24.1
+ zod: 3.24.2
transitivePeerDependencies:
- supports-color
@@ -19562,9 +19568,9 @@ snapshots:
mysql2: 3.11.3
react: 18.3.1
dependencies:
- zod: 3.24.1
+ zod: 3.24.2
dependencies:
@@ -19785,7 +19791,7 @@ snapshots:
dependencies:
'@types/estree-jsx': 1.0.5
- acorn: 8.14.0
+ acorn: 8.14.1
esast-util-from-estree: 2.0.0
vfile-message: 4.0.2
@@ -20140,7 +20146,7 @@ snapshots:
'@typescript-eslint/parser': 5.62.0([email protected])([email protected])
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
- eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -23081,8 +23087,8 @@ snapshots:
dependencies:
- acorn: 8.14.0
- acorn-jsx: 5.3.2([email protected])
+ acorn: 8.14.1
+ acorn-jsx: 5.3.2([email protected])
micromark-extension-mdx-expression: 3.0.0
micromark-extension-mdx-jsx: 3.0.1
micromark-extension-mdx-md: 2.0.0
@@ -25617,7 +25623,7 @@ snapshots:
dependencies:
- '@storybook/builder-vite': 9.0.0-alpha.10([email protected])([email protected](@types/[email protected])([email protected]))
+ '@storybook/builder-vite': 9.0.0-alpha.11([email protected])([email protected](@types/[email protected])([email protected]))
transitivePeerDependencies:
- storybook
- vite
@@ -26142,7 +26148,7 @@ snapshots:
optionalDependencies:
@@ -26493,7 +26499,7 @@ snapshots:
dependencies:
- acorn: 8.14.0
+ acorn: 8.14.1
webpack-virtual-modules: 0.6.2
diff --git a/scripts/env-cli.js b/scripts/env-cli.js
index 98d0380df..d41910eb9 100644
--- a/scripts/env-cli.js
+++ b/scripts/env-cli.js
@@ -9,6 +9,18 @@ import { text } from "@clack/prompts";
import { confirm } from "@clack/prompts";
import { intro, multiselect, isCancel } from "@clack/prompts";
+const DOCKER_S3_ENVS = {
+ accessKey: "capS3root",
+ secretKey: "capS3root",
+ bucket: "capso",
+ region: "us-east-1",
+ endpoint: "http://localhost:3902",
+};
+
+const DOCKER_DB_ENVS = {
+ url: "mysql://root:@localhost:3306/planetscale",
+};
+
async function main() {
intro("Welcome to the Cap env setup CLI!");
@@ -26,18 +38,7 @@ async function main() {
const file = await fs
.readFile("./target/env-profiles/default.json", "utf8")
.catch(() => null);
- let allEnvs = file
- ? JSON.parse(file)
- : {
- VITE_ENVIRONMENT: "development",
- NODE_ENV: "development",
- CAP_AWS_ACCESS_KEY: "capS3root",
- CAP_AWS_SECRET_KEY: "capS3root",
- NEXT_PUBLIC_CAP_AWS_BUCKET: "capso",
- NEXT_PUBLIC_CAP_AWS_REGION: "us-east-1",
- NEXT_PUBLIC_CAP_AWS_ENDPOINT: "http://localhost:3902",
- DATABASE_URL: "mysql://root:@localhost:3306/planetscale",
- };
+ let allEnvs = file ? JSON.parse(file) : {};
let envs = {};
@@ -137,6 +138,15 @@ async function main() {
);
envs = { ...envs, ...s3Values };
+ } else {
+ envs.DATABASE_URL = DOCKER_DB_ENVS.url;
+ envs.DATABASE_MIGRATION_URL = DOCKER_DB_ENVS.url;
+
+ envs.CAP_AWS_ACCESS_KEY = DOCKER_S3_ENVS.accessKey;
+ envs.CAP_AWS_SECRET_KEY = DOCKER_S3_ENVS.secretKey;
+ envs.NEXT_PUBLIC_CAP_AWS_BUCKET = DOCKER_S3_ENVS.bucket;
+ envs.NEXT_PUBLIC_CAP_AWS_REGION = DOCKER_S3_ENVS.region;
+ envs.NEXT_PUBLIC_CAP_AWS_ENDPOINT = DOCKER_S3_ENVS.endpoint;
}
} else {
envs.VITE_SERVER_URL = "http://cap.so";
@@ -145,13 +155,15 @@ async function main() {
if (hasDesktop) {
const values = await group(
{
- VITE_VERCEL_AUTOMATION_BYPASS_SECRET: () =>
- text({
- message:
- "VITE_VERCEL_AUTOMATION_BYPASS_SECRET - skip if you're not a Cap team member",
- placeholder: allEnvs.VITE_VERCEL_AUTOMATION_BYPASS_SECRET,
- defaultValue: allEnvs.VITE_VERCEL_AUTOMATION_BYPASS_SECRET,
- }),
+ VITE_VERCEL_AUTOMATION_BYPASS_SECRET: () => {
+ if (!hasWeb)
+ return text({
+ message:
+ "VITE_VERCEL_AUTOMATION_BYPASS_SECRET - skip if you're not a Cap team member",
+ placeholder: allEnvs.VITE_VERCEL_AUTOMATION_BYPASS_SECRET,
+ defaultValue: allEnvs.VITE_VERCEL_AUTOMATION_BYPASS_SECRET,
+ });
+ },
},
{ onCancel: () => process.exit(0) }
);
@@ -163,7 +175,7 @@ async function main() {
}
await fs.writeFile(
- ".env.test",
+ ".env",
Object.entries(envs)
.map(([key, value]) => `${key}=${value}`)
.join("\n")
diff --git a/scripts/setup.js b/scripts/setup.js
index 0136777dd..5d6f2087e 100644
--- a/scripts/setup.js
+++ b/scripts/setup.js
@@ -166,18 +166,6 @@ async function main() {
path.join(__root, ".cargo/config.toml"),
cargoConfigContents
);
-
- if (!(await fileExists(path.join(__root, ".env")))) {
- await fs.copyFile(
- path.join(__root, ".env"),
- path.join(__root, ".env.example")
- );
- }
-
- await fs.copyFile(
- path.join(__root, ".env"),
- path.join(__root, "apps/desktop/.env")
- );
}
main();