From af3e6c28e58c9b3b2ce9c753bf77c146718732ba Mon Sep 17 00:00:00 2001 From: Alvin-Zilverstand <524715@vistacollege.nl> Date: Wed, 9 Sep 2026 10:43:35 +0200 Subject: [PATCH] Add rolling replay media pipeline --- Cargo.lock | 1556 +++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 6 + src-tauri/Cargo.lock | 566 ++++++++++++++- src-tauri/src/main.rs | 216 ++++-- src/capture.rs | 265 ++++++- src/database.rs | 231 ++++++ src/lib.rs | 2 + src/media.rs | 265 +++++++ src/upload.rs | 163 ++++- ui/src/main.ts | 33 +- ui/styles.css | 9 + 11 files changed, 3182 insertions(+), 130 deletions(-) create mode 100644 src/database.rs create mode 100644 src/media.rs diff --git a/Cargo.lock b/Cargo.lock index 3a94f82..dc6b13b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,1562 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005ec2760ca554fae18df7a11195552ec576cd665632a881bc011d5bb2fd4d80" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core", +] + [[package]] name = "clipforge" version = "0.1.0" +dependencies = [ + "reqwest", + "rusqlite", + "serde_json", + "sysinfo", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "find-msvc-tools" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "rand_core", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "mio" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rusqlite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" +dependencies = [ + "bitflags", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustls" +version = "0.23.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "sysinfo" +version = "0.31.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf0ded5c4e56918d8f8a339e1bb67d038d3bc6d144ac407904015ba2e4cde9b" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.5", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbddc4a036f00ec4f18c83445bd3115cb306a91da554919a099d9222fe4a7f8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.5", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 4363caf..88d0eee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,12 @@ path = "src/lib.rs" name = "clipforge" path = "src/main.rs" +[dependencies] +reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "multipart", "rustls-tls"] } +rusqlite = { version = "0.32", features = ["bundled"] } +serde_json = "1" +sysinfo = "0.31" + [profile.dev] debug = true diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 51a8eae..ae3a088 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -8,6 +8,18 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.5" @@ -315,6 +327,23 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core", +] + [[package]] name = "chrono" version = "0.4.45" @@ -330,6 +359,12 @@ dependencies = [ [[package]] name = "clipforge" version = "0.1.0" +dependencies = [ + "reqwest 0.12.28", + "rusqlite", + "serde_json", + "sysinfo", +] [[package]] name = "clipforge-desktop" @@ -410,6 +445,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.1" @@ -428,6 +472,25 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.23" @@ -732,6 +795,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + [[package]] name = "embed-resource" version = "3.0.11" @@ -769,6 +838,18 @@ dependencies = [ "typeid", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + [[package]] name = "fastrand" version = "2.5.0" @@ -866,6 +947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -1046,8 +1128,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1069,8 +1153,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", + "rand_core", + "wasm-bindgen", ] [[package]] @@ -1227,12 +1314,30 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "heck" version = "0.4.1" @@ -1320,6 +1425,22 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + [[package]] name = "hyper-util" version = "0.1.20" @@ -1753,6 +1874,17 @@ dependencies = [ "libc", ] +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "litemap" version = "0.8.3" @@ -1774,6 +1906,12 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "markup5ever" version = "0.38.0" @@ -1806,6 +1944,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1888,6 +2036,15 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + [[package]] name = "num-conv" version = "0.2.2" @@ -2397,6 +2554,62 @@ dependencies = [ "memchr", ] +[[package]] +name = "quinn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.20", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.20", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "quote" version = "1.0.47" @@ -2418,12 +2631,58 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core", +] + [[package]] name = "raw-window-handle" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -2493,6 +2752,47 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + [[package]] name = "reqwest" version = "0.13.4" @@ -2527,6 +2827,34 @@ dependencies = [ "web-sys", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rusqlite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" +dependencies = [ + "bitflags 2.13.1", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + [[package]] name = "rustc-hash" version = "2.1.3" @@ -2542,12 +2870,53 @@ dependencies = [ "semver", ] +[[package]] +name = "rustls" +version = "0.23.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + [[package]] name = "same-file" version = "1.0.6" @@ -2738,6 +3107,18 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_with" version = "3.23.0" @@ -2809,7 +3190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -2937,6 +3318,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "swift-rs" version = "1.0.8" @@ -3000,6 +3387,20 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "sysinfo" +version = "0.31.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows 0.57.0", +] + [[package]] name = "system-deps" version = "6.2.2" @@ -3047,7 +3448,7 @@ dependencies = [ "tao-macros", "unicode-segmentation", "url", - "windows", + "windows 0.61.3", "windows-core 0.61.2", "windows-version", "x11-dl", @@ -3100,7 +3501,7 @@ dependencies = [ "percent-encoding", "plist", "raw-window-handle", - "reqwest", + "reqwest 0.13.4", "serde", "serde_json", "serde_repr", @@ -3118,7 +3519,7 @@ dependencies = [ "webkit2gtk", "webview2-com", "window-vibrancy", - "windows", + "windows 0.61.3", ] [[package]] @@ -3205,7 +3606,7 @@ dependencies = [ "url", "webkit2gtk", "webview2-com", - "windows", + "windows 0.61.3", ] [[package]] @@ -3230,7 +3631,7 @@ dependencies = [ "url", "webkit2gtk", "webview2-com", - "windows", + "windows 0.61.3", "wry", ] @@ -3401,6 +3802,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "tokio-rustls" +version = "0.26.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c85f2c3ef0b1cd58b36682f4b17aaa995f0e5db534d85692b4903abce21f67" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.19" @@ -3679,6 +4090,12 @@ dependencies = [ "unic-common", ] +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -3691,6 +4108,12 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.8" @@ -3734,6 +4157,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version-compare" version = "0.2.1" @@ -3878,6 +4307,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "web_atoms" version = "0.2.6" @@ -3934,6 +4373,15 @@ dependencies = [ "system-deps", ] +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webview2-com" version = "0.38.2" @@ -3942,10 +4390,10 @@ checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows", + "windows 0.61.3", "windows-core 0.61.2", - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", ] [[package]] @@ -3966,7 +4414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" dependencies = [ "thiserror 2.0.20", - "windows", + "windows 0.61.3", "windows-core 0.61.2", ] @@ -4016,6 +4464,16 @@ dependencies = [ "windows-version", ] +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows" version = "0.61.3" @@ -4038,14 +4496,26 @@ dependencies = [ "windows-core 0.61.2", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link 0.1.3", "windows-result 0.3.4", "windows-strings 0.4.2", @@ -4057,8 +4527,8 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link 0.2.1", "windows-result 0.4.1", "windows-strings 0.5.1", @@ -4075,6 +4545,17 @@ dependencies = [ "windows-threading", ] +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-implement" version = "0.60.2" @@ -4086,6 +4567,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-interface" version = "0.59.3" @@ -4119,6 +4611,15 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-result" version = "0.3.4" @@ -4164,6 +4665,15 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.59.0" @@ -4405,7 +4915,7 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows", + "windows 0.61.3", "windows-core 0.61.2", "windows-version", "x11-dl", @@ -4455,6 +4965,26 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zerocopy" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "zerofrom" version = "0.1.8" @@ -4476,6 +5006,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + [[package]] name = "zerotrie" version = "0.2.5" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 31406b5..c376a82 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,12 +1,17 @@ use clipforge::capture::{ ffmpeg_is_available, find_ffmpeg_executable, CaptureBackend, CaptureConfig, CaptureSource, - EncoderPreference, FfmpegCaptureBackend, + EncoderPreference, FfmpegReplayCaptureBackend, +}; +use clipforge::database::ClipDatabase; +use clipforge::game_detection::{default_profiles, detect_game}; +use clipforge::media::{ + collect_segments, concat_segments, generate_thumbnail, prune_old_segments, recent_segments, + trim_clip as ffmpeg_trim_clip, }; -use clipforge::game_detection::{default_profiles, detect_game, RunningProcess}; use clipforge::models::{Clip, ClipSource, RecordingStatus, UploadProvider}; -use clipforge::recorder::{BufferSegment, RecorderAction, RecorderService}; +use clipforge::recorder::{RecorderAction, RecorderService}; use clipforge::settings::AppSettings; -use clipforge::storage::{clip_path, is_inside_root, write_placeholder_mp4, LibraryPaths}; +use clipforge::storage::{clip_path, is_inside_root, LibraryPaths}; use serde::Serialize; use std::env; use std::fs; @@ -18,14 +23,17 @@ use tauri::State; struct AppRuntime { recorder: Mutex, + database: Mutex, capture: Mutex>, } #[derive(Debug)] struct ActiveCapture { - output_path: PathBuf, + buffer_dir: PathBuf, + session_output_path: PathBuf, + segment_duration: Duration, started_at: SystemTime, - backend: FfmpegCaptureBackend, + backend: FfmpegReplayCaptureBackend, } #[derive(Debug, Serialize)] @@ -55,6 +63,7 @@ struct ClipDto { created_at: String, upload_state: String, path: String, + thumbnail_path: Option, tags: Vec, color_class: String, } @@ -75,7 +84,24 @@ fn list_clips(runtime: State<'_, AppRuntime>) -> Result, String> { #[tauri::command] fn save_manual_clip(seconds: u64, runtime: State<'_, AppRuntime>) -> Result { let mut recorder = runtime.recorder.lock().map_err(|error| error.to_string())?; + let capture = runtime.capture.lock().map_err(|error| error.to_string())?; + let Some(active) = capture.as_ref() else { + return Err("Start recording before saving a replay clip.".to_string()); + }; + let ffmpeg = find_ffmpeg_executable() + .ok_or_else(|| "FFmpeg was not found on PATH or in the bundled sidecar.".to_string())?; let now = SystemTime::now(); + let segment_paths = recent_segments( + &active.buffer_dir, + Duration::from_secs(seconds), + active.segment_duration, + now, + ) + .map_err(|error| error.to_string())?; + if segment_paths.is_empty() { + return Err("The replay buffer has not produced any segments yet.".to_string()); + } + let action = recorder .save_manual_clip(Duration::from_secs(seconds), now) .ok_or_else(|| "No active recording session is available.".to_string())?; @@ -92,7 +118,22 @@ fn save_manual_clip(seconds: u64, runtime: State<'_, AppRuntime>) -> Result) -> Result) -> Result) -> Result if let Some(mut active) = capture.take() { active.backend.stop().map_err(|error| error.to_string())?; - add_session_clip(&mut recorder, active.output_path, active.started_at, SystemTime::now())?; + let ffmpeg = find_ffmpeg_executable() + .ok_or_else(|| "FFmpeg was not found on PATH or in the bundled sidecar.".to_string())?; + let segments = collect_segments(&active.buffer_dir) + .map_err(|error| error.to_string())? + .into_iter() + .map(|segment| segment.path) + .collect::>(); + if !segments.is_empty() { + concat_segments(&ffmpeg, &segments, &active.session_output_path) + .map_err(|error| error.to_string())?; + let clip = add_session_clip( + &mut recorder, + active.session_output_path, + active.started_at, + SystemTime::now(), + )?; + if let Some(thumbnail_path) = &clip.thumbnail_path { + let _ = generate_thumbnail(&ffmpeg, &clip.path, thumbnail_path); + } + persist_clip(&runtime, &clip)?; + } + if is_inside_root(&recorder.paths.buffer_root, &active.buffer_dir) { + let _ = fs::remove_dir_all(&active.buffer_dir); + } } if matches!(recorder.state.status, RecordingStatus::RecordingSession) { @@ -172,7 +245,13 @@ fn delete_clip(clip_id: String, runtime: State<'_, AppRuntime>) -> Result) -> Result RecorderService { +fn create_runtime() -> Result<(RecorderService, ClipDatabase), String> { let root = env::current_dir() .unwrap_or_else(|_| PathBuf::from(".")) .join("clipforge-library"); let settings = AppSettings::default_for_root(&root); let paths = LibraryPaths::new(&root); - let _ = paths.ensure(); + paths.ensure().map_err(|error| error.to_string())?; + let database = ClipDatabase::open(root.join("library.sqlite")) + .map_err(|error| format!("Could not open clip database: {error}"))?; let mut recorder = RecorderService::new(settings, paths); - - let sample_processes = vec![RunningProcess { - pid: 730, - process_name: "cs2.exe".to_string(), - executable_path: "C:/Steam/cs2.exe".to_string(), - window_title: Some("Counter-Strike 2".to_string()), - }]; - - if let Some(game) = detect_game(&sample_processes, &default_profiles()) { - let now = SystemTime::now(); - recorder.start_for_game(game.game_id, now); - for index in 0..12 { - recorder.add_segment(BufferSegment { - id: format!("boot-segment-{index}"), - started_at: now + Duration::from_secs(index * 5), - duration: Duration::from_secs(5), - path_hint: format!("boot_segment_{index}.mp4"), - }); - } + for clip in database + .load_clips() + .map_err(|error| format!("Could not load clip database: {error}"))? + { + recorder.library.add_clip(clip); } - recorder + let _ = detect_game(&[], &default_profiles()); + Ok((recorder, database)) } fn add_session_clip( @@ -364,9 +426,12 @@ fn add_session_clip( output_path: PathBuf, started_at: SystemTime, stopped_at: SystemTime, -) -> Result<(), String> { +) -> Result { if !output_path.exists() { - return Ok(()); + return Err(format!( + "Session recording was not written: {}", + output_path.display() + )); } let duration = stopped_at @@ -398,8 +463,9 @@ fn add_session_clip( upload_url: None, upload_provider: None, }; - recorder.library.add_clip(clip); - save_manifest(recorder) + recorder.library.add_clip(clip.clone()); + save_manifest(recorder)?; + Ok(clip) } fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCapture>) -> DesktopStatus { @@ -411,7 +477,7 @@ fn status_from_recorder(recorder: &RecorderService, capture: Option<&ActiveCaptu upload_enabled: false, session_recording: matches!(recorder.state.status, RecordingStatus::RecordingSession), capture_active: capture.is_some(), - capture_path: capture.map(|active| active.output_path.display().to_string()), + capture_path: capture.map(|active| active.session_output_path.display().to_string()), clip_count: recorder.library.all().len(), library_root: recorder.paths.clip_root.display().to_string(), ffmpeg_available: ffmpeg_is_available(), @@ -455,6 +521,10 @@ fn clip_to_dto(clip: &Clip) -> ClipDto { "Local only".to_string() }, path: clip.path.display().to_string(), + thumbnail_path: clip + .thumbnail_path + .as_ref() + .map(|path| path.display().to_string()), tags: clip.tags.clone(), color_class: match clip.source { ClipSource::ManualHotkey => "manual".to_string(), @@ -465,6 +535,20 @@ fn clip_to_dto(clip: &Clip) -> ClipDto { } } +fn persist_clip(runtime: &State<'_, AppRuntime>, clip: &Clip) -> Result<(), String> { + let database = runtime.database.lock().map_err(|error| error.to_string())?; + database + .upsert_clip(clip) + .map_err(|error| format!("Could not save clip database record: {error}")) +} + +fn delete_clip_record(runtime: &State<'_, AppRuntime>, clip_id: &str) -> Result<(), String> { + let database = runtime.database.lock().map_err(|error| error.to_string())?; + database + .delete_clip(clip_id) + .map_err(|error| format!("Could not delete clip database record: {error}")) +} + fn save_manifest(recorder: &RecorderService) -> Result<(), String> { let manifest = recorder .paths diff --git a/src/capture.rs b/src/capture.rs index c502119..523f9fa 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -31,7 +31,10 @@ pub struct CaptureConfig { pub fps: u32, pub bitrate_kbps: u32, pub encoder: EncoderPreference, + pub system_audio_enabled: bool, pub mic_enabled: bool, + pub system_audio_device: Option, + pub mic_device: Option, } #[derive(Debug, Clone, PartialEq, Eq)] @@ -126,42 +129,125 @@ impl FfmpegRecordingPlan { output: impl Into, config: &CaptureConfig, ) -> Self { - let preset = match config.encoder { - EncoderPreference::HardwareH264 => "h264_mf", - EncoderPreference::SoftwareH264 => "libx264", - }; let output = output.into(); - let size = format!("{}x{}", config.width, config.height); - let fps = config.fps.to_string(); - let bitrate = format!("{}k", config.bitrate_kbps); + + let mut args = base_desktop_input_args(config); + args.extend([ + "-movflags".to_string(), + "+faststart".to_string(), + output.display().to_string(), + ]); Self { executable: executable.into(), - args: vec![ - "-y".to_string(), - "-hide_banner".to_string(), - "-loglevel".to_string(), - "error".to_string(), - "-f".to_string(), - "gdigrab".to_string(), - "-framerate".to_string(), - fps, - "-video_size".to_string(), - size, - "-i".to_string(), - "desktop".to_string(), - "-c:v".to_string(), - preset.to_string(), - "-b:v".to_string(), - bitrate, - "-pix_fmt".to_string(), - "yuv420p".to_string(), - "-movflags".to_string(), - "+faststart".to_string(), - output.display().to_string(), - ], + args, } } + + pub fn for_windows_desktop_segments( + executable: impl Into, + output_pattern: impl Into, + config: &CaptureConfig, + segment_duration: Duration, + ) -> Self { + let output_pattern = output_pattern.into(); + let mut args = base_desktop_input_args(config); + args.extend([ + "-f".to_string(), + "segment".to_string(), + "-segment_time".to_string(), + segment_duration.as_secs().max(1).to_string(), + "-reset_timestamps".to_string(), + "1".to_string(), + "-segment_format".to_string(), + "mp4".to_string(), + output_pattern.display().to_string(), + ]); + + Self { + executable: executable.into(), + args, + } + } +} + +fn base_desktop_input_args(config: &CaptureConfig) -> Vec { + let preset = match config.encoder { + EncoderPreference::HardwareH264 => "h264_mf", + EncoderPreference::SoftwareH264 => "libx264", + }; + let size = format!("{}x{}", config.width, config.height); + let fps = config.fps.to_string(); + let bitrate = format!("{}k", config.bitrate_kbps); + let mut args = vec![ + "-y".to_string(), + "-hide_banner".to_string(), + "-loglevel".to_string(), + "error".to_string(), + "-f".to_string(), + "gdigrab".to_string(), + "-framerate".to_string(), + fps, + "-video_size".to_string(), + size, + "-i".to_string(), + "desktop".to_string(), + ]; + let mut next_input_index = 1; + let mut audio_maps = Vec::new(); + + if config.system_audio_enabled { + args.extend([ + "-f".to_string(), + "wasapi".to_string(), + "-i".to_string(), + config + .system_audio_device + .clone() + .unwrap_or_else(|| "default".to_string()), + ]); + audio_maps.push(format!("{next_input_index}:a?")); + next_input_index += 1; + } + + if config.mic_enabled { + args.extend([ + "-f".to_string(), + "dshow".to_string(), + "-i".to_string(), + format!( + "audio={}", + config + .mic_device + .clone() + .unwrap_or_else(|| "Microphone".to_string()) + ), + ]); + audio_maps.push(format!("{next_input_index}:a?")); + } + + args.extend([ + "-map".to_string(), + "0:v:0".to_string(), + "-c:v".to_string(), + preset.to_string(), + "-b:v".to_string(), + bitrate, + "-pix_fmt".to_string(), + "yuv420p".to_string(), + ]); + for audio_map in audio_maps { + args.extend(["-map".to_string(), audio_map]); + } + if config.system_audio_enabled || config.mic_enabled { + args.extend([ + "-c:a".to_string(), + "aac".to_string(), + "-b:a".to_string(), + "160k".to_string(), + ]); + } + args } #[derive(Debug)] @@ -239,6 +325,96 @@ impl Drop for FfmpegCaptureBackend { } } +#[derive(Debug)] +pub struct FfmpegReplayCaptureBackend { + executable: PathBuf, + output_pattern: PathBuf, + segment_duration: Duration, + child: Option, +} + +impl FfmpegReplayCaptureBackend { + pub fn new( + executable: impl Into, + output_pattern: impl Into, + segment_duration: Duration, + ) -> Self { + Self { + executable: executable.into(), + output_pattern: output_pattern.into(), + segment_duration, + child: None, + } + } + + pub fn plan(&self, config: &CaptureConfig) -> FfmpegRecordingPlan { + FfmpegRecordingPlan::for_windows_desktop_segments( + &self.executable, + &self.output_pattern, + config, + self.segment_duration, + ) + } +} + +impl CaptureBackend for FfmpegReplayCaptureBackend { + fn name(&self) -> &'static str { + "ffmpeg-gdigrab-segments" + } + + fn start(&mut self, config: CaptureConfig) -> Result<(), CaptureError> { + if self.child.is_some() { + return Ok(()); + } + + let plan = self.plan(&config); + let child = Command::new(&plan.executable) + .args(&plan.args) + .stdin(Stdio::piped()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn() + .map_err(|error| CaptureError::DeviceUnavailable(error.to_string()))?; + self.child = Some(child); + Ok(()) + } + + fn stop(&mut self) -> Result<(), CaptureError> { + stop_ffmpeg_child(&mut self.child) + } +} + +impl Drop for FfmpegReplayCaptureBackend { + fn drop(&mut self) { + let _ = self.stop(); + } +} + +fn stop_ffmpeg_child(child: &mut Option) -> Result<(), CaptureError> { + if let Some(mut child) = child.take() { + if let Some(stdin) = child.stdin.as_mut() { + let _ = stdin.write_all(b"q\n"); + } + let deadline = Instant::now() + Duration::from_secs(5); + loop { + if child + .try_wait() + .map_err(|error| CaptureError::DeviceUnavailable(error.to_string()))? + .is_some() + { + break; + } + if Instant::now() >= deadline { + let _ = child.kill(); + let _ = child.wait(); + break; + } + thread::sleep(Duration::from_millis(100)); + } + } + Ok(()) +} + #[cfg(test)] mod tests { use super::*; @@ -252,7 +428,10 @@ mod tests { fps: 30, bitrate_kbps: 6000, encoder: EncoderPreference::HardwareH264, + system_audio_enabled: false, mic_enabled: false, + system_audio_device: None, + mic_device: None, }; let plan = FfmpegRecordingPlan::for_windows_desktop("ffmpeg", "out.mp4", &config); @@ -261,4 +440,30 @@ mod tests { assert!(plan.args.contains(&"1280x720".to_string())); assert!(plan.args.contains(&"6000k".to_string())); } + + #[test] + fn ffmpeg_segment_plan_uses_segment_muxer() { + let config = CaptureConfig { + source: CaptureSource::Desktop, + width: 1280, + height: 720, + fps: 30, + bitrate_kbps: 6000, + encoder: EncoderPreference::HardwareH264, + system_audio_enabled: false, + mic_enabled: false, + system_audio_device: None, + mic_device: None, + }; + + let plan = FfmpegRecordingPlan::for_windows_desktop_segments( + "ffmpeg", + "segment-%05d.mp4", + &config, + Duration::from_secs(5), + ); + + assert!(plan.args.contains(&"segment".to_string())); + assert!(plan.args.contains(&"segment-%05d.mp4".to_string())); + } } diff --git a/src/database.rs b/src/database.rs new file mode 100644 index 0000000..835e329 --- /dev/null +++ b/src/database.rs @@ -0,0 +1,231 @@ +use crate::models::{Clip, ClipSource, GameEventType, UploadProvider}; +use rusqlite::{params, Connection}; +use std::path::{Path, PathBuf}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; + +#[derive(Debug)] +pub struct ClipDatabase { + connection: Connection, +} + +impl ClipDatabase { + pub fn open(path: impl AsRef) -> rusqlite::Result { + let path = path.as_ref(); + if let Some(parent) = path.parent() { + std::fs::create_dir_all(parent) + .map_err(|error| rusqlite::Error::ToSqlConversionFailure(Box::new(error)))?; + } + let connection = Connection::open(path)?; + let database = Self { connection }; + database.init()?; + Ok(database) + } + + pub fn init(&self) -> rusqlite::Result<()> { + self.connection.execute_batch( + " + CREATE TABLE IF NOT EXISTS clips ( + id TEXT PRIMARY KEY NOT NULL, + session_id TEXT NOT NULL, + game_id TEXT NOT NULL, + path TEXT NOT NULL, + thumbnail_path TEXT, + created_at_ms INTEGER NOT NULL, + duration_ms INTEGER NOT NULL, + source TEXT NOT NULL, + event_type TEXT, + tags_json TEXT NOT NULL, + upload_url TEXT, + upload_provider TEXT + ); + CREATE INDEX IF NOT EXISTS clips_created_at_idx ON clips(created_at_ms DESC); + CREATE INDEX IF NOT EXISTS clips_game_id_idx ON clips(game_id); + ", + ) + } + + pub fn load_clips(&self) -> rusqlite::Result> { + let mut statement = self.connection.prepare( + " + SELECT id, session_id, game_id, path, thumbnail_path, created_at_ms, duration_ms, + source, event_type, tags_json, upload_url, upload_provider + FROM clips + ORDER BY created_at_ms DESC + ", + )?; + + let rows = statement.query_map([], |row| { + let tags_json: String = row.get(9)?; + let tags = serde_json::from_str::>(&tags_json).unwrap_or_default(); + let event_type = row + .get::<_, Option>(8)? + .map(|value| parse_event_type(&value)); + let upload_provider = row + .get::<_, Option>(11)? + .and_then(|value| parse_upload_provider(&value)); + + Ok(Clip { + id: row.get(0)?, + session_id: row.get(1)?, + game_id: row.get(2)?, + path: PathBuf::from(row.get::<_, String>(3)?), + thumbnail_path: row.get::<_, Option>(4)?.map(PathBuf::from), + created_at: millis_to_system_time(row.get(5)?), + duration: Duration::from_millis(row.get::<_, i64>(6)?.max(0) as u64), + source: parse_clip_source(&row.get::<_, String>(7)?), + event_type, + tags, + upload_url: row.get(10)?, + upload_provider, + }) + })?; + + rows.collect() + } + + pub fn upsert_clip(&self, clip: &Clip) -> rusqlite::Result<()> { + let tags_json = serde_json::to_string(&clip.tags).unwrap_or_else(|_| "[]".to_string()); + self.connection.execute( + " + INSERT INTO clips ( + id, session_id, game_id, path, thumbnail_path, created_at_ms, duration_ms, + source, event_type, tags_json, upload_url, upload_provider + ) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12) + ON CONFLICT(id) DO UPDATE SET + session_id = excluded.session_id, + game_id = excluded.game_id, + path = excluded.path, + thumbnail_path = excluded.thumbnail_path, + created_at_ms = excluded.created_at_ms, + duration_ms = excluded.duration_ms, + source = excluded.source, + event_type = excluded.event_type, + tags_json = excluded.tags_json, + upload_url = excluded.upload_url, + upload_provider = excluded.upload_provider + ", + params![ + clip.id, + clip.session_id, + clip.game_id, + clip.path.display().to_string(), + clip.thumbnail_path + .as_ref() + .map(|path| path.display().to_string()), + system_time_to_millis(clip.created_at), + clip.duration.as_millis().min(i64::MAX as u128) as i64, + clip_source_name(&clip.source), + clip.event_type.as_ref().map(ToString::to_string), + tags_json, + clip.upload_url, + clip.upload_provider.as_ref().map(upload_provider_name), + ], + )?; + Ok(()) + } + + pub fn delete_clip(&self, clip_id: &str) -> rusqlite::Result<()> { + self.connection + .execute("DELETE FROM clips WHERE id = ?1", params![clip_id])?; + Ok(()) + } +} + +fn parse_clip_source(value: &str) -> ClipSource { + match value { + "manual_hotkey" => ClipSource::ManualHotkey, + "auto_event" => ClipSource::AutoEvent, + "full_session_bookmark" => ClipSource::FullSessionBookmark, + _ => ClipSource::Imported, + } +} + +fn clip_source_name(source: &ClipSource) -> &'static str { + match source { + ClipSource::ManualHotkey => "manual_hotkey", + ClipSource::AutoEvent => "auto_event", + ClipSource::FullSessionBookmark => "full_session_bookmark", + ClipSource::Imported => "imported", + } +} + +fn parse_event_type(value: &str) -> GameEventType { + match value { + "kill" => GameEventType::Kill, + "death" => GameEventType::Death, + "assist" => GameEventType::Assist, + "round_win" => GameEventType::RoundWin, + "match_win" => GameEventType::MatchWin, + "objective" => GameEventType::Objective, + "multi_kill" => GameEventType::MultiKill, + "bookmark" => GameEventType::Bookmark, + value => GameEventType::Unknown(value.to_string()), + } +} + +fn parse_upload_provider(value: &str) -> Option { + match value { + "catbox" => Some(UploadProvider::Catbox), + "litterbox" => Some(UploadProvider::Litterbox), + "lustful" => Some(UploadProvider::Lustful), + "custom_http" => Some(UploadProvider::CustomHttp), + _ => None, + } +} + +fn upload_provider_name(provider: &UploadProvider) -> &'static str { + match provider { + UploadProvider::Catbox => "catbox", + UploadProvider::Litterbox => "litterbox", + UploadProvider::Lustful => "lustful", + UploadProvider::CustomHttp => "custom_http", + } +} + +fn system_time_to_millis(time: SystemTime) -> i64 { + time.duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_millis() + .min(i64::MAX as u128) as i64 +} + +fn millis_to_system_time(millis: i64) -> SystemTime { + UNIX_EPOCH + Duration::from_millis(millis.max(0) as u64) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn round_trips_clip_records() { + let db_path = std::env::temp_dir().join(format!( + "clipforge-db-{}.sqlite", + system_time_to_millis(SystemTime::now()) + )); + let database = ClipDatabase::open(&db_path).expect("database"); + let clip = Clip { + id: "clip-1".to_string(), + session_id: "session-1".to_string(), + game_id: "counter-strike-2".to_string(), + path: PathBuf::from("C:/clips/clip-1.mp4"), + thumbnail_path: Some(PathBuf::from("C:/clips/clip-1.jpg")), + created_at: UNIX_EPOCH + Duration::from_secs(10), + duration: Duration::from_secs(60), + source: ClipSource::ManualHotkey, + event_type: Some(GameEventType::Kill), + tags: vec!["clutch".to_string()], + upload_url: Some("https://example.test/clip.mp4".to_string()), + upload_provider: Some(UploadProvider::CustomHttp), + }; + + database.upsert_clip(&clip).expect("upsert"); + let loaded = database.load_clips().expect("load"); + + assert_eq!(loaded, vec![clip]); + database.delete_clip("clip-1").expect("delete"); + assert!(database.load_clips().expect("load empty").is_empty()); + let _ = std::fs::remove_file(db_path); + } +} diff --git a/src/lib.rs b/src/lib.rs index 3b3b260..6f1cc07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,11 @@ pub mod capture; +pub mod database; pub mod game_detection; pub mod hotkeys; pub mod integrations; pub mod jobs; pub mod library; +pub mod media; pub mod models; pub mod recorder; pub mod settings; diff --git a/src/media.rs b/src/media.rs new file mode 100644 index 0000000..feb7075 --- /dev/null +++ b/src/media.rs @@ -0,0 +1,265 @@ +use std::fs; +use std::io; +use std::path::{Path, PathBuf}; +use std::process::Command; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SegmentFile { + pub path: PathBuf, + pub modified_at: SystemTime, +} + +pub fn collect_segments(buffer_dir: &Path) -> io::Result> { + let mut segments = Vec::new(); + if !buffer_dir.exists() { + return Ok(segments); + } + + for entry in fs::read_dir(buffer_dir)? { + let entry = entry?; + let path = entry.path(); + if path.extension().and_then(|value| value.to_str()) != Some("mp4") { + continue; + } + let metadata = entry.metadata()?; + segments.push(SegmentFile { + path, + modified_at: metadata.modified().unwrap_or(SystemTime::UNIX_EPOCH), + }); + } + + segments.sort_by(|left, right| left.modified_at.cmp(&right.modified_at)); + Ok(segments) +} + +pub fn recent_segments( + buffer_dir: &Path, + window: Duration, + segment_duration: Duration, + now: SystemTime, +) -> io::Result> { + let cutoff = now + .checked_sub(window + segment_duration) + .unwrap_or(SystemTime::UNIX_EPOCH); + Ok(collect_segments(buffer_dir)? + .into_iter() + .filter(|segment| segment.modified_at >= cutoff) + .map(|segment| segment.path) + .collect()) +} + +pub fn prune_old_segments( + buffer_dir: &Path, + replay_window: Duration, + segment_duration: Duration, +) -> io::Result { + let mut segments = collect_segments(buffer_dir)?; + let keep_count = + (replay_window.as_secs_f64() / segment_duration.as_secs_f64()).ceil() as usize + 4; + if segments.len() <= keep_count { + return Ok(0); + } + + let remove_count = segments.len() - keep_count; + let mut removed = 0; + for segment in segments.drain(..remove_count) { + fs::remove_file(segment.path)?; + removed += 1; + } + Ok(removed) +} + +pub fn concat_segments( + ffmpeg: &Path, + segments: &[PathBuf], + output: &Path, +) -> Result<(), MediaError> { + if segments.is_empty() { + return Err(MediaError::NoSegments); + } + if let Some(parent) = output.parent() { + fs::create_dir_all(parent)?; + } + + if segments.len() == 1 { + fs::copy(&segments[0], output)?; + return Ok(()); + } + + let list_path = output.with_extension("concat.txt"); + let mut list = String::new(); + for segment in segments { + list.push_str("file '"); + list.push_str(&escape_concat_path(segment)); + list.push_str("'\n"); + } + fs::write(&list_path, list)?; + + let status = Command::new(ffmpeg) + .args([ + "-y", + "-hide_banner", + "-loglevel", + "error", + "-f", + "concat", + "-safe", + "0", + "-i", + &list_path.display().to_string(), + "-c", + "copy", + &output.display().to_string(), + ]) + .status() + .map_err(|error| MediaError::Ffmpeg(error.to_string()))?; + + let _ = fs::remove_file(list_path); + if status.success() { + Ok(()) + } else { + Err(MediaError::Ffmpeg("FFmpeg concat failed".to_string())) + } +} + +pub fn trim_clip( + ffmpeg: &Path, + input: &Path, + output: &Path, + start_seconds: f64, + end_seconds: f64, +) -> Result<(), MediaError> { + if !(end_seconds > start_seconds && start_seconds >= 0.0) { + return Err(MediaError::InvalidWindow); + } + if let Some(parent) = output.parent() { + fs::create_dir_all(parent)?; + } + + let status = Command::new(ffmpeg) + .args([ + "-y", + "-hide_banner", + "-loglevel", + "error", + "-ss", + &format!("{start_seconds:.3}"), + "-to", + &format!("{end_seconds:.3}"), + "-i", + &input.display().to_string(), + "-c", + "copy", + &output.display().to_string(), + ]) + .status() + .map_err(|error| MediaError::Ffmpeg(error.to_string()))?; + + if status.success() { + Ok(()) + } else { + Err(MediaError::Ffmpeg("FFmpeg trim failed".to_string())) + } +} + +pub fn generate_thumbnail(ffmpeg: &Path, input: &Path, output: &Path) -> Result<(), MediaError> { + if let Some(parent) = output.parent() { + fs::create_dir_all(parent)?; + } + + let status = Command::new(ffmpeg) + .args([ + "-y", + "-hide_banner", + "-loglevel", + "error", + "-ss", + "00:00:01", + "-i", + &input.display().to_string(), + "-frames:v", + "1", + "-q:v", + "3", + &output.display().to_string(), + ]) + .status() + .map_err(|error| MediaError::Ffmpeg(error.to_string()))?; + + if status.success() { + Ok(()) + } else { + Err(MediaError::Ffmpeg( + "FFmpeg thumbnail generation failed".to_string(), + )) + } +} + +fn escape_concat_path(path: &Path) -> String { + path.display() + .to_string() + .replace('\\', "/") + .replace('\'', "'\\''") +} + +#[derive(Debug)] +pub enum MediaError { + Io(io::Error), + Ffmpeg(String), + InvalidWindow, + NoSegments, +} + +impl std::fmt::Display for MediaError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Io(error) => write!(f, "{error}"), + Self::Ffmpeg(error) => write!(f, "{error}"), + Self::InvalidWindow => f.write_str("clip window is invalid"), + Self::NoSegments => f.write_str("no replay buffer segments are available"), + } + } +} + +impl From for MediaError { + fn from(value: io::Error) -> Self { + Self::Io(value) + } +} + +pub fn timestamp_millis(time: SystemTime) -> u128 { + time.duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_millis() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn concat_paths_are_ffmpeg_friendly() { + let path = Path::new("C:\\clips\\a'b.mp4"); + assert_eq!(escape_concat_path(path), "C:/clips/a'\\''b.mp4"); + } + + #[test] + fn prune_keeps_replay_window_plus_slack() { + let root = std::env::temp_dir().join(format!( + "clipforge-media-{}", + timestamp_millis(SystemTime::now()) + )); + fs::create_dir_all(&root).expect("test root"); + for index in 0..8 { + fs::write(root.join(format!("segment-{index}.mp4")), b"x").expect("segment"); + } + + let removed = prune_old_segments(&root, Duration::from_secs(10), Duration::from_secs(5)) + .expect("prune"); + + assert_eq!(removed, 2); + assert_eq!(collect_segments(&root).expect("segments").len(), 6); + let _ = fs::remove_dir_all(root); + } +} diff --git a/src/upload.rs b/src/upload.rs index abec7c8..91bb690 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -1,5 +1,6 @@ use crate::models::UploadProvider; use std::path::Path; +use std::time::Duration; #[derive(Debug, Clone, PartialEq, Eq)] pub struct UploadMetadata { @@ -37,6 +38,17 @@ pub enum UploadError { Provider(String), } +impl std::fmt::Display for UploadError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::NotConfigured(message) => write!(f, "{message}"), + Self::FileTooLarge { max_mb } => write!(f, "file is larger than {max_mb} MB"), + Self::Network(message) => write!(f, "upload network error: {message}"), + Self::Provider(message) => write!(f, "upload provider error: {message}"), + } + } +} + pub trait Uploader { fn info(&self) -> UploaderInfo; fn upload(&self, file: &Path, metadata: &UploadMetadata) -> Result; @@ -63,10 +75,31 @@ impl Uploader for CatboxUploader { fn upload(&self, file: &Path, _metadata: &UploadMetadata) -> Result { ensure_file_limit(file, 200)?; - Err(UploadError::Network( - "Catbox upload is wired at the adapter boundary; enable HTTP client dependency for live uploads." - .to_string(), - )) + let client = upload_client()?; + let file_part = reqwest::blocking::multipart::Part::file(file) + .map_err(|error| UploadError::Network(error.to_string()))?; + let mut form = reqwest::blocking::multipart::Form::new() + .text("reqtype", "fileupload") + .part("fileToUpload", file_part); + if let Some(userhash) = &self.userhash { + if !userhash.trim().is_empty() { + form = form.text("userhash", userhash.clone()); + } + } + let body = client + .post("https://catbox.moe/user/api.php") + .multipart(form) + .send() + .map_err(|error| UploadError::Network(error.to_string()))? + .error_for_status() + .map_err(|error| UploadError::Provider(error.to_string()))? + .text() + .map_err(|error| UploadError::Network(error.to_string()))?; + let url = parse_plain_url(&body)?; + Ok(UploadResult { + provider: UploadProvider::Catbox, + url, + }) } } @@ -98,10 +131,27 @@ impl Uploader for LitterboxUploader { "Litterbox expiry must be one of 1, 12, 24, or 72 hours.".to_string(), )); } - Err(UploadError::Network( - "Litterbox upload is wired at the adapter boundary; enable HTTP client dependency for live uploads." - .to_string(), - )) + let client = upload_client()?; + let file_part = reqwest::blocking::multipart::Part::file(file) + .map_err(|error| UploadError::Network(error.to_string()))?; + let form = reqwest::blocking::multipart::Form::new() + .text("reqtype", "fileupload") + .text("time", format!("{}h", self.expiry_hours)) + .part("fileToUpload", file_part); + let body = client + .post("https://litterbox.catbox.moe/resources/internals/api.php") + .multipart(form) + .send() + .map_err(|error| UploadError::Network(error.to_string()))? + .error_for_status() + .map_err(|error| UploadError::Provider(error.to_string()))? + .text() + .map_err(|error| UploadError::Network(error.to_string()))?; + let url = parse_plain_url(&body)?; + Ok(UploadResult { + provider: UploadProvider::Litterbox, + url, + }) } } @@ -111,6 +161,7 @@ pub struct CustomHttpUploader { pub method: String, pub multipart_field: String, pub response_url_path: String, + pub headers: Vec<(String, String)>, } impl Uploader for CustomHttpUploader { @@ -127,20 +178,52 @@ impl Uploader for CustomHttpUploader { } } - fn upload( - &self, - _file: &Path, - _metadata: &UploadMetadata, - ) -> Result { + fn upload(&self, file: &Path, metadata: &UploadMetadata) -> Result { if self.endpoint.trim().is_empty() { return Err(UploadError::NotConfigured( "custom upload endpoint is required".to_string(), )); } - Err(UploadError::Network( - "Custom upload is configured; enable HTTP client dependency for live uploads." - .to_string(), - )) + if !self.method.eq_ignore_ascii_case("POST") { + return Err(UploadError::Provider( + "custom uploads currently support POST multipart requests".to_string(), + )); + } + let client = upload_client()?; + let file_part = reqwest::blocking::multipart::Part::file(file) + .map_err(|error| UploadError::Network(error.to_string()))?; + let field_name = if self.multipart_field.trim().is_empty() { + "file" + } else { + self.multipart_field.trim() + }; + let form = reqwest::blocking::multipart::Form::new() + .text("clip_id", metadata.clip_id.clone()) + .text("game_id", metadata.game_id.clone()) + .text("title", metadata.title.clone()) + .part(field_name.to_string(), file_part); + let mut request = client.post(&self.endpoint).multipart(form); + for (name, value) in &self.headers { + if !name.trim().is_empty() { + request = request.header(name, value); + } + } + let body = request + .send() + .map_err(|error| UploadError::Network(error.to_string()))? + .error_for_status() + .map_err(|error| UploadError::Provider(error.to_string()))? + .text() + .map_err(|error| UploadError::Network(error.to_string()))?; + let url = if self.response_url_path.trim().is_empty() { + parse_plain_url(&body)? + } else { + extract_json_path(&body, &self.response_url_path)? + }; + Ok(UploadResult { + provider: UploadProvider::CustomHttp, + url, + }) } } @@ -178,6 +261,42 @@ fn ensure_file_limit(file: &Path, max_mb: u64) -> Result<(), UploadError> { Ok(()) } +fn upload_client() -> Result { + reqwest::blocking::Client::builder() + .timeout(Duration::from_secs(120)) + .user_agent("ClipForge/0.1") + .build() + .map_err(|error| UploadError::Network(error.to_string())) +} + +fn parse_plain_url(body: &str) -> Result { + let trimmed = body.trim(); + if trimmed.starts_with("http://") || trimmed.starts_with("https://") { + Ok(trimmed.to_string()) + } else { + Err(UploadError::Provider(trimmed.to_string())) + } +} + +fn extract_json_path(body: &str, path: &str) -> Result { + let mut value: &serde_json::Value = &serde_json::from_str(body) + .map_err(|error| UploadError::Provider(format!("invalid JSON response: {error}")))?; + for key in path.trim().trim_start_matches("$.").split('.') { + if key.is_empty() { + continue; + } + value = value.get(key).ok_or_else(|| { + UploadError::Provider(format!("response URL path was not found: {path}")) + })?; + } + let Some(url) = value.as_str() else { + return Err(UploadError::Provider(format!( + "response URL path is not a string: {path}" + ))); + }; + parse_plain_url(url) +} + #[cfg(test)] mod tests { use super::*; @@ -196,4 +315,14 @@ mod tests { assert!(matches!(result, Err(UploadError::Provider(_)))); } + + #[test] + fn extracts_custom_json_url_path() { + let url = extract_json_path( + r#"{"data":{"url":"https://example.test/c.mp4"}}"#, + "data.url", + ) + .expect("url"); + assert_eq!(url, "https://example.test/c.mp4"); + } } diff --git a/ui/src/main.ts b/ui/src/main.ts index c3af028..a749770 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,3 +1,5 @@ +import { convertFileSrc } from "@tauri-apps/api/core"; + type RecordingState = | "WaitingForGame" | "Buffering" @@ -19,6 +21,9 @@ type Clip = { createdAt: string; uploadState: UploadState; path: string; + thumbnailPath: string | null; + videoUrl: string | null; + thumbnailUrl: string | null; tags: string[]; colorClass: string; }; @@ -55,6 +60,7 @@ type ClipDto = { created_at: string; upload_state: UploadState; path: string; + thumbnail_path: string | null; tags: string[]; color_class: string; }; @@ -115,6 +121,9 @@ const state: AppState = { createdAt: "Today 12:08", uploadState: "Local only", path: "", + thumbnailPath: null, + videoUrl: null, + thumbnailUrl: null, tags: ["clutch", "kill"], colorClass: "kill", }, @@ -128,6 +137,9 @@ const state: AppState = { createdAt: "Today 11:44", uploadState: "Queued", path: "", + thumbnailPath: null, + videoUrl: null, + thumbnailUrl: null, tags: ["objective"], colorClass: "objective", }, @@ -141,6 +153,9 @@ const state: AppState = { createdAt: "Yesterday 22:15", uploadState: "Uploaded", path: "", + thumbnailPath: null, + videoUrl: null, + thumbnailUrl: null, tags: ["teamfight"], colorClass: "manual", }, @@ -270,6 +285,9 @@ function clipFromDto(dto: ClipDto): Clip { createdAt: dto.created_at, uploadState: dto.upload_state, path: dto.path, + thumbnailPath: dto.thumbnail_path, + videoUrl: dto.path ? convertFileSrc(dto.path) : null, + thumbnailUrl: dto.thumbnail_path ? convertFileSrc(dto.thumbnail_path) : null, tags: dto.tags, colorClass: dto.color_class, }; @@ -278,7 +296,9 @@ function clipFromDto(dto: ClipDto): Clip { function renderClipCard(clip: Clip) { return `
-
${clip.event}
+
+ ${clip.thumbnailUrl ? `` : clip.event} +

${clip.title}

${clip.game} · ${clip.source} · ${clip.duration}

@@ -298,7 +318,13 @@ function renderClipDetails(clip: Clip | undefined) { return `