From 9ff18aae3540f753b8880d8a6359b08282ac9cfd Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Tue, 7 Apr 2026 11:46:08 +0700 Subject: [PATCH] chore: restruture --- Cargo.lock | 111 +++++++++--------- Cargo.toml | 4 +- GEMINI.md | 54 +++++++++ crates/coop_mobile/Cargo.toml | 36 ------ {crates/coop => desktop}/Cargo.toml | 28 ++--- .../coop => desktop}/resources/128x128.png | Bin .../coop => desktop}/resources/128x128@2x.png | Bin {crates/coop => desktop}/resources/32x32.png | Bin .../resources/coop.desktop.in | 0 .../resources/flatpak/coop.metainfo.xml.in | 0 .../resources/flatpak/manifest-template.json | 2 +- {crates/coop => desktop}/resources/icon.icns | Bin {crates/coop => desktop}/resources/icon.ico | Bin {crates/coop => desktop}/resources/icon.png | Bin .../coop => desktop}/resources/icon@2x.png | Bin .../resources/snap/snapcraft.yaml.in | 0 .../coop => desktop}/src/dialogs/accounts.rs | 0 .../coop => desktop}/src/dialogs/connect.rs | 0 .../coop => desktop}/src/dialogs/import.rs | 0 {crates/coop => desktop}/src/dialogs/mod.rs | 0 .../coop => desktop}/src/dialogs/restore.rs | 0 .../coop => desktop}/src/dialogs/screening.rs | 0 .../coop => desktop}/src/dialogs/settings.rs | 0 {crates/coop => desktop}/src/main.rs | 0 {crates/coop => desktop}/src/panels/backup.rs | 0 .../src/panels/contact_list.rs | 0 .../coop => desktop}/src/panels/greeter.rs | 0 .../src/panels/messaging_relays.rs | 0 {crates/coop => desktop}/src/panels/mod.rs | 0 .../coop => desktop}/src/panels/profile.rs | 0 .../coop => desktop}/src/panels/relay_list.rs | 0 {crates/coop => desktop}/src/panels/trash.rs | 0 {crates/coop => desktop}/src/sidebar/entry.rs | 0 {crates/coop => desktop}/src/sidebar/mod.rs | 0 {crates/coop => desktop}/src/workspace.rs | 0 mobile/Cargo.toml | 51 ++++++++ {crates/coop_mobile => mobile}/src/lib.rs | 0 script/bundle-linux | 6 +- script/bundle-snap | 6 +- script/flatpak/bundle-flatpak | 2 +- script/prepare-flathub | 8 +- script/release | 2 +- {crates/coop_web => web}/Cargo.toml | 20 ++-- {crates/coop_web => web}/src/lib.rs | 0 {crates/coop_web => web}/src/www/index.html | 0 45 files changed, 201 insertions(+), 129 deletions(-) create mode 100644 GEMINI.md delete mode 100644 crates/coop_mobile/Cargo.toml rename {crates/coop => desktop}/Cargo.toml (68%) rename {crates/coop => desktop}/resources/128x128.png (100%) rename {crates/coop => desktop}/resources/128x128@2x.png (100%) rename {crates/coop => desktop}/resources/32x32.png (100%) rename {crates/coop => desktop}/resources/coop.desktop.in (100%) rename {crates/coop => desktop}/resources/flatpak/coop.metainfo.xml.in (100%) rename {crates/coop => desktop}/resources/flatpak/manifest-template.json (97%) rename {crates/coop => desktop}/resources/icon.icns (100%) rename {crates/coop => desktop}/resources/icon.ico (100%) rename {crates/coop => desktop}/resources/icon.png (100%) rename {crates/coop => desktop}/resources/icon@2x.png (100%) rename {crates/coop => desktop}/resources/snap/snapcraft.yaml.in (100%) rename {crates/coop => desktop}/src/dialogs/accounts.rs (100%) rename {crates/coop => desktop}/src/dialogs/connect.rs (100%) rename {crates/coop => desktop}/src/dialogs/import.rs (100%) rename {crates/coop => desktop}/src/dialogs/mod.rs (100%) rename {crates/coop => desktop}/src/dialogs/restore.rs (100%) rename {crates/coop => desktop}/src/dialogs/screening.rs (100%) rename {crates/coop => desktop}/src/dialogs/settings.rs (100%) rename {crates/coop => desktop}/src/main.rs (100%) rename {crates/coop => desktop}/src/panels/backup.rs (100%) rename {crates/coop => desktop}/src/panels/contact_list.rs (100%) rename {crates/coop => desktop}/src/panels/greeter.rs (100%) rename {crates/coop => desktop}/src/panels/messaging_relays.rs (100%) rename {crates/coop => desktop}/src/panels/mod.rs (100%) rename {crates/coop => desktop}/src/panels/profile.rs (100%) rename {crates/coop => desktop}/src/panels/relay_list.rs (100%) rename {crates/coop => desktop}/src/panels/trash.rs (100%) rename {crates/coop => desktop}/src/sidebar/entry.rs (100%) rename {crates/coop => desktop}/src/sidebar/mod.rs (100%) rename {crates/coop => desktop}/src/workspace.rs (100%) create mode 100644 mobile/Cargo.toml rename {crates/coop_mobile => mobile}/src/lib.rs (100%) rename {crates/coop_web => web}/Cargo.toml (64%) rename {crates/coop_web => web}/src/lib.rs (100%) rename {crates/coop_web => web}/src/www/index.html (100%) diff --git a/Cargo.lock b/Cargo.lock index 5ee2577..df09983 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ dependencies = [ [[package]] name = "assets" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "gpui 0.2.2 (git+https://github.com/zed-industries/zed)", @@ -343,7 +343,7 @@ checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.3.0", + "fastrand 2.4.1", "futures-lite 2.6.1", "pin-project-lite", "slab", @@ -577,7 +577,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "auto_update" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -1037,7 +1037,7 @@ dependencies = [ [[package]] name = "chat" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "chat_ui" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "chat", @@ -1254,7 +1254,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "indexmap", "rustc-hash 2.1.2", @@ -1294,7 +1294,7 @@ dependencies = [ [[package]] name = "common" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "bech32", @@ -1390,7 +1390,7 @@ dependencies = [ [[package]] name = "coop" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "assets", @@ -1431,8 +1431,10 @@ dependencies = [ [[package]] name = "coop_mobile" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ + "android-activity", + "android_logger", "anyhow", "assets", "chat", @@ -1443,10 +1445,10 @@ dependencies = [ "gpui-mobile", "gpui_platform", "gpui_tokio", - "itertools 0.13.0", "log", "nostr-connect", "nostr-sdk", + "objc2", "oneshot", "person", "relay_auth", @@ -1463,7 +1465,7 @@ dependencies = [ [[package]] name = "coop_web" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "assets", @@ -1788,6 +1790,7 @@ dependencies = [ "quote", "rustc_version", "syn", + "unicode-xid", ] [[package]] @@ -1803,7 +1806,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "proc-macro2", "quote", @@ -1812,7 +1815,7 @@ dependencies = [ [[package]] name = "device" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -2188,11 +2191,11 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" dependencies = [ - "getrandom 0.2.17", + "getrandom 0.3.4", ] [[package]] @@ -2332,7 +2335,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" dependencies = [ - "fastrand 2.3.0", + "fastrand 2.4.1", "futures-core", "futures-sink", "spin 0.9.8", @@ -2552,7 +2555,7 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" dependencies = [ - "fastrand 2.3.0", + "fastrand 2.4.1", "futures-core", "futures-io", "parking", @@ -2879,7 +2882,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.2.2" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "async-channel 2.5.0", @@ -2959,12 +2962,12 @@ dependencies = [ [[package]] name = "gpui-mobile" version = "0.1.0" -source = "git+https://github.com/itsbalamurali/gpui-mobile#f75068f0e036c82fb10436549537d8daea83ef06" +source = "git+https://github.com/itsbalamurali/gpui-mobile#24c8ef2f987d7c0ad891ad15599d7f3ecd193282" dependencies = [ "android-activity", "android_logger", "anyhow", - "block", + "block2", "core-foundation 0.10.0", "core-foundation-sys", "core-graphics 0.24.0", @@ -2977,7 +2980,7 @@ dependencies = [ "ndk", "ndk-context", "ndk-sys", - "objc", + "objc2", "parking_lot", "pathfinder_geometry", "raw-window-handle", @@ -2991,7 +2994,7 @@ dependencies = [ [[package]] name = "gpui_linux" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -3039,7 +3042,7 @@ dependencies = [ [[package]] name = "gpui_macos" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "async-task", @@ -3093,7 +3096,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3104,7 +3107,7 @@ dependencies = [ [[package]] name = "gpui_platform" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "console_error_panic_hook", "gpui 0.2.2 (git+https://github.com/zed-industries/zed)", @@ -3117,7 +3120,7 @@ dependencies = [ [[package]] name = "gpui_tokio" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "gpui 0.2.2 (git+https://github.com/zed-industries/zed)", @@ -3137,7 +3140,7 @@ dependencies = [ [[package]] name = "gpui_util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "log", @@ -3146,7 +3149,7 @@ dependencies = [ [[package]] name = "gpui_web" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "console_error_panic_hook", @@ -3198,7 +3201,7 @@ dependencies = [ [[package]] name = "gpui_wgpu" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "bytemuck", @@ -3226,7 +3229,7 @@ dependencies = [ [[package]] name = "gpui_windows" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "collections 0.1.0 (git+https://github.com/zed-industries/zed)", @@ -3523,7 +3526,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "async-compression", @@ -3548,7 +3551,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "rustls", "rustls-platform-verifier", @@ -4403,7 +4406,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "bindgen", @@ -5277,7 +5280,7 @@ dependencies = [ [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "collections 0.1.0 (git+https://github.com/zed-industries/zed)", "serde", @@ -5286,7 +5289,7 @@ dependencies = [ [[package]] name = "person" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -5401,7 +5404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" dependencies = [ "atomic-waker", - "fastrand 2.3.0", + "fastrand 2.4.1", "futures-io", ] @@ -5997,7 +6000,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "derive_refineable 0.1.0 (git+https://github.com/zed-industries/zed)", ] @@ -6033,7 +6036,7 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "relay_auth" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -6096,7 +6099,7 @@ dependencies = [ [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "bytes", @@ -6154,7 +6157,7 @@ dependencies = [ [[package]] name = "rope" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "heapless 0.9.2", "log", @@ -6431,7 +6434,7 @@ dependencies = [ [[package]] name = "scheduler" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "async-task", "backtrace", @@ -6710,7 +6713,7 @@ dependencies = [ [[package]] name = "settings" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -6957,7 +6960,7 @@ dependencies = [ [[package]] name = "state" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -7044,7 +7047,7 @@ dependencies = [ [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "heapless 0.9.2", "log", @@ -7278,7 +7281,7 @@ version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ - "fastrand 2.3.0", + "fastrand 2.4.1", "getrandom 0.4.2", "once_cell", "rustix 1.1.4", @@ -7307,7 +7310,7 @@ dependencies = [ [[package]] name = "theme" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "gpui 0.2.2 (git+https://github.com/zed-industries/zed)", @@ -7444,7 +7447,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "title_bar" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -7826,7 +7829,7 @@ dependencies = [ [[package]] name = "ui" -version = "1.0.0-beta2" +version = "1.0.0-beta3" dependencies = [ "anyhow", "common", @@ -8056,7 +8059,7 @@ dependencies = [ [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "async-fs", @@ -8105,7 +8108,7 @@ dependencies = [ [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "perf 0.1.0 (git+https://github.com/zed-industries/zed)", "quote", @@ -9933,7 +9936,7 @@ dependencies = [ [[package]] name = "zlog" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "anyhow", "chrono", @@ -9961,7 +9964,7 @@ dependencies = [ [[package]] name = "ztracing" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" dependencies = [ "tracing", "tracing-subscriber", @@ -9977,7 +9980,7 @@ source = "git+https://github.com/zed-industries/zed?rev=56104fb17e6c5849900a4c28 [[package]] name = "ztracing_macro" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#68452a3daea53843b9b388ec53a2cfd7673baac0" +source = "git+https://github.com/zed-industries/zed#3a5dc8ef6aaed33f7c57f9eeab36bbc71a19bc59" [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index 47c83c9..0c7978f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" -members = ["crates/*"] -default-members = ["crates/coop"] +members = ["crates/*", "desktop", "web", "mobile"] +default-members = ["desktop"] [workspace.package] version = "1.0.0-beta3" diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 0000000..8bc2571 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,54 @@ +# Coop - Gemini Context + +## Project Overview + +Coop is a simple, fast, and reliable Nostr client for secure messaging across all platforms. It is written in Rust and structured as a Cargo workspace. The project utilizes: +- **GPUI**: The GPU-accelerated UI framework developed by Zed Industries for cross-platform, high-performance user interfaces. +- **Rust Nostr SDK**: For handling the Nostr protocol (including NIPs like 44, 49, 59, 96). + +The workspace is divided into several sub-crates under `crates/`, including the main application (`coop`), UI components (`ui`, `chat_ui`, `title_bar`, `theme`), and domain logic (`chat`, `person`, `relay_auth`, `state`, `device`). + +## Building and Running + +### Prerequisites +- **Rust Toolchain**: Use `rustup` to install the Rust toolchain. +- **System Dependencies**: Depending on your OS, you must run the provided setup scripts to install necessary libraries before compiling. + +### Commands +- **Install Linux Dependencies**: + ```bash + ./script/linux + ``` +- **Install FreeBSD Dependencies**: + ```bash + ./script/freebsd + ``` +- **Install macOS Dependencies**: + ```bash + ./script/macos + ``` +- **Build the project** (debug mode): + ```bash + cargo build + ``` +- **Run the application**: + ```bash + cargo run + ``` +- **Build for Production** (optimized release binary): + ```bash + cargo build --release + ``` + +### Packaging +- Packaging scripts and manifests are available in the `script/` directory (e.g., `bundle-linux`, `bundle-snap`, `prepare-flathub`) and the `flathub/` directory. + +## Development Conventions + +- **Code Formatting**: The project enforces a strict Rust code formatting style via `rustfmt.toml`. + - **Edition**: 2024 + - **Indentation**: Block style with 4 tab spaces. + - **Imports**: Grouped by `StdExternalCrate`, with module granularity and automatic reordering of imports, modules, and impl items. +- **Modularity**: Code is split into focused crates (e.g., separating UI code in `chat_ui` from core messaging logic in `chat`). When contributing, ensure your code respects these boundaries. +- **Contributing**: Contributions are made via Pull Requests on the `lumehq/coop` GitHub repository. Ensure all tests pass before submitting. +- **UI Architecture**: Because Coop uses GPUI, UI components are built using GPUI's element tree structure, event handling, and view contexts. diff --git a/crates/coop_mobile/Cargo.toml b/crates/coop_mobile/Cargo.toml deleted file mode 100644 index c0c38f2..0000000 --- a/crates/coop_mobile/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "coop_mobile" -version.workspace = true -edition.workspace = true -publish.workspace = true - -[dependencies] -assets = { path = "../assets" } -ui = { path = "../ui" } -theme = { path = "../theme" } -common = { path = "../common" } -state = { path = "../state" } -device = { path = "../device" } -chat = { path = "../chat" } -settings = { path = "../settings" } -person = { path = "../person" } -relay_auth = { path = "../relay_auth" } - -gpui.workspace = true -gpui_platform.workspace = true -gpui_tokio.workspace = true -gpui-mobile = { git = "https://github.com/itsbalamurali/gpui-mobile" } - -nostr-connect.workspace = true -nostr-sdk.workspace = true - -anyhow.workspace = true -serde.workspace = true -serde_json.workspace = true -itertools.workspace = true -log.workspace = true -smallvec.workspace = true -smol.workspace = true -futures.workspace = true -oneshot.workspace = true -tracing-subscriber.workspace = true diff --git a/crates/coop/Cargo.toml b/desktop/Cargo.toml similarity index 68% rename from crates/coop/Cargo.toml rename to desktop/Cargo.toml index 42659f0..aea5a71 100644 --- a/crates/coop/Cargo.toml +++ b/desktop/Cargo.toml @@ -15,7 +15,7 @@ description = "Chat Freely, Stay Private on Nostr" identifier = "su.reya.coop" category = "SocialNetworking" version = "1.0.0-beta3" -out-dir = "../../dist" +out-dir = "../dist" before-packaging-command = "cargo build --release" resources = ["Cargo.toml", "src"] icons = [ @@ -27,19 +27,19 @@ icons = [ ] [dependencies] -assets = { path = "../assets" } -ui = { path = "../ui" } -title_bar = { path = "../title_bar" } -theme = { path = "../theme" } -common = { path = "../common" } -state = { path = "../state" } -device = { path = "../device" } -chat = { path = "../chat" } -chat_ui = { path = "../chat_ui" } -settings = { path = "../settings" } -auto_update = { path = "../auto_update" } -person = { path = "../person" } -relay_auth = { path = "../relay_auth" } +assets = { path = "../crates/assets" } +ui = { path = "../crates/ui" } +title_bar = { path = "../crates/title_bar" } +theme = { path = "../crates/theme" } +common = { path = "../crates/common" } +state = { path = "../crates/state" } +device = { path = "../crates/device" } +chat = { path = "../crates/chat" } +chat_ui = { path = "../crates/chat_ui" } +settings = { path = "../crates/settings" } +auto_update = { path = "../crates/auto_update" } +person = { path = "../crates/person" } +relay_auth = { path = "../crates/relay_auth" } gpui.workspace = true gpui_platform.workspace = true diff --git a/crates/coop/resources/128x128.png b/desktop/resources/128x128.png similarity index 100% rename from crates/coop/resources/128x128.png rename to desktop/resources/128x128.png diff --git a/crates/coop/resources/128x128@2x.png b/desktop/resources/128x128@2x.png similarity index 100% rename from crates/coop/resources/128x128@2x.png rename to desktop/resources/128x128@2x.png diff --git a/crates/coop/resources/32x32.png b/desktop/resources/32x32.png similarity index 100% rename from crates/coop/resources/32x32.png rename to desktop/resources/32x32.png diff --git a/crates/coop/resources/coop.desktop.in b/desktop/resources/coop.desktop.in similarity index 100% rename from crates/coop/resources/coop.desktop.in rename to desktop/resources/coop.desktop.in diff --git a/crates/coop/resources/flatpak/coop.metainfo.xml.in b/desktop/resources/flatpak/coop.metainfo.xml.in similarity index 100% rename from crates/coop/resources/flatpak/coop.metainfo.xml.in rename to desktop/resources/flatpak/coop.metainfo.xml.in diff --git a/crates/coop/resources/flatpak/manifest-template.json b/desktop/resources/flatpak/manifest-template.json similarity index 97% rename from crates/coop/resources/flatpak/manifest-template.json rename to desktop/resources/flatpak/manifest-template.json index 7538982..1b8860a 100644 --- a/crates/coop/resources/flatpak/manifest-template.json +++ b/desktop/resources/flatpak/manifest-template.json @@ -50,7 +50,7 @@ }, { "type": "dir", - "path": "./crates/coop/resources" + "path": "./desktop/resources" } ] } diff --git a/crates/coop/resources/icon.icns b/desktop/resources/icon.icns similarity index 100% rename from crates/coop/resources/icon.icns rename to desktop/resources/icon.icns diff --git a/crates/coop/resources/icon.ico b/desktop/resources/icon.ico similarity index 100% rename from crates/coop/resources/icon.ico rename to desktop/resources/icon.ico diff --git a/crates/coop/resources/icon.png b/desktop/resources/icon.png similarity index 100% rename from crates/coop/resources/icon.png rename to desktop/resources/icon.png diff --git a/crates/coop/resources/icon@2x.png b/desktop/resources/icon@2x.png similarity index 100% rename from crates/coop/resources/icon@2x.png rename to desktop/resources/icon@2x.png diff --git a/crates/coop/resources/snap/snapcraft.yaml.in b/desktop/resources/snap/snapcraft.yaml.in similarity index 100% rename from crates/coop/resources/snap/snapcraft.yaml.in rename to desktop/resources/snap/snapcraft.yaml.in diff --git a/crates/coop/src/dialogs/accounts.rs b/desktop/src/dialogs/accounts.rs similarity index 100% rename from crates/coop/src/dialogs/accounts.rs rename to desktop/src/dialogs/accounts.rs diff --git a/crates/coop/src/dialogs/connect.rs b/desktop/src/dialogs/connect.rs similarity index 100% rename from crates/coop/src/dialogs/connect.rs rename to desktop/src/dialogs/connect.rs diff --git a/crates/coop/src/dialogs/import.rs b/desktop/src/dialogs/import.rs similarity index 100% rename from crates/coop/src/dialogs/import.rs rename to desktop/src/dialogs/import.rs diff --git a/crates/coop/src/dialogs/mod.rs b/desktop/src/dialogs/mod.rs similarity index 100% rename from crates/coop/src/dialogs/mod.rs rename to desktop/src/dialogs/mod.rs diff --git a/crates/coop/src/dialogs/restore.rs b/desktop/src/dialogs/restore.rs similarity index 100% rename from crates/coop/src/dialogs/restore.rs rename to desktop/src/dialogs/restore.rs diff --git a/crates/coop/src/dialogs/screening.rs b/desktop/src/dialogs/screening.rs similarity index 100% rename from crates/coop/src/dialogs/screening.rs rename to desktop/src/dialogs/screening.rs diff --git a/crates/coop/src/dialogs/settings.rs b/desktop/src/dialogs/settings.rs similarity index 100% rename from crates/coop/src/dialogs/settings.rs rename to desktop/src/dialogs/settings.rs diff --git a/crates/coop/src/main.rs b/desktop/src/main.rs similarity index 100% rename from crates/coop/src/main.rs rename to desktop/src/main.rs diff --git a/crates/coop/src/panels/backup.rs b/desktop/src/panels/backup.rs similarity index 100% rename from crates/coop/src/panels/backup.rs rename to desktop/src/panels/backup.rs diff --git a/crates/coop/src/panels/contact_list.rs b/desktop/src/panels/contact_list.rs similarity index 100% rename from crates/coop/src/panels/contact_list.rs rename to desktop/src/panels/contact_list.rs diff --git a/crates/coop/src/panels/greeter.rs b/desktop/src/panels/greeter.rs similarity index 100% rename from crates/coop/src/panels/greeter.rs rename to desktop/src/panels/greeter.rs diff --git a/crates/coop/src/panels/messaging_relays.rs b/desktop/src/panels/messaging_relays.rs similarity index 100% rename from crates/coop/src/panels/messaging_relays.rs rename to desktop/src/panels/messaging_relays.rs diff --git a/crates/coop/src/panels/mod.rs b/desktop/src/panels/mod.rs similarity index 100% rename from crates/coop/src/panels/mod.rs rename to desktop/src/panels/mod.rs diff --git a/crates/coop/src/panels/profile.rs b/desktop/src/panels/profile.rs similarity index 100% rename from crates/coop/src/panels/profile.rs rename to desktop/src/panels/profile.rs diff --git a/crates/coop/src/panels/relay_list.rs b/desktop/src/panels/relay_list.rs similarity index 100% rename from crates/coop/src/panels/relay_list.rs rename to desktop/src/panels/relay_list.rs diff --git a/crates/coop/src/panels/trash.rs b/desktop/src/panels/trash.rs similarity index 100% rename from crates/coop/src/panels/trash.rs rename to desktop/src/panels/trash.rs diff --git a/crates/coop/src/sidebar/entry.rs b/desktop/src/sidebar/entry.rs similarity index 100% rename from crates/coop/src/sidebar/entry.rs rename to desktop/src/sidebar/entry.rs diff --git a/crates/coop/src/sidebar/mod.rs b/desktop/src/sidebar/mod.rs similarity index 100% rename from crates/coop/src/sidebar/mod.rs rename to desktop/src/sidebar/mod.rs diff --git a/crates/coop/src/workspace.rs b/desktop/src/workspace.rs similarity index 100% rename from crates/coop/src/workspace.rs rename to desktop/src/workspace.rs diff --git a/mobile/Cargo.toml b/mobile/Cargo.toml new file mode 100644 index 0000000..45c6f9c --- /dev/null +++ b/mobile/Cargo.toml @@ -0,0 +1,51 @@ +[package] +name = "coop_mobile" +version.workspace = true +edition.workspace = true +publish.workspace = true + +[lib] +name = "coop_mobile" +crate-type = ["cdylib", "staticlib", "lib"] +path = "src/lib.rs" + +[[bin]] +name = "coop_mobile" +path = "src/main.rs" + +[dependencies] +assets = { path = "../crates/assets" } +ui = { path = "../crates/ui" } +theme = { path = "../crates/theme" } +common = { path = "../crates/common" } +state = { path = "../crates/state" } +device = { path = "../crates/device" } +chat = { path = "../crates/chat" } +settings = { path = "../crates/settings" } +person = { path = "../crates/person" } +relay_auth = { path = "../crates/relay_auth" } + +gpui.workspace = true +gpui_platform.workspace = true +gpui_tokio.workspace = true +gpui-mobile = { git = "https://github.com/itsbalamurali/gpui-mobile" } + +nostr-connect.workspace = true +nostr-sdk.workspace = true + +anyhow.workspace = true +serde.workspace = true +serde_json.workspace = true +log.workspace = true +smallvec.workspace = true +smol.workspace = true +futures.workspace = true +oneshot.workspace = true +tracing-subscriber.workspace = true + +[target.'cfg(target_os = "ios")'.dependencies] +objc2 = "0.6" + +[target.'cfg(target_os = "android")'.dependencies] +android_logger = "0.15" +android-activity = { version = "0.6", features = ["native-activity"] } diff --git a/crates/coop_mobile/src/lib.rs b/mobile/src/lib.rs similarity index 100% rename from crates/coop_mobile/src/lib.rs rename to mobile/src/lib.rs diff --git a/script/bundle-linux b/script/bundle-linux index 8cdd0f2..87b34cd 100755 --- a/script/bundle-linux +++ b/script/bundle-linux @@ -98,9 +98,9 @@ cp $(find_libs) "${coop_dir}/lib" # Icons mkdir -p "${coop_dir}/share/icons/hicolor/512x512/apps" -cp "crates/coop/resources/icon.png" "${coop_dir}/share/icons/hicolor/512x512/apps/coop.png" +cp "desktop/resources/icon.png" "${coop_dir}/share/icons/hicolor/512x512/apps/coop.png" mkdir -p "${coop_dir}/share/icons/hicolor/1024x1024/apps" -cp "crates/coop/resources/icon@2x.png" "${coop_dir}/share/icons/hicolor/1024x1024/apps/coop.png" +cp "desktop/resources/icon@2x.png" "${coop_dir}/share/icons/hicolor/1024x1024/apps/coop.png" # .desktop export DO_STARTUP_NOTIFY="true" @@ -110,7 +110,7 @@ export APP_ARGS="%U" export APP_NAME="Coop" mkdir -p "${coop_dir}/share/applications" -envsubst < "crates/coop/resources/coop.desktop.in" > "${coop_dir}/share/applications/coop.desktop" +envsubst < "desktop/resources/coop.desktop.in" > "${coop_dir}/share/applications/coop.desktop" # Create archive out of everything that's in the temp directory arch=$(uname -m) diff --git a/script/bundle-snap b/script/bundle-snap index a1fa64c..75a52d0 100755 --- a/script/bundle-snap +++ b/script/bundle-snap @@ -21,11 +21,11 @@ export DO_STARTUP_NOTIFY="true" export APP_NAME="Coop" export APP_ICON="\${SNAP}/meta/gui/coop.png" export APP_ARGS="%U" -envsubst < "crates/coop/resources/coop.desktop.in" > "snap/gui/coop.desktop" -cp "crates/coop/resources/icon.png" "snap/gui/coop.png" +envsubst < "desktop/resources/coop.desktop.in" > "snap/gui/coop.desktop" +cp "desktop/resources/icon.png" "snap/gui/coop.png" # Generate snapcraft.yaml with version and architecture -RELEASE_VERSION="$1" ARCH_SUFFIX="$ARCH_SUFFIX" envsubst < crates/coop/resources/snap/snapcraft.yaml.in > snap/snapcraft.yaml +RELEASE_VERSION="$1" ARCH_SUFFIX="$ARCH_SUFFIX" envsubst < desktop/resources/snap/snapcraft.yaml.in > snap/snapcraft.yaml # Clean previous builds snapcraft clean diff --git a/script/flatpak/bundle-flatpak b/script/flatpak/bundle-flatpak index 2ef0ba1..8f3ec55 100755 --- a/script/flatpak/bundle-flatpak +++ b/script/flatpak/bundle-flatpak @@ -24,7 +24,7 @@ export ICON_FILE="icon" export CHANNEL="stable" # Generate manifest -envsubst < "crates/coop/resources/flatpak/manifest-template.json" > "$APP_ID.json" +envsubst < "desktop/resources/flatpak/manifest-template.json" > "$APP_ID.json" # Build Flatpak flatpak-builder --user --install --force-clean build "$APP_ID.json" diff --git a/script/prepare-flathub b/script/prepare-flathub index 61acfea..daf8725 100755 --- a/script/prepare-flathub +++ b/script/prepare-flathub @@ -93,7 +93,7 @@ echo " Created flathub/release-info.xml" # Step 4: Generate the metainfo file with release info echo "[4/5] Generating metainfo.xml..." export APP_ID APP_NAME BRANDING_LIGHT BRANDING_DARK -cat crates/coop/resources/flatpak/coop.metainfo.xml.in | \ +cat desktop/resources/flatpak/coop.metainfo.xml.in | \ sed -e "/@release_info@/r flathub/release-info.xml" -e '/@release_info@/d' \ > flathub/${APP_ID}.metainfo.xml echo " Created flathub/${APP_ID}.metainfo.xml" @@ -153,8 +153,8 @@ modules: - install -Dm755 target/release/coop /app/bin/coop # Install icons - - install -Dm644 crates/coop/resources/icon.png /app/share/icons/hicolor/512x512/apps/su.reya.coop.png - - install -Dm644 crates/coop/resources/icon@2x.png /app/share/icons/hicolor/1024x1024/apps/su.reya.coop.png + - install -Dm644 desktop/resources/icon.png /app/share/icons/hicolor/512x512/apps/su.reya.coop.png + - install -Dm644 desktop/resources/icon@2x.png /app/share/icons/hicolor/1024x1024/apps/su.reya.coop.png # Install desktop file - | @@ -164,7 +164,7 @@ modules: export APP_CLI="coop" export APP_ARGS="%U" export DO_STARTUP_NOTIFY="true" - envsubst < crates/coop/resources/coop.desktop.in > coop.desktop + envsubst < desktop/resources/coop.desktop.in > coop.desktop install -Dm644 coop.desktop /app/share/applications/su.reya.coop.desktop # Install metainfo (use pre-generated one with release info) diff --git a/script/release b/script/release index 03c2ff1..cce181e 100755 --- a/script/release +++ b/script/release @@ -13,7 +13,7 @@ fi NEW_VERSION="$1" WORKSPACE_CARGO="Cargo.toml" -CRATE_CARGO="crates/coop/Cargo.toml" +CRATE_CARGO="desktop/Cargo.toml" # Check if both Cargo.toml files exist if [ ! -f "$WORKSPACE_CARGO" ]; then diff --git a/crates/coop_web/Cargo.toml b/web/Cargo.toml similarity index 64% rename from crates/coop_web/Cargo.toml rename to web/Cargo.toml index e22c8a2..6ebc020 100644 --- a/crates/coop_web/Cargo.toml +++ b/web/Cargo.toml @@ -5,16 +5,16 @@ edition.workspace = true publish.workspace = true [dependencies] -assets = { path = "../assets" } -ui = { path = "../ui" } -theme = { path = "../theme" } -common = { path = "../common" } -state = { path = "../state" } -device = { path = "../device" } -chat = { path = "../chat" } -settings = { path = "../settings" } -person = { path = "../person" } -relay_auth = { path = "../relay_auth" } +assets = { path = "../crates/assets" } +ui = { path = "../crates/ui" } +theme = { path = "../crates/theme" } +common = { path = "../crates/common" } +state = { path = "../crates/state" } +device = { path = "../crates/device" } +chat = { path = "../crates/chat" } +settings = { path = "../crates/settings" } +person = { path = "../crates/person" } +relay_auth = { path = "../crates/relay_auth" } gpui.workspace = true gpui_platform.workspace = true diff --git a/crates/coop_web/src/lib.rs b/web/src/lib.rs similarity index 100% rename from crates/coop_web/src/lib.rs rename to web/src/lib.rs diff --git a/crates/coop_web/src/www/index.html b/web/src/www/index.html similarity index 100% rename from crates/coop_web/src/www/index.html rename to web/src/www/index.html