mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 03:03:31 +00:00
fixed memory leak and high cpu pike
This commit is contained in:
parent
eb440eda1b
commit
38033fcd57
@ -36,7 +36,7 @@
|
||||
"next": "^13.2.4",
|
||||
"next-remove-imports": "^1.0.10",
|
||||
"nostr-relaypool": "^0.5.18",
|
||||
"nostr-tools": "^1.7.5",
|
||||
"nostr-tools": "^1.8.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.43.8",
|
||||
@ -50,7 +50,7 @@
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"@tauri-apps/cli": "^1.2.3",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
||||
"@types/node": "^18.15.9",
|
||||
"@types/node": "^18.15.10",
|
||||
"@types/react": "^18.0.29",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
||||
|
@ -17,7 +17,7 @@ specifiers:
|
||||
'@tauri-apps/api': ^1.2.0
|
||||
'@tauri-apps/cli': ^1.2.3
|
||||
'@trivago/prettier-plugin-sort-imports': ^4.1.1
|
||||
'@types/node': ^18.15.9
|
||||
'@types/node': ^18.15.10
|
||||
'@types/react': ^18.0.29
|
||||
'@types/react-dom': ^18.0.11
|
||||
'@typescript-eslint/eslint-plugin': ^5.56.0
|
||||
@ -42,7 +42,7 @@ specifiers:
|
||||
next: ^13.2.4
|
||||
next-remove-imports: ^1.0.10
|
||||
nostr-relaypool: ^0.5.18
|
||||
nostr-tools: ^1.7.5
|
||||
nostr-tools: ^1.8.0
|
||||
postcss: ^8.4.21
|
||||
prettier: ^2.8.7
|
||||
prettier-plugin-tailwindcss: ^0.2.5
|
||||
@ -83,7 +83,7 @@ dependencies:
|
||||
next: 13.2.4_biqbaboplfbrettd7655fr4n2y
|
||||
next-remove-imports: 1.0.10
|
||||
nostr-relaypool: 0.5.18_ws@8.13.0
|
||||
nostr-tools: 1.7.5
|
||||
nostr-tools: 1.8.0
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0_react@18.2.0
|
||||
react-hook-form: 7.43.8_react@18.2.0
|
||||
@ -97,7 +97,7 @@ devDependencies:
|
||||
'@tailwindcss/typography': 0.5.9_tailwindcss@3.2.7
|
||||
'@tauri-apps/cli': 1.2.3
|
||||
'@trivago/prettier-plugin-sort-imports': 4.1.1_prettier@2.8.7
|
||||
'@types/node': 18.15.9
|
||||
'@types/node': 18.15.10
|
||||
'@types/react': 18.0.29
|
||||
'@types/react-dom': 18.0.11
|
||||
'@typescript-eslint/eslint-plugin': 5.56.0_iskin7c6dxqunwflhstekcjqmq
|
||||
@ -1490,9 +1490,9 @@ packages:
|
||||
{ integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== }
|
||||
dev: true
|
||||
|
||||
/@types/node/18.15.9:
|
||||
/@types/node/18.15.10:
|
||||
resolution:
|
||||
{ integrity: sha512-dUxhiNzBLr6IqlZXz6e/rN2YQXlFgOei/Dxy+e3cyXTJ4txSUbGT2/fmnD6zd/75jDMeW5bDee+YXxlFKHoV0A== }
|
||||
{ integrity: sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ== }
|
||||
|
||||
/@types/phoenix/1.5.5:
|
||||
resolution:
|
||||
@ -1531,7 +1531,7 @@ packages:
|
||||
resolution:
|
||||
{ integrity: sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== }
|
||||
dependencies:
|
||||
'@types/node': 18.15.9
|
||||
'@types/node': 18.15.10
|
||||
dev: false
|
||||
|
||||
/@typescript-eslint/eslint-plugin/5.56.0_iskin7c6dxqunwflhstekcjqmq:
|
||||
@ -1913,7 +1913,7 @@ packages:
|
||||
postcss: ^8.1.0
|
||||
dependencies:
|
||||
browserslist: 4.21.5
|
||||
caniuse-lite: 1.0.30001469
|
||||
caniuse-lite: 1.0.30001470
|
||||
fraction.js: 4.2.0
|
||||
normalize-range: 0.1.2
|
||||
picocolors: 1.0.0
|
||||
@ -2000,7 +2000,7 @@ packages:
|
||||
engines: { node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7 }
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001469
|
||||
caniuse-lite: 1.0.30001470
|
||||
electron-to-chromium: 1.4.340
|
||||
node-releases: 2.0.10
|
||||
update-browserslist-db: 1.0.10_browserslist@4.21.5
|
||||
@ -2033,9 +2033,9 @@ packages:
|
||||
engines: { node: '>= 6' }
|
||||
dev: true
|
||||
|
||||
/caniuse-lite/1.0.30001469:
|
||||
/caniuse-lite/1.0.30001470:
|
||||
resolution:
|
||||
{ integrity: sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g== }
|
||||
{ integrity: sha512-065uNwY6QtHCBOExzbV6m236DDhYCCtPmQUCoQtwkVqzud8v5QPidoMr6CoMkC2nfp6nksjttqWQRRh75LqUmA== }
|
||||
|
||||
/chalk/2.4.2:
|
||||
resolution:
|
||||
@ -2575,7 +2575,7 @@ packages:
|
||||
enhanced-resolve: 5.12.0
|
||||
eslint: 8.36.0
|
||||
eslint-plugin-import: 2.27.5_as6wyplljmmarlclp2tx3tj6rq
|
||||
get-tsconfig: 4.4.0
|
||||
get-tsconfig: 4.5.0
|
||||
globby: 13.1.3
|
||||
is-core-module: 2.11.0
|
||||
is-glob: 4.0.3
|
||||
@ -3039,9 +3039,9 @@ packages:
|
||||
get-intrinsic: 1.2.0
|
||||
dev: true
|
||||
|
||||
/get-tsconfig/4.4.0:
|
||||
/get-tsconfig/4.5.0:
|
||||
resolution:
|
||||
{ integrity: sha512-0Gdjo/9+FzsYhXCEFueo2aY1z1tpXrxWZzP7k8ul9qt1U5o8rYJwTJYmaeHdrVosYIVYkOy2iwCJ9FdpocJhPQ== }
|
||||
{ integrity: sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ== }
|
||||
dev: true
|
||||
|
||||
/glob-parent/5.1.2:
|
||||
@ -3827,9 +3827,9 @@ packages:
|
||||
{ integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== }
|
||||
dev: true
|
||||
|
||||
/nanoid/3.3.4:
|
||||
/nanoid/3.3.6:
|
||||
resolution:
|
||||
{ integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== }
|
||||
{ integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== }
|
||||
engines: { node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 }
|
||||
hasBin: true
|
||||
|
||||
@ -3884,7 +3884,7 @@ packages:
|
||||
dependencies:
|
||||
'@next/env': 13.2.4
|
||||
'@swc/helpers': 0.4.14
|
||||
caniuse-lite: 1.0.30001469
|
||||
caniuse-lite: 1.0.30001470
|
||||
postcss: 8.4.14
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0_react@18.2.0
|
||||
@ -3949,15 +3949,15 @@ packages:
|
||||
dependencies:
|
||||
'@jest/source-map': 29.4.3
|
||||
isomorphic-ws: 5.0.0_ws@8.13.0
|
||||
nostr-tools: 1.7.5
|
||||
nostr-tools: 1.8.0
|
||||
safe-stable-stringify: 2.4.3
|
||||
transitivePeerDependencies:
|
||||
- ws
|
||||
dev: false
|
||||
|
||||
/nostr-tools/1.7.5:
|
||||
/nostr-tools/1.8.0:
|
||||
resolution:
|
||||
{ integrity: sha512-FFaYOAn9lFyISClbBzPe2eQ2ZiKx8xFviwHmdgTAmuue+eLrtPEI3tCqPtP624HghX/X4VnaixoiMvDB8g2+tQ== }
|
||||
{ integrity: sha512-oVLAU0gukNWf57wgjK581XiVOM5hL/Y9OTDyIBpH/f54OdAB4QHinhmj1dDcZ0Eppfna3Hlmwur1FSHdsfE9ag== }
|
||||
dependencies:
|
||||
'@noble/hashes': 1.0.0
|
||||
'@noble/secp256k1': 1.7.1
|
||||
@ -4301,7 +4301,7 @@ packages:
|
||||
{ integrity: sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== }
|
||||
engines: { node: ^10 || ^12 || >=14 }
|
||||
dependencies:
|
||||
nanoid: 3.3.4
|
||||
nanoid: 3.3.6
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: false
|
||||
@ -4311,7 +4311,7 @@ packages:
|
||||
{ integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg== }
|
||||
engines: { node: ^10 || ^12 || >=14 }
|
||||
dependencies:
|
||||
nanoid: 3.3.4
|
||||
nanoid: 3.3.6
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: true
|
||||
|
197
src-tauri/Cargo.lock
generated
197
src-tauri/Cargo.lock
generated
@ -516,17 +516,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dbus"
|
||||
version = "0.9.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"libdbus-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.17"
|
||||
@ -915,7 +904,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"rustversion",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1409,15 +1398,6 @@ version = "0.2.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "libdbus-sys"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f8d7ae751e1cb825c840ae5e682f59b098cdfd213c350ac268b61449a5f58a0"
|
||||
dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
@ -1501,19 +1481,6 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
||||
|
||||
[[package]]
|
||||
name = "mac-notification-sys"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e72d50edb17756489e79d52eb146927bec8eba9dd48faadf9ef08bca3791ad5"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"dirs-next",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
@ -1671,17 +1638,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ce656bb6d22a93ae276a23de52d1aec5ba4db3ece3c0eb79dfd5add7384db6a"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"mac-notification-sys",
|
||||
"tauri-winrt-notification",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
@ -1763,17 +1719,6 @@ dependencies = [
|
||||
"objc_exception",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-foundation"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
|
||||
dependencies = [
|
||||
"block",
|
||||
"objc",
|
||||
"objc_id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
@ -2116,7 +2061,7 @@ dependencies = [
|
||||
"base64 0.13.1",
|
||||
"indexmap",
|
||||
"line-wrap",
|
||||
"quick-xml 0.26.0",
|
||||
"quick-xml",
|
||||
"serde",
|
||||
"time",
|
||||
]
|
||||
@ -2194,15 +2139,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.26.0"
|
||||
@ -2366,30 +2302,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rfd"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea"
|
||||
dependencies = [
|
||||
"block",
|
||||
"dispatch",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"gtk-sys",
|
||||
"js-sys",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"raw-window-handle",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"windows 0.37.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.20"
|
||||
@ -2931,27 +2843,6 @@ version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb"
|
||||
dependencies = [
|
||||
"heck 0.3.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.107"
|
||||
@ -3032,7 +2923,7 @@ dependencies = [
|
||||
"serde",
|
||||
"unicode-segmentation",
|
||||
"uuid 1.3.0",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
"windows-implement",
|
||||
"x11-dl",
|
||||
]
|
||||
@ -3068,7 +2959,6 @@ dependencies = [
|
||||
"heck 0.4.1",
|
||||
"http",
|
||||
"ignore",
|
||||
"notify-rust",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"open",
|
||||
@ -3077,7 +2967,6 @@ dependencies = [
|
||||
"rand 0.8.5",
|
||||
"raw-window-handle",
|
||||
"regex",
|
||||
"rfd",
|
||||
"semver 1.0.16",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -3096,7 +2985,7 @@ dependencies = [
|
||||
"uuid 1.3.0",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3187,7 +3076,7 @@ dependencies = [
|
||||
"thiserror",
|
||||
"uuid 1.3.0",
|
||||
"webview2-com",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3206,7 +3095,7 @@ dependencies = [
|
||||
"uuid 1.3.0",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
"wry",
|
||||
]
|
||||
|
||||
@ -3235,18 +3124,7 @@ dependencies = [
|
||||
"thiserror",
|
||||
"url",
|
||||
"walkdir",
|
||||
"windows 0.39.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-winrt-notification"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c58de036c4d2e20717024de2a3c4bf56c301f07b21bc8ef9b57189fce06f1f3b"
|
||||
dependencies = [
|
||||
"quick-xml 0.23.1",
|
||||
"strum",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3649,18 +3527,6 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.84"
|
||||
@ -3774,7 +3640,7 @@ checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178"
|
||||
dependencies = [
|
||||
"webview2-com-macros",
|
||||
"webview2-com-sys",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
"windows-implement",
|
||||
]
|
||||
|
||||
@ -3799,7 +3665,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
"windows-bindgen",
|
||||
"windows-metadata",
|
||||
]
|
||||
@ -3835,19 +3701,6 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc 0.37.0",
|
||||
"windows_i686_gnu 0.37.0",
|
||||
"windows_i686_msvc 0.37.0",
|
||||
"windows_x86_64_gnu 0.37.0",
|
||||
"windows_x86_64_msvc 0.37.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.39.0"
|
||||
@ -3939,12 +3792,6 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.39.0"
|
||||
@ -3957,12 +3804,6 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.39.0"
|
||||
@ -3975,12 +3816,6 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.39.0"
|
||||
@ -3993,12 +3828,6 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.39.0"
|
||||
@ -4017,12 +3846,6 @@ version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.39.0"
|
||||
@ -4078,7 +3901,7 @@ dependencies = [
|
||||
"webkit2gtk",
|
||||
"webkit2gtk-sys",
|
||||
"webview2-com",
|
||||
"windows 0.39.0",
|
||||
"windows",
|
||||
"windows-implement",
|
||||
]
|
||||
|
||||
|
@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2", features = ["app-all", "clipboard-all", "http-all", "notification-all", "os-all", "shell-open", "system-tray", "window-close", "window-start-dragging"] }
|
||||
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "http-request", "os-all", "shell-open", "system-tray", "window-close", "window-start-dragging"] }
|
||||
|
||||
[dependencies.tauri-plugin-sql]
|
||||
git = "https://github.com/tauri-apps/plugins-workspace"
|
||||
|
@ -17,20 +17,20 @@ INSERT INTO
|
||||
relays (relay_url, relay_status)
|
||||
VALUES
|
||||
("wss://relay.damus.io", "1"),
|
||||
("wss://eden.nostr.land", "1"),
|
||||
("wss://eden.nostr.land", "0"),
|
||||
("wss://nostr-pub.wellorder.net", "1"),
|
||||
("wss://nostr.bongbong.com", "1"),
|
||||
("wss://nostr.zebedee.cloud", "1"),
|
||||
("wss://nostr.fmt.wiz.biz", "1"),
|
||||
("wss://nostr.walletofsatoshi.com", "1"),
|
||||
("wss://nostr.walletofsatoshi.com", "0"),
|
||||
("wss://relay.snort.social", "1"),
|
||||
("wss://offchain.pub", "1"),
|
||||
("wss://brb.io", "1"),
|
||||
("wss://brb.io", "0"),
|
||||
("wss://relay.current.fyi", "1"),
|
||||
("wss://nostr.relayer.se", "1"),
|
||||
("wss://nostr.relayer.se", "0"),
|
||||
("wss://nostr.bitcoiner.social", "1"),
|
||||
("wss://relay.nostr.info", "1"),
|
||||
("wss://relay.zeh.app", "1"),
|
||||
("wss://relay.zeh.app", "0"),
|
||||
("wss://nostr-01.dorafactory.org", "1"),
|
||||
("wss://nostr.zhongwen.world", "1"),
|
||||
("wss://nostro.cc", "1"),
|
||||
|
@ -7,15 +7,13 @@
|
||||
#[macro_use]
|
||||
extern crate objc;
|
||||
|
||||
use tauri::{Manager, SystemTray, WindowEvent};
|
||||
use tauri::{Manager, WindowEvent};
|
||||
use tauri_plugin_sql::{Migration, MigrationKind};
|
||||
use window_ext::WindowExt;
|
||||
|
||||
mod window_ext;
|
||||
|
||||
fn main() {
|
||||
let tray = SystemTray::new();
|
||||
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
let main_window = app.get_window("main").unwrap();
|
||||
@ -24,7 +22,6 @@ fn main() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.system_tray(tray)
|
||||
.plugin(
|
||||
tauri_plugin_sql::Builder::default()
|
||||
.add_migrations(
|
||||
|
@ -14,15 +14,13 @@
|
||||
"allowlist": {
|
||||
"all": false,
|
||||
"app": {
|
||||
"all": true,
|
||||
"hide": false,
|
||||
"show": false
|
||||
"all": false
|
||||
},
|
||||
"os": {
|
||||
"all": true
|
||||
},
|
||||
"http": {
|
||||
"all": true,
|
||||
"all": false,
|
||||
"request": true,
|
||||
"scope": ["https://rbr.bio/*", "https://metadata.uselume.xyz/*"]
|
||||
},
|
||||
@ -31,12 +29,12 @@
|
||||
"open": true
|
||||
},
|
||||
"clipboard": {
|
||||
"all": true,
|
||||
"all": false,
|
||||
"writeText": true,
|
||||
"readText": true
|
||||
},
|
||||
"notification": {
|
||||
"all": true
|
||||
"all": false
|
||||
},
|
||||
"window": {
|
||||
"startDragging": true,
|
||||
|
@ -2,39 +2,44 @@ import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { relaysAtom } from '@stores/relays';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
import { createFollows } from '@utils/storage';
|
||||
import { tagsToArray } from '@utils/transform';
|
||||
|
||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||
import { AvatarIcon, ExitIcon, GearIcon } from '@radix-ui/react-icons';
|
||||
import destr from 'destr';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router';
|
||||
import { memo, useContext, useEffect } from 'react';
|
||||
import { memo, useContext, useEffect, useRef } from 'react';
|
||||
|
||||
export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
const relays = useAtomValue(relaysAtom);
|
||||
|
||||
const router = useRouter();
|
||||
const userData = JSON.parse(user.metadata);
|
||||
const userData = destr(user.metadata);
|
||||
|
||||
const now = useRef(new Date());
|
||||
|
||||
const openProfile = () => {
|
||||
router.push(`/users/${user.pubkey}`);
|
||||
router.push(`/users/${user.id}`);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
pool.subscribe(
|
||||
const unsubscribe = pool.subscribe(
|
||||
[
|
||||
{
|
||||
kinds: [3],
|
||||
authors: [user.pubkey],
|
||||
authors: [user.id],
|
||||
since: dateToUnix(now.current),
|
||||
},
|
||||
],
|
||||
relays,
|
||||
(event: any) => {
|
||||
if (event.tags.length > 0) {
|
||||
createFollows(tagsToArray(event.tags), user.pubkey, 0);
|
||||
createFollows(tagsToArray(event.tags), user.id, 0);
|
||||
}
|
||||
},
|
||||
undefined,
|
||||
@ -43,7 +48,11 @@ export const ActiveAccount = memo(function ActiveAccount({ user }: { user: any }
|
||||
unsubscribeOnEose: true,
|
||||
}
|
||||
);
|
||||
}, [pool, relays, user.pubkey]);
|
||||
|
||||
return () => {
|
||||
unsubscribe;
|
||||
};
|
||||
}, [pool, relays, user.id]);
|
||||
|
||||
return (
|
||||
<DropdownMenu.Root>
|
||||
|
@ -1,8 +1,9 @@
|
||||
import destr from 'destr';
|
||||
import Image from 'next/image';
|
||||
import { memo } from 'react';
|
||||
|
||||
export const InactiveAccount = memo(function InactiveAccount({ user }: { user: any }) {
|
||||
const userData = JSON.parse(user.metadata);
|
||||
const userData = destr(user.metadata);
|
||||
|
||||
const setCurrentUser = () => {
|
||||
console.log('clicked');
|
||||
|
@ -1,24 +1,9 @@
|
||||
import { MessageList } from '@components/columns/navigator/messages/list';
|
||||
|
||||
import { activeAccountAtom } from '@stores/account';
|
||||
|
||||
import { getAllFollowsByID } from '@utils/storage';
|
||||
|
||||
import * as Collapsible from '@radix-ui/react-collapsible';
|
||||
import { TriangleUpIcon } from '@radix-ui/react-icons';
|
||||
import { useAtom } from 'jotai';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function Messages() {
|
||||
const [open, setOpen] = useState(true);
|
||||
const [follows, setFollows] = useState([]);
|
||||
const [activeAccount] = useAtom(activeAccountAtom);
|
||||
|
||||
useEffect(() => {
|
||||
getAllFollowsByID(activeAccount.id)
|
||||
.then((res: any) => setFollows(res))
|
||||
.catch(console.error);
|
||||
}, [activeAccount.id]);
|
||||
|
||||
return (
|
||||
<Collapsible.Root open={open} onOpenChange={setOpen}>
|
||||
@ -35,9 +20,7 @@ export default function Messages() {
|
||||
Messages
|
||||
</h3>
|
||||
</Collapsible.Trigger>
|
||||
<Collapsible.Content className="flex flex-col">
|
||||
<MessageList data={follows} />
|
||||
</Collapsible.Content>
|
||||
<Collapsible.Content className="flex flex-col"></Collapsible.Content>
|
||||
</div>
|
||||
</Collapsible.Root>
|
||||
);
|
||||
|
@ -8,7 +8,6 @@ import { relaysAtom } from '@stores/relays';
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
import { ImageIcon, ResetIcon } from '@radix-ui/react-icons';
|
||||
import { sendNotification } from '@tauri-apps/api/notification';
|
||||
import { useAtom, useAtomValue } from 'jotai';
|
||||
import { useResetAtom } from 'jotai/utils';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
@ -41,7 +40,7 @@ export default function FormBase() {
|
||||
// reset form
|
||||
resetValue();
|
||||
// send notification
|
||||
sendNotification('Note has been published successfully');
|
||||
// sendNotification('Note has been published successfully');
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -6,7 +6,6 @@ import { relaysAtom } from '@stores/relays';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
|
||||
import { sendNotification } from '@tauri-apps/api/notification';
|
||||
import destr from 'destr';
|
||||
import { useAtom, useAtomValue } from 'jotai';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
@ -35,7 +34,7 @@ export default function FormComment({ eventID }: { eventID: any }) {
|
||||
// publish note
|
||||
pool.publish(event, relays);
|
||||
// send notification
|
||||
sendNotification('Comment has been published successfully');
|
||||
// sendNotification('Comment has been published successfully');
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -11,6 +11,7 @@ import CommentIcon from '@assets/icons/comment';
|
||||
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { SizeIcon } from '@radix-ui/react-icons';
|
||||
import destr from 'destr';
|
||||
import { useAtom, useAtomValue } from 'jotai';
|
||||
import { useRouter } from 'next/router';
|
||||
import { getEventHash, signEvent } from 'nostr-tools';
|
||||
@ -38,7 +39,7 @@ export const NoteComment = memo(function NoteComment({
|
||||
const [open, setOpen] = useState(false);
|
||||
const [value, setValue] = useState('');
|
||||
|
||||
const profile = JSON.parse(activeAccount.metadata);
|
||||
const profile = destr(activeAccount.metadata);
|
||||
|
||||
const openThread = () => {
|
||||
router.push(`/newsfeed/${eventID}`);
|
||||
|
@ -4,6 +4,7 @@ import { RelayContext } from '@components/relaysProvider';
|
||||
|
||||
import { relaysAtom } from '@stores/relays';
|
||||
|
||||
import { dateToUnix } from '@utils/getDate';
|
||||
import { createCacheCommentNote } from '@utils/storage';
|
||||
|
||||
import { useAtomValue } from 'jotai';
|
||||
@ -17,7 +18,7 @@ export default function NoteMetadata({
|
||||
}: {
|
||||
eventID: string;
|
||||
eventPubkey: string;
|
||||
eventTime: string;
|
||||
eventTime: any;
|
||||
eventContent: any;
|
||||
}) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
@ -26,13 +27,15 @@ export default function NoteMetadata({
|
||||
const [likes, setLikes] = useState(0);
|
||||
const [comments, setComments] = useState(0);
|
||||
|
||||
/*
|
||||
useEffect(() => {
|
||||
const unsubscribe = pool.subscribe(
|
||||
[
|
||||
{
|
||||
'#e': [eventID],
|
||||
since: 0,
|
||||
since: parseInt(eventTime),
|
||||
kinds: [1, 7],
|
||||
limit: 50,
|
||||
},
|
||||
],
|
||||
relays,
|
||||
@ -53,7 +56,7 @@ export default function NoteMetadata({
|
||||
break;
|
||||
}
|
||||
},
|
||||
undefined,
|
||||
1000,
|
||||
undefined,
|
||||
{
|
||||
unsubscribeOnEose: true,
|
||||
@ -61,9 +64,10 @@ export default function NoteMetadata({
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
unsubscribe;
|
||||
};
|
||||
}, [eventID, pool, relays]);
|
||||
}, [eventID, eventTime, pool, relays]);
|
||||
*/
|
||||
|
||||
return (
|
||||
<div className="relative z-10 -ml-1 flex items-center gap-8">
|
||||
|
@ -12,7 +12,7 @@ import { createCacheNote, getNoteByID } from '@utils/storage';
|
||||
|
||||
import destr from 'destr';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import ReactPlayer from 'react-player';
|
||||
import reactStringReplace from 'react-string-replace';
|
||||
|
||||
@ -21,9 +21,10 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
|
||||
const relays = useAtomValue(relaysAtom);
|
||||
const [event, setEvent] = useState(null);
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
const fetchEvent = useCallback(() => {
|
||||
pool.subscribe(
|
||||
unsubscribe.current = pool.subscribe(
|
||||
[
|
||||
{
|
||||
ids: [id],
|
||||
@ -53,6 +54,10 @@ export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||
fetchEvent();
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe.current;
|
||||
};
|
||||
}, [fetchEvent, id]);
|
||||
|
||||
const content = useMemo(() => {
|
||||
|
@ -8,7 +8,7 @@ import { createCacheNote, getNoteByID } from '@utils/storage';
|
||||
|
||||
import destr from 'destr';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import reactStringReplace from 'react-string-replace';
|
||||
|
||||
export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||
@ -16,9 +16,10 @@ export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||
|
||||
const relays = useAtomValue(relaysAtom);
|
||||
const [event, setEvent] = useState(null);
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
const fetchEvent = useCallback(() => {
|
||||
pool.subscribe(
|
||||
unsubscribe.current = pool.subscribe(
|
||||
[
|
||||
{
|
||||
ids: [id],
|
||||
@ -48,6 +49,10 @@ export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||
fetchEvent();
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe.current;
|
||||
};
|
||||
}, [fetchEvent, id]);
|
||||
|
||||
const content = useMemo(() => {
|
||||
@ -100,22 +105,6 @@ export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="relative z-10 flex h-min animate-pulse select-text flex-col pb-5">
|
||||
<div className="flex items-start gap-2">
|
||||
<div className="relative h-11 w-11 shrink overflow-hidden rounded-md bg-zinc-700" />
|
||||
<div className="flex w-full flex-1 items-start justify-between">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<div className="h-4 w-16 rounded bg-zinc-700" />
|
||||
<span className="text-zinc-500">·</span>
|
||||
<div className="h-4 w-12 rounded bg-zinc-700" />
|
||||
</div>
|
||||
<div className="h-3 w-3 rounded-full bg-zinc-700" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return <div className="mt-2 h-6 animate-pulse select-text flex-col rounded bg-zinc-700 pb-5"></div>;
|
||||
}
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ import { fetch } from '@tauri-apps/api/http';
|
||||
import Avatar from 'boring-avatars';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import destr from 'destr';
|
||||
import { useRouter } from 'next/router';
|
||||
import { memo, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
@ -33,11 +34,11 @@ export const UserExtend = memo(function UserExtend({ pubkey, time }: { pubkey: s
|
||||
useEffect(() => {
|
||||
getCacheProfile(pubkey).then((res) => {
|
||||
if (res) {
|
||||
setProfile(JSON.parse(res.metadata));
|
||||
setProfile(destr(res.metadata));
|
||||
} else {
|
||||
fetchProfile(pubkey)
|
||||
.then((res: any) => {
|
||||
setProfile(JSON.parse(res.content));
|
||||
setProfile(destr(res.content));
|
||||
createCacheProfile(pubkey, res.content);
|
||||
})
|
||||
.catch(console.error);
|
||||
|
@ -8,6 +8,7 @@ import { fetch } from '@tauri-apps/api/http';
|
||||
import Avatar from 'boring-avatars';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import destr from 'destr';
|
||||
import { memo, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
@ -26,11 +27,11 @@ export const UserLarge = memo(function UserLarge({ pubkey, time }: { pubkey: str
|
||||
useEffect(() => {
|
||||
getCacheProfile(pubkey).then((res) => {
|
||||
if (res) {
|
||||
setProfile(JSON.parse(res.metadata));
|
||||
setProfile(destr(res.metadata));
|
||||
} else {
|
||||
fetchProfile(pubkey)
|
||||
.then((res: any) => {
|
||||
setProfile(JSON.parse(res.content));
|
||||
setProfile(destr(res.content));
|
||||
createCacheProfile(pubkey, res.content);
|
||||
})
|
||||
.catch(console.error);
|
||||
|
@ -2,6 +2,7 @@ import { createCacheProfile, getCacheProfile } from '@utils/storage';
|
||||
import { truncate } from '@utils/truncate';
|
||||
|
||||
import { fetch } from '@tauri-apps/api/http';
|
||||
import destr from 'destr';
|
||||
import { memo, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export const UserMention = memo(function UserMention({ pubkey }: { pubkey: string }) {
|
||||
@ -18,11 +19,11 @@ export const UserMention = memo(function UserMention({ pubkey }: { pubkey: strin
|
||||
useEffect(() => {
|
||||
getCacheProfile(pubkey).then((res) => {
|
||||
if (res) {
|
||||
setProfile(JSON.parse(res.metadata));
|
||||
setProfile(destr(res.metadata));
|
||||
} else {
|
||||
fetchProfile(pubkey)
|
||||
.then((res: any) => {
|
||||
setProfile(JSON.parse(res.content));
|
||||
setProfile(destr(res.content));
|
||||
createCacheProfile(pubkey, res.content);
|
||||
})
|
||||
.catch(console.error);
|
||||
|
@ -5,6 +5,7 @@ import { truncate } from '@utils/truncate';
|
||||
|
||||
import { fetch } from '@tauri-apps/api/http';
|
||||
import Avatar from 'boring-avatars';
|
||||
import destr from 'destr';
|
||||
import { memo, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export const UserMini = memo(function UserMini({ pubkey }: { pubkey: string }) {
|
||||
@ -21,11 +22,11 @@ export const UserMini = memo(function UserMini({ pubkey }: { pubkey: string }) {
|
||||
useEffect(() => {
|
||||
getCacheProfile(pubkey).then((res) => {
|
||||
if (res) {
|
||||
setProfile(JSON.parse(res.metadata));
|
||||
setProfile(destr(res.metadata));
|
||||
} else {
|
||||
fetchProfile(pubkey)
|
||||
.then((res: any) => {
|
||||
setProfile(JSON.parse(res.content));
|
||||
setProfile(destr(res.content));
|
||||
createCacheProfile(pubkey, res.content);
|
||||
})
|
||||
.catch(console.error);
|
||||
|
@ -13,7 +13,17 @@ import LumeSymbol from '@assets/icons/Lume';
|
||||
|
||||
import { useAtom, useAtomValue } from 'jotai';
|
||||
import { useRouter } from 'next/router';
|
||||
import { JSXElementConstructor, ReactElement, ReactFragment, ReactPortal, useContext, useEffect, useRef } from 'react';
|
||||
import {
|
||||
JSXElementConstructor,
|
||||
ReactElement,
|
||||
ReactFragment,
|
||||
ReactPortal,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
export default function Page() {
|
||||
const router = useRouter();
|
||||
@ -22,72 +32,60 @@ export default function Page() {
|
||||
const relays = useAtomValue(relaysAtom);
|
||||
const [activeAccount] = useAtom(activeAccountAtom);
|
||||
|
||||
const [done, setDone] = useState(false);
|
||||
const now = useRef(new Date());
|
||||
const timer = useRef(null);
|
||||
const unsubscribe = useRef(null);
|
||||
|
||||
const fetchData = useCallback(
|
||||
(since) => {
|
||||
getAllFollowsByID(activeAccount.id).then((follows) => {
|
||||
unsubscribe.current = pool.subscribe(
|
||||
[
|
||||
{
|
||||
kinds: [1],
|
||||
authors: pubkeyArray(follows),
|
||||
since: dateToUnix(since),
|
||||
until: dateToUnix(now.current),
|
||||
},
|
||||
],
|
||||
relays,
|
||||
(event) => {
|
||||
// insert event to local database
|
||||
createCacheNote(event);
|
||||
},
|
||||
undefined,
|
||||
() => {
|
||||
setDone(true);
|
||||
},
|
||||
{
|
||||
unsubscribeOnEose: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
[activeAccount.id, pool, relays]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
countTotalNotes().then((count) => {
|
||||
if (count.total === 0) {
|
||||
getAllFollowsByID(activeAccount.id).then((follows) => {
|
||||
pool.subscribe(
|
||||
[
|
||||
{
|
||||
kinds: [1],
|
||||
authors: pubkeyArray(follows),
|
||||
since: dateToUnix(hoursAgo(24, now.current)),
|
||||
until: dateToUnix(now.current),
|
||||
},
|
||||
],
|
||||
relays,
|
||||
(event) => {
|
||||
// insert event to local database
|
||||
createCacheNote(event);
|
||||
},
|
||||
undefined,
|
||||
() => {
|
||||
timer.current = setTimeout(() => router.push('/newsfeed/following'), 3000);
|
||||
},
|
||||
{
|
||||
unsubscribeOnEose: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
getLastLoginTime().then((time) => {
|
||||
const parseDate = new Date(time);
|
||||
|
||||
getAllFollowsByID(activeAccount.id).then((follows) => {
|
||||
pool.subscribe(
|
||||
[
|
||||
{
|
||||
kinds: [1],
|
||||
authors: pubkeyArray(follows),
|
||||
since: dateToUnix(parseDate),
|
||||
until: dateToUnix(now.current),
|
||||
},
|
||||
],
|
||||
relays,
|
||||
(event) => {
|
||||
// insert event to local database
|
||||
createCacheNote(event);
|
||||
},
|
||||
undefined,
|
||||
() => {
|
||||
timer.current = setTimeout(() => router.push('/newsfeed/following'), 3000);
|
||||
},
|
||||
{
|
||||
unsubscribeOnEose: true,
|
||||
}
|
||||
);
|
||||
if (!done) {
|
||||
countTotalNotes().then((count) => {
|
||||
if (count.total === 0) {
|
||||
fetchData(hoursAgo(24, now.current));
|
||||
} else {
|
||||
getLastLoginTime().then((time) => {
|
||||
const parseDate = new Date(time.setting_value);
|
||||
fetchData(parseDate);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push('/newsfeed/following');
|
||||
}
|
||||
|
||||
return () => {
|
||||
clearTimeout(timer.current);
|
||||
unsubscribe.current;
|
||||
};
|
||||
}, [activeAccount.id, pool, relays, router]);
|
||||
}, [activeAccount.id, done, pool, relays, router, fetchData]);
|
||||
|
||||
return (
|
||||
<div className="relative h-full overflow-hidden">
|
||||
|
@ -17,8 +17,7 @@ export default function Page() {
|
||||
|
||||
const virtualizer = useVirtualizer({
|
||||
count: data.length,
|
||||
overscan: 5,
|
||||
estimateSize: () => 600,
|
||||
estimateSize: () => 500,
|
||||
getScrollElement: () => parentRef.current,
|
||||
getItemKey: (index) => data[index].id,
|
||||
});
|
||||
|
@ -34,7 +34,6 @@ export default function Page() {
|
||||
const relays = useAtomValue(relaysAtom);
|
||||
const [profile, setProfile] = useState(null);
|
||||
const [done, setDone] = useState(false);
|
||||
const timer = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = pool.subscribe(
|
||||
@ -65,7 +64,7 @@ export default function Page() {
|
||||
},
|
||||
undefined,
|
||||
() => {
|
||||
timer.current = setTimeout(() => setDone(true), 3000);
|
||||
setDone(true);
|
||||
},
|
||||
{
|
||||
unsubscribeOnEose: true,
|
||||
@ -73,8 +72,7 @@ export default function Page() {
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
clearTimeout(timer.current);
|
||||
unsubscribe;
|
||||
};
|
||||
}, [pool, privkey, pubkey, relays]);
|
||||
|
||||
|
@ -91,7 +91,7 @@ export async function getCacheProfile(id) {
|
||||
// get all notes
|
||||
export async function getAllNotes() {
|
||||
const db = await connect();
|
||||
return await db.select(`SELECT * FROM cache_notes GROUP BY parent_id ORDER BY created_at DESC LIMIT 1000`);
|
||||
return await db.select(`SELECT * FROM cache_notes GROUP BY parent_id ORDER BY created_at DESC LIMIT 500`);
|
||||
}
|
||||
|
||||
// get note by id
|
||||
@ -122,7 +122,7 @@ export async function createCacheNote(data) {
|
||||
export async function getAllCommentNotes(eid) {
|
||||
const db = await connect();
|
||||
return await db.select(
|
||||
`SELECT * FROM cache_notes WHERE parent_comment_id = "${eid}" ORDER BY created_at DESC LIMIT 1000`
|
||||
`SELECT * FROM cache_notes WHERE parent_comment_id = "${eid}" ORDER BY created_at DESC LIMIT 500`
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user