diff --git a/package.json b/package.json index 17af7bfe14..7e48541d78 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@runcitadel/sdk": "^0.3.8", "@tailwindcss/forms": "^0.5.2", "@tailwindcss/line-clamp": "^0.4.0", + "@vespaiach/axios-fetch-adapter": "^0.3.0", "axios": "^0.27.2", "bech32": "^2.0.0", "bolt11": "^1.4.0", diff --git a/src/extension/background-script/actions/setup/setIcon.js b/src/extension/background-script/actions/setup/setIcon.js deleted file mode 100644 index fe1a2f553c..0000000000 --- a/src/extension/background-script/actions/setup/setIcon.js +++ /dev/null @@ -1,27 +0,0 @@ -import browser from "webextension-polyfill"; - -const setIcon = async (message, sender) => { - // TODO: refactor names / rename files? - const names = { - active: "alby_icon_yellow", - off: "alby_icon_sleeping", - }; - const name = names[message.args.icon]; - return browser.action - .setIcon({ - path: { - 16: `assets/icons/${name}_16x16.png`, - 32: `assets/icons/${name}_32x32.png`, - 48: `assets/icons/${name}_48x48.png`, - 128: `assets/icons/${name}_128x128.png`, - }, - tabId: sender.tab.id, - }) - .then(() => { - return { - data: true, - }; - }); -}; - -export default setIcon; diff --git a/src/extension/background-script/connectors/lndhub.ts b/src/extension/background-script/connectors/lndhub.ts index 7cbc7ff608..b878c0b33e 100644 --- a/src/extension/background-script/connectors/lndhub.ts +++ b/src/extension/background-script/connectors/lndhub.ts @@ -1,3 +1,4 @@ +import fetchAdapter from "@vespaiach/axios-fetch-adapter"; import axios, { AxiosRequestConfig, Method } from "axios"; import type { AxiosResponse } from "axios"; import lightningPayReq from "bolt11"; @@ -345,6 +346,7 @@ export default class LndHub implements Connector { }, { headers: defaultHeaders, + adapter: fetchAdapter, } ); @@ -381,6 +383,7 @@ export default class LndHub implements Connector { ...defaultHeaders, Authorization: `Bearer ${this.access_token}`, }, + adapter: fetchAdapter, }; if (method === "POST") { diff --git a/src/extension/background-script/index.ts b/src/extension/background-script/index.ts index 34f0200f99..585a2b6d02 100644 --- a/src/extension/background-script/index.ts +++ b/src/extension/background-script/index.ts @@ -58,26 +58,10 @@ const updateIcon = async ( .equalsIgnoreCase(url.host) .first(); - // TODO: move to some config file - const names = { - active: "alby_icon_yellow", - off: "alby_icon_sleeping", - }; - let name; - if (allowance) { - name = names.active; - } else { - name = names.off; - } - return browser.action.setIcon({ - path: { - 16: `assets/icons/${name}_16x16.png`, - 32: `assets/icons/${name}_32x32.png`, - 48: `assets/icons/${name}_48x48.png`, - 128: `assets/icons/${name}_128x128.png`, - }, - tabId: tabId, - }); + await setIcon( + allowance ? ExtensionIcon.Active : ExtensionIcon.Default, + tabId + ); }; const debugLogger = (message: unknown, sender: Runtime.MessageSender) => { diff --git a/src/manifest.json b/src/manifest.json index c42bb7c8bb..cc495e5a6d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Alby - Bitcoin Lightning Wallet", - "version": "1.0.0", + "version": "0.0.0", "icons": { "16": "assets/icons/alby_icon_yellow_16x16.png", diff --git a/yarn.lock b/yarn.lock index f3a6cb8523..ad34704ab4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4351,6 +4351,11 @@ "@typescript-eslint/types" "5.31.0" eslint-visitor-keys "^3.3.0" +"@vespaiach/axios-fetch-adapter@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@vespaiach/axios-fetch-adapter/-/axios-fetch-adapter-0.3.0.tgz#abbd23478260a317165d0c52297306af9d39bb24" + integrity sha512-X3U9VANu+8R4Wu/77bAUiUSqgeTelDFZeJcGZDe63DiFcPI6onjrMWrG3py/N4Qf8qCU3YLq+wO2d8V6ftYcaw== + "@webassemblyjs/ast@1.11.0": version "1.11.0" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz"