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