commit 472aa6f9ecfff628242108e9ee2ac657d76e69ec Author: lashman Date: Mon May 11 23:32:25 2026 +0300 initial scaffold diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef4dff8 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# ByteSize + +Portable Windows screen-to-clip recorder. Drag a frame, record, export to GIF, WebM, or MP4 with a target file size slider that handles the math. Spiritual successor to GifCam. CC0. + +## Build + +``` +npm install +npm run tauri dev +``` + +Release build: + +``` +npm run tauri build -- --no-bundle +``` + +Output is a single portable `ByteSize.exe`. Drop it in a folder and run. + +## Runtime layout + +When you run the exe, it creates the following next to itself: + +``` +ByteSize.exe +config.toml # user settings +bin/ffmpeg.exe # downloaded on first run +output/ # default export location +temp/ # scratch space, auto-cleaned +logs/ # optional, off by default +``` + +Nothing goes in AppData. Nothing goes in the registry. Zip the folder, run anywhere, delete to leave no trace. + +## License + +ByteSize is CC0. The ffmpeg binary downloaded on first run is licensed separately under its own terms (typically GPL for builds that include x264 / x265). diff --git a/index.html b/index.html new file mode 100644 index 0000000..c0ed481 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + ByteSize + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..357f9c2 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "bytesize", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "tauri": "tauri", + "check": "svelte-check --tsconfig ./tsconfig.json" + }, + "dependencies": { + "@tauri-apps/api": "^2.11.1", + "@tauri-apps/plugin-dialog": "^2.0.0" + }, + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^5.0.0", + "@tauri-apps/cli": "^2.11.1", + "svelte": "^5.0.0", + "svelte-check": "^4.0.0", + "tslib": "^2.6.0", + "typescript": "^5.6.0", + "vite": "^6.0.0" + } +} diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml new file mode 100644 index 0000000..6b5e874 --- /dev/null +++ b/src-tauri/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "bytesize" +version = "0.1.0" +description = "Portable Windows screen-to-clip recorder" +authors = ["lashman "] +edition = "2021" +rust-version = "1.95" + +[lib] +name = "bytesize_lib" +crate-type = ["staticlib", "cdylib", "rlib"] + +[build-dependencies] +tauri-build = { version = "2.11", features = [] } + +[dependencies] +tauri = { version = "2.11", features = [] } +tauri-plugin-dialog = "2.11" +windows-capture = "1.5" +tokio = { version = "1.47", features = ["full"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +toml = "0.9" +anyhow = "1.0" +thiserror = "2.0" +reqwest = { version = "0.13", default-features = false, features = ["rustls-tls", "stream"] } +image = "0.25" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["fmt"] } +sha2 = "0.10" + +[features] +default = ["custom-protocol"] +custom-protocol = ["tauri/custom-protocol"] + +[profile.release] +panic = "abort" +codegen-units = 1 +lto = true +opt-level = "s" +strip = true diff --git a/src-tauri/build.rs b/src-tauri/build.rs new file mode 100644 index 0000000..d860e1e --- /dev/null +++ b/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build() +} diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json new file mode 100644 index 0000000..ebaa4a8 --- /dev/null +++ b/src-tauri/capabilities/default.json @@ -0,0 +1,10 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "default capabilities for ByteSize", + "windows": ["main"], + "permissions": [ + "core:default", + "dialog:default" + ] +} diff --git a/src-tauri/src/bootstrap.rs b/src-tauri/src/bootstrap.rs new file mode 100644 index 0000000..5fd5c5a --- /dev/null +++ b/src-tauri/src/bootstrap.rs @@ -0,0 +1 @@ +// first-run ffmpeg download, sha256 verification, extraction into ./bin/ diff --git a/src-tauri/src/capture.rs b/src-tauri/src/capture.rs new file mode 100644 index 0000000..a9f870b --- /dev/null +++ b/src-tauri/src/capture.rs @@ -0,0 +1 @@ +// screen capture via windows-capture (Windows Graphics Capture API) diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs new file mode 100644 index 0000000..40b557b --- /dev/null +++ b/src-tauri/src/config.rs @@ -0,0 +1 @@ +// TOML config load/save - state lives in ./config.toml next to the exe diff --git a/src-tauri/src/encode.rs b/src-tauri/src/encode.rs new file mode 100644 index 0000000..9267f38 --- /dev/null +++ b/src-tauri/src/encode.rs @@ -0,0 +1 @@ +// ffmpeg invocation, target-size encoding logic, codec selection diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs new file mode 100644 index 0000000..5a44240 --- /dev/null +++ b/src-tauri/src/lib.rs @@ -0,0 +1,12 @@ +mod bootstrap; +mod capture; +mod config; +mod encode; + +pub fn run() { + tauri::Builder::default() + .plugin(tauri_plugin_dialog::init()) + .invoke_handler(tauri::generate_handler![]) + .run(tauri::generate_context!()) + .expect("error while running ByteSize") +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs new file mode 100644 index 0000000..a376671 --- /dev/null +++ b/src-tauri/src/main.rs @@ -0,0 +1,5 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +fn main() { + bytesize_lib::run() +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json new file mode 100644 index 0000000..1f432db --- /dev/null +++ b/src-tauri/tauri.conf.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "productName": "ByteSize", + "version": "0.1.0", + "identifier": "live.lashman.bytesize", + "build": { + "beforeDevCommand": "npm run dev", + "devUrl": "http://localhost:1420", + "beforeBuildCommand": "npm run build", + "frontendDist": "../dist" + }, + "app": { + "windows": [ + { + "label": "main", + "title": "ByteSize", + "width": 900, + "height": 600, + "minWidth": 600, + "minHeight": 400, + "resizable": true, + "fullscreen": false + } + ], + "security": { + "csp": null + } + }, + "bundle": { + "active": true, + "targets": "none", + "icon": [ + "icons/icon.ico" + ] + } +} diff --git a/src/App.svelte b/src/App.svelte new file mode 100644 index 0000000..038ae90 --- /dev/null +++ b/src/App.svelte @@ -0,0 +1,61 @@ + + +
+
+

