From d7a56b19d40b9097606ba8a7a7f1a9d50072fdbb Mon Sep 17 00:00:00 2001 From: Alvin-Zilverstand Date: Mon, 16 Nov 2026 10:30:06 +0100 Subject: [PATCH] d --- {.github => .gitea}/workflows/release.yml | 56 +++++++++++++---------- CONTRIBUTING.md | 6 +-- README.md | 14 +++--- docs/architecture.md | 43 +++++++++-------- docs/ffmpeg-installer.md | 4 +- src/updater.rs | 6 +-- 6 files changed, 69 insertions(+), 60 deletions(-) rename {.github => .gitea}/workflows/release.yml (63%) diff --git a/.github/workflows/release.yml b/.gitea/workflows/release.yml similarity index 63% rename from .github/workflows/release.yml rename to .gitea/workflows/release.yml index 4ccb352..a4e5a5c 100644 --- a/.github/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: inputs: publish_release: - description: "Publish the installers to a GitHub Release" + description: "Publish the installers to a Gitea release" required: true default: true type: boolean @@ -25,16 +25,18 @@ on: type: string permissions: - contents: write + code: read + releases: write concurrency: - group: build-windows-release-${{ github.ref }} + group: build-windows-release-${{ gitea.ref }} cancel-in-progress: true jobs: tests: name: Rust tests - runs-on: windows-latest + # Register a Windows Gitea runner with the label windows:host. + runs-on: windows defaults: run: @@ -42,7 +44,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: https://gitea.com/actions/checkout@v4 - name: Set up Rust uses: dtolnay/rust-toolchain@stable @@ -59,7 +61,7 @@ jobs: windows-installer: name: Windows installer - runs-on: windows-latest + runs-on: windows defaults: run: @@ -67,7 +69,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: https://gitea.com/actions/checkout@v4 - name: Set up pnpm uses: pnpm/action-setup@v4 @@ -90,18 +92,21 @@ jobs: . src-tauri - - name: Install Windows bundler dependencies + - name: Check Windows bundler dependencies run: | - choco install nsis wixtoolset -y --no-progress - if (Test-Path "C:\Program Files (x86)\NSIS") { - Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\NSIS" + $nsis = "C:\Program Files (x86)\NSIS" + $wix = @( + "C:\Program Files (x86)\WiX Toolset v3.14\bin", + "C:\Program Files (x86)\WiX Toolset v3.11\bin" + ) | Where-Object { Test-Path $_ } | Select-Object -First 1 + if (-not (Test-Path "$nsis\makensis.exe")) { + throw "NSIS is missing. Install it on the Windows runner before starting the runner." } - if (Test-Path "C:\Program Files (x86)\WiX Toolset v3.14\bin") { - Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\WiX Toolset v3.14\bin" - } - if (Test-Path "C:\Program Files (x86)\WiX Toolset v3.11\bin") { - Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\WiX Toolset v3.11\bin" + if (-not $wix) { + throw "WiX Toolset 3 is missing. Install it on the Windows runner before starting the runner." } + Add-Content $env:GITEA_PATH $nsis + Add-Content $env:GITEA_PATH $wix - name: Install frontend dependencies run: pnpm install --frozen-lockfile @@ -118,10 +123,10 @@ jobs: $publish = "false" $tag = "" - if ($env:GITHUB_REF -like "refs/tags/*") { + if ($env:GITEA_REF -like "refs/tags/*") { $publish = "true" - $tag = $env:GITHUB_REF_NAME - } elseif ($env:GITHUB_EVENT_NAME -eq "workflow_dispatch" -and $env:DISPATCH_PUBLISH_RELEASE -eq "true") { + $tag = $env:GITEA_REF_NAME + } elseif ($env:GITEA_EVENT_NAME -eq "workflow_dispatch" -and $env:DISPATCH_PUBLISH_RELEASE -eq "true") { $publish = "true" $tag = $env:DISPATCH_RELEASE_TAG.Trim() if ([string]::IsNullOrWhiteSpace($tag)) { @@ -129,11 +134,11 @@ jobs: } } - "publish=$publish" >> $env:GITHUB_OUTPUT - "tag=$tag" >> $env:GITHUB_OUTPUT + "publish=$publish" >> $env:GITEA_OUTPUT + "tag=$tag" >> $env:GITEA_OUTPUT - name: Upload installer artifacts - uses: actions/upload-artifact@v4 + uses: https://gitea.com/actions/upload-artifact@v4 with: name: clipforge-windows-installers if-no-files-found: error @@ -141,12 +146,13 @@ jobs: src-tauri/target/release/bundle/msi/*.msi src-tauri/target/release/bundle/nsis/*.exe - - name: Publish GitHub release assets + - name: Publish Gitea release assets if: steps.release.outputs.publish == 'true' - uses: softprops/action-gh-release@v2 + uses: https://gitea.com/actions/gitea-release-action@v1 with: + server_url: ${{ gitea.server_url }} + token: ${{ secrets.GITEA_TOKEN }} tag_name: ${{ steps.release.outputs.tag }} - generate_release_notes: true files: | src-tauri/target/release/bundle/msi/*.msi src-tauri/target/release/bundle/nsis/*.exe diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77b96cc..0f0e687 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ pnpm install pnpm run build # Build the Tauri app (debug) -pnpm run tauri dev +pnpm run desktop:dev # Build the Tauri app (release installers) pnpm run desktop:build @@ -90,7 +90,7 @@ Types: ### Code Style - Rust: `cargo fmt` (standard rustfmt) -- TypeScript: `pnpm run lint` (ESLint + Prettier) +- TypeScript: `pnpm run build` (Vite runs the frontend build). There is currently no lint script in `package.json`. - Run `cargo clippy` before committing ## Architecture Overview @@ -148,4 +148,4 @@ See [SECURITY.md](SECURITY.md) for reporting security vulnerabilities. ## License -By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE). \ No newline at end of file +By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE). diff --git a/README.md b/README.md index a5f825e..6bfdc50 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ cargo check --manifest-path src-tauri\Cargo.toml For the desktop app: ```powershell -pnpm run tauri dev +pnpm run desktop:dev pnpm run desktop:build ``` @@ -35,18 +35,18 @@ pnpm run desktop:build ## Architecture -See `docs/architecture.md` and `docs/product-spec.md`. +See [architecture](docs/architecture.md), [implementation status](docs/implementation-status.md), and [product spec](docs/product-spec.md). ## Desktop Installer -The verified build outputs are: +Installer filenames follow the current version and architecture. For version 0.1.1, they are expected under: -- `src-tauri/target/release/bundle/msi/ClipForge_0.1.0_x64_en-US.msi` -- `src-tauri/target/release/bundle/nsis/ClipForge_0.1.0_x64-setup.exe` +- `src-tauri/target/release/bundle/msi/ClipForge_0.1.1_x64_en-US.msi` +- `src-tauri/target/release/bundle/nsis/ClipForge_0.1.1_x64-setup.exe` The NSIS setup EXE installs for the current Windows user by default and creates the normal Windows uninstaller entry/file during installation. The MSI can also be removed through Windows Apps/Programs and Features. -## GitHub Releases +## Gitea Releases -GitHub Actions builds Windows installer artifacts on pushes to `master`/`main`, pull requests, and manual runs. Any pushed file change, including newly added files, triggers a build. Pushing a tag like `v0.1.0` also publishes the MSI and setup EXE to a GitHub Release. +Gitea Actions builds Windows installer artifacts on pushes to `master`/`main`, pull requests, and manual runs. Any pushed file change, including newly added files, triggers a build. Pushing a tag like `v0.1.1` also publishes the MSI and setup EXE to a Gitea release. The workflow requires a Windows Gitea runner registered with the `windows:host` label, with PowerShell 7, Node.js, Git, NSIS, and WiX Toolset 3 installed. Enable Actions for this repository and allow the job token `code: read` and `releases: write` permissions. diff --git a/docs/architecture.md b/docs/architecture.md index 54fd596..f4a5f4f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,28 +1,31 @@ # ClipForge Architecture -ClipForge is a Windows-first, local-first game clipping app scaffold. The code in this repository implements the testable core and app shell boundaries for a Medal/FTHR-style product without using game memory injection or anti-cheat-sensitive hooks. +ClipForge is a Windows-first, local-first desktop app. A Tauri 2 shell hosts the TypeScript/Vite UI in WebView2; the Rust library in `src/` contains recorder, capture, storage, and integration code. `src-tauri/src/main.rs` owns application state, exposes Tauri commands, registers hotkeys, and runs background workers. Capture and game events use Windows APIs and local endpoints; the app does not inject into games. -## Runtime Shape +## Codebase map -- Tauri shell hosts the frontend UI and calls Rust commands. -- Rust recorder service owns capture lifecycle, replay buffer, clip rendering, game integrations, upload adapters, and local storage. -- Windows capture should be implemented behind `CaptureBackend` using Windows Graphics Capture first, then DXGI/Desktop Duplication fallback. -- Encoding should prefer hardware H.264 through Media Foundation, with software H.264 as fallback. -- Audio should use WASAPI loopback for system/game audio and WASAPI input for mic, with mic disabled by default. +| Area | Main files | Responsibility | +| --- | --- | --- | +| Desktop shell | `src-tauri/src/main.rs`, `src-tauri/tauri.conf.json` | Commands, lifecycle, tray, hotkeys, workers, installer configuration | +| UI | `ui/src/main.ts`, `ui/styles.css` | Recording, library, auto clip, uploads, settings, onboarding | +| Recording | `src/recorder.rs`, `src/ram_buffer.rs`, `src/media.rs` | Session state, rolling segments, clip extraction, thumbnails | +| Capture and audio | `src/capture.rs`, `src/native_wgc.rs`, `src/native_audio.rs` | Native Windows Graphics Capture, WASAPI, FFmpeg fallback | +| Games and events | `src/game_detection.rs`, `src/game_watcher.rs`, `src/integrations.rs`, `src/gsi_config.rs` | Game detection, League polling, Valve GSI normalization | +| Persistence | `src/database.rs`, `src/library.rs`, `src/settings.rs`, `src/storage.rs` | SQLite clip and upload history, versioned JSON settings, file layout | +| Other services | `src/upload.rs`, `src/updater.rs`, `src/screenshot.rs`, `src/crashlog.rs` | Upload providers, GitHub release updates, screenshots, crash reports | -## Implemented Core +## Capture and clip flow -- Replay buffer window selection and pruning. -- Auto-clip event duplicate detection and merge-window policy. -- Game profile detection against process/window facts. -- Normalized event model for League Live Client Data and Valve GSI-style feeds. -- Upload adapter contracts for Catbox, Litterbox, Lustful, and custom HTTP. -- Local library path layout for clips, thumbnails, sessions, and buffer files. +`start_capture` selects the active game and capture quality, checks free space, then starts a rolling segment recorder. It prefers native Windows Graphics Capture with Media Foundation H.264 when the requested audio setup is supported. Separate system and microphone tracks use the FFmpeg backend when available. FFmpeg falls back through Desktop Duplication (`ddagrab`) and `gdigrab`. Native audio uses WASAPI loopback and microphone input; its output is a mixed track. -## Next Native Work +Recent segments are held in a capped RAM buffer and on disk. Manual hotkeys and normalized game events select a time window, render an MP4, make a thumbnail, and add metadata to SQLite. Stopping capture finalizes the segments into a full-session MP4. Background workers refresh game detection, process auto clips, and enforce storage limits. The Tauri shell emits clip and storage events so the UI can refresh its views. -1. Wire Tauri commands to the Rust library. -2. Replace capture stubs with Windows Graphics Capture and Media Foundation implementations. -3. Add SQLite persistence. -4. Add an HTTP client dependency for live upload adapters. -5. Package with installer and auto-update strategy. +## Data and integrations + +The default library is `~/Documents/ClipForge`. It contains clips, thumbnails, sessions, rolling buffer files, settings, database data, and logs. The clip directory can be changed in Settings; the other folders remain under the library root. Screenshots are saved to `~/Pictures/ClipForge`. Settings are versioned in `settings.json`; the SQLite schema uses `PRAGMA user_version` migrations. + +League events are polled from the local Live Client endpoint. A local Valve GSI receiver listens on `127.0.0.1:49321` for CS2/Dota-style posts. Upload adapters support Catbox, Litterbox, and custom multipart HTTP endpoints, with attempt history stored in SQLite. Updates are checked against GitHub Releases and require a newer version with an installer asset. + +## Current limits + +The recorder runs in the Tauri process, so capture does not survive an app restart. Native capture mixes system and mic audio into one track; separate tracks require FFmpeg. The current Valve mapping focuses on CS2 round/bomb events and Dota 2 match transitions. Capture still needs manual QA across gaming hardware. See [implementation status](implementation-status.md) for the detailed feature and remaining-work inventory. diff --git a/docs/ffmpeg-installer.md b/docs/ffmpeg-installer.md index 0b2317e..3891a1b 100644 --- a/docs/ffmpeg-installer.md +++ b/docs/ffmpeg-installer.md @@ -5,10 +5,10 @@ ClipForge should stay lightweight while still working for users who do not alrea ## Packaging Behavior - `pnpm run prepare:ffmpeg` prepares `src-tauri/binaries/ffmpeg-x86_64-pc-windows-msvc.exe`. -- If `ffmpeg` is already on PATH, the script copies that binary into the sidecar location. +- If the sidecar already exists, the script reuses it. Otherwise, if `ffmpeg` is on PATH, the script copies that binary into the sidecar location. - If `ffmpeg` is missing, the script downloads the FFmpeg essentials zip and extracts `ffmpeg.exe` into the sidecar location. - `src-tauri/tauri.conf.json` declares `bundle.externalBin = ["binaries/ffmpeg"]`, so Tauri includes the binary in MSI/NSIS installers. -- Installed users do not need a separate FFmpeg install; ClipForge can prefer system FFmpeg when present and fall back to the bundled sidecar. +- Installed users do not need a separate FFmpeg install; ClipForge checks the bundled sidecar first, then system PATH. ## Why This Is Lightweight diff --git a/src/updater.rs b/src/updater.rs index 6cb751b..c9d2199 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -83,7 +83,7 @@ pub fn check_for_updates( current_version: &str, ) -> Result { let client = http_client(current_version)?; - let url = format!("https://api.github.com/repos/{repo}/releases/latest"); + let url = format!("https://codealvin.xyz/api/v1/repos/{repo}/releases/latest"); let response = client .get(&url) .send() @@ -94,7 +94,7 @@ pub fn check_for_updates( } if !response.status().is_success() { return Err(UpdateCheckError::Http(format!( - "GitHub returned {} for {}", + "Gitea returned {} for {}", response.status(), url ))); @@ -390,4 +390,4 @@ mod tests { ); assert!(!check.latest_version.is_empty()); } -} \ No newline at end of file +}