chore: update deps

This commit is contained in:
2025-09-19 08:42:08 +07:00
parent 9f369bf57f
commit 1de3045505
11 changed files with 219 additions and 170 deletions

175
Cargo.lock generated
View File

@@ -1131,7 +1131,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
@@ -1572,7 +1572,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1746,7 +1746,7 @@ dependencies = [
"cc", "cc",
"memchr", "memchr",
"rustc_version", "rustc_version",
"toml 0.9.5", "toml 0.9.7",
"vswhom", "vswhom",
"winreg", "winreg",
] ]
@@ -2378,7 +2378,7 @@ dependencies = [
"js-sys", "js-sys",
"libc", "libc",
"r-efi", "r-efi",
"wasi 0.14.5+wasi-0.2.4", "wasi 0.14.7+wasi-0.2.4",
"wasm-bindgen", "wasm-bindgen",
] ]
@@ -2499,7 +2499,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2592,7 +2592,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -2604,7 +2604,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_tokio" name = "gpui_tokio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"gpui", "gpui",
@@ -2673,6 +2673,12 @@ dependencies = [
"foldhash", "foldhash",
] ]
[[package]]
name = "hashbrown"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.1" version = "0.4.1"
@@ -2818,7 +2824,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -2838,7 +2844,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client_tls" name = "http_client_tls"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"rustls", "rustls",
"rustls-platform-verifier", "rustls-platform-verifier",
@@ -2915,9 +2921,9 @@ dependencies = [
[[package]] [[package]]
name = "hyper-util" name = "hyper-util"
version = "0.1.16" version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@@ -3141,13 +3147,14 @@ checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.11.1" version = "2.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206a8042aec68fa4a62e8d3f7aa4ceb508177d9324faf261e1959e495b7a1921" checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.5", "hashbrown 0.16.0",
"serde", "serde",
"serde_core",
] ]
[[package]] [[package]]
@@ -3335,9 +3342,9 @@ dependencies = [
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.78" version = "0.3.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c0b063578492ceec17683ef2f8c5e89121fbd0b172cbc280635ab7567db2738" checksum = "852f13bec5eba4ba9afbeb93fd7c13fe56147f055939ae21c43a29a0ecb2702e"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"wasm-bindgen", "wasm-bindgen",
@@ -3629,7 +3636,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen 0.71.1", "bindgen 0.71.1",
@@ -3877,7 +3884,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"aes", "aes",
"base64", "base64",
@@ -3901,7 +3908,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-connect" name = "nostr-connect"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -3913,7 +3920,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"flatbuffers", "flatbuffers",
"lru", "lru",
@@ -3924,7 +3931,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"flume", "flume",
@@ -3938,7 +3945,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-relay-pool" name = "nostr-relay-pool"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
@@ -3955,7 +3962,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.43.0" version = "0.43.0"
source = "git+https://github.com/rust-nostr/nostr#b1016f439ef1da5f8fdeae14368f5b7340414389" source = "git+https://github.com/rust-nostr/nostr#2f14457d6b87eb9aa7ccf2ddfbcfef23670436f0"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -4676,11 +4683,11 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "3.3.0" version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
dependencies = [ dependencies = [
"toml_edit", "toml_edit 0.23.6",
] ]
[[package]] [[package]]
@@ -5069,7 +5076,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
"workspace-hack", "workspace-hack",
@@ -5223,7 +5230,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -5509,9 +5516,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
[[package]] [[package]]
name = "rustls-webpki" name = "rustls-webpki"
version = "0.103.5" version = "0.103.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a37813727b78798e53c2bec3f5e8fe12a6d6f8389bf9ca7802add4c9905ad8" checksum = "8572f3c2cb9934231157b45499fc41e1f58c589fdfb81a844ba873265e80f8eb"
dependencies = [ dependencies = [
"aws-lc-rs", "aws-lc-rs",
"ring", "ring",
@@ -5758,7 +5765,7 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -5773,9 +5780,9 @@ checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.223" version = "1.0.225"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a505d71960adde88e293da5cb5eda57093379f64e61cf77bf0e6a63af07a7bac" checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d"
dependencies = [ dependencies = [
"serde_core", "serde_core",
"serde_derive", "serde_derive",
@@ -5783,18 +5790,18 @@ dependencies = [
[[package]] [[package]]
name = "serde_core" name = "serde_core"
version = "1.0.223" version = "1.0.225"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20f57cbd357666aa7b3ac84a90b4ea328f1d4ddb6772b430caa5d9e1309bb9e9" checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.223" version = "1.0.225"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d428d07faf17e306e699ec1e91996e5a165ba5d6bce5b5155173e91a8a01a56" checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -5870,11 +5877,11 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "1.0.0" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee"
dependencies = [ dependencies = [
"serde", "serde_core",
] ]
[[package]] [[package]]
@@ -6210,7 +6217,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -6733,9 +6740,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.26.2" version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" checksum = "05f63835928ca123f1bef57abbcd23bb2ba0ac9ae1235f1e65bda0d06e7786bd"
dependencies = [ dependencies = [
"rustls", "rustls",
"tokio", "tokio",
@@ -6791,19 +6798,19 @@ dependencies = [
"serde", "serde",
"serde_spanned 0.6.9", "serde_spanned 0.6.9",
"toml_datetime 0.6.11", "toml_datetime 0.6.11",
"toml_edit", "toml_edit 0.22.27",
] ]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.9.5" version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"serde", "serde_core",
"serde_spanned 1.0.0", "serde_spanned 1.0.2",
"toml_datetime 0.7.0", "toml_datetime 0.7.2",
"toml_parser", "toml_parser",
"toml_writer", "toml_writer",
"winnow", "winnow",
@@ -6820,11 +6827,11 @@ dependencies = [
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.7.0" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1"
dependencies = [ dependencies = [
"serde", "serde_core",
] ]
[[package]] [[package]]
@@ -6842,10 +6849,22 @@ dependencies = [
] ]
[[package]] [[package]]
name = "toml_parser" name = "toml_edit"
version = "1.0.2" version = "0.23.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b"
dependencies = [
"indexmap",
"toml_datetime 0.7.2",
"toml_parser",
"winnow",
]
[[package]]
name = "toml_parser"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627"
dependencies = [ dependencies = [
"winnow", "winnow",
] ]
@@ -6858,9 +6877,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]] [[package]]
name = "toml_writer" name = "toml_writer"
version = "1.0.2" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109"
[[package]] [[package]]
name = "tower" name = "tower"
@@ -7240,7 +7259,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1090c47a90c586b397dc3fdd0cd09b530f37e5a0" source = "git+https://github.com/zed-industries/zed#e5e308ba78c3de679b822e50a07b3432a1624ce1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs", "async-fs",
@@ -7409,18 +7428,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.14.5+wasi-0.2.4" version = "0.14.7+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4494f6290a82f5fe584817a676a34b9d6763e8d9d18204009fb31dceca98fd4" checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c"
dependencies = [ dependencies = [
"wasip2", "wasip2",
] ]
[[package]] [[package]]
name = "wasip2" name = "wasip2"
version = "1.0.0+wasi-0.2.4" version = "1.0.1+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03fa2761397e5bd52002cd7e73110c71af2109aca4e521a9f40473fe685b0a24" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
dependencies = [ dependencies = [
"wit-bindgen", "wit-bindgen",
] ]
@@ -7433,9 +7452,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.101" version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b" checksum = "ab10a69fbd0a177f5f649ad4d8d3305499c42bab9aef2f7ff592d0ec8f833819"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"once_cell", "once_cell",
@@ -7446,9 +7465,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.101" version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb" checksum = "0bb702423545a6007bbc368fde243ba47ca275e549c8a28617f56f6ba53b1d1c"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
@@ -7460,9 +7479,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.51" version = "0.4.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca85039a9b469b38336411d6d6ced91f3fc87109a2a27b0c197663f5144dffe" checksum = "a0b221ff421256839509adbb55998214a70d829d3a28c69b4a6672e9d2a42f67"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@@ -7473,9 +7492,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.101" version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d" checksum = "fc65f4f411d91494355917b605e1480033152658d71f722a90647f56a70c88a0"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@@ -7483,9 +7502,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.101" version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" checksum = "ffc003a991398a8ee604a401e194b6b3a39677b3173d6e74495eb51b82e99a32"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -7496,9 +7515,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.101" version = "0.2.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1" checksum = "293c37f4efa430ca14db3721dfbe48d8c33308096bd44d80ebaa775ab71ba1cf"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -7603,9 +7622,9 @@ dependencies = [
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.78" version = "0.3.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77e4b637749ff0d92b8fad63aa1f7cff3cbe125fd49c175cd6345e7272638b12" checksum = "fbe734895e869dc429d78c4b433f8d17d95f8d05317440b4fad5ab2d33e596dc"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@@ -8293,9 +8312,9 @@ dependencies = [
[[package]] [[package]]
name = "wit-bindgen" name = "wit-bindgen"
version = "0.45.1" version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
[[package]] [[package]]
name = "workspace-hack" name = "workspace-hack"

View File

@@ -1,7 +1,7 @@
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use global::app_state;
use global::constants::KEYRING_URL; use global::constants::KEYRING_URL;
use global::css;
use gpui::{App, AppContext, Context, Entity, Global, Subscription, Window}; use gpui::{App, AppContext, Context, Entity, Global, Subscription, Window};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
@@ -61,7 +61,7 @@ impl ClientKeys {
return; return;
} }
let css = css(); let app_state = app_state();
let read_client_keys = cx.read_credentials(KEYRING_URL); let read_client_keys = cx.read_credentials(KEYRING_URL);
cx.spawn_in(window, async move |this, cx| { cx.spawn_in(window, async move |this, cx| {
@@ -76,7 +76,7 @@ impl ClientKeys {
this.set_keys(Some(keys), false, true, cx); this.set_keys(Some(keys), false, true, cx);
}) })
.ok(); .ok();
} else if css.is_first_run.load(Ordering::Acquire) { } else if app_state.is_first_run.load(Ordering::Acquire) {
// If this is the first run, generate new keys and use them for the client keys // If this is the first run, generate new keys and use them for the client keys
this.update(cx, |this, cx| { this.update(cx, |this, cx| {
this.new_keys(cx); this.new_keys(cx);

View File

@@ -13,7 +13,7 @@ use global::constants::{
ACCOUNT_IDENTIFIER, BOOTSTRAP_RELAYS, DEFAULT_SIDEBAR_WIDTH, METADATA_BATCH_LIMIT, ACCOUNT_IDENTIFIER, BOOTSTRAP_RELAYS, DEFAULT_SIDEBAR_WIDTH, METADATA_BATCH_LIMIT,
METADATA_BATCH_TIMEOUT, SEARCH_RELAYS, METADATA_BATCH_TIMEOUT, SEARCH_RELAYS,
}; };
use global::{css, nostr_client, AuthRequest, Notice, SignalKind, UnwrappingStatus}; use global::{app_state, nostr_client, AuthRequest, Notice, SignalKind, UnwrappingStatus};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, px, rems, App, AppContext, AsyncWindowContext, Axis, Context, Entity, InteractiveElement, div, px, rems, App, AppContext, AsyncWindowContext, Axis, Context, Entity, InteractiveElement,
@@ -213,7 +213,7 @@ impl ChatSpace {
async fn observe_signer() { async fn observe_signer() {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let stream_timeout = Duration::from_secs(5); let stream_timeout = Duration::from_secs(5);
let loop_duration = Duration::from_secs(1); let loop_duration = Duration::from_secs(1);
@@ -229,7 +229,10 @@ impl ChatSpace {
}; };
// Notify the app that the signer has been set. // Notify the app that the signer has been set.
css.signal.send(SignalKind::SignerSet(public_key)).await; app_state
.signal
.send(SignalKind::SignerSet(public_key))
.await;
// Subscribe to the NIP-65 relays for the public key. // Subscribe to the NIP-65 relays for the public key.
let filter = Filter::new() let filter = Filter::new()
@@ -248,12 +251,12 @@ impl ChatSpace {
nip65_found = true; nip65_found = true;
} else { } else {
// Timeout // Timeout
css.signal.send(SignalKind::RelaysNotFound).await; app_state.signal.send(SignalKind::RelaysNotFound).await;
} }
} }
Err(e) => { Err(e) => {
log::error!("Error fetching NIP-65 Relay: {e:?}"); log::error!("Error fetching NIP-65 Relay: {e:?}");
css.signal.send(SignalKind::RelaysNotFound).await; app_state.signal.send(SignalKind::RelaysNotFound).await;
} }
}; };
@@ -270,12 +273,12 @@ impl ChatSpace {
break; break;
} else { } else {
// Timeout // Timeout
css.signal.send(SignalKind::RelaysNotFound).await; app_state.signal.send(SignalKind::RelaysNotFound).await;
} }
} }
Err(e) => { Err(e) => {
log::error!("Error fetching NIP-17 Relay: {e:?}"); log::error!("Error fetching NIP-17 Relay: {e:?}");
css.signal.send(SignalKind::RelaysNotFound).await; app_state.signal.send(SignalKind::RelaysNotFound).await;
} }
}; };
} }
@@ -286,7 +289,7 @@ impl ChatSpace {
async fn observe_giftwrap() { async fn observe_giftwrap() {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let loop_duration = Duration::from_secs(20); let loop_duration = Duration::from_secs(20);
let mut is_start_processing = false; let mut is_start_processing = false;
let mut total_loops = 0; let mut total_loops = 0;
@@ -295,11 +298,11 @@ impl ChatSpace {
if client.has_signer().await { if client.has_signer().await {
total_loops += 1; total_loops += 1;
if css.gift_wrap_processing.load(Ordering::Acquire) { if app_state.gift_wrap_processing.load(Ordering::Acquire) {
is_start_processing = true; is_start_processing = true;
// Reset gift wrap processing flag // Reset gift wrap processing flag
let _ = css.gift_wrap_processing.compare_exchange( let _ = app_state.gift_wrap_processing.compare_exchange(
true, true,
false, false,
Ordering::Release, Ordering::Release,
@@ -307,13 +310,13 @@ impl ChatSpace {
); );
let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Processing); let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Processing);
css.signal.send(signal).await; app_state.signal.send(signal).await;
} else { } else {
// Only run further if we are already processing // Only run further if we are already processing
// Wait until after 2 loops to prevent exiting early while events are still being processed // Wait until after 2 loops to prevent exiting early while events are still being processed
if is_start_processing && total_loops >= 2 { if is_start_processing && total_loops >= 2 {
let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Complete); let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Complete);
css.signal.send(signal).await; app_state.signal.send(signal).await;
// Reset the counter // Reset the counter
is_start_processing = false; is_start_processing = false;
@@ -327,7 +330,7 @@ impl ChatSpace {
} }
async fn process_batching_metadata() { async fn process_batching_metadata() {
let css = css(); let app_state = app_state();
let timeout = Duration::from_millis(METADATA_BATCH_TIMEOUT); let timeout = Duration::from_millis(METADATA_BATCH_TIMEOUT);
let mut processed_pubkeys: HashSet<PublicKey> = HashSet::new(); let mut processed_pubkeys: HashSet<PublicKey> = HashSet::new();
let mut batch: HashSet<PublicKey> = HashSet::new(); let mut batch: HashSet<PublicKey> = HashSet::new();
@@ -342,7 +345,7 @@ impl ChatSpace {
loop { loop {
let futs = smol::future::or( let futs = smol::future::or(
async move { async move {
if let Ok(public_key) = css.ingester.receiver().recv_async().await { if let Ok(public_key) = app_state.ingester.receiver().recv_async().await {
BatchEvent::PublicKey(public_key) BatchEvent::PublicKey(public_key)
} else { } else {
BatchEvent::Closed BatchEvent::Closed
@@ -379,7 +382,7 @@ impl ChatSpace {
async fn process_nostr_events() -> Result<(), Error> { async fn process_nostr_events() -> Result<(), Error> {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let mut processed_events: HashSet<EventId> = HashSet::new(); let mut processed_events: HashSet<EventId> = HashSet::new();
let mut challenges: HashSet<Cow<'_, str>> = HashSet::new(); let mut challenges: HashSet<Cow<'_, str>> = HashSet::new();
@@ -393,7 +396,8 @@ impl ChatSpace {
match message { match message {
RelayMessage::Event { event, .. } => { RelayMessage::Event { event, .. } => {
// Keep track of which relays have seen this event // Keep track of which relays have seen this event
css.seen_on_relays app_state
.seen_on_relays
.write() .write()
.await .await
.entry(event.id) .entry(event.id)
@@ -423,18 +427,18 @@ impl ChatSpace {
for relay in relays.clone().into_iter() { for relay in relays.clone().into_iter() {
if client.add_relay(relay).await.is_err() { if client.add_relay(relay).await.is_err() {
let notice = Notice::RelayFailed(relay.clone()); let notice = Notice::RelayFailed(relay.clone());
css.signal.send(SignalKind::Notice(notice)).await; app_state.signal.send(SignalKind::Notice(notice)).await;
} }
if client.connect_relay(relay).await.is_err() { if client.connect_relay(relay).await.is_err() {
let notice = Notice::RelayFailed(relay.clone()); let notice = Notice::RelayFailed(relay.clone());
css.signal.send(SignalKind::Notice(notice)).await; app_state.signal.send(SignalKind::Notice(notice)).await;
} }
} }
// Subscribe to gift wrap events only in the current user's NIP-17 relays // Subscribe to gift wrap events only in the current user's NIP-17 relays
Self::fetch_gift_wrap(relays, event.pubkey).await; Self::fetch_gift_wrap(relays, event.pubkey).await;
} else { } else {
css.signal.send(SignalKind::RelaysNotFound).await; app_state.signal.send(SignalKind::RelaysNotFound).await;
} }
} }
} }
@@ -447,7 +451,11 @@ impl ChatSpace {
Filter::new().limit(limit).authors(public_keys).kinds(kinds); Filter::new().limit(limit).authors(public_keys).kinds(kinds);
client client
.subscribe_to(BOOTSTRAP_RELAYS, filter, css.auto_close_opts) .subscribe_to(
BOOTSTRAP_RELAYS,
filter,
app_state.auto_close_opts,
)
.await .await
.ok(); .ok();
} }
@@ -456,7 +464,7 @@ impl ChatSpace {
let metadata = Metadata::from_json(&event.content).unwrap_or_default(); let metadata = Metadata::from_json(&event.content).unwrap_or_default();
let profile = Profile::new(event.pubkey, metadata); let profile = Profile::new(event.pubkey, metadata);
css.signal.send(SignalKind::NewProfile(profile)).await; app_state.signal.send(SignalKind::NewProfile(profile)).await;
} }
Kind::GiftWrap => { Kind::GiftWrap => {
Self::unwrap_gift_wrap(&event).await; Self::unwrap_gift_wrap(&event).await;
@@ -465,28 +473,32 @@ impl ChatSpace {
} }
} }
RelayMessage::EndOfStoredEvents(subscription_id) => { RelayMessage::EndOfStoredEvents(subscription_id) => {
if *subscription_id == css.gift_wrap_sub_id { if *subscription_id == app_state.gift_wrap_sub_id {
let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Processing); let signal = SignalKind::GiftWrapStatus(UnwrappingStatus::Processing);
css.signal.send(signal).await; app_state.signal.send(signal).await;
} }
} }
RelayMessage::Auth { challenge } => { RelayMessage::Auth { challenge } => {
if challenges.insert(challenge.clone()) { if challenges.insert(challenge.clone()) {
let req = AuthRequest::new(challenge, relay_url); let req = AuthRequest::new(challenge, relay_url);
// Send a signal to the ingester to handle the auth request // Send a signal to the ingester to handle the auth request
css.signal.send(SignalKind::Auth(req)).await; app_state.signal.send(SignalKind::Auth(req)).await;
} }
} }
RelayMessage::Ok { RelayMessage::Ok {
event_id, message, .. event_id, message, ..
} => { } => {
// Keep track of events sent by Coop // Keep track of events sent by Coop
css.sent_ids.write().await.insert(event_id); app_state.sent_ids.write().await.insert(event_id);
// Keep track of events that need to be resent // Keep track of events that need to be resent
match MachineReadablePrefix::parse(&message) { match MachineReadablePrefix::parse(&message) {
Some(MachineReadablePrefix::AuthRequired) => { Some(MachineReadablePrefix::AuthRequired) => {
css.resend_queue.write().await.insert(event_id, relay_url); app_state
.resend_queue
.write()
.await
.insert(event_id, relay_url);
} }
Some(_) => {} Some(_) => {}
None => {} None => {}
@@ -500,10 +512,10 @@ impl ChatSpace {
} }
async fn process_nostr_signals(view: WeakEntity<ChatSpace>, cx: &mut AsyncWindowContext) { async fn process_nostr_signals(view: WeakEntity<ChatSpace>, cx: &mut AsyncWindowContext) {
let css = css(); let app_state = app_state();
let mut is_open_proxy_modal = false; let mut is_open_proxy_modal = false;
while let Ok(signal) = css.signal.receiver().recv_async().await { while let Ok(signal) = app_state.signal.receiver().recv_async().await {
cx.update(|window, cx| { cx.update(|window, cx| {
let registry = Registry::global(cx); let registry = Registry::global(cx);
let settings = AppSettings::global(cx); let settings = AppSettings::global(cx);
@@ -611,10 +623,10 @@ impl ChatSpace {
/// Fetches a single event by kind and public key /// Fetches a single event by kind and public key
pub async fn fetch_single_event(kind: Kind, public_key: PublicKey) { pub async fn fetch_single_event(kind: Kind, public_key: PublicKey) {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let filter = Filter::new().kind(kind).author(public_key).limit(1); let filter = Filter::new().kind(kind).author(public_key).limit(1);
if let Err(e) = client.subscribe(filter, css.auto_close_opts).await { if let Err(e) = client.subscribe(filter, app_state.auto_close_opts).await {
log::info!("Failed to subscribe: {e}"); log::info!("Failed to subscribe: {e}");
} }
} }
@@ -622,11 +634,11 @@ impl ChatSpace {
/// Fetches gift wrap events for a given public key and relays /// Fetches gift wrap events for a given public key and relays
pub async fn fetch_gift_wrap(relays: Vec<&RelayUrl>, public_key: PublicKey) { pub async fn fetch_gift_wrap(relays: Vec<&RelayUrl>, public_key: PublicKey) {
let client = nostr_client(); let client = nostr_client();
let sub_id = css().gift_wrap_sub_id.clone(); let id = app_state().gift_wrap_sub_id.clone();
let filter = Filter::new().kind(Kind::GiftWrap).pubkey(public_key); let filter = Filter::new().kind(Kind::GiftWrap).pubkey(public_key);
if client if client
.subscribe_with_id_to(relays.clone(), sub_id, filter, None) .subscribe_with_id_to(relays.clone(), id, filter, None)
.await .await
.is_ok() .is_ok()
{ {
@@ -641,7 +653,7 @@ impl ChatSpace {
} }
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let kinds = vec![Kind::Metadata, Kind::ContactList, Kind::RelayList]; let kinds = vec![Kind::Metadata, Kind::ContactList, Kind::RelayList];
let limit = public_keys.len() * kinds.len() + 20; let limit = public_keys.len() * kinds.len() + 20;
@@ -650,7 +662,7 @@ impl ChatSpace {
let filter = Filter::new().authors(public_keys).kinds(kinds).limit(limit); let filter = Filter::new().authors(public_keys).kinds(kinds).limit(limit);
client client
.subscribe_to(BOOTSTRAP_RELAYS, filter, css.auto_close_opts) .subscribe_to(BOOTSTRAP_RELAYS, filter, app_state.auto_close_opts)
.await .await
.ok(); .ok();
} }
@@ -698,7 +710,7 @@ impl ChatSpace {
/// Unwraps a gift-wrapped event and processes its contents. /// Unwraps a gift-wrapped event and processes its contents.
async fn unwrap_gift_wrap(target: &Event) { async fn unwrap_gift_wrap(target: &Event) {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let mut message: Option<Event> = None; let mut message: Option<Event> = None;
if let Ok(event) = Self::get_unwrapped_event(target.id).await { if let Ok(event) = Self::get_unwrapped_event(target.id).await {
@@ -718,21 +730,24 @@ impl ChatSpace {
if let Some(event) = message { if let Some(event) = message {
// Send all pubkeys to the metadata batch to sync data // Send all pubkeys to the metadata batch to sync data
for public_key in event.all_pubkeys() { for public_key in event.all_pubkeys() {
css.ingester.send(public_key).await; app_state.ingester.send(public_key).await;
} }
match event.created_at >= css.init_at { match event.created_at >= app_state.init_at {
// New message: send a signal to notify the UI // New message: send a signal to notify the UI
true => { true => {
// A small delay to prevent UI flickering // A small delay to prevent UI flickering
smol::Timer::after(Duration::from_millis(200)).await; smol::Timer::after(Duration::from_millis(200)).await;
css.signal app_state
.signal
.send(SignalKind::NewMessage((target.id, event))) .send(SignalKind::NewMessage((target.id, event)))
.await; .await;
} }
// Old message: Coop is probably processing the user's messages during initial load // Old message: Coop is probably processing the user's messages during initial load
false => { false => {
css.gift_wrap_processing.store(true, Ordering::Release); app_state
.gift_wrap_processing
.store(true, Ordering::Release);
} }
} }
} }
@@ -783,7 +798,7 @@ impl ChatSpace {
let task: Task<Result<(), Error>> = cx.background_spawn(async move { let task: Task<Result<(), Error>> = cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let signer = client.signer().await?; let signer = client.signer().await?;
// Construct event // Construct event
@@ -814,7 +829,7 @@ impl ChatSpace {
relay.resubscribe().await?; relay.resubscribe().await?;
// Get all failed events that need to be resent // Get all failed events that need to be resent
let mut queue = css.resend_queue.write().await; let mut queue = app_state.resend_queue.write().await;
let ids: Vec<EventId> = queue let ids: Vec<EventId> = queue
.iter() .iter()
@@ -833,8 +848,8 @@ impl ChatSpace {
success: HashSet::from([relay_url]), success: HashSet::from([relay_url]),
}; };
css.sent_ids.write().await.insert(event_id); app_state.sent_ids.write().await.insert(event_id);
css.resent_ids.write().await.push(output); app_state.resent_ids.write().await.push(output);
} }
} }
} }
@@ -1092,7 +1107,7 @@ impl ChatSpace {
) { ) {
let task: Task<Result<(), Error>> = cx.background_spawn(async move { let task: Task<Result<(), Error>> = cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let filter = Filter::new().kind(Kind::PrivateDirectMessage); let filter = Filter::new().kind(Kind::PrivateDirectMessage);
@@ -1111,7 +1126,7 @@ impl ChatSpace {
.authors(pubkeys); .authors(pubkeys);
client client
.subscribe_to(BOOTSTRAP_RELAYS, filter, css.auto_close_opts) .subscribe_to(BOOTSTRAP_RELAYS, filter, app_state.auto_close_opts)
.await?; .await?;
Ok(()) Ok(())
@@ -1131,7 +1146,7 @@ impl ChatSpace {
fn on_sign_out(&mut self, _e: &Logout, _window: &mut Window, cx: &mut Context<Self>) { fn on_sign_out(&mut self, _e: &Logout, _window: &mut Window, cx: &mut Context<Self>) {
cx.background_spawn(async move { cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let filter = Filter::new() let filter = Filter::new()
.kind(Kind::ApplicationSpecificData) .kind(Kind::ApplicationSpecificData)
@@ -1144,7 +1159,7 @@ impl ChatSpace {
client.reset().await; client.reset().await;
// Notify the channel about the signer being unset // Notify the channel about the signer being unset
css.signal.send(SignalKind::SignerUnset).await; app_state.signal.send(SignalKind::SignerUnset).await;
}) })
.detach(); .detach();
} }
@@ -1368,7 +1383,7 @@ impl ChatSpace {
this._tasks.push(cx.background_spawn(async move { this._tasks.push(cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
if proxy.start().await.is_ok() { if proxy.start().await.is_ok() {
webbrowser::open(&url).ok(); webbrowser::open(&url).ok();
@@ -1399,7 +1414,7 @@ impl ChatSpace {
break; break;
} else { } else {
css.signal.send(SignalKind::ProxyDown).await; app_state.signal.send(SignalKind::ProxyDown).await;
} }
smol::Timer::after(Duration::from_secs(1)).await; smol::Timer::after(Duration::from_secs(1)).await;
} }

View File

@@ -2,7 +2,7 @@ use std::sync::Arc;
use assets::Assets; use assets::Assets;
use global::constants::{APP_ID, APP_NAME}; use global::constants::{APP_ID, APP_NAME};
use global::{css, nostr_client}; use global::{app_state, nostr_client};
use gpui::{ use gpui::{
point, px, size, AppContext, Application, Bounds, KeyBinding, Menu, MenuItem, SharedString, point, px, size, AppContext, Application, Bounds, KeyBinding, Menu, MenuItem, SharedString,
TitlebarOptions, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, TitlebarOptions, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind,
@@ -27,7 +27,7 @@ fn main() {
let _client = nostr_client(); let _client = nostr_client();
// Initialize the coop simple storage // Initialize the coop simple storage
let _css = css(); let _app_state = app_state();
// Initialize the Application // Initialize the Application
let app = Application::new() let app = Application::new()

View File

@@ -5,7 +5,7 @@ use client_keys::ClientKeys;
use common::display::ReadableProfile; use common::display::ReadableProfile;
use common::handle_auth::CoopAuthUrlHandler; use common::handle_auth::CoopAuthUrlHandler;
use global::constants::{ACCOUNT_IDENTIFIER, BUNKER_TIMEOUT}; use global::constants::{ACCOUNT_IDENTIFIER, BUNKER_TIMEOUT};
use global::{css, nostr_client, SignalKind}; use global::{app_state, nostr_client, SignalKind};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, relative, rems, svg, AnyElement, App, AppContext, Context, Entity, EventEmitter, div, relative, rems, svg, AnyElement, App, AppContext, Context, Entity, EventEmitter,
@@ -245,7 +245,7 @@ impl Account {
// Reset the nostr client in the background // Reset the nostr client in the background
cx.background_spawn(async move { cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let filter = Filter::new() let filter = Filter::new()
.kind(Kind::ApplicationSpecificData) .kind(Kind::ApplicationSpecificData)
@@ -258,7 +258,7 @@ impl Account {
client.unset_signer().await; client.unset_signer().await;
// Notify the channel about the signer being unset // Notify the channel about the signer being unset
css.signal.send(SignalKind::SignerUnset).await; app_state.signal.send(SignalKind::SignerUnset).await;
}), }),
); );
} }
@@ -339,8 +339,7 @@ impl Render for Account {
.id("account") .id("account")
.h_10() .h_10()
.w_72() .w_72()
.bg(cx.theme().element_background) .bg(cx.theme().elevated_surface_background)
.text_color(cx.theme().element_foreground)
.rounded_lg() .rounded_lg()
.text_sm() .text_sm()
.when(self.loading, |this| { .when(self.loading, |this| {
@@ -368,19 +367,40 @@ impl Render for Account {
.child(Avatar::new(avatar).size(rems(1.5))) .child(Avatar::new(avatar).size(rems(1.5)))
.child(div().pb_px().font_semibold().child(name)), .child(div().pb_px().font_semibold().child(name)),
) )
.child(SharedString::from("-"))
.child( .child(
div() div()
.text_xs()
.when(self.is_bunker, |this| { .when(self.is_bunker, |this| {
this.child(SharedString::from("Nostr Connect")) this.child(
div()
.py_0p5()
.px_2()
.text_xs()
.bg(cx.theme().secondary_active)
.text_color(
cx.theme().secondary_foreground,
)
.rounded_full()
.child("Nostr Connect"),
)
}) })
.when(self.is_extension, |this| { .when(self.is_extension, |this| {
this.child(SharedString::from("Extension")) this.child(
div()
.py_0p5()
.px_2()
.text_xs()
.bg(cx.theme().secondary_active)
.text_color(
cx.theme().secondary_foreground,
)
.rounded_full()
.child("Extension"),
)
}), }),
), ),
) )
}) })
.active(|this| this.bg(cx.theme().element_active))
.hover(|this| this.bg(cx.theme().element_hover)) .hover(|this| this.bg(cx.theme().element_hover))
.on_click(cx.listener(move |this, _e, window, cx| { .on_click(cx.listener(move |this, _e, window, cx| {
this.login(window, cx); this.login(window, cx);

View File

@@ -3,7 +3,7 @@ use std::collections::HashMap;
use anyhow::anyhow; use anyhow::anyhow;
use common::display::{ReadableProfile, ReadableTimestamp}; use common::display::{ReadableProfile, ReadableTimestamp};
use common::nip96::nip96_upload; use common::nip96::nip96_upload;
use global::{css, nostr_client}; use global::{app_state, nostr_client};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, img, list, px, red, relative, rems, svg, white, Action, AnyElement, App, AppContext, div, img, list, px, red, relative, rems, svg, white, Action, AnyElement, App, AppContext,
@@ -298,7 +298,7 @@ impl Chat {
/// Check if the event is sent by Coop /// Check if the event is sent by Coop
fn is_sent_by_coop(&self, gift_wrap_id: &EventId) -> bool { fn is_sent_by_coop(&self, gift_wrap_id: &EventId) -> bool {
css().sent_ids.read_blocking().contains(gift_wrap_id) app_state().sent_ids.read_blocking().contains(gift_wrap_id)
} }
/// Send a message to all members of the chat /// Send a message to all members of the chat
@@ -1263,7 +1263,7 @@ impl Chat {
let task: Task<Result<Vec<RelayUrl>, Error>> = cx.background_spawn(async move { let task: Task<Result<Vec<RelayUrl>, Error>> = cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let mut relays: Vec<RelayUrl> = vec![]; let mut relays: Vec<RelayUrl> = vec![];
let filter = Filter::new() let filter = Filter::new()
@@ -1273,7 +1273,7 @@ impl Chat {
if let Some(event) = client.database().query(filter).await?.first_owned() { if let Some(event) = client.database().query(filter).await?.first_owned() {
if let Some(Ok(id)) = event.tags.identifier().map(EventId::parse) { if let Some(Ok(id)) = event.tags.identifier().map(EventId::parse) {
if let Some(urls) = css.seen_on_relays.read().await.get(&id).cloned() { if let Some(urls) = app_state.seen_on_relays.read().await.get(&id).cloned() {
relays.extend(urls); relays.extend(urls);
} }
} }

View File

@@ -5,7 +5,7 @@ use anyhow::{anyhow, Error};
use common::display::{ReadableProfile, TextUtils}; use common::display::{ReadableProfile, TextUtils};
use common::nip05::nip05_profile; use common::nip05::nip05_profile;
use global::constants::BOOTSTRAP_RELAYS; use global::constants::BOOTSTRAP_RELAYS;
use global::{css, nostr_client}; use global::{app_state, nostr_client};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, px, relative, rems, uniform_list, App, AppContext, Context, Entity, InteractiveElement, div, px, relative, rems, uniform_list, App, AppContext, Context, Entity, InteractiveElement,
@@ -186,12 +186,12 @@ impl Compose {
async fn request_metadata(public_key: PublicKey) -> Result<(), Error> { async fn request_metadata(public_key: PublicKey) -> Result<(), Error> {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let kinds = vec![Kind::Metadata, Kind::ContactList, Kind::RelayList]; let kinds = vec![Kind::Metadata, Kind::ContactList, Kind::RelayList];
let filter = Filter::new().author(public_key).kinds(kinds).limit(10); let filter = Filter::new().author(public_key).kinds(kinds).limit(10);
client client
.subscribe_to(BOOTSTRAP_RELAYS, filter, css.auto_close_opts) .subscribe_to(BOOTSTRAP_RELAYS, filter, app_state.auto_close_opts)
.await?; .await?;
Ok(()) Ok(())

View File

@@ -2,7 +2,7 @@ use std::time::Duration;
use anyhow::{anyhow, Error}; use anyhow::{anyhow, Error};
use global::constants::NIP17_RELAYS; use global::constants::NIP17_RELAYS;
use global::{css, nostr_client}; use global::{app_state, nostr_client};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, px, uniform_list, App, AppContext, Context, Entity, InteractiveElement, IntoElement, div, px, uniform_list, App, AppContext, Context, Entity, InteractiveElement, IntoElement,
@@ -218,7 +218,7 @@ impl SetupRelay {
} }
// Fetch gift wrap events // Fetch gift wrap events
let sub_id = css().gift_wrap_sub_id.clone(); let sub_id = app_state().gift_wrap_sub_id.clone();
let filter = Filter::new().kind(Kind::GiftWrap).pubkey(public_key); let filter = Filter::new().kind(Kind::GiftWrap).pubkey(public_key);
if client if client

View File

@@ -6,7 +6,7 @@ use anyhow::{anyhow, Error};
use common::debounced_delay::DebouncedDelay; use common::debounced_delay::DebouncedDelay;
use common::display::{ReadableTimestamp, TextUtils}; use common::display::{ReadableTimestamp, TextUtils};
use global::constants::{BOOTSTRAP_RELAYS, SEARCH_RELAYS}; use global::constants::{BOOTSTRAP_RELAYS, SEARCH_RELAYS};
use global::{css, nostr_client, UnwrappingStatus}; use global::{app_state, nostr_client, UnwrappingStatus};
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
div, relative, uniform_list, AnyElement, App, AppContext, Context, Entity, EventEmitter, div, relative, uniform_list, AnyElement, App, AppContext, Context, Entity, EventEmitter,
@@ -530,8 +530,8 @@ impl Sidebar {
fn on_manage(&mut self, _ev: &RelayStatus, window: &mut Window, cx: &mut Context<Self>) { fn on_manage(&mut self, _ev: &RelayStatus, window: &mut Window, cx: &mut Context<Self>) {
let task: Task<Result<Vec<Relay>, Error>> = cx.background_spawn(async move { let task: Task<Result<Vec<Relay>, Error>> = cx.background_spawn(async move {
let client = nostr_client(); let client = nostr_client();
let css = css(); let app_state = app_state();
let subscription = client.subscription(&css.gift_wrap_sub_id).await; let subscription = client.subscription(&app_state.gift_wrap_sub_id).await;
let mut relays: Vec<Relay> = vec![]; let mut relays: Vec<Relay> = vec![];
for (url, _filter) in subscription.into_iter() { for (url, _filter) in subscription.into_iter() {

View File

@@ -146,7 +146,7 @@ impl Ingester {
/// A simple storage to store all states that using across the application. /// A simple storage to store all states that using across the application.
#[derive(Debug)] #[derive(Debug)]
pub struct CoopSimpleStorage { pub struct AppState {
pub init_at: Timestamp, pub init_at: Timestamp,
pub last_used_at: Option<Timestamp>, pub last_used_at: Option<Timestamp>,
@@ -172,13 +172,13 @@ pub struct CoopSimpleStorage {
pub ingester: Ingester, pub ingester: Ingester,
} }
impl Default for CoopSimpleStorage { impl Default for AppState {
fn default() -> Self { fn default() -> Self {
Self::new() Self::new()
} }
} }
impl CoopSimpleStorage { impl AppState {
pub fn new() -> Self { pub fn new() -> Self {
let init_at = Timestamp::now(); let init_at = Timestamp::now();
let first_run = first_run(); let first_run = first_run();
@@ -205,7 +205,7 @@ impl CoopSimpleStorage {
} }
static NOSTR_CLIENT: OnceLock<Client> = OnceLock::new(); static NOSTR_CLIENT: OnceLock<Client> = OnceLock::new();
static COOP_SIMPLE_STORAGE: OnceLock<CoopSimpleStorage> = OnceLock::new(); static APP_STATE: OnceLock<AppState> = OnceLock::new();
pub fn nostr_client() -> &'static Client { pub fn nostr_client() -> &'static Client {
NOSTR_CLIENT.get_or_init(|| { NOSTR_CLIENT.get_or_init(|| {
@@ -223,15 +223,15 @@ pub fn nostr_client() -> &'static Client {
.automatic_authentication(false) .automatic_authentication(false)
.verify_subscriptions(false) .verify_subscriptions(false)
.sleep_when_idle(SleepWhenIdle::Enabled { .sleep_when_idle(SleepWhenIdle::Enabled {
timeout: Duration::from_secs(30), timeout: Duration::from_secs(300),
}); });
ClientBuilder::default().database(lmdb).opts(opts).build() ClientBuilder::default().database(lmdb).opts(opts).build()
}) })
} }
pub fn css() -> &'static CoopSimpleStorage { pub fn app_state() -> &'static AppState {
COOP_SIMPLE_STORAGE.get_or_init(CoopSimpleStorage::new) APP_STATE.get_or_init(AppState::new)
} }
fn first_run() -> bool { fn first_run() -> bool {

View File

@@ -7,7 +7,7 @@ use anyhow::Error;
use common::display::ReadableProfile; use common::display::ReadableProfile;
use common::event::EventUtils; use common::event::EventUtils;
use global::constants::SEND_RETRY; use global::constants::SEND_RETRY;
use global::{css, nostr_client}; use global::{app_state, nostr_client};
use gpui::{App, AppContext, Context, EventEmitter, SharedString, Task}; use gpui::{App, AppContext, Context, EventEmitter, SharedString, Task};
use itertools::Itertools; use itertools::Itertools;
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
@@ -432,7 +432,7 @@ impl Room {
let mut public_keys = self.members.clone(); let mut public_keys = self.members.clone();
cx.background_spawn(async move { cx.background_spawn(async move {
let css = css(); let app_state = app_state();
let client = nostr_client(); let client = nostr_client();
let signer = client.signer().await?; let signer = client.signer().await?;
let public_key = signer.get_public_key().await?; let public_key = signer.get_public_key().await?;
@@ -492,15 +492,10 @@ impl Room {
if auth_required { if auth_required {
// Wait for authenticated and resent event successfully // Wait for authenticated and resent event successfully
for attempt in 0..=SEND_RETRY { for attempt in 0..=SEND_RETRY {
let ids = app_state.resent_ids.read().await;
// Check if event was successfully resent // Check if event was successfully resent
if let Some(output) = css if let Some(output) = ids.iter().find(|e| e.id() == &id).cloned() {
.resent_ids
.read()
.await
.iter()
.find(|e| e.id() == &id)
.cloned()
{
let output = SendReport::new(pubkey).status(output).tags(&tags); let output = SendReport::new(pubkey).status(output).tags(&tags);
reports.push(output); reports.push(output);
break; break;