From dbf6747c18cebfb74d19c801088fb2f7b8d79dce Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Tue, 25 Nov 2025 10:15:29 +0800 Subject: [PATCH] sovereignty over app lifecycle --- src-tauri/Cargo.lock | 668 +++++++++++++++++++----- src-tauri/Cargo.toml | 10 +- src-tauri/src/app.rs | 41 ++ src-tauri/src/core/mod.rs | 4 + src-tauri/src/core/models/app_config.rs | 8 + src-tauri/src/core/models/mod.rs | 1 + src-tauri/src/core/services/mod.rs | 1 + src-tauri/src/core/state.rs | 26 + src-tauri/src/core/utilities.rs | 29 + src-tauri/src/lib.rs | 46 +- src-tauri/src/main.rs | 3 +- src-tauri/src/services/mod.rs | 1 + src-tauri/src/services/overlay.rs | 25 + src-tauri/tauri.conf.json | 11 +- src/app.css | 137 ++--- src/app.html | 22 +- src/routes/+layout.svelte | 7 + src/routes/+layout.ts | 1 + src/routes/+page.svelte | 6 +- src/routes/scene/+page.svelte | 10 + 20 files changed, 842 insertions(+), 215 deletions(-) create mode 100644 src-tauri/src/app.rs create mode 100644 src-tauri/src/core/mod.rs create mode 100644 src-tauri/src/core/models/app_config.rs create mode 100644 src-tauri/src/core/models/mod.rs create mode 100644 src-tauri/src/core/services/mod.rs create mode 100644 src-tauri/src/core/state.rs create mode 100644 src-tauri/src/core/utilities.rs create mode 100644 src-tauri/src/services/mod.rs create mode 100644 src-tauri/src/services/overlay.rs create mode 100644 src/routes/+layout.svelte create mode 100644 src/routes/scene/+page.svelte diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 32cf50c..bf15737 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -309,9 +309,9 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytemuck" -version = "1.24.0" +version = "1.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +checksum = "3995eaeebcdf32f91f980d360f78732ddc061097ab4e39991ae7a6ace9194677" [[package]] name = "byteorder" @@ -491,6 +491,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation" version = "0.10.1" @@ -514,9 +524,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ "bitflags 2.10.0", - "core-foundation", + "core-foundation 0.10.1", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -527,7 +537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ "bitflags 2.10.0", - "core-foundation", + "core-foundation 0.10.1", "libc", ] @@ -697,7 +707,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -806,6 +816,15 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + [[package]] name = "endi" version = "1.1.0" @@ -857,7 +876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -928,6 +947,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -935,7 +963,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -949,6 +977,12 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -968,11 +1002,16 @@ dependencies = [ name = "friendolls-desktop" version = "0.1.0" dependencies = [ + "reqwest", "serde", "serde_json", "tauri", "tauri-build", + "tauri-plugin-global-shortcut", "tauri-plugin-opener", + "tauri-plugin-positioner", + "tokio", + "ts-rs", ] [[package]] @@ -1188,6 +1227,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55" +dependencies = [ + "rustix", + "windows-targets 0.52.6", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -1284,7 +1333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" dependencies = [ "heck 0.4.1", - "proc-macro-crate 2.0.2", + "proc-macro-crate 2.0.0", "proc-macro-error", "proc-macro2", "quote", @@ -1307,6 +1356,24 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "global-hotkey" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9247516746aa8e53411a0db9b62b0e24efbcf6a76e0ba73e5a91b512ddabed7" +dependencies = [ + "crossbeam-channel", + "keyboard-types", + "objc2 0.6.3", + "objc2-app-kit", + "once_cell", + "serde", + "thiserror 2.0.17", + "windows-sys 0.59.0", + "x11rb", + "xkeysym", +] + [[package]] name = "gobject-sys" version = "0.18.0" @@ -1370,6 +1437,25 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "h2" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.12.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1460,14 +1546,15 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "hyper" -version = "1.8.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" dependencies = [ "atomic-waker", "bytes", "futures-channel", "futures-core", + "h2", "http", "http-body", "httparse", @@ -1480,10 +1567,42 @@ dependencies = [ ] [[package]] -name = "hyper-util" -version = "0.1.18" +name = "hyper-rustls" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ "base64 0.22.1", "bytes", @@ -1498,9 +1617,11 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] @@ -1515,7 +1636,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core", ] [[package]] @@ -1685,9 +1806,9 @@ checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "iri-string" -version = "0.7.9" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" dependencies = [ "memchr", "serde", @@ -1765,9 +1886,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -2001,6 +2122,23 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndk" version = "0.9.0" @@ -2073,9 +2211,9 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" dependencies = [ "num_enum_derive", "rustversion", @@ -2083,11 +2221,11 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ - "proc-macro-crate 3.4.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.110", @@ -2375,6 +2513,50 @@ dependencies = [ "pathdiff", ] +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -2702,21 +2884,20 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "toml_datetime 0.6.3", "toml_edit 0.20.2", ] [[package]] name = "proc-macro-crate" -version = "3.4.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ - "toml_edit 0.23.7", + "toml_edit 0.22.27", ] [[package]] @@ -2940,28 +3121,36 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.12.24" +version = "0.12.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" dependencies = [ "base64 0.22.1", "bytes", + "encoding_rs", "futures-core", "futures-util", + "h2", "http", "http-body", "http-body-util", "hyper", + "hyper-rustls", + "hyper-tls", "hyper-util", "js-sys", "log", + "mime", + "native-tls", "percent-encoding", "pin-project-lite", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", + "tokio-native-tls", "tokio-util", "tower", "tower-http", @@ -2973,6 +3162,20 @@ 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.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc_version" version = "0.4.1" @@ -2992,7 +3195,40 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls" +version = "0.23.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -3016,6 +3252,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "schemars" version = "0.8.22" @@ -3073,6 +3318,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "selectors" version = "0.24.0" @@ -3346,7 +3614,7 @@ dependencies = [ "bytemuck", "cfg_aliases", "core-graphics", - "foreign-types", + "foreign-types 0.5.0", "js-sys", "log", "objc2 0.5.2", @@ -3428,6 +3696,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.7" @@ -3481,6 +3755,27 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.10.0", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "system-deps" version = "6.2.2" @@ -3490,7 +3785,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.2", + "toml 0.8.23", "version-compare", ] @@ -3502,7 +3797,7 @@ checksum = "f3a753bdc39c07b192151523a3f77cd0394aa75413802c883a0f6f6a0e5ee2e7" dependencies = [ "bitflags 2.10.0", "block2 0.6.2", - "core-foundation", + "core-foundation 0.10.1", "core-graphics", "crossbeam-channel", "dispatch", @@ -3529,7 +3824,7 @@ dependencies = [ "unicode-segmentation", "url", "windows", - "windows-core 0.61.2", + "windows-core", "windows-version", "x11-dl", ] @@ -3682,6 +3977,21 @@ dependencies = [ "walkdir", ] +[[package]] +name = "tauri-plugin-global-shortcut" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df9f0f7bf2fe768b85fee4951c2505a35b72c44df1f6403e74e110bc13c5f58" +dependencies = [ + "global-hotkey", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.17", +] + [[package]] name = "tauri-plugin-opener" version = "2.5.2" @@ -3704,6 +4014,21 @@ dependencies = [ "zbus", ] +[[package]] +name = "tauri-plugin-positioner" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a01e373ea3f3f5f46d40f434ba13bd12fa4833aabab50dfc09f6362bad27c95" +dependencies = [ + "log", + "serde", + "serde_json", + "serde_repr", + "tauri", + "tauri-plugin", + "thiserror 2.0.17", +] + [[package]] name = "tauri-runtime" version = "2.9.1" @@ -3815,7 +4140,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3829,6 +4154,15 @@ dependencies = [ "utf-8", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -3921,14 +4255,46 @@ dependencies = [ "mio", "pin-project-lite", "socket2", + "tokio-macros", "windows-sys 0.61.2", ] [[package]] -name = "tokio-util" -version = "0.7.17" +name = "tokio-macros" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", @@ -3939,14 +4305,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", "serde_spanned 0.6.9", - "toml_datetime 0.6.3", - "toml_edit 0.20.2", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", ] [[package]] @@ -3966,9 +4332,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" dependencies = [ "serde", ] @@ -3989,7 +4355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.12.0", - "toml_datetime 0.6.3", + "toml_datetime 0.6.11", "winnow 0.5.40", ] @@ -4000,21 +4366,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap 2.12.0", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.3", + "toml_datetime 0.6.11", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap 2.12.0", - "toml_datetime 0.7.3", - "toml_parser", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "winnow 0.7.13", ] @@ -4137,6 +4502,28 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ts-rs" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be" +dependencies = [ + "thiserror 2.0.17", + "ts-rs-macros", +] + +[[package]] +name = "ts-rs-macros" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ed7b4c18cc150a6a0a1e9ea1ecfa688791220781af6e119f9599a8502a0a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", + "termcolor", +] + [[package]] name = "typeid" version = "1.0.3" @@ -4213,6 +4600,12 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[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.7" @@ -4261,6 +4654,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" @@ -4335,22 +4734,35 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.110", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.55" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -4361,9 +4773,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4371,22 +4783,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ - "bumpalo", "proc-macro2", "quote", "syn 2.0.110", + "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ "unicode-ident", ] @@ -4406,9 +4818,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.82" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -4467,7 +4879,7 @@ dependencies = [ "webview2-com-macros", "webview2-com-sys", "windows", - "windows-core 0.61.2", + "windows-core", "windows-implement", "windows-interface", ] @@ -4491,7 +4903,7 @@ checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c" dependencies = [ "thiserror 2.0.17", "windows", - "windows-core 0.61.2", + "windows-core", ] [[package]] @@ -4516,7 +4928,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4547,7 +4959,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ "windows-collections", - "windows-core 0.61.2", + "windows-core", "windows-future", "windows-link 0.1.3", "windows-numerics", @@ -4559,7 +4971,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" dependencies = [ - "windows-core 0.61.2", + "windows-core", ] [[package]] @@ -4571,21 +4983,8 @@ dependencies = [ "windows-implement", "windows-interface", "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", + "windows-result", + "windows-strings", ] [[package]] @@ -4594,16 +4993,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ - "windows-core 0.61.2", + "windows-core", "windows-link 0.1.3", "windows-threading", ] [[package]] name = "windows-implement" -version = "0.60.2" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", @@ -4612,9 +5011,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.3" +version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", @@ -4639,10 +5038,21 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ - "windows-core 0.61.2", + "windows-core", "windows-link 0.1.3", ] +[[package]] +name = "windows-registry" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" +dependencies = [ + "windows-link 0.1.3", + "windows-result", + "windows-strings", +] + [[package]] name = "windows-result" version = "0.3.4" @@ -4652,15 +5062,6 @@ dependencies = [ "windows-link 0.1.3", ] -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - [[package]] name = "windows-strings" version = "0.4.2" @@ -4670,15 +5071,6 @@ dependencies = [ "windows-link 0.1.3", ] -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -4688,6 +5080,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" @@ -4703,7 +5104,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.5", + "windows-targets 0.53.3", ] [[package]] @@ -4748,11 +5149,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.5" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link 0.2.1", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -4999,7 +5400,7 @@ dependencies = [ "webkit2gtk-sys", "webview2-com", "windows", - "windows-core 0.61.2", + "windows-core", "windows-version", "x11-dl", ] @@ -5025,6 +5426,29 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "gethostname", + "rustix", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + [[package]] name = "yoke" version = "0.8.1" @@ -5088,7 +5512,7 @@ version = "5.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cdb94821ca8a87ca9c298b5d1cbd80e2a8b67115d99f6e4551ac49e42b6a314" dependencies = [ - "proc-macro-crate 3.4.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.110", @@ -5150,6 +5574,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + [[package]] name = "zerotrie" version = "0.2.3" @@ -5203,7 +5633,7 @@ version = "5.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da58575a1b2b20766513b1ec59d8e2e68db2745379f961f86650655e862d2006" dependencies = [ - "proc-macro-crate 3.4.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.110", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d465df8..384d0fa 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -18,8 +18,16 @@ crate-type = ["staticlib", "cdylib", "rlib"] tauri-build = { version = "2", features = [] } [dependencies] -tauri = { version = "2", features = [] } +tauri = { version = "2", features = ["macos-private-api", "unstable"] } tauri-plugin-opener = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" +tokio = { version = "1.47.1", features = ["macros", "rt-multi-thread"] } +tauri-plugin-global-shortcut = "2" +tauri-plugin-positioner = "2" +reqwest = { version = "0.12.23", features = ["json", "native-tls"] } +ts-rs = "11.0.1" +[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] +tauri-plugin-global-shortcut = "2" +tauri-plugin-positioner = "2" diff --git a/src-tauri/src/app.rs b/src-tauri/src/app.rs new file mode 100644 index 0000000..52d8525 --- /dev/null +++ b/src-tauri/src/app.rs @@ -0,0 +1,41 @@ +use tauri::Manager; +use tauri_plugin_positioner::WindowExt; + +use crate::{ + get_app_handle, + services::overlay::{overlay_fullscreen, SCENE_WINDOW_LABEL}, +}; + +pub async fn start_fdoll() { + initialize_session().await; +} + +pub async fn initialize_session() { + let webview_window = tauri::WebviewWindowBuilder::new( + get_app_handle(), + SCENE_WINDOW_LABEL, + tauri::WebviewUrl::App("/scene".into()), + ) + .title("Friendolls Scene") + .inner_size(600.0, 500.0) + .resizable(false) + .decorations(false) + .transparent(true) + .shadow(false) + .visible(true) + .skip_taskbar(true) + .always_on_top(true) + .visible_on_all_workspaces(true) + .build() + .expect("Failed to display scene screen"); + + webview_window + .move_window(tauri_plugin_positioner::Position::Center) + .unwrap(); + + let window = get_app_handle().get_window(webview_window.label()).unwrap(); + overlay_fullscreen(&window).unwrap(); + window.set_ignore_cursor_events(true).unwrap(); + + println!("Scene window initialized."); +} diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs new file mode 100644 index 0000000..e83a919 --- /dev/null +++ b/src-tauri/src/core/mod.rs @@ -0,0 +1,4 @@ +pub mod models; +pub mod services; +pub mod state; +pub mod utilities; diff --git a/src-tauri/src/core/models/app_config.rs b/src-tauri/src/core/models/app_config.rs new file mode 100644 index 0000000..3ab205b --- /dev/null +++ b/src-tauri/src/core/models/app_config.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; +use ts_rs::TS; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)] +#[ts(export)] +pub struct AppConfig { + pub api_base_url: Option, +} diff --git a/src-tauri/src/core/models/mod.rs b/src-tauri/src/core/models/mod.rs new file mode 100644 index 0000000..62a6f82 --- /dev/null +++ b/src-tauri/src/core/models/mod.rs @@ -0,0 +1 @@ +pub mod app_config; diff --git a/src-tauri/src/core/services/mod.rs b/src-tauri/src/core/services/mod.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src-tauri/src/core/services/mod.rs @@ -0,0 +1 @@ + diff --git a/src-tauri/src/core/state.rs b/src-tauri/src/core/state.rs new file mode 100644 index 0000000..18c9a0f --- /dev/null +++ b/src-tauri/src/core/state.rs @@ -0,0 +1,26 @@ +// in app-core/src/state.rs +use crate::{core::models::app_config::AppConfig, lock_w}; +use reqwest::Client; +use std::sync::{Arc, LazyLock, RwLock}; + +#[derive(Default)] +pub struct AppState { + pub app_config: Option, + pub http_client: Client, +} + +// Global application state +// FDOLL = Multiplayer Todo App +// Read / write this state via the `lock_r!` / `lock_w!` macros from `fdoll-core::utilities` +pub static FDOLL: LazyLock>> = + LazyLock::new(|| Arc::new(RwLock::new(AppState::default()))); + +pub fn init_fdoll_state() { + { + let mut guard = lock_w!(FDOLL); + guard.app_config = Some(AppConfig { + api_base_url: Some("http://sandbox:3000".to_string()), + }); + guard.http_client = reqwest::Client::new(); + } +} diff --git a/src-tauri/src/core/utilities.rs b/src-tauri/src/core/utilities.rs new file mode 100644 index 0000000..f75e7ab --- /dev/null +++ b/src-tauri/src/core/utilities.rs @@ -0,0 +1,29 @@ +#[macro_export] +macro_rules! lock_r { + ($rwlock:expr) => {{ + match $rwlock.read() { + Ok(guard) => guard, + Err(_) => panic!( + "Failed to acquire read lock on {} at {}:{}", + stringify!($rwlock), + file!(), + line!() + ), + } + }}; +} + +#[macro_export] +macro_rules! lock_w { + ($rwlock:expr) => {{ + match $rwlock.write() { + Ok(guard) => guard, + Err(_) => panic!( + "Failed to acquire write lock on {} at {}:{}", + stringify!($rwlock), + file!(), + line!() + ), + } + }}; +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a74da47..ae8401e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,8 +1,50 @@ +static APP_HANDLE: std::sync::OnceLock> = std::sync::OnceLock::new(); + +mod app; +mod core; +mod services; + +/// Tauri app handle +pub fn get_app_handle<'a>() -> &'a tauri::AppHandle { + APP_HANDLE + .get() + .expect("get_app_handle called but app is still not initialized") +} + +fn setup_fdoll() -> Result<(), tauri::Error> { + core::state::init_fdoll_state(); + tokio::spawn(async move { app::start_fdoll().await }); + Ok(()) +} + +fn register_app_events(event: tauri::RunEvent) { + match event { + tauri::RunEvent::ExitRequested { api, code, .. } => { + if code.is_none() { + api.prevent_exit(); + } else { + println!("exit code: {:?}", code); + } + } + _ => {} + } +} + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) + .plugin(tauri_plugin_positioner::init()) + // .plugin(tauri_plugin_global_shortcut::Builder::new().build()) .invoke_handler(tauri::generate_handler![]) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); + .setup(|app| { + APP_HANDLE + .set(app.handle().to_owned()) + .expect("Failed to init app handle."); + setup_fdoll().expect("Failed to setup app."); + Ok(()) + }) + .build(tauri::generate_context!()) + .expect("error while running tauri application") + .run(|_, event| register_app_events(event)); } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 775cc38..9790d5e 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,6 +1,7 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -fn main() { +#[tokio::main] +async fn main() { friendolls_desktop_lib::run() } diff --git a/src-tauri/src/services/mod.rs b/src-tauri/src/services/mod.rs new file mode 100644 index 0000000..2b55280 --- /dev/null +++ b/src-tauri/src/services/mod.rs @@ -0,0 +1 @@ +pub mod overlay; diff --git a/src-tauri/src/services/overlay.rs b/src-tauri/src/services/overlay.rs new file mode 100644 index 0000000..a74512e --- /dev/null +++ b/src-tauri/src/services/overlay.rs @@ -0,0 +1,25 @@ +use crate::get_app_handle; + +pub static SCENE_WINDOW_LABEL: &str = "scene"; + +pub fn overlay_fullscreen(window: &tauri::Window) -> Result<(), tauri::Error> { + // Get the primary monitor + let monitor = get_app_handle().primary_monitor()?.unwrap(); + + // Get the work area (usable space, excluding menu bar/dock/notch) + let work_area = monitor.work_area(); + + // Set window position to top-left of the work area + window.set_position(tauri::PhysicalPosition { + x: work_area.position.x, + y: work_area.position.y, + })?; + + // Set window size to match work area size + window.set_size(tauri::PhysicalSize { + width: work_area.size.width, + height: work_area.size.height, + })?; + + Ok(()) +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5b1cca1..e8bfc2e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -10,16 +10,11 @@ "frontendDist": "../build" }, "app": { - "windows": [ - { - "title": "friendolls-desktop", - "width": 800, - "height": 600 - } - ], + "windows": [], "security": { "csp": null - } + }, + "macOSPrivateApi": true }, "bundle": { "active": true, diff --git a/src/app.css b/src/app.css index 74c008e..05a4b12 100644 --- a/src/app.css +++ b/src/app.css @@ -1,75 +1,76 @@ @import "tailwindcss"; @plugin "daisyui"; - @plugin "daisyui/theme" { - name: "proper"; - default: true; - prefersdark: false; - color-scheme: "light"; - --color-base-100: oklch(96% 0.001 286.375); - --color-base-200: oklch(92% 0.004 286.32); - --color-base-300: oklch(87% 0.006 286.286); - --color-base-content: oklch(44% 0.017 285.786); - --color-primary: oklch(71% 0.143 215.221); - --color-primary-content: oklch(98% 0.019 200.873); - --color-secondary: oklch(67% 0.182 276.935); - --color-secondary-content: oklch(93% 0.034 272.788); - --color-accent: oklch(93% 0.032 255.585); - --color-accent-content: oklch(38% 0.063 188.416); - --color-neutral: oklch(96% 0.001 286.375); - --color-neutral-content: oklch(0% 0 0); - --color-info: oklch(58% 0.158 241.966); - --color-info-content: oklch(100% 0 0); - --color-success: oklch(76% 0.233 130.85); - --color-success-content: oklch(98% 0.031 120.757); - --color-warning: oklch(66% 0.179 58.318); - --color-warning-content: oklch(100% 0 0); - --color-error: oklch(70% 0.191 22.216); - --color-error-content: oklch(100% 0 0); - --radius-selector: 0.5rem; - --radius-field: 0.5rem; - --radius-box: 0.5rem; - --size-selector: 0.25rem; - --size-field: 0.25rem; - --border: 1px; - --depth: 1; - --noise: 1; + name: "proper"; + default: true; + prefersdark: false; + color-scheme: "light"; + --color-base-100: oklch(96% 0.001 286.375); + --color-base-200: oklch(92% 0.004 286.32); + --color-base-300: oklch(87% 0.006 286.286); + --color-base-content: oklch(44% 0.017 285.786); + --color-primary: oklch(71% 0.143 215.221); + --color-primary-content: oklch(98% 0.019 200.873); + --color-secondary: oklch(67% 0.182 276.935); + --color-secondary-content: oklch(93% 0.034 272.788); + --color-accent: oklch(93% 0.032 255.585); + --color-accent-content: oklch(38% 0.063 188.416); + --color-neutral: oklch(96% 0.001 286.375); + --color-neutral-content: oklch(0% 0 0); + --color-info: oklch(58% 0.158 241.966); + --color-info-content: oklch(100% 0 0); + --color-success: oklch(76% 0.233 130.85); + --color-success-content: oklch(98% 0.031 120.757); + --color-warning: oklch(66% 0.179 58.318); + --color-warning-content: oklch(100% 0 0); + --color-error: oklch(70% 0.191 22.216); + --color-error-content: oklch(100% 0 0); + --radius-selector: 0.5rem; + --radius-field: 0.5rem; + --radius-box: 0.5rem; + --size-selector: 0.25rem; + --size-field: 0.25rem; + --border: 1px; + --depth: 1; + --noise: 1; } - - @plugin "daisyui/theme" { - name: "properdark"; - default: false; - prefersdark: true; - color-scheme: "dark"; - --color-base-100: oklch(26% 0 0); - --color-base-200: oklch(37% 0 0); - --color-base-300: oklch(43% 0 0); - --color-base-content: oklch(100% 0 0); - --color-primary: oklch(86% 0.127 207.078); - --color-primary-content: oklch(39% 0.07 227.392); - --color-secondary: oklch(87% 0.065 274.039); - --color-secondary-content: oklch(35% 0.144 278.697); - --color-accent: oklch(36.2% 0.076 265.6); - --color-accent-content: oklch(97% 0.014 254.604); - --color-neutral: oklch(37% 0.01 67.558); - --color-neutral-content: oklch(100% 0 0); - --color-info: oklch(64.4% 0.12 237.3); - --color-info-content: oklch(100% 0 0); - --color-success: oklch(76% 0.233 130.85); - --color-success-content: oklch(0% 0 0); - --color-warning: oklch(87% 0.169 91.605); - --color-warning-content: oklch(0% 0 0); - --color-error: oklch(63% 0.237 25.331); - --color-error-content: oklch(100% 0 0); - --radius-selector: 0.5rem; - --radius-field: 0.5rem; - --radius-box: 0.5rem; - --size-selector: 0.25rem; - --size-field: 0.25rem; - --border: 1px; - --depth: 1; - --noise: 1; -} \ No newline at end of file + name: "properdark"; + default: false; + prefersdark: true; + color-scheme: "dark"; + --color-base-100: oklch(26% 0 0); + --color-base-200: oklch(37% 0 0); + --color-base-300: oklch(43% 0 0); + --color-base-content: oklch(100% 0 0); + --color-primary: oklch(86% 0.127 207.078); + --color-primary-content: oklch(39% 0.07 227.392); + --color-secondary: oklch(87% 0.065 274.039); + --color-secondary-content: oklch(35% 0.144 278.697); + --color-accent: oklch(36.2% 0.076 265.6); + --color-accent-content: oklch(97% 0.014 254.604); + --color-neutral: oklch(37% 0.01 67.558); + --color-neutral-content: oklch(100% 0 0); + --color-info: oklch(64.4% 0.12 237.3); + --color-info-content: oklch(100% 0 0); + --color-success: oklch(76% 0.233 130.85); + --color-success-content: oklch(0% 0 0); + --color-warning: oklch(87% 0.169 91.605); + --color-warning-content: oklch(0% 0 0); + --color-error: oklch(63% 0.237 25.331); + --color-error-content: oklch(100% 0 0); + --radius-selector: 0.5rem; + --radius-field: 0.5rem; + --radius-box: 0.5rem; + --size-selector: 0.25rem; + --size-field: 0.25rem; + --border: 1px; + --depth: 1; + --noise: 1; +} + +:root { + background-color: transparent; +} diff --git a/src/app.html b/src/app.html index d976b53..19c1d20 100644 --- a/src/app.html +++ b/src/app.html @@ -1,13 +1,13 @@ - + - - - - - Friendolls - %sveltekit.head% - - -
%sveltekit.body%
- + + + + + Friendolls + %sveltekit.head% + + +
%sveltekit.body%
+ diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte new file mode 100644 index 0000000..73f0b68 --- /dev/null +++ b/src/routes/+layout.svelte @@ -0,0 +1,7 @@ + + +
+ {@render children?.()} +
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 9d24899..1ab31d7 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -3,3 +3,4 @@ // See: https://svelte.dev/docs/kit/single-page-apps // See: https://v2.tauri.app/start/frontend/sveltekit/ for more info export const ssr = false; +import "../app.css"; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 69ae05b..c9648a1 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,3 @@ - -
- +
diff --git a/src/routes/scene/+page.svelte b/src/routes/scene/+page.svelte new file mode 100644 index 0000000..5a12d32 --- /dev/null +++ b/src/routes/scene/+page.svelte @@ -0,0 +1,10 @@ +
+
+
+

Friendolls

+

Scene Screen

+
+
+