diff --git a/Cargo.lock b/Cargo.lock index b004a67..0cb320b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1029,9 +1029,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -1129,7 +1129,7 @@ dependencies = [ "cocoa-foundation 0.1.2", "core-foundation 0.9.4", "core-graphics 0.23.2", - "foreign-types 0.5.0", + "foreign-types", "libc", "objc", ] @@ -1145,7 +1145,7 @@ dependencies = [ "cocoa-foundation 0.2.0", "core-foundation 0.10.0", "core-graphics 0.24.0", - "foreign-types 0.5.0", + "foreign-types", "libc", "objc", ] @@ -1192,7 +1192,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "indexmap", "rustc-hash 2.1.1", @@ -1376,7 +1376,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -1389,7 +1389,7 @@ dependencies = [ "bitflags 2.11.0", "core-foundation 0.10.0", "core-graphics-types 0.2.0", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -1402,7 +1402,7 @@ dependencies = [ "bitflags 2.11.0", "core-foundation 0.10.0", "core-graphics-types 0.2.0", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -1415,7 +1415,7 @@ dependencies = [ "bitflags 2.11.0", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -1462,7 +1462,7 @@ checksum = "fce32d657e17d6e4a8e70fe2ae6875218015f320620a78e5949d228bc76622bd" dependencies = [ "core-foundation 0.10.0", "core-graphics 0.25.0", - "foreign-types 0.5.0", + "foreign-types", ] [[package]] @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "proc-macro2", "quote", @@ -1916,7 +1916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2179,15 +2179,6 @@ dependencies = [ "ttf-parser", ] -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -2195,7 +2186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared 0.3.1", + "foreign-types-shared", ] [[package]] @@ -2209,12 +2200,6 @@ dependencies = [ "syn", ] -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -2577,7 +2562,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.2.2" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "async-task", @@ -2599,7 +2584,7 @@ dependencies = [ "derive_more", "embed-resource", "etagere", - "foreign-types 0.5.0", + "foreign-types", "futures", "gpui_macros", "http_client", @@ -2651,7 +2636,7 @@ dependencies = [ [[package]] name = "gpui_linux" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -2699,7 +2684,7 @@ dependencies = [ [[package]] name = "gpui_macos" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "async-task", @@ -2716,7 +2701,7 @@ dependencies = [ "ctor", "derive_more", "etagere", - "foreign-types 0.5.0", + "foreign-types", "futures", "gpui", "image", @@ -2741,7 +2726,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -2752,7 +2737,7 @@ dependencies = [ [[package]] name = "gpui_platform" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "gpui", "gpui_linux", @@ -2763,7 +2748,7 @@ dependencies = [ [[package]] name = "gpui_tokio" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "gpui", @@ -2774,7 +2759,7 @@ dependencies = [ [[package]] name = "gpui_wgpu" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "bytemuck", @@ -2793,7 +2778,7 @@ dependencies = [ [[package]] name = "gpui_windows" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "collections", @@ -3037,7 +3022,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "async-compression", @@ -3062,7 +3047,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "rustls", "rustls-platform-verifier", @@ -3111,22 +3096,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", + "webpki-roots 1.0.6", ] [[package]] @@ -3147,11 +3117,9 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2", - "system-configuration 0.7.0", "tokio", "tower-service", "tracing", - "windows-registry 0.6.1", ] [[package]] @@ -3503,9 +3471,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.88" +version = "0.3.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e709f3e3d22866f9c25b3aff01af289b18422cc8b4262fb19103ee80fe513d" +checksum = "f4eacb0641a310445a4c513f2a5e23e19952e269c6a38887254d5f837a305506" dependencies = [ "once_cell", "wasm-bindgen", @@ -3843,14 +3811,14 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "bindgen", "core-foundation 0.10.0", "core-video", "ctor", - "foreign-types 0.5.0", + "foreign-types", "metal", "objc", ] @@ -3897,7 +3865,7 @@ dependencies = [ "bitflags 2.11.0", "block", "core-graphics-types 0.2.0", - "foreign-types 0.5.0", + "foreign-types", "log", "objc", "paste", @@ -3991,23 +3959,6 @@ dependencies = [ "getrandom 0.2.17", ] -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "ndk-context" version = "0.1.1" @@ -4087,7 +4038,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "nostr" version = "0.44.1" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "aes", "base64", @@ -4098,21 +4049,31 @@ dependencies = [ "chacha20", "chacha20poly1305", "hex", - "instant", - "once_cell", "rand 0.9.2", "scrypt", "secp256k1", "serde", "serde_json", "unicode-normalization", + "universal-time", "url", ] +[[package]] +name = "nostr-blossom" +version = "0.44.0" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" +dependencies = [ + "base64", + "nostr", + "reqwest", + "serde", +] + [[package]] name = "nostr-connect" version = "0.44.0" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "async-utility", "futures-core", @@ -4125,19 +4086,17 @@ dependencies = [ [[package]] name = "nostr-database" version = "0.44.0" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "btreecap", "flatbuffers", - "lru", "nostr", - "tokio", ] [[package]] name = "nostr-gossip" version = "0.44.0" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "nostr", ] @@ -4145,7 +4104,7 @@ dependencies = [ [[package]] name = "nostr-lmdb" version = "0.44.0" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "async-utility", "flume", @@ -4159,7 +4118,7 @@ dependencies = [ [[package]] name = "nostr-sdk" version = "0.44.1" -source = "git+https://github.com/rust-nostr/nostr#c6ada24c23b25b8b6e8f5468fc56a3c149ae9a93" +source = "git+https://github.com/rust-nostr/nostr#b1ac65997d05424ad7b888dbdb5214b8999924ff" dependencies = [ "async-utility", "async-wsocket", @@ -4173,6 +4132,7 @@ dependencies = [ "tokio", "tokio-stream", "tracing", + "universal-time", ] [[package]] @@ -4190,7 +4150,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4448,50 +4408,12 @@ dependencies = [ "pathdiff", ] -[[package]] -name = "openssl" -version = "0.10.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" -dependencies = [ - "bitflags 2.11.0", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "openssl-probe" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -4633,7 +4555,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "collections", "serde", @@ -5061,7 +4983,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -5308,7 +5230,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "derive_refineable", ] @@ -5374,46 +5296,40 @@ checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64", "bytes", - "encoding_rs", "futures-core", - "futures-util", - "h2", "http", "http-body", "http-body-util", "hyper", "hyper-rustls", - "hyper-tls", "hyper-util", "js-sys", "log", - "mime", - "mime_guess", - "native-tls", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", - "tokio-util", + "tokio-rustls", "tower", "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", - "wasm-streams", "web-sys", + "webpki-roots 1.0.6", ] [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "bytes", @@ -5468,7 +5384,7 @@ dependencies = [ [[package]] name = "rope" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "arrayvec", "log", @@ -5581,7 +5497,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5730,7 +5646,7 @@ dependencies = [ [[package]] name = "scheduler" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "async-task", "backtrace", @@ -6246,12 +6162,13 @@ dependencies = [ "gpui", "gpui_tokio", "log", + "mime_guess", "nostr", + "nostr-blossom", "nostr-connect", "nostr-lmdb", "nostr-sdk", "petname", - "reqwest", "rustls", "serde", "serde_json", @@ -6311,7 +6228,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "arrayvec", "log", @@ -6499,17 +6416,6 @@ dependencies = [ "system-configuration-sys", ] -[[package]] -name = "system-configuration" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" -dependencies = [ - "bitflags 2.11.0", - "core-foundation 0.9.4", - "system-configuration-sys", -] - [[package]] name = "system-configuration-sys" version = "0.6.0" @@ -6552,15 +6458,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.25.0" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand 2.3.0", "getrandom 0.4.1", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6763,16 +6669,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.4" @@ -7202,6 +7098,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "universal-time" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b35da41b69caac5d25e3eba1ca0b7e9ac859a23af369d2e36a37dbb7defbc93" + [[package]] name = "untrusted" version = "0.9.0" @@ -7269,7 +7171,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "async-fs", @@ -7307,7 +7209,7 @@ dependencies = [ [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "perf", "quote", @@ -7380,12 +7282,6 @@ dependencies = [ "sval_serde", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -7469,9 +7365,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.111" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1adf1535672f5b7824f817792b1afd731d7e843d2d04ec8f27e8cb51edd8ac" +checksum = "05d7d0fce354c88b7982aec4400b3e7fcf723c32737cef571bd165f7613557ee" dependencies = [ "cfg-if", "once_cell", @@ -7482,9 +7378,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.61" +version = "0.4.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe88540d1c934c4ec8e6db0afa536876c5441289d7f9f9123d4f065ac1250a6b" +checksum = "ee85afca410ac4abba5b584b12e77ea225db6ee5471d0aebaae0861166f9378a" dependencies = [ "cfg-if", "futures-util", @@ -7496,9 +7392,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.111" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e638317c08b21663aed4d2b9a2091450548954695ff4efa75bff5fa546b3b1" +checksum = "55839b71ba921e4f75b674cb16f843f4b1f3b26ddfcb3454de1cf65cc021ec0f" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7506,9 +7402,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.111" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c64760850114d03d5f65457e96fc988f11f01d38fbaa51b254e4ab5809102af" +checksum = "caf2e969c2d60ff52e7e98b7392ff1588bffdd1ccd4769eba27222fd3d621571" dependencies = [ "bumpalo", "proc-macro2", @@ -7519,9 +7415,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.111" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60eecd4fe26177cfa3339eb00b4a36445889ba3ad37080c2429879718e20ca41" +checksum = "0861f0dcdf46ea819407495634953cdcc8a8c7215ab799a7a7ce366be71c7b30" dependencies = [ "unicode-ident", ] @@ -7673,9 +7569,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.88" +version = "0.3.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6bb20ed2d9572df8584f6dc81d68a41a625cadc6f15999d649a70ce7e3597a" +checksum = "10053fbf9a374174094915bbce141e87a6bf32ecd9a002980db4b638405e8962" dependencies = [ "js-sys", "wasm-bindgen", @@ -7944,7 +7840,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] @@ -8177,17 +8073,6 @@ dependencies = [ "windows-strings 0.4.2", ] -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - [[package]] name = "windows-result" version = "0.1.2" @@ -8963,7 +8848,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration 0.6.1", + "system-configuration", "tokio", "tokio-rustls", "tokio-socks", @@ -9115,7 +9000,7 @@ dependencies = [ [[package]] name = "zlog" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "anyhow", "chrono", @@ -9132,7 +9017,7 @@ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" [[package]] name = "ztracing" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" dependencies = [ "tracing", "tracing-subscriber", @@ -9143,7 +9028,7 @@ dependencies = [ [[package]] name = "ztracing_macro" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#67d9e7d0119aad7f27a1de76befd750303db27fc" +source = "git+https://github.com/zed-industries/zed#0f21e2a5c608d3b4b0df8e50217397b53de3136b" [[package]] name = "zune-core" diff --git a/Cargo.toml b/Cargo.toml index 1780bd6..337a929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ reqwest_client = { git = "https://github.com/zed-industries/zed" } # Nostr nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" } nostr-connect = { git = "https://github.com/rust-nostr/nostr" } +nostr-blossom = { git = "https://github.com/rust-nostr/nostr" } nostr-sdk = { git = "https://github.com/rust-nostr/nostr" } nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip96", "nip59", "nip49", "nip44" ] } diff --git a/crates/chat_ui/src/lib.rs b/crates/chat_ui/src/lib.rs index b346f1e..fb16f2e 100644 --- a/crates/chat_ui/src/lib.rs +++ b/crates/chat_ui/src/lib.rs @@ -13,15 +13,13 @@ use gpui::{ PathPromptOptions, Render, SharedString, StatefulInteractiveElement, Styled, StyledImage, Subscription, Task, WeakEntity, Window, }; -use gpui_tokio::Tokio; use itertools::Itertools; use nostr_sdk::prelude::*; use person::{Person, PersonRegistry}; use settings::{AppSettings, SignerKind}; use smallvec::{smallvec, SmallVec}; -use smol::fs; use smol::lock::RwLock; -use state::{nostr_upload, NostrRegistry}; +use state::{upload, NostrRegistry}; use theme::ActiveTheme; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; @@ -522,12 +520,10 @@ impl ChatPanel { } fn upload(&mut self, window: &mut Window, cx: &mut Context) { - let nostr = NostrRegistry::global(cx); - let client = nostr.read(cx).client(); - - // Get the user's configured NIP96 server - let nip96_server = AppSettings::get_file_server(cx); + // Get the user's configured blossom server + let server = AppSettings::get_file_server(cx); + // Ask user for file upload let path = cx.prompt_for_paths(PathPromptOptions { files: true, directories: false, @@ -536,34 +532,27 @@ impl ChatPanel { }); self.tasks.push(cx.spawn_in(window, async move |this, cx| { + this.update(cx, |this, cx| { + this.set_uploading(true, cx); + })?; + let mut paths = path.await??.context("Not found")?; let path = paths.pop().context("No path")?; - let upload = Tokio::spawn(cx, async move { - let file = fs::read(path).await.ok()?; - let url = nostr_upload(&client, &nip96_server, file).await.ok()?; - - Some(url) - }); - - if let Ok(task) = upload.await { - this.update(cx, |this, cx| { - this.set_uploading(true, cx); - }) - .ok(); - - this.update_in(cx, |this, _window, cx| { - match task { - Some(url) => { - this.add_attachment(url, cx); - this.set_uploading(false, cx); - } - None => { - this.set_uploading(false, cx); - } - }; - }) - .ok(); + // Upload via blossom client + match upload(server, path, cx).await { + Ok(url) => { + this.update_in(cx, |this, _window, cx| { + this.add_attachment(url, cx); + this.set_uploading(false, cx); + })?; + } + Err(e) => { + this.update_in(cx, |this, window, cx| { + this.set_uploading(false, cx); + window.push_notification(Notification::error(e.to_string()), cx); + })?; + } } Ok(()) diff --git a/crates/coop/src/panels/profile.rs b/crates/coop/src/panels/profile.rs index 5a13b98..3757b4a 100644 --- a/crates/coop/src/panels/profile.rs +++ b/crates/coop/src/panels/profile.rs @@ -1,18 +1,16 @@ use std::str::FromStr; use std::time::Duration; -use anyhow::{anyhow, Error}; +use anyhow::{Context as AnyhowContext, Error}; use gpui::{ div, rems, AnyElement, App, AppContext, ClipboardItem, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, ParentElement, PathPromptOptions, Render, SharedString, Styled, Task, Window, }; -use gpui_tokio::Tokio; use nostr_sdk::prelude::*; use person::{shorten_pubkey, Person, PersonRegistry}; use settings::AppSettings; -use smol::fs; -use state::{nostr_upload, NostrRegistry}; +use state::{upload, NostrRegistry}; use theme::ActiveTheme; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; @@ -150,66 +148,51 @@ impl ProfilePanel { } } - fn uploading(&mut self, status: bool, cx: &mut Context) { + fn set_uploading(&mut self, status: bool, cx: &mut Context) { self.uploading = status; cx.notify(); } fn upload(&mut self, window: &mut Window, cx: &mut Context) { - self.uploading(true, cx); + // Get the user's configured blossom server + let server = AppSettings::get_file_server(cx); - let nostr = NostrRegistry::global(cx); - let client = nostr.read(cx).client(); - - // Get the user's configured NIP96 server - let nip96_server = AppSettings::get_file_server(cx); - - // Open native file dialog - let paths = cx.prompt_for_paths(PathPromptOptions { + // Ask user for file upload + let path = cx.prompt_for_paths(PathPromptOptions { files: true, directories: false, multiple: false, prompt: None, }); - let task = Tokio::spawn(cx, async move { - match paths.await { - Ok(Ok(Some(mut paths))) => { - if let Some(path) = paths.pop() { - let file = fs::read(path).await?; - let url = nostr_upload(&client, &nip96_server, file).await?; + self.tasks.push(cx.spawn_in(window, async move |this, cx| { + this.update(cx, |this, cx| { + this.set_uploading(true, cx); + })?; - Ok(url) - } else { - Err(anyhow!("Path not found")) - } - } - _ => Err(anyhow!("Error")), - } - }); + let mut paths = path.await??.context("Not found")?; + let path = paths.pop().context("No path")?; - cx.spawn_in(window, async move |this, cx| { - let result = task.await; - - this.update_in(cx, |this, window, cx| { - match result { - Ok(Ok(url)) => { + // Upload via blossom client + match upload(server, path, cx).await { + Ok(url) => { + this.update_in(cx, |this, window, cx| { this.avatar_input.update(cx, |this, cx| { this.set_value(url.to_string(), window, cx); }); - } - Ok(Err(e)) => { - window.push_notification(e.to_string(), cx); - } - Err(e) => { - log::warn!("Failed to upload avatar: {e}"); - } - }; - this.uploading(false, cx); - }) - .expect("Entity has been released"); - }) - .detach(); + this.set_uploading(false, cx); + })?; + } + Err(e) => { + this.update_in(cx, |this, window, cx| { + this.set_uploading(false, cx); + window.push_notification(Notification::error(e.to_string()), cx); + })?; + } + } + + Ok(()) + })); } fn set_updating(&mut self, updating: bool, cx: &mut Context) { diff --git a/crates/settings/src/lib.rs b/crates/settings/src/lib.rs index c4ce94a..b502f81 100644 --- a/crates/settings/src/lib.rs +++ b/crates/settings/src/lib.rs @@ -119,7 +119,7 @@ pub struct Settings { /// Configuration for each chat room pub room_configs: HashMap, - /// File server for NIP-96 media attachments + /// Server for blossom media attachments pub file_server: Url, } @@ -131,7 +131,7 @@ impl Default for Settings { auth_mode: AuthMode::default(), trusted_relays: HashSet::default(), room_configs: HashMap::default(), - file_server: Url::parse("https://nostrmedia.com").unwrap(), + file_server: Url::parse("https://blossom.band/").unwrap(), } } } diff --git a/crates/state/Cargo.toml b/crates/state/Cargo.toml index 29c49bb..fcedd0d 100644 --- a/crates/state/Cargo.toml +++ b/crates/state/Cargo.toml @@ -11,6 +11,7 @@ nostr.workspace = true nostr-sdk.workspace = true nostr-lmdb.workspace = true nostr-connect.workspace = true +nostr-blossom.workspace = true gpui.workspace = true gpui_tokio.workspace = true @@ -25,4 +26,4 @@ serde_json.workspace = true rustls = "0.23" petname = "2.0.2" whoami = "1.6.1" -reqwest = { version = "0.12", features = ["multipart", "stream", "json"] } +mime_guess = "2.0.4" diff --git a/crates/state/src/blossom.rs b/crates/state/src/blossom.rs new file mode 100644 index 0000000..38dee46 --- /dev/null +++ b/crates/state/src/blossom.rs @@ -0,0 +1,85 @@ +use std::path::PathBuf; + +use anyhow::{anyhow, Error}; +use gpui::AsyncApp; +use gpui_tokio::Tokio; +use mime_guess::from_path; +use nostr_blossom::prelude::*; +use nostr_sdk::prelude::*; + +pub async fn upload(server: Url, path: PathBuf, cx: &AsyncApp) -> Result { + let content_type = from_path(&path).first_or_octet_stream().to_string(); + let data = smol::fs::read(path).await?; + let keys = Keys::generate(); + + // Construct the blossom client + let client = BlossomClient::new(server); + + Tokio::spawn(cx, async move { + let blob = client + .upload_blob(data, Some(content_type), None, Some(&keys)) + .await?; + + Ok(blob.url) + }) + .await + .map_err(|e| anyhow!("Upload error: {e}"))? +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_mime_type_detection() { + // Test common file extensions + assert_eq!( + from_path("image.jpg").first_or_octet_stream().to_string(), + "image/jpeg" + ); + assert_eq!( + from_path("document.pdf") + .first_or_octet_stream() + .to_string(), + "application/pdf" + ); + assert_eq!( + from_path("page.html").first_or_octet_stream().to_string(), + "text/html" + ); + assert_eq!( + from_path("data.json").first_or_octet_stream().to_string(), + "application/json" + ); + assert_eq!( + from_path("script.js").first_or_octet_stream().to_string(), + "text/javascript" + ); + assert_eq!( + from_path("style.css").first_or_octet_stream().to_string(), + "text/css" + ); + + // Test unknown extension falls back to octet-stream + assert_eq!( + from_path("unknown.xyz").first_or_octet_stream().to_string(), + "chemical/x-xyz" + ); + + // Test no extension falls back to octet-stream + assert_eq!( + from_path("file_without_extension") + .first_or_octet_stream() + .to_string(), + "application/octet-stream" + ); + + // Test truly unknown extension + assert_eq!( + from_path("unknown.unknown123") + .first_or_octet_stream() + .to_string(), + "application/octet-stream" + ); + } +} diff --git a/crates/state/src/lib.rs b/crates/state/src/lib.rs index 65e5d5c..fb5466c 100644 --- a/crates/state/src/lib.rs +++ b/crates/state/src/lib.rs @@ -10,18 +10,18 @@ use nostr_connect::prelude::*; use nostr_lmdb::prelude::*; use nostr_sdk::prelude::*; +mod blossom; mod constants; mod device; mod gossip; mod nip05; -mod nip96; mod signer; +pub use blossom::*; pub use constants::*; pub use device::*; pub use gossip::*; pub use nip05::*; -pub use nip96::*; pub use signer::*; pub fn init(window: &mut Window, cx: &mut App) { diff --git a/crates/state/src/nip96.rs b/crates/state/src/nip96.rs deleted file mode 100644 index e5974bf..0000000 --- a/crates/state/src/nip96.rs +++ /dev/null @@ -1,83 +0,0 @@ -use anyhow::anyhow; -use nostr::hashes::sha256::Hash as Sha256Hash; -use nostr::hashes::Hash; -use nostr::prelude::*; -use nostr_sdk::prelude::*; -use reqwest::{multipart, Client as ReqClient, Response}; - -pub(crate) fn make_multipart_form( - file_data: Vec, - mime_type: Option<&str>, -) -> Result { - let form_file_part = multipart::Part::bytes(file_data).file_name("filename"); - - // Set the part's MIME type, or leave it as is if mime_type is None - - let part = match mime_type { - Some(mime) => form_file_part.mime_str(mime)?, - None => form_file_part, - }; - - Ok(multipart::Form::new().part("file", part)) -} - -pub(crate) async fn upload( - signer: &T, - desc: &ServerConfig, - file_data: Vec, - mime_type: Option<&str>, -) -> Result -where - T: NostrSigner, -{ - let payload: Sha256Hash = Sha256Hash::hash(&file_data); - let data: HttpData = HttpData::new(desc.api_url.clone(), HttpMethod::POST).payload(payload); - let nip98_auth: String = data.to_authorization(signer).await?; - - // Make form - let form: multipart::Form = make_multipart_form(file_data, mime_type)?; - - // Make req client - let req_client = ReqClient::new(); - - // Send - let response: Response = req_client - .post(desc.api_url.clone()) - .header("Authorization", nip98_auth) - .multipart(form) - .send() - .await?; - - // Parse response - let json: Value = response.json().await?; - let upload_response = nip96::UploadResponse::from_json(json.to_string())?; - - if upload_response.status == UploadResponseStatus::Error { - return Err(anyhow!(upload_response.message)); - } - - Ok(upload_response.download_url()?.to_owned()) -} - -pub async fn nostr_upload( - client: &Client, - server: &Url, - file: Vec, -) -> Result { - let req_client = ReqClient::new(); - let config_url = nip96::get_server_config_url(server)?; - - // Get - let res = req_client.get(config_url.to_string()).send().await?; - let json: Value = res.json().await?; - - let config = nip96::ServerConfig::from_json(json.to_string())?; - let signer = client - .signer() - .cloned() - .unwrap_or(Keys::generate().into_nostr_signer()); - - let url = upload(&signer, &config, file, None).await?; - - Ok(url) -}