From 42ae2963d7a27fe9052678586c095d12aea21d5e Mon Sep 17 00:00:00 2001 From: "Weblate (bot)" Date: Mon, 29 Apr 2024 10:02:01 +0200 Subject: [PATCH 1/8] Translations update from Hosted Weblate (#3126) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Translated using Weblate (Portuguese (Brazil)) Currently translated at 78.5% (607 of 773 strings) Co-authored-by: Hosted Weblate Co-authored-by: Leonardo Translate-URL: https://hosted.weblate.org/projects/getalby-lightning-browser-extension/getalby-lightning-browser-extension/pt_BR/ Translation: getAlby - lightning-browser-extension/getAlby - lightning-browser-extension * Translated using Weblate (German) Currently translated at 100.0% (773 of 773 strings) Co-authored-by: BSN ∞/21M ₿ Co-authored-by: Hosted Weblate Translate-URL: https://hosted.weblate.org/projects/getalby-lightning-browser-extension/getalby-lightning-browser-extension/de/ Translation: getAlby - lightning-browser-extension/getAlby - lightning-browser-extension * Translated using Weblate (Chinese (Simplified)) Currently translated at 67.0% (518 of 773 strings) Co-authored-by: ra5pvt1n Translate-URL: https://hosted.weblate.org/projects/getalby-lightning-browser-extension/getalby-lightning-browser-extension/zh_Hans/ Translation: getAlby - lightning-browser-extension/getAlby - lightning-browser-extension --------- Co-authored-by: Leonardo Co-authored-by: BSN ∞/21M ₿ Co-authored-by: ra5pvt1n --- src/i18n/locales/de/translation.json | 7 +++++-- src/i18n/locales/pt_BR/translation.json | 7 +++++-- src/i18n/locales/zh_Hans/translation.json | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json index 0303ad8926..40d4604ef1 100644 --- a/src/i18n/locales/de/translation.json +++ b/src/i18n/locales/de/translation.json @@ -1092,7 +1092,8 @@ "edit_allowance": { "title": "Seiten Einstellung", "screen_reader": "Zulässigkeitsoptionen", - "always_allow": "Immer erlauben" + "always_allow": "Immer erlauben", + "always_reject": "Immer ablehnen" }, "enable_login": { "title": "Anmeldung auf der Webseite aktivieren", @@ -1211,7 +1212,9 @@ "disconnect": "Verbindung trennen", "copied_to_clipboard": "In die Zwischenablage kopiert", "hide": "Ausblenden", - "finish": "Oberfläche" + "finish": "Oberfläche", + "deny": "Verweigern", + "sign": "Unterschrift" }, "discover": "Apps entdecken", "errors": { diff --git a/src/i18n/locales/pt_BR/translation.json b/src/i18n/locales/pt_BR/translation.json index 58cb0b1092..f909c07a47 100644 --- a/src/i18n/locales/pt_BR/translation.json +++ b/src/i18n/locales/pt_BR/translation.json @@ -969,7 +969,9 @@ "copied_to_clipboard": "Copiado para a área de transferência", "review": "Revisar", "hide": "Ocultar", - "finish": "Pronto" + "finish": "Pronto", + "sign": "Assinar", + "deny": "Negar" }, "errors": { "connection_failed": "Falha na conexão", @@ -1031,7 +1033,8 @@ "edit_allowance": { "title": "Preferências", "screen_reader": "Opções limite de gastos", - "always_allow": "Sempre permitir" + "always_allow": "Sempre permitir", + "always_reject": "Sempre rejeitar" }, "enable_login": { "title": "Login", diff --git a/src/i18n/locales/zh_Hans/translation.json b/src/i18n/locales/zh_Hans/translation.json index d58a20480f..23995b90bc 100644 --- a/src/i18n/locales/zh_Hans/translation.json +++ b/src/i18n/locales/zh_Hans/translation.json @@ -12,7 +12,8 @@ "enter_password": "请输入密码。", "confirm_password": "请确认你的密码。", "mismatched_password": "密码不匹配。" - } + }, + "title": "设置解锁密码" }, "test_connection": { "ready": "真棒,你已准备就绪!", From 4c867c06f0cea478a4e4eeed3813f768401f8c24 Mon Sep 17 00:00:00 2001 From: Pavan Joshi <55848322+pavanjoshi914@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:32:39 +0530 Subject: [PATCH 2/8] feat: add custom records in outgoing payments (#3106) --- src/extension/background-script/connectors/lndhub.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extension/background-script/connectors/lndhub.ts b/src/extension/background-script/connectors/lndhub.ts index 9d2da17f9e..7aedc7deaf 100644 --- a/src/extension/background-script/connectors/lndhub.ts +++ b/src/extension/background-script/connectors/lndhub.ts @@ -171,6 +171,7 @@ export default class LndHub implements Connector { (transaction, index): ConnectorTransaction => ({ id: `${index}`, memo: transaction.memo, + custom_records: transaction.custom_records, preimage: transaction.payment_preimage, payment_hash: Buffer.from(transaction.payment_hash.data).toString( "hex" From 9c4af462cfb7100325f6cac8d514aebaf95a4248 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:17:26 +0000 Subject: [PATCH 3/8] Update dexie to version 3.2.7 (#3121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: René Aaron <100827540+reneaaron@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b1d5a1c676..10f080c750 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "bolt11": "^1.4.1", "crypto-js": "^4.2.0", "dayjs": "^1.11.10", - "dexie": "^3.2.6", + "dexie": "^3.2.7", "elliptic": "^6.5.4", "events": "^3.3.0", "html5-qrcode": "^2.3.8", diff --git a/yarn.lock b/yarn.lock index f8c595827f..360039eb65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3960,12 +3960,10 @@ devtools-protocol@0.0.1191157: resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1191157.tgz#2a3e4d95b3fdb8696ab8c486e34d76519eb8715a" integrity sha512-Fu2mUhX7zkzLHMJZk5wQTiHdl1eJrhK0GypUoSzogUt51MmYEv/46pCz4PtGGFlr0f2ZyYDzzx5CPtbEkuvcTA== -dexie@^3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/dexie/-/dexie-3.2.6.tgz#c5980e4228d7e81744bb324c81459afa6604da41" - integrity sha512-R9VzQ27/cncQymoAeD1kfu66NUrdxcnMNXVfEoFLnQ+apVVbS4++veUcSGxft9V++zaeiLkMAREOMf8EwgR/Vw== - dependencies: - karma-safari-launcher "^1.0.0" +dexie@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/dexie/-/dexie-3.2.7.tgz#1346541c9c81e3bc6055a042a928837890595e3a" + integrity sha512-2a+BXvVhY5op+smDRLxeBAivE7YcYaneXJ1la3HOkUfX9zKkE/AJ8CNgjiXbtXepFyFmJNGSbmjOwqbT749r/w== didyoumean@^1.2.2: version "1.2.2" @@ -6555,11 +6553,6 @@ jsonparse@^1.2.0: array-includes "^3.1.2" object.assign "^4.1.2" -karma-safari-launcher@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/karma-safari-launcher/-/karma-safari-launcher-1.0.0.tgz#96982a2cc47d066aae71c553babb28319115a2ce" - integrity sha512-qmypLWd6F2qrDJfAETvXDfxHvKDk+nyIjpH9xIeI3/hENr0U3nuqkxaftq73PfXZ4aOuOChA6SnLW4m4AxfRjQ== - kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" From 69e9d66d25f8df88ff68fd1ba7d7beed0bf86dc8 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:43:14 +0200 Subject: [PATCH 4/8] Update react-router-dom to version 6.22.3 (#3120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: René Aaron <100827540+reneaaron@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 10f080c750..6eacaa128e 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "react-loading-skeleton": "^3.3.1", "react-modal": "^3.16.1", "react-qr-code": "^2.0.12", - "react-router-dom": "^6.22.2", + "react-router-dom": "^6.22.3", "slip77": "^0.2.0", "stream": "^0.0.2", "tailwindcss": "^3.4.1", diff --git a/yarn.lock b/yarn.lock index 360039eb65..2747a87b7a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1177,10 +1177,10 @@ unbzip2-stream "1.4.3" yargs "17.7.2" -"@remix-run/router@1.15.2": - version "1.15.2" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.15.2.tgz#35726510d332ba5349c6398d13259d5da184553d" - integrity sha512-+Rnav+CaoTE5QJc4Jcwh5toUpnVLKYbpU6Ys0zqbakqbaLQHeglLVHPfxOiQqdNmUy5C2lXz5dwC6tQNX2JW2Q== +"@remix-run/router@1.15.3": + version "1.15.3" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.15.3.tgz#d2509048d69dbb72d5389a14945339f1430b2d3c" + integrity sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w== "@scure/base@1.1.1", "@scure/base@~1.1.0": version "1.1.1" @@ -8329,20 +8329,20 @@ react-qr-code@^2.0.12: prop-types "^15.8.1" qr.js "0.0.0" -react-router-dom@^6.22.2: - version "6.22.2" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.22.2.tgz#8233968a8a576f3006e5549c80f3527d2598fc9c" - integrity sha512-WgqxD2qySEIBPZ3w0sHH+PUAiamDeszls9tzqMPBDA1YYVucTBXLU7+gtRfcSnhe92A3glPnvSxK2dhNoAVOIQ== +react-router-dom@^6.22.3: + version "6.22.3" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.22.3.tgz#9781415667fd1361a475146c5826d9f16752a691" + integrity sha512-7ZILI7HjcE+p31oQvwbokjk6OA/bnFxrhJ19n82Ex9Ph8fNAq+Hm/7KchpMGlTgWhUxRHMMCut+vEtNpWpowKw== dependencies: - "@remix-run/router" "1.15.2" - react-router "6.22.2" + "@remix-run/router" "1.15.3" + react-router "6.22.3" -react-router@6.22.2: - version "6.22.2" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.22.2.tgz#27e77e4c635a5697693b922d131d773451c98a5b" - integrity sha512-YD3Dzprzpcq+tBMHBS822tCjnWD3iIZbTeSXMY9LPSG541EfoBGyZ3bS25KEnaZjLcmQpw2AVLkFyfgXY8uvcw== +react-router@6.22.3: + version "6.22.3" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.22.3.tgz#9d9142f35e08be08c736a2082db5f0c9540a885e" + integrity sha512-dr2eb3Mj5zK2YISHK++foM9w4eBnO23eKnZEDs7c880P6oKbrjz/Svg9+nxqtHQK+oMW4OtjZca0RqPglXxguQ== dependencies: - "@remix-run/router" "1.15.2" + "@remix-run/router" "1.15.3" react@^18.2.0: version "18.2.0" From 3cbb3be9a2e7ade887f32a6ddbd7e57bf8016fee Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:01:19 +0200 Subject: [PATCH 5/8] Update tailwindcss to version 3.4.3 (#3135) Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 6eacaa128e..cbd2e11cf4 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "react-router-dom": "^6.22.3", "slip77": "^0.2.0", "stream": "^0.0.2", - "tailwindcss": "^3.4.1", + "tailwindcss": "^3.4.3", "uuid": "^9.0.1", "webextension-polyfill": "^0.10.0", "zustand": "^4.5.2" diff --git a/yarn.lock b/yarn.lock index 2747a87b7a..3744d2413c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6419,7 +6419,7 @@ jiti@^1.18.2: resolved "https://registry.npmjs.org/jiti/-/jiti-1.18.2.tgz" integrity sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg== -jiti@^1.19.1: +jiti@^1.21.0: version "1.21.0" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== @@ -9337,10 +9337,10 @@ tailwindcss-3d@^1.0.2: "@swc/helpers" "0.5.3" lodash "4.17.21" -tailwindcss@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.1.tgz#f512ca5d1dd4c9503c7d3d28a968f1ad8f5c839d" - integrity sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA== +tailwindcss@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.3.tgz#be48f5283df77dfced705451319a5dffb8621519" + integrity sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A== dependencies: "@alloc/quick-lru" "^5.2.0" arg "^5.0.2" @@ -9350,7 +9350,7 @@ tailwindcss@^3.4.1: fast-glob "^3.3.0" glob-parent "^6.0.2" is-glob "^4.0.3" - jiti "^1.19.1" + jiti "^1.21.0" lilconfig "^2.1.0" micromatch "^4.0.5" normalize-path "^3.0.0" From 116c8ae5466227c7cd9cb3f8d34cb03e42ff1c13 Mon Sep 17 00:00:00 2001 From: Pavan Joshi <55848322+pavanjoshi914@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:14:31 +0530 Subject: [PATCH 6/8] feat: unify encrypt decrypt for nip04 and nip44 (#3127) * feat: unify encrypt decrypt for nip04 and nip44 * feat: add migrations for encrypt decrypt --- src/app/screens/Nostr/ConfirmDecrypt.tsx | 2 +- .../actions/nostr/decryptOrPrompt.ts | 4 +- .../background-script/actions/nostr/enable.ts | 6 +- .../actions/nostr/encryptOrPrompt.ts | 4 +- .../actions/nostr/nip44DecryptOrPrompt.ts | 4 +- .../actions/nostr/nip44EncryptOrPrompt.ts | 4 +- .../background-script/migrations/index.ts | 84 +++++++++++++++++-- src/i18n/locales/en/translation.json | 18 ++-- src/types.ts | 6 +- 9 files changed, 96 insertions(+), 36 deletions(-) diff --git a/src/app/screens/Nostr/ConfirmDecrypt.tsx b/src/app/screens/Nostr/ConfirmDecrypt.tsx index 1f3199c1c5..7709b169e0 100644 --- a/src/app/screens/Nostr/ConfirmDecrypt.tsx +++ b/src/app/screens/Nostr/ConfirmDecrypt.tsx @@ -70,7 +70,7 @@ function NostrConfirmDecrypt() {

{t("allow", { host: origin.host })}

- {tPermissions("nostr.decrypt")} + {tPermissions("nostr.decrypt.title")}

diff --git a/src/extension/background-script/actions/nostr/decryptOrPrompt.ts b/src/extension/background-script/actions/nostr/decryptOrPrompt.ts index 85232c663b..581ce8075e 100644 --- a/src/extension/background-script/actions/nostr/decryptOrPrompt.ts +++ b/src/extension/background-script/actions/nostr/decryptOrPrompt.ts @@ -14,7 +14,7 @@ const decryptOrPrompt = async (message: MessageDecryptGet, sender: Sender) => { try { const hasPermission = await hasPermissionFor( - PermissionMethodNostr["NOSTR_NIP04DECRYPT"], + PermissionMethodNostr["NOSTR_DECRYPT"], host ); @@ -39,7 +39,7 @@ const decryptOrPrompt = async (message: MessageDecryptGet, sender: Sender) => { // add permission to db only if user decided to always allow this request if (promptResponse.data.rememberPermission) { await addPermissionFor( - PermissionMethodNostr["NOSTR_NIP04DECRYPT"], + PermissionMethodNostr["NOSTR_DECRYPT"], host, promptResponse.data.blocked ); diff --git a/src/extension/background-script/actions/nostr/enable.ts b/src/extension/background-script/actions/nostr/enable.ts index 0321f39863..316c908d06 100644 --- a/src/extension/background-script/actions/nostr/enable.ts +++ b/src/extension/background-script/actions/nostr/enable.ts @@ -82,10 +82,8 @@ const enable = async (message: MessageAllowanceEnable, sender: Sender) => { // Add permissions const permissions: PermissionMethodNostr[] = [ PermissionMethodNostr.NOSTR_GETPUBLICKEY, - PermissionMethodNostr.NOSTR_NIP04ENCRYPT, - PermissionMethodNostr.NOSTR_NIP04DECRYPT, - PermissionMethodNostr.NOSTR_NIP44ENCRYPT, - PermissionMethodNostr.NOSTR_NIP44DECRYPT, + PermissionMethodNostr.NOSTR_ENCRYPT, + PermissionMethodNostr.NOSTR_DECRYPT, ]; permissions.forEach(async (permission) => { await addPermissionFor(permission, host, false); diff --git a/src/extension/background-script/actions/nostr/encryptOrPrompt.ts b/src/extension/background-script/actions/nostr/encryptOrPrompt.ts index ad63469e02..2d1b3c3b82 100644 --- a/src/extension/background-script/actions/nostr/encryptOrPrompt.ts +++ b/src/extension/background-script/actions/nostr/encryptOrPrompt.ts @@ -15,7 +15,7 @@ const encryptOrPrompt = async (message: MessageEncryptGet, sender: Sender) => { try { const hasPermission = await hasPermissionFor( - PermissionMethodNostr["NOSTR_NIP04ENCRYPT"], + PermissionMethodNostr["NOSTR_ENCRYPT"], host ); @@ -45,7 +45,7 @@ const encryptOrPrompt = async (message: MessageEncryptGet, sender: Sender) => { // add permission to db only if user decided to always allow this request if (promptResponse.data.rememberPermission) { await addPermissionFor( - PermissionMethodNostr["NOSTR_NIP04ENCRYPT"], + PermissionMethodNostr["NOSTR_ENCRYPT"], host, promptResponse.data.blocked ); diff --git a/src/extension/background-script/actions/nostr/nip44DecryptOrPrompt.ts b/src/extension/background-script/actions/nostr/nip44DecryptOrPrompt.ts index 6361374dcc..65a241752b 100644 --- a/src/extension/background-script/actions/nostr/nip44DecryptOrPrompt.ts +++ b/src/extension/background-script/actions/nostr/nip44DecryptOrPrompt.ts @@ -17,7 +17,7 @@ const nip44DecryptOrPrompt = async ( try { const hasPermission = await hasPermissionFor( - PermissionMethodNostr["NOSTR_NIP44DECRYPT"], + PermissionMethodNostr["NOSTR_DECRYPT"], host ); @@ -42,7 +42,7 @@ const nip44DecryptOrPrompt = async ( // add permission to db only if user decided to always allow this request if (promptResponse.data.rememberPermission) { await addPermissionFor( - PermissionMethodNostr["NOSTR_NIP44DECRYPT"], + PermissionMethodNostr["NOSTR_DECRYPT"], host, promptResponse.data.blocked ); diff --git a/src/extension/background-script/actions/nostr/nip44EncryptOrPrompt.ts b/src/extension/background-script/actions/nostr/nip44EncryptOrPrompt.ts index d91dd82175..b9eded7d5f 100644 --- a/src/extension/background-script/actions/nostr/nip44EncryptOrPrompt.ts +++ b/src/extension/background-script/actions/nostr/nip44EncryptOrPrompt.ts @@ -18,7 +18,7 @@ const nip44EncryptOrPrompt = async ( try { const hasPermission = await hasPermissionFor( - PermissionMethodNostr["NOSTR_NIP44ENCRYPT"], + PermissionMethodNostr["NOSTR_ENCRYPT"], host ); @@ -47,7 +47,7 @@ const nip44EncryptOrPrompt = async ( // add permission to db only if user decided to always allow this request if (promptResponse.data.rememberPermission) { await addPermissionFor( - PermissionMethodNostr["NOSTR_NIP44ENCRYPT"], + PermissionMethodNostr["NOSTR_ENCRYPT"], host, promptResponse.data.blocked ); diff --git a/src/extension/background-script/migrations/index.ts b/src/extension/background-script/migrations/index.ts index 833baf0261..eb511f5e41 100644 --- a/src/extension/background-script/migrations/index.ts +++ b/src/extension/background-script/migrations/index.ts @@ -1,10 +1,8 @@ -// import db from "../db"; -// import state from "../state"; +import db from "../db"; +import state from "../state"; export type Migration = keyof typeof migrations; -/* - // TS does not want unused code. // we need this for the next migration again @@ -30,9 +28,71 @@ const setMigrated = (name: Migration): Promise => { return state.getState().saveToStorage(); }; -*/ +const migrations = { + migrateEncryptPermission: async () => { + const allowances = await db.allowances.toArray(); + + for (const allowance of allowances) { + const permissions = await db.permissions + .where({ allowanceId: allowance.id }) + .toArray(); + + let isupdated = false; + + for (const permission of permissions) { + if ( + permission.method === "nostr/nip04encrypt" || + permission.method === "nostr/nip44encrypt" + ) { + if (isupdated === false) { + permission.id && + (await db.permissions.update(permission.id, { + method: "nostr/encrypt", + })); + + isupdated = true; + } else { + permission.id && (await db.permissions.delete(permission.id)); + } + } + } + } + + console.info("Migration migrateEncryptPermission complete."); + }, + + migrateDecryptPermission: async () => { + const allowances = await db.allowances.toArray(); + + for (const allowance of allowances) { + const permissions = await db.permissions + .where({ allowanceId: allowance.id }) + .toArray(); -const migrations = {}; + let isupdated = false; + + for (const permission of permissions) { + if ( + permission.method === "nostr/nip04decrypt" || + permission.method === "nostr/nip44decrypt" + ) { + if (isupdated === false) { + permission.id && + (await db.permissions.update(permission.id, { + method: "nostr/decrypt", + })); + + isupdated = true; + } else { + permission.id && (await db.permissions.delete(permission.id)); + } + } + } + } + + console.info("Migration migrateDecryptPermission complete."); + }, +}; const migrate = async () => { // going forward we can iterate through the the migrations object above and DRY this up: @@ -43,6 +103,18 @@ const migrate = async () => { // await migrations["migratePermissionsWithoutAccountId"](); // await setMigrated("migratePermissionsWithoutAccountId"); //} + + if (shouldMigrate("migrateEncryptPermission")) { + console.info("Running migration for: migrateEncryptPermission"); + await migrations["migrateEncryptPermission"](); + await setMigrated("migrateEncryptPermission"); + } + + if (shouldMigrate("migrateDecryptPermission")) { + console.info("Running migration for: migrateDecryptPermission"); + await migrations["migrateDecryptPermission"](); + await setMigrated("migrateDecryptPermission"); + } }; export default migrate; diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 434efe018e..fe0ae30008 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -1290,23 +1290,15 @@ "title": "read public key", "description": "Read your public key" }, - "decrypt": "Decrypt data", - "nip04decrypt": { - "title": "decrypt (nip04)", + "decrypt": { + "title": "decrypt", "description": "Decrypt data" }, - "nip04encrypt": { - "title": "encrypt (nip04)", - "description": "Encrypt data" - }, - "nip44decrypt": { - "title": "decrypt (nip44)", - "description": "Decrypt data" - }, - "nip44encrypt": { - "title": "encrypt (nip44)", + "encrypt": { + "title": "encrypt", "description": "Encrypt data" }, + "signmessage": { "title": "Sign Message", "description": "Sign all nostr events" diff --git a/src/types.ts b/src/types.ts index 2062a20270..f777f10370 100644 --- a/src/types.ts +++ b/src/types.ts @@ -803,10 +803,8 @@ export enum PermissionMethodNostr { NOSTR_SIGNMESSAGE = "nostr/signMessage", NOSTR_SIGNSCHNORR = "nostr/signSchnorr", NOSTR_GETPUBLICKEY = "nostr/getPublicKey", - NOSTR_NIP04DECRYPT = "nostr/nip04decrypt", - NOSTR_NIP04ENCRYPT = "nostr/nip04encrypt", - NOSTR_NIP44DECRYPT = "nostr/nip44decrypt", - NOSTR_NIP44ENCRYPT = "nostr/nip44encrypt", + NOSTR_DECRYPT = "nostr/decrypt", + NOSTR_ENCRYPT = "nostr/encrypt", } export interface DbPermission { From f585f0c23c939bcbc620beebeae6a75250b2f91e Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Wed, 1 May 2024 15:40:12 +0530 Subject: [PATCH 7/8] fix: fix-badges --- src/app/components/Badge/index.tsx | 2 +- src/app/components/BadgesList/index.tsx | 4 ++-- src/app/components/SitePreferences/index.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/Badge/index.tsx b/src/app/components/Badge/index.tsx index 277eb143b4..9b9befe192 100644 --- a/src/app/components/Badge/index.tsx +++ b/src/app/components/Badge/index.tsx @@ -17,7 +17,7 @@ export default function Badge({ return (
0) { badges.push({ label: "budget", - className: "bg-blue-500 text-white", + className: "bg-blue-500 text-white mr-2", }); } if (allowance.lnurlAuth) { badges.push({ label: "auth", - className: "bg-green-bitcoin text-white", + className: "bg-green-bitcoin text-white mr-2", }); } diff --git a/src/app/components/SitePreferences/index.tsx b/src/app/components/SitePreferences/index.tsx index ceb02b9cdc..ae17f50d0e 100644 --- a/src/app/components/SitePreferences/index.tsx +++ b/src/app/components/SitePreferences/index.tsx @@ -291,7 +291,7 @@ function SitePreferences({ launcherType, allowance, onEdit, onDelete }: Props) { ) ); }} - className="bg-green-50 dark:bg-emerald-950 border border-green-100 dark:border-emerald-900 text-gray-800 dark:text-neutral-200 gap-1" + className="bg-green-50 dark:bg-emerald-950 border border-green-100 dark:border-emerald-900 text-gray-800 dark:text-neutral-200 mr-2 mb-2" /> ))} @@ -319,7 +319,7 @@ function SitePreferences({ launcherType, allowance, onEdit, onDelete }: Props) { ) ); }} - className="bg-red-50 dark:bg-red-950 border border-red-100 dark:border-red-900 text-gray-800 dark:text-neutral-200 gap-1" + className="bg-red-50 dark:bg-red-950 border border-red-100 dark:border-red-900 text-gray-800 dark:text-neutral-200 mr-2 mb-2" /> ))} From 76ec91e1530c44ce1206a01a5a1ba259f234f1a3 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Fri, 3 May 2024 11:08:41 +0530 Subject: [PATCH 8/8] feat: update popicons --- package.json | 2 +- src/app/components/AccountMenu/index.tsx | 2 +- src/app/icons/popicons/BitcoinCircleLine.tsx | 27 -------------------- src/app/icons/popicons/GlobeLine.tsx | 21 --------------- yarn.lock | 8 +++--- 5 files changed, 6 insertions(+), 54 deletions(-) delete mode 100644 src/app/icons/popicons/BitcoinCircleLine.tsx delete mode 100644 src/app/icons/popicons/GlobeLine.tsx diff --git a/package.json b/package.json index cbd2e11cf4..bff0c33ec4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@noble/curves": "^1.4.0", "@noble/hashes": "^1.4.0", "@noble/secp256k1": "^2.0.0", - "@popicons/react": "^0.0.9", + "@popicons/react": "^0.0.11", "@scure/base": "^1.1.6", "@scure/bip32": "^1.3.3", "@scure/bip39": "^1.2.2", diff --git a/src/app/components/AccountMenu/index.tsx b/src/app/components/AccountMenu/index.tsx index 48c2eba1d2..54af0fcfc1 100644 --- a/src/app/components/AccountMenu/index.tsx +++ b/src/app/components/AccountMenu/index.tsx @@ -1,6 +1,7 @@ import { PopiconsChevronBottomLine, PopiconsCirclePlusLine, + PopiconsGlobeLine, PopiconsWalletLine, } from "@popicons/react"; import { useEffect } from "react"; @@ -14,7 +15,6 @@ import { useAccounts } from "~/app/context/AccountsContext"; import { isAlbyLNDHubAccount, isAlbyOAuthAccount } from "~/app/utils"; import utils from "~/common/lib/utils"; -import PopiconsGlobeLine from "~/app/icons/popicons/GlobeLine"; import Menu from "../Menu"; export type Props = { diff --git a/src/app/icons/popicons/BitcoinCircleLine.tsx b/src/app/icons/popicons/BitcoinCircleLine.tsx deleted file mode 100644 index e7f9bcddb5..0000000000 --- a/src/app/icons/popicons/BitcoinCircleLine.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { SVGProps } from "react"; - -const PopiconsBitcoinCircleLine = (props: SVGProps) => ( - - - - -); - -export default PopiconsBitcoinCircleLine; diff --git a/src/app/icons/popicons/GlobeLine.tsx b/src/app/icons/popicons/GlobeLine.tsx deleted file mode 100644 index 8209757e77..0000000000 --- a/src/app/icons/popicons/GlobeLine.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { SVGProps } from "react"; - -const PopiconsGlobeLine = (props: SVGProps) => ( - - - -); - -export default PopiconsGlobeLine; diff --git a/yarn.lock b/yarn.lock index 3744d2413c..ed64d8c1c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1159,10 +1159,10 @@ resolved "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz" integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g== -"@popicons/react@^0.0.9": - version "0.0.9" - resolved "https://registry.yarnpkg.com/@popicons/react/-/react-0.0.9.tgz#4dd1e83dcb8a121258f0a074f5f4ce6954718efb" - integrity sha512-uS3/R4JriCX96CmULktVG0KLoOfapWbKXc+R8Z07G8FWY2O+YrMTufc/sgTCnH+y3SFScI5FV3peX0FWKGLzKQ== +"@popicons/react@^0.0.11": + version "0.0.11" + resolved "https://registry.yarnpkg.com/@popicons/react/-/react-0.0.11.tgz#33b9c13c6a362c72d0cd07481b129da4ca9798cd" + integrity sha512-7KZGIe8A5J25FjT4t5d4tZgQIZrGwuZkYUjQpz3fX+frQNPseVOCrbW0SXaeuke/bt66/o+VPlxO9RkaWUZ/4g== "@puppeteer/browsers@1.8.0": version "1.8.0"