Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: address linux cli review feedback
Richie McIlroyed7134121d2e
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex 5c0472603..9151fc46d 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -204,7 +204,7 @@ jobs:if: ${{ runner.os == 'macOS' }}run: echo "${{ secrets.APPLE_API_KEY_FILE }}" > api.p8- - uses: apple-actions/import-codesign-certs@v2+ - uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2if: ${{ runner.os == 'macOS' }}with:p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}diff --git a/apps/web/app/api/download/route.ts b/apps/web/app/api/download/route.tsindex 3cdeb770c..d510c2230 100644--- a/apps/web/app/api/download/route.ts+++ b/apps/web/app/api/download/route.ts@@ -15,7 +15,11 @@ export async function GET(request: NextRequest) {if (clientPlatform.includes("windows") || userAgent.includes("windows")) {platform = "windows";} else if (clientPlatform.includes("macos") || userAgent.includes("mac")) {- if (userAgent.includes("intel")) {+ if (+ userAgent.includes("intel") ||+ userAgent.includes("x86_64") ||+ userAgent.includes("amd64")+ ) {platform = "apple-intel";} else {platform = "apple-silicon";diff --git a/apps/web/app/install-cli.sh/route.ts b/apps/web/app/install-cli.sh/route.tsindex de0669672..6225be5e0 100644--- a/apps/web/app/install-cli.sh/route.ts+++ b/apps/web/app/install-cli.sh/route.ts@@ -152,6 +152,7 @@ prepare_appimage_cli() {APP_TMP=""rm -rf "$TMP_ROOT"TMP_ROOT=""+ trap - EXIT HUP INT TERMfind_cli_in_dir "$APPDIR_PATH"}@@ -296,7 +297,7 @@ install_cap_desktop_linux_appimage() {mkdir -p "$APP_DIR"echo "Downloading Cap Desktop AppImage..."- curl -fL "https://cap.so/download/linux-appimage" -o "$APPIMAGE_PATH"+ curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 1 -fL "https://cap.so/download/linux-appimage" -o "$APPIMAGE_PATH"chmod +x "$APPIMAGE_PATH"if ! prepare_appimage_cli; thendiff --git a/apps/web/components/pages/DownloadPage.tsx b/apps/web/components/pages/DownloadPage.tsxindex 958721817..779944816 100644--- a/apps/web/components/pages/DownloadPage.tsx+++ b/apps/web/components/pages/DownloadPage.tsx@@ -154,30 +154,34 @@ export const DownloadPage = () => {Linux AppImage</a>)}- <a- href="/download/linux-deb"- onClick={() =>- trackDownloadClick(- "other_option_linux_deb",- "/download/linux-deb",- )- }- className="text-sm transition-all text-gray-10 hover:underline"- >- Debian/Ubuntu- </a>- <a- href="/download/linux-rpm"- onClick={() =>- trackDownloadClick(- "other_option_linux_rpm",- "/download/linux-rpm",- )- }- className="text-sm transition-all text-gray-10 hover:underline"- >- Fedora/RHEL- </a>+ {platform === "linux" && (+ <>+ <a+ href="/download/linux-deb"+ onClick={() =>+ trackDownloadClick(+ "other_option_linux_deb",+ "/download/linux-deb",+ )+ }+ className="text-sm transition-all text-gray-10 hover:underline"+ >+ Debian/Ubuntu+ </a>+ <a+ href="/download/linux-rpm"+ onClick={() =>+ trackDownloadClick(+ "other_option_linux_rpm",+ "/download/linux-rpm",+ )+ }+ className="text-sm transition-all text-gray-10 hover:underline"+ >+ Fedora/RHEL+ </a>+ </>+ )}{platform === "macos" && isIntel && (<ahref="/download/apple-silicon"diff --git a/crates/camera-ffmpeg/src/linux.rs b/crates/camera-ffmpeg/src/linux.rsindex 7664931e1..89e42e2a8 100644--- a/crates/camera-ffmpeg/src/linux.rs+++ b/crates/camera-ffmpeg/src/linux.rs@@ -18,6 +18,8 @@ pub enum AsFFmpegError {},#[error("MJPEG decode error: {0}")]MjpegDecodeError(String),+ #[error("Invalid camera frame stride for {format}: {stride}")]+ InvalidFrameStride { format: String, stride: usize },}struct MjpegDecoder {@@ -159,6 +161,12 @@ fn copy_yuv420(let y_stride = format.stride.max(width);let chroma_width = width / 2;let chroma_height = height / 2;+ if y_stride % 2 != 0 {+ return Err(AsFFmpegError::InvalidFrameStride {+ format: fourcc_str(format.fourcc),+ stride: y_stride,+ });+ }let chroma_stride = y_stride / 2;let y_size = y_stride * height;let chroma_size = chroma_stride * chroma_height;diff --git a/crates/recording/src/cursor.rs b/crates/recording/src/cursor.rsindex 6b236152e..460c8ca90 100644--- a/crates/recording/src/cursor.rs+++ b/crates/recording/src/cursor.rs@@ -34,6 +34,7 @@ pub struct CursorActorResponse {pub struct CursorActor {stop: Option<DropGuard>,+ stop_wakeup: Option<std::sync::mpsc::Sender<()>>,thread: Option<std::thread::JoinHandle<()>>,pub rx: Shared<oneshot::Receiver<CursorActorResponse>>,}@@ -46,6 +47,9 @@ pub struct IncrementalCaptureOutputs {impl CursorActor {pub fn stop(&mut self) {drop(self.stop.take());+ if let Some(stop_wakeup) = self.stop_wakeup.take() {+ let _ = stop_wakeup.send(());+ }if let Some(thread) = self.thread.take() {let _ = thread.join();}@@ -235,6 +239,7 @@ pub fn spawn_cursor_recorder(let stop_token = CancellationToken::new();let (tx, rx) = oneshot::channel();+ let (stop_wakeup_tx, stop_wakeup_rx) = std::sync::mpsc::channel();let stop_token_child = stop_token.child_token();let thread = std::thread::spawn(move || {@@ -263,7 +268,12 @@ pub fn spawn_cursor_recorder(break;}- std::thread::sleep(Duration::from_millis(16));+ if stop_wakeup_rx+ .recv_timeout(Duration::from_millis(16))+ .is_ok()+ {+ break;+ }let elapsed = start_time.instant().elapsed().as_secs_f64() * 1000.0;let mouse_state = device_state.get_mouse();@@ -415,6 +425,7 @@ pub fn spawn_cursor_recorder(CursorActor {stop: Some(stop_token.drop_guard()),+ stop_wakeup: Some(stop_wakeup_tx),thread: Some(thread),rx: rx.shared(),}diff --git a/crates/recording/src/screenshot.rs b/crates/recording/src/screenshot.rsindex 95c83be94..362e1441c 100644--- a/crates/recording/src/screenshot.rs+++ b/crates/recording/src/screenshot.rs@@ -484,7 +484,7 @@ fn windows_capture_settings(target: &ScreenCaptureTarget) -> anyhow::Result<(Setlet mut cropped = false;- if let ScreenCaptureTarget::Area { bounds, screen: _ } = target {+ if let ScreenCaptureTarget::Area { bounds, screen } = target {let display =scap_targets::Display::from_id(screen).ok_or_else(|| anyhow!("Display not found"))?;let physical = display