support nip94 and fix some bugs

This commit is contained in:
Ren Amamiya 2023-08-09 09:04:16 +07:00
parent e6c6793f6e
commit d1d0a462f4
11 changed files with 285 additions and 166 deletions

View File

@ -17,6 +17,7 @@
"**/*.{ts, tsx, css, md, html, json}": "prettier --cache --write"
},
"dependencies": {
"@ctrl/magnet-link": "^3.1.2",
"@headlessui/react": "^1.7.16",
"@noble/ciphers": "^0.2.0",
"@noble/curves": "^1.1.0",
@ -54,6 +55,7 @@
"@tiptap/react": "^2.0.4",
"@tiptap/starter-kit": "^2.0.4",
"@tiptap/suggestion": "^2.0.4",
"@void-cat/api": "^1.0.7",
"cheerio": "1.0.0-rc.12",
"dayjs": "^1.11.9",
"destr": "^1.2.2",
@ -86,7 +88,7 @@
"@tauri-apps/cli": "2.0.0-alpha.10",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/html-to-text": "^9.0.1",
"@types/node": "^18.17.3",
"@types/node": "^18.17.4",
"@types/react": "^18.2.19",
"@types/react-dom": "^18.2.7",
"@types/youtube-player": "^5.5.7",

View File

@ -1,6 +1,9 @@
lockfileVersion: '6.0'
dependencies:
'@ctrl/magnet-link':
specifier: ^3.1.2
version: 3.1.2
'@headlessui/react':
specifier: ^1.7.16
version: 1.7.16(react-dom@18.2.0)(react@18.2.0)
@ -112,6 +115,9 @@ dependencies:
'@tiptap/suggestion':
specifier: ^2.0.4
version: 2.0.4(@tiptap/core@2.0.4)(@tiptap/pm@2.0.4)
'@void-cat/api':
specifier: ^1.0.7
version: 1.0.7
cheerio:
specifier: 1.0.0-rc.12
version: 1.0.0-rc.12
@ -205,8 +211,8 @@ devDependencies:
specifier: ^9.0.1
version: 9.0.1
'@types/node':
specifier: ^18.17.3
version: 18.17.3
specifier: ^18.17.4
version: 18.17.4
'@types/react':
specifier: ^18.2.19
version: 18.2.19
@ -284,7 +290,7 @@ devDependencies:
version: 4.9.5
vite:
specifier: ^4.4.9
version: 4.4.9(@types/node@18.17.3)
version: 4.4.9(@types/node@18.17.4)
vite-plugin-top-level-await:
specifier: ^1.3.1
version: 1.3.1(vite@4.4.9)
@ -564,6 +570,18 @@ packages:
'@babel/helper-validator-identifier': 7.22.5
to-fast-properties: 2.0.0
/@ctrl/magnet-link@3.1.2:
resolution: {integrity: sha512-XtOAThYlGGp3atqy/pfXDXN9OawHWUFg+Dg8t8vD7ITAk76O3Ev/wJlA+jx33gaifLZEL78+saffHB+Qv9aWRw==}
engines: {node: '>=14.16'}
dependencies:
'@ctrl/ts-base32': 2.1.3
dev: false
/@ctrl/ts-base32@2.1.3:
resolution: {integrity: sha512-kL3E0PcmbD80JGHyQ7o6fN4mcdQWDM1HVuaKYmPYIlZmfuMEaXiQ6LdlEF7aq0iP+QkU0bayCVEbnIgrKtqbvQ==}
engines: {node: '>=14.16'}
dev: false
/@emotion/is-prop-valid@0.8.8:
resolution: {integrity: sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==}
requiresBuild: true
@ -2451,8 +2469,8 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: false
/@types/node@18.17.3:
resolution: {integrity: sha512-2x8HWtFk0S99zqVQABU9wTpr8wPoaDHZUcAkoTKH+nL7kPv3WUI9cRi/Kk5Mz4xdqXSqTkKP7IWNoQQYCnDsTA==}
/@types/node@18.17.4:
resolution: {integrity: sha512-ATL4WLgr7/W40+Sp1WnNTSKbgVn6Pvhc/2RHAdt8fl6NsQyp4oPCi2eKcGOvA494bwf1K/W6nGgZ9TwDqvpjdw==}
dev: true
/@types/normalize-package-data@2.4.1:
@ -2628,11 +2646,17 @@ packages:
vite: ^4
dependencies:
'@swc/core': 1.3.75
vite: 4.4.9(@types/node@18.17.3)
vite: 4.4.9(@types/node@18.17.4)
transitivePeerDependencies:
- '@swc/helpers'
dev: true
/@void-cat/api@1.0.7:
resolution: {integrity: sha512-0K20PaLnRL0lYLOOn8Sk3J6THdU7ebIHWPR7S8Ytzdi5VGI8468ocackCs0b/gFZvvkwVp0X/Rygxe1/nhch+Q==}
dependencies:
sjcl: 1.0.8
dev: false
/abbrev@1.1.1:
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
dev: false
@ -2922,7 +2946,7 @@ packages:
hasBin: true
dependencies:
caniuse-lite: 1.0.30001519
electron-to-chromium: 1.4.487
electron-to-chromium: 1.4.488
node-releases: 2.0.13
update-browserslist-db: 1.0.11(browserslist@4.21.10)
@ -3394,8 +3418,8 @@ packages:
/eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
/electron-to-chromium@1.4.487:
resolution: {integrity: sha512-XbCRs/34l31np/p33m+5tdBrdXu9jJkZxSbNxj5I0H1KtV2ZMSB+i/HYqDiRzHaFx2T5EdytjoBRe8QRJE2vQg==}
/electron-to-chromium@1.4.488:
resolution: {integrity: sha512-Dv4sTjiW7t/UWGL+H8ZkgIjtUAVZDgb/PwGWvMsCT7jipzUV/u5skbLXPFKb6iV0tiddVi/bcS2/kUrczeWgIQ==}
/emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
@ -6712,6 +6736,10 @@ packages:
engines: {node: '>=14'}
dev: false
/sjcl@1.0.8:
resolution: {integrity: sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ==}
dev: false
/slash@3.0.0:
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
engines: {node: '>=8'}
@ -7455,7 +7483,7 @@ packages:
'@rollup/plugin-virtual': 3.0.1
'@swc/core': 1.3.75
uuid: 9.0.0
vite: 4.4.9(@types/node@18.17.3)
vite: 4.4.9(@types/node@18.17.4)
transitivePeerDependencies:
- '@swc/helpers'
- rollup
@ -7472,13 +7500,13 @@ packages:
debug: 4.3.4
globrex: 0.1.2
tsconfck: 2.1.2(typescript@4.9.5)
vite: 4.4.9(@types/node@18.17.3)
vite: 4.4.9(@types/node@18.17.4)
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/vite@4.4.9(@types/node@18.17.3):
/vite@4.4.9(@types/node@18.17.4):
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
@ -7506,7 +7534,7 @@ packages:
terser:
optional: true
dependencies:
'@types/node': 18.17.3
'@types/node': 18.17.4
esbuild: 0.18.20
postcss: 8.4.27
rollup: 3.27.2

279
src-tauri/Cargo.lock generated
View File

@ -33,11 +33,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
"cfg-if",
"cipher",
"cipher 0.3.0",
"cpufeatures",
"opaque-debug",
]
[[package]]
name = "aes"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2"
dependencies = [
"cfg-if",
"cipher 0.4.4",
"cpufeatures",
]
[[package]]
name = "aes-gcm"
version = "0.9.4"
@ -45,8 +56,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6"
dependencies = [
"aead",
"aes",
"cipher",
"aes 0.7.5",
"cipher 0.3.0",
"ctr",
"ghash",
"subtle",
@ -536,16 +547,6 @@ dependencies = [
"alloc-stdlib",
]
[[package]]
name = "bstr"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
dependencies = [
"memchr",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.13.0"
@ -573,6 +574,27 @@ dependencies = [
"serde",
]
[[package]]
name = "bzip2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
dependencies = [
"bzip2-sys",
"libc",
]
[[package]]
name = "bzip2-sys"
version = "0.1.11+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "cairo-rs"
version = "0.16.7"
@ -641,10 +663,11 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.81"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0"
checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01"
dependencies = [
"jobserver",
"libc",
]
@ -688,7 +711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6"
dependencies = [
"cfg-if",
"cipher",
"cipher 0.3.0",
"cpufeatures",
"zeroize",
]
@ -701,7 +724,7 @@ checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5"
dependencies = [
"aead",
"chacha20",
"cipher",
"cipher 0.3.0",
"poly1305",
"zeroize",
]
@ -729,10 +752,20 @@ dependencies = [
]
[[package]]
name = "clap"
version = "4.3.19"
name = "cipher"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d"
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"crypto-common",
"inout",
]
[[package]]
name = "clap"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd"
dependencies = [
"clap_builder",
"clap_derive",
@ -741,9 +774,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.3.19"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1"
checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
dependencies = [
"anstream",
"anstyle",
@ -873,9 +906,9 @@ dependencies = [
[[package]]
name = "const-oid"
version = "0.9.4"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747"
checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f"
[[package]]
name = "constant_time_eq"
@ -1087,7 +1120,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea"
dependencies = [
"cipher",
"cipher 0.3.0",
]
[[package]]
@ -1139,10 +1172,16 @@ dependencies = [
]
[[package]]
name = "der"
version = "0.7.7"
name = "data-url"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946"
checksum = "41b319d1b62ffbd002e057f36bebd1f42b9f97927c9577461d855f3513c4289f"
[[package]]
name = "der"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c"
dependencies = [
"const-oid",
"pem-rfc7468",
@ -1940,19 +1979,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "globset"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
dependencies = [
"aho-corasick",
"bstr",
"fnv",
"log",
"regex",
]
[[package]]
name = "gobject-sys"
version = "0.16.3"
@ -2241,23 +2267,6 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "ignore"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
dependencies = [
"globset",
"lazy_static",
"log",
"memchr",
"regex",
"same-file",
"thread_local",
"walkdir",
"winapi-util",
]
[[package]]
name = "image"
version = "0.24.6"
@ -2304,6 +2313,15 @@ dependencies = [
"cfb",
]
[[package]]
name = "inout"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
dependencies = [
"generic-array",
]
[[package]]
name = "instant"
version = "0.1.12"
@ -2331,7 +2349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e04d492224bff6e97142f033d0a4383bcbc05918be1ff7b3abd2c1cc85205a2"
dependencies = [
"aead",
"aes",
"aes 0.7.5",
"aes-gcm",
"autocfg",
"blake2",
@ -2477,6 +2495,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.0"
@ -3191,6 +3218,17 @@ dependencies = [
"windows-targets 0.48.1",
]
[[package]]
name = "password-hash"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "paste"
version = "1.0.14"
@ -3210,6 +3248,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest 0.10.7",
"hmac",
"password-hash",
"sha2 0.10.7",
]
[[package]]
@ -3327,18 +3368,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "1.1.2"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842"
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.2"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c"
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
@ -3347,9 +3388,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.10"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c"
[[package]]
name = "pin-utils"
@ -3937,9 +3978,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
version = "0.101.2"
version = "0.101.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59"
checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0"
dependencies = [
"ring",
"untrusted",
@ -4049,18 +4090,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.181"
version = "1.0.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d3e73c93c3240c0bda063c239298e633114c69a888c3e37ca8bb33f343e9890"
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.181"
version = "1.0.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be02f6cb0cd3a5ec20bbcfbcbd749f57daddb1a0882dc2e46a6c236c90b977ed"
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816"
dependencies = [
"proc-macro2",
"quote",
@ -4718,9 +4759,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "swift-rs"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05e51d6f2b5fff4808614f429f8a7655ac8bcfe218185413f3a60c508482c2d6"
checksum = "1bbdb58577b6301f8d17ae2561f32002a5bae056d444e0f69e611e504a276204"
dependencies = [
"base64 0.21.2",
"serde",
@ -4834,9 +4875,9 @@ dependencies = [
[[package]]
name = "tar"
version = "0.4.39"
version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96"
checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
dependencies = [
"filetime",
"libc",
@ -4959,7 +5000,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-app"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"tauri",
]
@ -4967,7 +5008,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-autostart"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"auto-launch",
"log",
@ -4980,7 +5021,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-clipboard-manager"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"arboard",
"log",
@ -4994,7 +5035,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-dialog"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"glib",
"log",
@ -5011,7 +5052,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-fs"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"anyhow",
"glob",
@ -5024,25 +5065,24 @@ dependencies = [
[[package]]
name = "tauri-plugin-http"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"bytes",
"data-url",
"glob",
"http",
"rand 0.8.5",
"reqwest",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-plugin-fs",
"thiserror",
"url",
]
[[package]]
name = "tauri-plugin-notification"
version = "2.0.0-alpha.1"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"log",
"notify-rust",
@ -5060,7 +5100,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-os"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"gethostname 0.4.3",
"log",
@ -5076,7 +5116,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-process"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"tauri",
]
@ -5084,7 +5124,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-shell"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"encoding_rs",
"log",
@ -5101,7 +5141,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-single-instance"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"log",
"serde",
@ -5115,7 +5155,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-sql"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"futures-core",
"log",
@ -5131,7 +5171,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-store"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"log",
"serde",
@ -5143,7 +5183,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-stronghold"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"hex",
"iota-crypto 0.23.0",
@ -5159,14 +5199,12 @@ dependencies = [
[[package]]
name = "tauri-plugin-updater"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"base64 0.21.2",
"dirs-next",
"flate2",
"futures-util",
"http",
"ignore",
"minisign-verify",
"percent-encoding",
"reqwest",
@ -5186,7 +5224,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-upload"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"futures-util",
"log",
@ -5203,7 +5241,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-window"
version = "2.0.0-alpha.0"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#7f2e2dd5b8af2c8e7e224bed132e2b76da983818"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#4ab90f048eab2918344f97dc8e04413a404e392d"
dependencies = [
"serde",
"tauri",
@ -5303,9 +5341,9 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.7.0"
version = "3.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998"
checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651"
dependencies = [
"cfg-if",
"fastrand 2.0.0",
@ -6431,9 +6469,9 @@ dependencies = [
[[package]]
name = "xattr"
version = "0.2.3"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"
checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985"
dependencies = [
"libc",
]
@ -6540,9 +6578,48 @@ version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"aes 0.8.3",
"byteorder",
"bzip2",
"constant_time_eq 0.1.5",
"crc32fast",
"crossbeam-utils",
"flate2",
"hmac",
"pbkdf2",
"sha1",
"time",
"zstd",
]
[[package]]
name = "zstd"
version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [
"libc",
"zstd-sys",
]
[[package]]
name = "zstd-sys"
version = "2.0.8+zstd.1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]

View File

@ -9,6 +9,7 @@ import { updateAccount } from '@libs/storage';
import { ArrowRightCircleIcon, CheckCircleIcon, LoaderIcon } from '@shared/icons';
import { useAccount } from '@utils/hooks/useAccount';
import { useNostr } from '@utils/hooks/useNostr';
import { usePublish } from '@utils/hooks/usePublish';
import { arrayToNIP02 } from '@utils/transform';
@ -17,6 +18,7 @@ export function OnboardStep1Screen() {
const navigate = useNavigate();
const { publish } = usePublish();
const { fetchNotes } = useNostr();
const { account } = useAccount();
const { status, data } = useQuery(['trending-profiles'], async () => {
const res = await fetch('https://api.nostr.band/v0/trending/profiles');
@ -45,8 +47,10 @@ export function OnboardStep1Screen() {
const event = await publish({ content: '', kind: 3, tags: tags });
await updateAccount('follows', follows);
const notes = await fetchNotes();
// redirect to next step
if (event) {
if (event && notes) {
setTimeout(() => {
queryClient.invalidateQueries(['currentAccount']);
navigate('/auth/onboarding/step-2', { replace: true });

View File

@ -109,6 +109,13 @@ export function OnboardStep3Screen() {
<div className="flex h-full w-full items-center justify-center">
<LoaderIcon className="h-4 w-4 animate-spin text-white" />
</div>
) : relaysAsArray.length === 0 ? (
<div className="flex h-full w-full items-center justify-center">
<p className="text-center text-white/50">
Can&apos;t found any relays, you can skip this step and use default relays
instead
</p>
</div>
) : (
relaysAsArray.map((item, index) => (
<button
@ -118,7 +125,7 @@ export function OnboardStep3Screen() {
className="inline-flex transform items-start justify-between bg-white/10 px-4 py-2 hover:bg-white/20"
>
<div className="flex flex-col items-start gap-1">
{item.replace(/\/+$/, '')}
<p className="max-w-[15rem] truncate">{item.replace(/\/+$/, '')}</p>
<UserRelay pubkey={data.get(item)} />
</div>
{relays.has(item) && (

View File

@ -1,4 +1,4 @@
import { FetchOptions, ResponseType, fetch } from '@tauri-apps/plugin-http';
import { fetch } from '@tauri-apps/plugin-http';
import * as cheerio from 'cheerio';
import { OPENGRAPH } from '@stores/constants';
@ -332,10 +332,9 @@ function parseResponse(response: IPreFetchedResource, options?: ILinkPreviewOpti
export async function getLinkPreview(text: string) {
const fetchUrl = text;
const options: FetchOptions = {
const options = {
method: 'GET',
timeout: 5,
responseType: ResponseType.Text,
};
let response = await fetch(fetchUrl, options);

View File

@ -529,10 +529,15 @@ export async function getRelays() {
export async function getExplicitRelayUrls() {
const db = await connect();
const activeAccount = await getActiveAccount();
if (!activeAccount) return null;
const result: Relays[] = await db.select(
`SELECT * FROM relays WHERE account_id = "${activeAccount.id}";`
);
if (result.length > 0) return result.map((el) => el.relay);
return null;
}
@ -541,7 +546,7 @@ export async function createRelay(relay: string, purpose?: string) {
const db = await connect();
const activeAccount = await getActiveAccount();
return await db.execute(
'INSERT OR IGNORE INTO blocks (account_id, relay, purpose) VALUES (?, ?, ?);',
'INSERT OR IGNORE INTO relays (account_id, relay, purpose) VALUES (?, ?, ?);',
[activeAccount.id, relay, purpose || '']
);
}

View File

@ -60,7 +60,7 @@ export function Composer() {
});
const uploadImage = async (file?: string) => {
const image = await upload(file);
const image = await upload(file, true);
if (image.url) {
editor.commands.setImage({ src: image.url });
editor.commands.createParagraphNear();

View File

@ -66,6 +66,7 @@ export const OPENGRAPH = {
export const FULL_RELAYS = [
'wss://relayable.org',
'wss://relay.damus.io',
'wss://relay.nostr.band/all',
'wss://nostr.mutinywallet.com',
];

View File

@ -1,6 +1,6 @@
import { readBinaryFile } from '@tauri-apps/plugin-fs';
export async function createBlobFromFile(path: string): Promise<Uint8Array> {
export async function createBlobFromFile(path: string): Promise<Blob> {
const file = await readBinaryFile(path);
return file;
return new Blob([file]);
}

View File

@ -1,28 +1,17 @@
import { magnetDecode } from '@ctrl/magnet-link';
import { open } from '@tauri-apps/plugin-dialog';
import { Body, fetch } from '@tauri-apps/plugin-http';
import { VoidApi } from '@void-cat/api';
import { createBlobFromFile } from '@utils/createBlobFromFile';
interface UploadResponse {
fileID?: string;
fileName?: string;
imageUrl?: string;
lightningDestination?: string;
lightningPaymentLink?: string;
message?: string;
route?: string;
status: number;
success: boolean;
url?: string;
data?: {
url?: string;
};
}
import { usePublish } from '@utils/hooks/usePublish';
export function useImageUploader() {
const upload = async (file: null | string, nip94?: boolean) => {
let filepath = file;
const { publish } = usePublish();
const upload = async (file: null | string, nip94?: boolean) => {
const voidcat = new VoidApi('https://void.cat');
let filepath = file;
if (!file) {
const selected = await open({
multiple: false,
@ -38,39 +27,46 @@ export function useImageUploader() {
} else if (selected === null) {
// user cancelled the selection
} else {
filepath = selected;
filepath = selected.path;
}
}
const filename = filepath.split('/').pop();
const filetype = 'image/' + filename.split('.').pop();
const filetype = filename.split('.').pop();
const blob = await createBlobFromFile(filepath);
const res = await fetch('https://nostrimg.com/api/upload', {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
},
body: Body.form({
keys: filename,
image: {
file: blob,
mime: filetype,
fileName: filename,
},
}),
});
const uploader = voidcat.getUploader(blob);
// upload file
const res = await uploader.upload();
if (res.ok) {
const data = res.data as UploadResponse;
if (typeof data?.imageUrl === 'string' && data.success) {
if (nip94) {
console.log('todo');
const url =
res.file?.metadata?.url ?? `https://void.cat/d/${res.file?.id}.${filetype}`;
console.log(url);
if (nip94) {
const tags = [
['url', url],
['x', res.file?.metadata?.digest ?? ''],
['m', res.file?.metadata?.mimeType ?? 'application/octet-stream'],
['size', res.file?.metadata?.size.toString() ?? '0'],
];
if (res.file?.metadata?.magnetLink) {
tags.push(['magnet', res.file.metadata.magnetLink]);
const parsedMagnet = magnetDecode(res.file.metadata.magnetLink);
if (parsedMagnet?.infoHash) {
tags.push(['i', parsedMagnet?.infoHash]);
}
}
return {
url: new URL(data.imageUrl).toString(),
};
await publish({ content: '', kind: 1063, tags: tags });
}
return {
url: url,
};
}
return {