From 12bfa2fca125fa43cd684816c15d7f3cd230c98f Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 18 Jul 2023 14:37:03 +0700 Subject: [PATCH] clean up database and update depedencies --- package.json | 12 +- pnpm-lock.yaml | 270 +++++++++--------- .../20230718072634_clean_up_old_tables.sql | 6 + src-tauri/src/main.rs | 6 + src/app/user/components/feed.tsx | 2 +- src/libs/ndk/instance.ts | 4 +- src/libs/storage.tsx | 54 +--- src/utils/types.d.ts | 6 + 8 files changed, 176 insertions(+), 184 deletions(-) create mode 100644 src-tauri/migrations/20230718072634_clean_up_old_tables.sql diff --git a/package.json b/package.json index 2100fc3e..5d0ef46b 100644 --- a/package.json +++ b/package.json @@ -28,21 +28,21 @@ "cheerio": "1.0.0-rc.12", "dayjs": "^1.11.9", "destr": "^1.2.2", - "framer-motion": "^10.12.21", + "framer-motion": "^10.12.22", "get-urls": "^11.0.0", "immer": "^10.0.2", "light-bolt11-decoder": "^3.0.0", - "nostr-fetch": "^0.11.0", - "nostr-tools": "^1.12.1", + "nostr-fetch": "^0.12.1", + "nostr-tools": "^1.13.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-hook-form": "^7.45.1", + "react-hook-form": "^7.45.2", "react-hotkeys-hook": "^4.4.1", "react-markdown": "^8.0.7", "react-player": "^2.12.0", - "react-router-dom": "^6.14.1", + "react-router-dom": "^6.14.2", "react-string-replace": "^1.1.1", - "react-virtuoso": "^4.4.0", + "react-virtuoso": "^4.4.1", "remark-gfm": "^3.0.1", "slate": "^0.94.1", "slate-history": "^0.93.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8025d5e0..bd551b35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,7 +9,7 @@ dependencies: version: 0.7.7(typescript@4.9.5) '@nostr-fetch/adapter-ndk': specifier: ^0.11.0 - version: 0.11.0(@nostr-dev-kit/ndk@0.7.7)(nostr-fetch@0.11.0) + version: 0.11.0(@nostr-dev-kit/ndk@0.7.7)(nostr-fetch@0.12.1) '@radix-ui/react-popover': specifier: ^1.0.6 version: 1.0.6(@types/react-dom@18.2.7)(@types/react@18.2.15)(react-dom@18.2.0)(react@18.2.0) @@ -38,8 +38,8 @@ dependencies: specifier: ^1.2.2 version: 1.2.2 framer-motion: - specifier: ^10.12.21 - version: 10.12.21(react-dom@18.2.0)(react@18.2.0) + specifier: ^10.12.22 + version: 10.12.22(react-dom@18.2.0)(react@18.2.0) get-urls: specifier: ^11.0.0 version: 11.0.0 @@ -50,11 +50,11 @@ dependencies: specifier: ^3.0.0 version: 3.0.0 nostr-fetch: - specifier: ^0.11.0 - version: 0.11.0 + specifier: ^0.12.1 + version: 0.12.1 nostr-tools: - specifier: ^1.12.1 - version: 1.12.1 + specifier: ^1.13.0 + version: 1.13.0 react: specifier: ^18.2.0 version: 18.2.0 @@ -62,8 +62,8 @@ dependencies: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) react-hook-form: - specifier: ^7.45.1 - version: 7.45.1(react@18.2.0) + specifier: ^7.45.2 + version: 7.45.2(react@18.2.0) react-hotkeys-hook: specifier: ^4.4.1 version: 4.4.1(react-dom@18.2.0)(react@18.2.0) @@ -74,14 +74,14 @@ dependencies: specifier: ^2.12.0 version: 2.12.0(react@18.2.0) react-router-dom: - specifier: ^6.14.1 - version: 6.14.1(react-dom@18.2.0)(react@18.2.0) + specifier: ^6.14.2 + version: 6.14.2(react-dom@18.2.0)(react@18.2.0) react-string-replace: specifier: ^1.1.1 version: 1.1.1 react-virtuoso: - specifier: ^4.4.0 - version: 4.4.0(react-dom@18.2.0)(react@18.2.0) + specifier: ^4.4.1 + version: 4.4.1(react-dom@18.2.0)(react@18.2.0) remark-gfm: specifier: ^3.0.1 version: 3.0.1 @@ -352,8 +352,8 @@ packages: dev: false optional: true - /@esbuild/android-arm64@0.18.13: - resolution: {integrity: sha512-j7NhycJUoUAG5kAzGf4fPWfd17N6SM3o1X6MlXVqfHvs2buFraCJzos9vbeWjLxOyBKHyPOnuCuipbhvbYtTAg==} + /@esbuild/android-arm64@0.18.14: + resolution: {integrity: sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -370,8 +370,8 @@ packages: dev: false optional: true - /@esbuild/android-arm@0.18.13: - resolution: {integrity: sha512-KwqFhxRFMKZINHzCqf8eKxE0XqWlAVPRxwy6rc7CbVFxzUWB2sA/s3hbMZeemPdhN3fKBkqOaFhTbS8xJXYIWQ==} + /@esbuild/android-arm@0.18.14: + resolution: {integrity: sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -388,8 +388,8 @@ packages: dev: false optional: true - /@esbuild/android-x64@0.18.13: - resolution: {integrity: sha512-M2eZkRxR6WnWfVELHmv6MUoHbOqnzoTVSIxgtsyhm/NsgmL+uTmag/VVzdXvmahak1I6sOb1K/2movco5ikDJg==} + /@esbuild/android-x64@0.18.14: + resolution: {integrity: sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -406,8 +406,8 @@ packages: dev: false optional: true - /@esbuild/darwin-arm64@0.18.13: - resolution: {integrity: sha512-f5goG30YgR1GU+fxtaBRdSW3SBG9pZW834Mmhxa6terzcboz7P2R0k4lDxlkP7NYRIIdBbWp+VgwQbmMH4yV7w==} + /@esbuild/darwin-arm64@0.18.14: + resolution: {integrity: sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -424,8 +424,8 @@ packages: dev: false optional: true - /@esbuild/darwin-x64@0.18.13: - resolution: {integrity: sha512-RIrxoKH5Eo+yE5BtaAIMZaiKutPhZjw+j0OCh8WdvKEKJQteacq0myZvBDLU+hOzQOZWJeDnuQ2xgSScKf1Ovw==} + /@esbuild/darwin-x64@0.18.14: + resolution: {integrity: sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -442,8 +442,8 @@ packages: dev: false optional: true - /@esbuild/freebsd-arm64@0.18.13: - resolution: {integrity: sha512-AfRPhHWmj9jGyLgW/2FkYERKmYR+IjYxf2rtSLmhOrPGFh0KCETFzSjx/JX/HJnvIqHt/DRQD/KAaVsUKoI3Xg==} + /@esbuild/freebsd-arm64@0.18.14: + resolution: {integrity: sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -460,8 +460,8 @@ packages: dev: false optional: true - /@esbuild/freebsd-x64@0.18.13: - resolution: {integrity: sha512-pGzWWZJBInhIgdEwzn8VHUBang8UvFKsvjDkeJ2oyY5gZtAM6BaxK0QLCuZY+qoj/nx/lIaItH425rm/hloETA==} + /@esbuild/freebsd-x64@0.18.14: + resolution: {integrity: sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -478,8 +478,8 @@ packages: dev: false optional: true - /@esbuild/linux-arm64@0.18.13: - resolution: {integrity: sha512-hCzZbVJEHV7QM77fHPv2qgBcWxgglGFGCxk6KfQx6PsVIdi1u09X7IvgE9QKqm38OpkzaAkPnnPqwRsltvLkIQ==} + /@esbuild/linux-arm64@0.18.14: + resolution: {integrity: sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -496,8 +496,8 @@ packages: dev: false optional: true - /@esbuild/linux-arm@0.18.13: - resolution: {integrity: sha512-4iMxLRMCxGyk7lEvkkvrxw4aJeC93YIIrfbBlUJ062kilUUnAiMb81eEkVvCVoh3ON283ans7+OQkuy1uHW+Hw==} + /@esbuild/linux-arm@0.18.14: + resolution: {integrity: sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -514,8 +514,8 @@ packages: dev: false optional: true - /@esbuild/linux-ia32@0.18.13: - resolution: {integrity: sha512-I3OKGbynl3AAIO6onXNrup/ttToE6Rv2XYfFgLK/wnr2J+1g+7k4asLrE+n7VMhaqX+BUnyWkCu27rl+62Adug==} + /@esbuild/linux-ia32@0.18.14: + resolution: {integrity: sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -532,8 +532,8 @@ packages: dev: false optional: true - /@esbuild/linux-loong64@0.18.13: - resolution: {integrity: sha512-8pcKDApAsKc6WW51ZEVidSGwGbebYw2qKnO1VyD8xd6JN0RN6EUXfhXmDk9Vc4/U3Y4AoFTexQewQDJGsBXBpg==} + /@esbuild/linux-loong64@0.18.14: + resolution: {integrity: sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -550,8 +550,8 @@ packages: dev: false optional: true - /@esbuild/linux-mips64el@0.18.13: - resolution: {integrity: sha512-6GU+J1PLiVqWx8yoCK4Z0GnfKyCGIH5L2KQipxOtbNPBs+qNDcMJr9euxnyJ6FkRPyMwaSkjejzPSISD9hb+gg==} + /@esbuild/linux-mips64el@0.18.14: + resolution: {integrity: sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -568,8 +568,8 @@ packages: dev: false optional: true - /@esbuild/linux-ppc64@0.18.13: - resolution: {integrity: sha512-pfn/OGZ8tyR8YCV7MlLl5hAit2cmS+j/ZZg9DdH0uxdCoJpV7+5DbuXrR+es4ayRVKIcfS9TTMCs60vqQDmh+w==} + /@esbuild/linux-ppc64@0.18.14: + resolution: {integrity: sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -586,8 +586,8 @@ packages: dev: false optional: true - /@esbuild/linux-riscv64@0.18.13: - resolution: {integrity: sha512-aIbhU3LPg0lOSCfVeGHbmGYIqOtW6+yzO+Nfv57YblEK01oj0mFMtvDJlOaeAZ6z0FZ9D13oahi5aIl9JFphGg==} + /@esbuild/linux-riscv64@0.18.14: + resolution: {integrity: sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -604,8 +604,8 @@ packages: dev: false optional: true - /@esbuild/linux-s390x@0.18.13: - resolution: {integrity: sha512-Pct1QwF2sp+5LVi4Iu5Y+6JsGaV2Z2vm4O9Dd7XZ5tKYxEHjFtb140fiMcl5HM1iuv6xXO8O1Vrb1iJxHlv8UA==} + /@esbuild/linux-s390x@0.18.14: + resolution: {integrity: sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -622,8 +622,8 @@ packages: dev: false optional: true - /@esbuild/linux-x64@0.18.13: - resolution: {integrity: sha512-zTrIP0KzYP7O0+3ZnmzvUKgGtUvf4+piY8PIO3V8/GfmVd3ZyHJGz7Ht0np3P1wz+I8qJ4rjwJKqqEAbIEPngA==} + /@esbuild/linux-x64@0.18.14: + resolution: {integrity: sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -640,8 +640,8 @@ packages: dev: false optional: true - /@esbuild/netbsd-x64@0.18.13: - resolution: {integrity: sha512-I6zs10TZeaHDYoGxENuksxE1sxqZpCp+agYeW039yqFwh3MgVvdmXL5NMveImOC6AtpLvE4xG5ujVic4NWFIDQ==} + /@esbuild/netbsd-x64@0.18.14: + resolution: {integrity: sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -658,8 +658,8 @@ packages: dev: false optional: true - /@esbuild/openbsd-x64@0.18.13: - resolution: {integrity: sha512-W5C5nczhrt1y1xPG5bV+0M12p2vetOGlvs43LH8SopQ3z2AseIROu09VgRqydx5qFN7y9qCbpgHLx0kb0TcW7g==} + /@esbuild/openbsd-x64@0.18.14: + resolution: {integrity: sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -676,8 +676,8 @@ packages: dev: false optional: true - /@esbuild/sunos-x64@0.18.13: - resolution: {integrity: sha512-X/xzuw4Hzpo/yq3YsfBbIsipNgmsm8mE/QeWbdGdTTeZ77fjxI2K0KP3AlhZ6gU3zKTw1bKoZTuKLnqcJ537qw==} + /@esbuild/sunos-x64@0.18.14: + resolution: {integrity: sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -694,8 +694,8 @@ packages: dev: false optional: true - /@esbuild/win32-arm64@0.18.13: - resolution: {integrity: sha512-4CGYdRQT/ILd+yLLE5i4VApMPfGE0RPc/wFQhlluDQCK09+b4JDbxzzjpgQqTPrdnP7r5KUtGVGZYclYiPuHrw==} + /@esbuild/win32-arm64@0.18.14: + resolution: {integrity: sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -712,8 +712,8 @@ packages: dev: false optional: true - /@esbuild/win32-ia32@0.18.13: - resolution: {integrity: sha512-D+wKZaRhQI+MUGMH+DbEr4owC2D7XnF+uyGiZk38QbgzLcofFqIOwFs7ELmIeU45CQgfHNy9Q+LKW3cE8g37Kg==} + /@esbuild/win32-ia32@0.18.14: + resolution: {integrity: sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -730,8 +730,8 @@ packages: dev: false optional: true - /@esbuild/win32-x64@0.18.13: - resolution: {integrity: sha512-iVl6lehAfJS+VmpF3exKpNQ8b0eucf5VWfzR8S7xFve64NBNz2jPUgx1X93/kfnkfgP737O+i1k54SVQS7uVZA==} + /@esbuild/win32-x64@0.18.14: + resolution: {integrity: sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -885,6 +885,12 @@ packages: '@noble/hashes': 1.3.0 dev: false + /@noble/curves@1.1.0: + resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==} + dependencies: + '@noble/hashes': 1.3.1 + dev: false + /@noble/hashes@1.3.0: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} dev: false @@ -938,7 +944,7 @@ packages: eventemitter3: 5.0.1 light-bolt11-decoder: 3.0.0 node-fetch: 3.3.1 - nostr-tools: 1.12.1 + nostr-tools: 1.13.0 tsd: 0.28.1 utf8-buffer: 1.0.0 websocket-polyfill: 0.0.3 @@ -949,7 +955,7 @@ packages: - typescript dev: false - /@nostr-fetch/adapter-ndk@0.11.0(@nostr-dev-kit/ndk@0.7.7)(nostr-fetch@0.11.0): + /@nostr-fetch/adapter-ndk@0.11.0(@nostr-dev-kit/ndk@0.7.7)(nostr-fetch@0.12.1): resolution: {integrity: sha512-Otl7SEzm9ecqyHB10bpYXBu1qpqJEnipp7dZ4qcA9LeJAtM38fnYKUD34HX0JXA9EDjtc6VS5UNZe544xC9GCg==} peerDependencies: '@nostr-dev-kit/ndk': ^0.5.0 @@ -957,7 +963,7 @@ packages: dependencies: '@nostr-dev-kit/ndk': 0.7.7(typescript@4.9.5) '@nostr-fetch/kernel': 0.11.0 - nostr-fetch: 0.11.0 + nostr-fetch: 0.12.1 dev: false /@nostr-fetch/kernel@0.11.0: @@ -967,6 +973,13 @@ packages: '@noble/secp256k1': 1.7.1 dev: false + /@nostr-fetch/kernel@0.12.1: + resolution: {integrity: sha512-c5Dm7K2o+Th2HQWd2whme2L/5+Gw9Vk7FMDSpJlUbM2QZLvFhsi7npFf940CRwPwgpiy8fmYchcYGz5pyN7l6Q==} + dependencies: + '@noble/curves': 1.1.0 + '@noble/hashes': 1.3.1 + dev: false + /@npmcli/fs@3.1.0: resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -1404,8 +1417,8 @@ packages: '@babel/runtime': 7.22.6 dev: false - /@remix-run/router@1.7.1: - resolution: {integrity: sha512-bgVQM4ZJ2u2CM8k1ey70o1ePFXsEzYVZoWghh6WjM8p59jQ7HxzbHW4SbnWFG7V9ig9chLawQxDTZ3xzOF8MkQ==} + /@remix-run/router@1.7.2: + resolution: {integrity: sha512-7Lcn7IqGMV+vizMPoEl5F0XDshcdDYtMI6uJLQdQz5CfZAwy3vvGKYSUk789qndt5dEC4HfSjviSYlSoHGL2+A==} engines: {node: '>=14'} dev: false @@ -1588,7 +1601,7 @@ packages: '@tanstack/react-query': 4.29.25(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - superjson: 1.12.4 + superjson: 1.13.1 use-sync-external-store: 1.2.0(react@18.2.0) dev: false @@ -2260,7 +2273,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001516 - electron-to-chromium: 1.4.461 + electron-to-chromium: 1.4.463 node-releases: 2.0.13 update-browserslist-db: 1.0.11(browserslist@4.21.9) dev: true @@ -2722,8 +2735,8 @@ packages: /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - /electron-to-chromium@1.4.461: - resolution: {integrity: sha512-1JkvV2sgEGTDXjdsaQCeSwYYuhLRphRpc+g6EHTFELJXEiznLt3/0pZ9JuAOQ5p2rI3YxKTbivtvajirIfhrEQ==} + /electron-to-chromium@1.4.463: + resolution: {integrity: sha512-fT3hvdUWLjDbaTGzyOjng/CQhQJSQP8ThO3XZAoaxHvHo2kUXiRQVMj9M235l8uDFiNPsPa6KHT1p3RaR6ugRw==} dev: true /emoji-regex@8.0.0: @@ -2783,7 +2796,7 @@ packages: is-regex: 1.1.4 is-shared-array-buffer: 1.0.2 is-string: 1.0.7 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 is-weakref: 1.0.2 object-inspect: 1.12.3 object-keys: 1.1.1 @@ -2799,7 +2812,7 @@ packages: typed-array-byte-offset: 1.0.0 typed-array-length: 1.0.4 unbox-primitive: 1.0.2 - which-typed-array: 1.1.10 + which-typed-array: 1.1.11 /es-set-tostringtag@2.0.1: resolution: {integrity: sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==} @@ -2881,34 +2894,34 @@ packages: '@esbuild/win32-x64': 0.17.19 dev: false - /esbuild@0.18.13: - resolution: {integrity: sha512-vhg/WR/Oiu4oUIkVhmfcc23G6/zWuEQKFS+yiosSHe4aN6+DQRXIfeloYGibIfVhkr4wyfuVsGNLr+sQU1rWWw==} + /esbuild@0.18.14: + resolution: {integrity: sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.13 - '@esbuild/android-arm64': 0.18.13 - '@esbuild/android-x64': 0.18.13 - '@esbuild/darwin-arm64': 0.18.13 - '@esbuild/darwin-x64': 0.18.13 - '@esbuild/freebsd-arm64': 0.18.13 - '@esbuild/freebsd-x64': 0.18.13 - '@esbuild/linux-arm': 0.18.13 - '@esbuild/linux-arm64': 0.18.13 - '@esbuild/linux-ia32': 0.18.13 - '@esbuild/linux-loong64': 0.18.13 - '@esbuild/linux-mips64el': 0.18.13 - '@esbuild/linux-ppc64': 0.18.13 - '@esbuild/linux-riscv64': 0.18.13 - '@esbuild/linux-s390x': 0.18.13 - '@esbuild/linux-x64': 0.18.13 - '@esbuild/netbsd-x64': 0.18.13 - '@esbuild/openbsd-x64': 0.18.13 - '@esbuild/sunos-x64': 0.18.13 - '@esbuild/win32-arm64': 0.18.13 - '@esbuild/win32-ia32': 0.18.13 - '@esbuild/win32-x64': 0.18.13 + '@esbuild/android-arm': 0.18.14 + '@esbuild/android-arm64': 0.18.14 + '@esbuild/android-x64': 0.18.14 + '@esbuild/darwin-arm64': 0.18.14 + '@esbuild/darwin-x64': 0.18.14 + '@esbuild/freebsd-arm64': 0.18.14 + '@esbuild/freebsd-x64': 0.18.14 + '@esbuild/linux-arm': 0.18.14 + '@esbuild/linux-arm64': 0.18.14 + '@esbuild/linux-ia32': 0.18.14 + '@esbuild/linux-loong64': 0.18.14 + '@esbuild/linux-mips64el': 0.18.14 + '@esbuild/linux-ppc64': 0.18.14 + '@esbuild/linux-riscv64': 0.18.14 + '@esbuild/linux-s390x': 0.18.14 + '@esbuild/linux-x64': 0.18.14 + '@esbuild/netbsd-x64': 0.18.14 + '@esbuild/openbsd-x64': 0.18.14 + '@esbuild/sunos-x64': 0.18.14 + '@esbuild/win32-arm64': 0.18.14 + '@esbuild/win32-ia32': 0.18.14 + '@esbuild/win32-x64': 0.18.14 dev: true /escalade@3.1.1: @@ -3314,8 +3327,8 @@ packages: resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} dev: true - /framer-motion@10.12.21(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-EmnP73O5+1OGm2jtQNoBPPuAJvhySl+p4/9PL7PPJHt58nkPWeFaxhCJaUDXDf6N3jSLluefxopc0FrMCQ+/tQ==} + /framer-motion@10.12.22(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-bBGYPOxvxcfzS7/py9MEqDucmXBkVl2g42HNlXXPieSTSGGkr8L7+MilCnrU6uX3HrNk/tcB++1SkWE8BosHFw==} peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 @@ -3706,7 +3719,7 @@ packages: dependencies: call-bind: 1.0.2 get-intrinsic: 1.2.1 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -3840,15 +3853,11 @@ packages: dependencies: has-symbols: 1.0.3 - /is-typed-array@1.1.10: - resolution: {integrity: sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==} + /is-typed-array@1.1.12: + resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} engines: {node: '>= 0.4'} dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.2 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 + which-typed-array: 1.1.11 /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} @@ -4822,14 +4831,14 @@ packages: engines: {node: '>=12.20'} dev: false - /nostr-fetch@0.11.0: - resolution: {integrity: sha512-l4GNnS7y4Zc58ROF43uiMPvPVVB8x/hAFqzJpEEqO0IQFQNZ90t6jQIzqPQfy8tFdaPN/n89uaY7KZbNQ7HJsQ==} + /nostr-fetch@0.12.1: + resolution: {integrity: sha512-InQ4xLlFZAtofrFDLawXwkU+hOXm/FckUCAOy9snduY+aexSlklmuyuvCWG1yOuQXG9e+vIBaq8Q9SZdw/s1ZA==} dependencies: - '@nostr-fetch/kernel': 0.11.0 + '@nostr-fetch/kernel': 0.12.1 dev: false - /nostr-tools@1.12.1: - resolution: {integrity: sha512-ZeoV7g3jBUAlb4mKa3C+6hrc84htPkbebMShfGNgV4vAiz18e/sQukUBFL6vb/+sxZy+dBQFkRwsJIaVFs8Gfw==} + /nostr-tools@1.13.0: + resolution: {integrity: sha512-Yj2DfPIcyim6jpnB49s1+yOfSTLwulce2lIr3GkSK5PVDKTyPuOQJCdEb423n3kGDS++7ScWdNPjtSu2mel3aA==} dependencies: '@noble/curves': 1.0.0 '@noble/hashes': 1.3.0 @@ -5334,8 +5343,8 @@ packages: resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==} dev: false - /react-hook-form@7.45.1(react@18.2.0): - resolution: {integrity: sha512-6dWoFJwycbuFfw/iKMcl+RdAOAOHDiF11KWYhNDRN/OkUt+Di5qsZHwA0OwsVnu9y135gkHpTw9DJA+WzCeR9w==} + /react-hook-form@7.45.2(react@18.2.0): + resolution: {integrity: sha512-9s45OdTaKN+4NSTbXVqeDITd/nwIg++nxJGL8+OD5uf1DxvhsXQ641kaYHk5K28cpIOTYm71O/fYk7rFaygb3A==} engines: {node: '>=12.22.0'} peerDependencies: react: ^16.8.0 || ^17 || ^18 @@ -5435,26 +5444,26 @@ packages: use-sidecar: 1.1.2(@types/react@18.2.15)(react@18.2.0) dev: false - /react-router-dom@6.14.1(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-ssF6M5UkQjHK70fgukCJyjlda0Dgono2QGwqGvuk7D+EDGHdacEN3Yke2LTMjkrpHuFwBfDFsEjGVXBDmL+bWw==} + /react-router-dom@6.14.2(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-5pWX0jdKR48XFZBuJqHosX3AAHjRAzygouMTyimnBPOLdY3WjzUSKhus2FVMihUFWzeLebDgr4r8UeQFAct7Bg==} engines: {node: '>=14'} peerDependencies: react: '>=16.8' react-dom: '>=16.8' dependencies: - '@remix-run/router': 1.7.1 + '@remix-run/router': 1.7.2 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - react-router: 6.14.1(react@18.2.0) + react-router: 6.14.2(react@18.2.0) dev: false - /react-router@6.14.1(react@18.2.0): - resolution: {integrity: sha512-U4PfgvG55LdvbQjg5Y9QRWyVxIdO1LlpYT7x+tMAxd9/vmiPuJhIwdxZuIQLN/9e3O4KFDHYfR9gzGeYMasW8g==} + /react-router@6.14.2(react@18.2.0): + resolution: {integrity: sha512-09Zss2dE2z+T1D03IheqAFtK4UzQyX8nFPWx6jkwdYzGLXd5ie06A6ezS2fO6zJfEb/SpG6UocN2O1hfD+2urQ==} engines: {node: '>=14'} peerDependencies: react: '>=16.8' dependencies: - '@remix-run/router': 1.7.1 + '@remix-run/router': 1.7.2 react: 18.2.0 dev: false @@ -5480,8 +5489,8 @@ packages: tslib: 2.6.0 dev: false - /react-virtuoso@4.4.0(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-7hVk43DN9Sx6czpclTpPnB2uzDmCaioSoTSN8lRv4mMF7UL5jmfc58UpjRrGoJavzVn1VBjHLLj6RHBLsS+N5Q==} + /react-virtuoso@4.4.1(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-QrZ0JLnZFH8ltMw6q+S7U1+V2vUcSHzoIfLRzQKSv4nMJhEdjiZ+e9PqWCI7xJiy2AmSCAgo7g1V5osuurJo2Q==} engines: {node: '>=10'} peerDependencies: react: '>=16 || >=17 || >= 18' @@ -5649,8 +5658,8 @@ packages: dependencies: glob: 7.2.3 - /rollup@3.26.2: - resolution: {integrity: sha512-6umBIGVz93er97pMgQO08LuH3m6PUb3jlDUUGFsNJB6VgTCUaDFpupf5JfU30529m/UKOgmiX+uY6Sx8cOYpLA==} + /rollup@3.26.3: + resolution: {integrity: sha512-7Tin0C8l86TkpcMtXvQu6saWH93nhG3dGQ1/+l5V2TDMceTxO7kDiK6GzbfLWNNxqJXm591PcEZUozZm51ogwQ==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -6030,8 +6039,8 @@ packages: ts-interface-checker: 0.1.13 dev: true - /superjson@1.12.4: - resolution: {integrity: sha512-vkpPQAxdCg9SLfPv5GPC5fnGrui/WryktoN9O5+Zif/14QIMjw+RITf/5LbBh+9QpBFb3KNvJth+puz2H8o6GQ==} + /superjson@1.13.1: + resolution: {integrity: sha512-AVH2eknm9DEd3qvxM4Sq+LTCkSXE2ssfh1t11MHMXyYXFQyQ1HLgVvV+guLTsaQnJU3gnaVo34TohHPulY/wLg==} engines: {node: '>=10'} dependencies: copy-anything: 3.0.5 @@ -6267,7 +6276,7 @@ packages: dependencies: call-bind: 1.0.2 get-intrinsic: 1.2.1 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 /typed-array-byte-length@1.0.0: resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} @@ -6276,7 +6285,7 @@ packages: call-bind: 1.0.2 for-each: 0.3.3 has-proto: 1.0.1 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 /typed-array-byte-offset@1.0.0: resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} @@ -6286,14 +6295,14 @@ packages: call-bind: 1.0.2 for-each: 0.3.3 has-proto: 1.0.1 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 /typed-array-length@1.0.4: resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} dependencies: call-bind: 1.0.2 for-each: 0.3.3 - is-typed-array: 1.1.10 + is-typed-array: 1.1.12 /typedarray-to-buffer@3.1.5: resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} @@ -6567,9 +6576,9 @@ packages: optional: true dependencies: '@types/node': 18.16.19 - esbuild: 0.18.13 + esbuild: 0.18.14 postcss: 8.4.26 - rollup: 3.26.2 + rollup: 3.26.3 optionalDependencies: fsevents: 2.3.2 dev: true @@ -6611,8 +6620,8 @@ packages: is-string: 1.0.7 is-symbol: 1.0.4 - /which-typed-array@1.1.10: - resolution: {integrity: sha512-uxoA5vLUfRPdjCuJ1h5LlYdmTLbYfums398v3WLkM+i/Wltl2/XyZpQWKbN++ck5L64SR/grOHqtXCUKmlZPNA==} + /which-typed-array@1.1.11: + resolution: {integrity: sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==} engines: {node: '>= 0.4'} dependencies: available-typed-arrays: 1.0.5 @@ -6620,7 +6629,6 @@ packages: for-each: 0.3.3 gopd: 1.0.1 has-tostringtag: 1.0.0 - is-typed-array: 1.1.10 /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} diff --git a/src-tauri/migrations/20230718072634_clean_up_old_tables.sql b/src-tauri/migrations/20230718072634_clean_up_old_tables.sql new file mode 100644 index 00000000..707d2f9c --- /dev/null +++ b/src-tauri/migrations/20230718072634_clean_up_old_tables.sql @@ -0,0 +1,6 @@ +-- Add migration script here +DROP TABLE IF EXISTS blacklist; + +DROP TABLE IF EXISTS channel_messages; + +DROP TABLE IF EXISTS channels; \ No newline at end of file diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f8a53515..b1ce70de 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -107,6 +107,12 @@ fn main() { sql: include_str!("../migrations/20230619082415_add_replies.sql"), kind: MigrationKind::Up, }, + Migration { + version: 20230718072634, + description: "clean up", + sql: include_str!("../migrations/20230718072634_clean_up_old_tables.sql"), + kind: MigrationKind::Up, + }, ], ) .build(), diff --git a/src/app/user/components/feed.tsx b/src/app/user/components/feed.tsx index fb9da7cf..49e47b4f 100644 --- a/src/app/user/components/feed.tsx +++ b/src/app/user/components/feed.tsx @@ -1,4 +1,4 @@ -import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; +import { useQuery } from '@tanstack/react-query'; import { useVirtualizer } from '@tanstack/react-virtual'; import { useRef } from 'react'; diff --git a/src/libs/ndk/instance.ts b/src/libs/ndk/instance.ts index c66f3e12..d73572ad 100644 --- a/src/libs/ndk/instance.ts +++ b/src/libs/ndk/instance.ts @@ -1,13 +1,13 @@ // source: https://github.com/nostr-dev-kit/ndk-react/ import NDK from '@nostr-dev-kit/ndk'; import { ndkAdapter } from '@nostr-fetch/adapter-ndk'; -import { NostrFetcher, normalizeRelayUrls } from 'nostr-fetch'; +import { NostrFetcher, normalizeRelayUrlSet } from 'nostr-fetch'; import { useEffect, useState } from 'react'; import { getSetting } from '@libs/storage'; const setting = await getSetting('relays'); -const relays = normalizeRelayUrls(JSON.parse(setting)); +const relays = normalizeRelayUrlSet(JSON.parse(setting)); export const NDKInstance = () => { const [ndk, setNDK] = useState(undefined); diff --git a/src/libs/storage.tsx b/src/libs/storage.tsx index 61369494..57e2a8dd 100644 --- a/src/libs/storage.tsx +++ b/src/libs/storage.tsx @@ -2,7 +2,7 @@ import destr from 'destr'; import Database from 'tauri-plugin-sql-api'; import { getParentID } from '@utils/transform'; -import { Account, Block, Chats, LumeEvent } from '@utils/types'; +import { Account, Block, Chats, LumeEvent, Settings } from '@utils/types'; let db: null | Database = null; @@ -84,7 +84,7 @@ export async function countTotalChannels() { // count total notes export async function countTotalNotes() { const db = await connect(); - const result = await db.select( + const result: Array<{ total: string }> = await db.select( 'SELECT COUNT(*) AS "total" FROM notes WHERE kind IN (1, 6);' ); return parseInt(result[0].total); @@ -198,7 +198,7 @@ export async function createReplyNote( event_id: string, pubkey: string, kind: number, - tags: any, + tags: string[][], content: string, created_at: number ) { @@ -328,7 +328,7 @@ export async function getChatMessages(receiver_pubkey: string, sender_pubkey: st const db = await connect(); let receiver = []; - const sender: any = await db.select( + const sender: Array = await db.select( `SELECT * FROM chats WHERE sender_pubkey = "${sender_pubkey}" AND receiver_pubkey = "${receiver_pubkey}";` ); @@ -365,7 +365,9 @@ export async function createChat( // get setting export async function getSetting(key: string) { const db = await connect(); - const result = await db.select(`SELECT value FROM settings WHERE key = "${key}";`); + const result: Array = await db.select( + `SELECT value FROM settings WHERE key = "${key}";` + ); return result[0]?.value; } @@ -378,7 +380,9 @@ export async function updateSetting(key: string, value: string | number) { // get last login export async function getLastLogin() { const db = await connect(); - const result = await db.select(`SELECT value FROM settings WHERE key = "last_login";`); + const result: Array = await db.select( + `SELECT value FROM settings WHERE key = "last_login";` + ); if (result[0]) { return parseInt(result[0].value); } else { @@ -394,44 +398,6 @@ export async function updateLastLogin(value: number) { ); } -// get blacklist by kind and account id -export async function getBlacklist(account_id: number, kind: number) { - const db = await connect(); - return await db.select( - `SELECT * FROM blacklist WHERE account_id = "${account_id}" AND kind = "${kind}";` - ); -} - -// get active blacklist by kind and account id -export async function getActiveBlacklist(account_id: number, kind: number) { - const db = await connect(); - return await db.select( - `SELECT content FROM blacklist WHERE account_id = "${account_id}" AND kind = "${kind}" AND status = 1;` - ); -} - -// add to blacklist -export async function addToBlacklist( - account_id: number, - content: string, - kind: number, - status?: number -) { - const db = await connect(); - return await db.execute( - 'INSERT OR IGNORE INTO blacklist (account_id, content, kind, status) VALUES (?, ?, ?, ?);', - [account_id, content, kind, status || 1] - ); -} - -// update item in blacklist -export async function updateItemInBlacklist(content: string, status: number) { - const db = await connect(); - return await db.execute( - `UPDATE blacklist SET status = "${status}" WHERE content = "${content}";` - ); -} - // get all blocks export async function getBlocks() { const db = await connect(); diff --git a/src/utils/types.d.ts b/src/utils/types.d.ts index 17ff140c..f5b2b7ba 100644 --- a/src/utils/types.d.ts +++ b/src/utils/types.d.ts @@ -32,3 +32,9 @@ export interface Chats { created_at: number; new_messages: number; } + +export interface Settings { + id: string; + key: string; + value: string; +}