Skip to content

Commit

Permalink
fix(axios): use fetach-adapter within service-worker #1124
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Sep 1, 2022
1 parent 5ef4bf8 commit cc8fcc7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 48 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 0 additions & 27 deletions src/extension/background-script/actions/setup/setIcon.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/extension/background-script/connectors/lndhub.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -345,6 +346,7 @@ export default class LndHub implements Connector {
},
{
headers: defaultHeaders,
adapter: fetchAdapter,
}
);

Expand Down Expand Up @@ -381,6 +383,7 @@ export default class LndHub implements Connector {
...defaultHeaders,
Authorization: `Bearer ${this.access_token}`,
},
adapter: fetchAdapter,
};

if (method === "POST") {
Expand Down
24 changes: 4 additions & 20 deletions src/extension/background-script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4349,6 +4349,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/[email protected]":
version "1.11.0"
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz"
Expand Down

0 comments on commit cc8fcc7

Please sign in to comment.