ByteSize

+

screen-to-clip recorder

+
+ +
+ +
+
+ + diff --git a/src/app.css b/src/app.css new file mode 100644 index 0000000..2a40f63 --- /dev/null +++ b/src/app.css @@ -0,0 +1,16 @@ +:root { + font-family: system-ui, -apple-system, "Segoe UI", sans-serif; + color-scheme: dark; + background: #1a1a1a; + color: #f0f0f0; + font-size: 14px; +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + min-height: 100vh; +} diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..c81057c --- /dev/null +++ b/src/main.ts @@ -0,0 +1,9 @@ +import { mount } from "svelte" +import "./app.css" +import App from "./App.svelte" + +const app = mount(App, { + target: document.getElementById("app")!, +}) + +export default app diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..4078e74 --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/svelte.config.js b/svelte.config.js new file mode 100644 index 0000000..7d1d57c --- /dev/null +++ b/svelte.config.js @@ -0,0 +1,5 @@ +import { vitePreprocess } from "@sveltejs/vite-plugin-svelte" + +export default { + preprocess: vitePreprocess(), +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..cbbff0a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "ES2022", + "useDefineForClassFields": true, + "module": "ESNext", + "resolveJsonModule": true, + "allowJs": true, + "checkJs": true, + "isolatedModules": true, + "moduleResolution": "bundler", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "strict": true, + "noImplicitAny": true, + "skipLibCheck": true, + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "verbatimModuleSyntax": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.svelte"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..107b1cd --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,20 @@ +import { defineConfig } from "vite" +import { svelte } from "@sveltejs/vite-plugin-svelte" + +const host = process.env.TAURI_DEV_HOST + +export default defineConfig({ + plugins: [svelte()], + clearScreen: false, + server: { + port: 1420, + strictPort: true, + host: host || false, + hmr: host + ? { protocol: "ws", host, port: 1421 } + : undefined, + watch: { + ignored: ["**/src-tauri/**"], + }, + }, +})