From 34c5b151ef00a48a3c9a98d97a42456a6a5c373f Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Mon, 8 Nov 2021 14:46:06 +0100 Subject: [PATCH 01/22] fix: callback not fired on slow connections --- src/extension/content-script/batteries/Twitter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extension/content-script/batteries/Twitter.ts b/src/extension/content-script/batteries/Twitter.ts index fe2e6a87ca..85a79f667e 100644 --- a/src/extension/content-script/batteries/Twitter.ts +++ b/src/extension/content-script/batteries/Twitter.ts @@ -132,6 +132,7 @@ function battery(): Promise<[Battery] | void> { const observer = new MutationObserver(twitterDOMChanged); observer.observe(document, { childList: true, subtree: true }); + twitterDOMChanged([], observer); timer = setTimeout(() => { observer.disconnect(); From 3d4c3318042dcc0675807d4d32036f3b3c7128c0 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Mon, 8 Nov 2021 14:55:14 +0100 Subject: [PATCH 02/22] docs: add comments --- src/extension/content-script/batteries/Twitter.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extension/content-script/batteries/Twitter.ts b/src/extension/content-script/batteries/Twitter.ts index 85a79f667e..a4651bfae2 100644 --- a/src/extension/content-script/batteries/Twitter.ts +++ b/src/extension/content-script/batteries/Twitter.ts @@ -132,6 +132,8 @@ function battery(): Promise<[Battery] | void> { const observer = new MutationObserver(twitterDOMChanged); observer.observe(document, { childList: true, subtree: true }); + // On slow connections the observer is added after the DOM is fully loaded. + // Therefore the callback twitterDOMChanged needs to also be called manually. twitterDOMChanged([], observer); timer = setTimeout(() => { From df4fc0dbfc83626c820053f34ea606860b1a1eac Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 8 Nov 2021 16:54:08 +0200 Subject: [PATCH 03/22] timezones... :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6aeb6736d6..0cb8e611b6 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The extension can connect to different node implementations and supports custodi We have a channel on the [bitcoin.design](https://bitcoin.design/) Slack community [#lightning-browser-extension](https://bitcoindesign.slack.com/archives/C02591ADXM2) and a [Telegram group](https://t.me/getAlby) Come and join us! -We also do a weekly call on Monday at 14:00 UTC - ([15:00 CEST/CAT - 09:00 EDT](https://www.worldtimebuddy.com/?qm=1&lid=100,12,5&h=100&date=2021-11-4&sln=14-15&hf=1)) on [Google Meet](https://meet.google.com/aea-xvbm-fhy) +We also do a weekly call on Monday at 14:00 UTC - ([15:00 CET/CAT - 10:00 EDT](https://www.worldtimebuddy.com/?qm=1&lid=100,12,5&h=100&date=2021-11-4&sln=14-15&hf=1)) on [Google Meet](https://meet.google.com/aea-xvbm-fhy) ## Try out the most recent version Download Nightly releases From 489c2ce935c8f0de0daf2e191ee145f9ed70d4ca Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Tue, 9 Nov 2021 11:52:11 -0700 Subject: [PATCH 04/22] Sat word update (#364) --- src/app/components/AllowanceMenu/index.tsx | 2 +- src/app/components/PaymentSummary.tsx | 4 ++-- src/app/components/TransactionsTable/index.tsx | 2 +- src/app/router/Options/Options.jsx | 2 +- src/app/router/Popup/Popup.jsx | 2 +- src/app/screens/ConfirmPayment/index.jsx | 2 +- src/app/screens/Home/index.jsx | 2 +- src/app/screens/LNURLPay.tsx | 2 +- src/app/screens/Onboard/ConnectLnbits/index.tsx | 2 +- src/app/screens/Onboard/ConnectLnd/index.tsx | 2 +- src/app/screens/Onboard/ConnectLndHub/index.tsx | 2 +- src/app/screens/Onboard/Intro/index.jsx | 2 +- src/app/screens/Onboard/NewWallet/index.tsx | 2 +- src/app/screens/Onboard/SetPassword/index.jsx | 2 +- src/app/screens/Onboard/TestConnection/index.jsx | 10 +++++----- src/app/screens/Options/TestConnection/index.jsx | 2 +- .../background-script/events/notifications.js | 2 +- 17 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/app/components/AllowanceMenu/index.tsx b/src/app/components/AllowanceMenu/index.tsx index 4be90c5036..99f6fc6deb 100644 --- a/src/app/components/AllowanceMenu/index.tsx +++ b/src/app/components/AllowanceMenu/index.tsx @@ -100,7 +100,7 @@ function AllowanceMenu({ allowance, onEdit, onDelete }: Props) { { setBudget(parseInt(event.target.value)); diff --git a/src/app/components/PaymentSummary.tsx b/src/app/components/PaymentSummary.tsx index d42f87a96a..5a9736cb56 100644 --- a/src/app/components/PaymentSummary.tsx +++ b/src/app/components/PaymentSummary.tsx @@ -13,8 +13,8 @@ function PaymentSummary({ amount, amountAlt, description }: Props) {
Amount
-
{amount} Sats
- {amountAlt &&
{amountAlt} Sats
} +
{amount} sat
+ {amountAlt &&
{amountAlt} sat
}
Description
diff --git a/src/app/components/TransactionsTable/index.tsx b/src/app/components/TransactionsTable/index.tsx index 33500de608..82d14b894d 100644 --- a/src/app/components/TransactionsTable/index.tsx +++ b/src/app/components/TransactionsTable/index.tsx @@ -66,7 +66,7 @@ export default function TransactionsTable({ transactions }: Props) {

{tx.type === "sent" || "sending" ? "-" : "+"} - {tx.totalAmount} sats + {tx.totalAmount} sat

{tx.date}

diff --git a/src/app/router/Options/Options.jsx b/src/app/router/Options/Options.jsx index 6b0b860503..1852114dab 100644 --- a/src/app/router/Options/Options.jsx +++ b/src/app/router/Options/Options.jsx @@ -45,7 +45,7 @@ function Options() { title={accountInfo.alias} subtitle={ typeof accountInfo.balance === "number" - ? `${accountInfo.balance} Sats` + ? `${accountInfo.balance} sat` : "" } onAccountSwitch={loadAccountInfo} diff --git a/src/app/router/Popup/Popup.jsx b/src/app/router/Popup/Popup.jsx index f045123375..075736c8c9 100644 --- a/src/app/router/Popup/Popup.jsx +++ b/src/app/router/Popup/Popup.jsx @@ -82,7 +82,7 @@ const Default = () => { title={accountInfo.alias} subtitle={ typeof accountInfo.balance === "number" - ? `${accountInfo.balance} Sats` + ? `${accountInfo.balance} sat` : "" } onAccountSwitch={() => { diff --git a/src/app/screens/ConfirmPayment/index.jsx b/src/app/screens/ConfirmPayment/index.jsx index 5a1abb745e..e9b3b75b59 100644 --- a/src/app/screens/ConfirmPayment/index.jsx +++ b/src/app/screens/ConfirmPayment/index.jsx @@ -115,7 +115,7 @@ class ConfirmPayment extends React.Component { { this.setBudget(event.target.value); diff --git a/src/app/screens/Home/index.jsx b/src/app/screens/Home/index.jsx index 1dc4a8e804..2c6c7cae22 100644 --- a/src/app/screens/Home/index.jsx +++ b/src/app/screens/Home/index.jsx @@ -278,7 +278,7 @@ class Home extends React.Component { this.setState({ loadingSendSats: false }); } }} - label="⚡️ Send Sats ⚡️" + label="⚡️ Send Satoshis ⚡️" primary loading={loadingSendSats} /> diff --git a/src/app/screens/LNURLPay.tsx b/src/app/screens/LNURLPay.tsx index b234e8d5f1..eb9de1c642 100644 --- a/src/app/screens/LNURLPay.tsx +++ b/src/app/screens/LNURLPay.tsx @@ -130,7 +130,7 @@ function LNURLPay(props: Props) { function renderAmount() { if (details.minSendable === details.maxSendable) { - return

{`${details.minSendable / 1000} Satoshi`}

; + return

{`${details.minSendable / 1000} sat`}

; } else { return (
diff --git a/src/app/screens/Onboard/ConnectLnbits/index.tsx b/src/app/screens/Onboard/ConnectLnbits/index.tsx index 666db695fb..6435c5e644 100644 --- a/src/app/screens/Onboard/ConnectLnbits/index.tsx +++ b/src/app/screens/Onboard/ConnectLnbits/index.tsx @@ -121,7 +121,7 @@ export default function ConnectLnbits() {
Sats
diff --git a/src/app/screens/Onboard/ConnectLnd/index.tsx b/src/app/screens/Onboard/ConnectLnd/index.tsx index 994daa6a47..dcce915c4d 100644 --- a/src/app/screens/Onboard/ConnectLnd/index.tsx +++ b/src/app/screens/Onboard/ConnectLnd/index.tsx @@ -198,7 +198,7 @@ export default function ConnectLnd() {
Sats
diff --git a/src/app/screens/Onboard/ConnectLndHub/index.tsx b/src/app/screens/Onboard/ConnectLndHub/index.tsx index ad5a1912f6..7fee677621 100644 --- a/src/app/screens/Onboard/ConnectLndHub/index.tsx +++ b/src/app/screens/Onboard/ConnectLndHub/index.tsx @@ -136,7 +136,7 @@ export default function ConnectLndHub() {
Sats
diff --git a/src/app/screens/Onboard/Intro/index.jsx b/src/app/screens/Onboard/Intro/index.jsx index cb41939252..07c71a0331 100644 --- a/src/app/screens/Onboard/Intro/index.jsx +++ b/src/app/screens/Onboard/Intro/index.jsx @@ -46,7 +46,7 @@ export default function Intro() {
Sats
diff --git a/src/app/screens/Onboard/NewWallet/index.tsx b/src/app/screens/Onboard/NewWallet/index.tsx index 9d5a27d721..a55716a5b1 100644 --- a/src/app/screens/Onboard/NewWallet/index.tsx +++ b/src/app/screens/Onboard/NewWallet/index.tsx @@ -152,7 +152,7 @@ export default function NewWallet() {
Sats
diff --git a/src/app/screens/Onboard/SetPassword/index.jsx b/src/app/screens/Onboard/SetPassword/index.jsx index 67087f8ee2..86ec3625ca 100644 --- a/src/app/screens/Onboard/SetPassword/index.jsx +++ b/src/app/screens/Onboard/SetPassword/index.jsx @@ -131,7 +131,7 @@ export default function SetPassword() {
Sats
diff --git a/src/app/screens/Onboard/TestConnection/index.jsx b/src/app/screens/Onboard/TestConnection/index.jsx index c07de8074e..88c43bcfcb 100644 --- a/src/app/screens/Onboard/TestConnection/index.jsx +++ b/src/app/screens/Onboard/TestConnection/index.jsx @@ -64,7 +64,7 @@ export default function TestConnection() { .then((response) => { if (response.data.ok) { loadAccountInfo(); - alert(`We've sent you ${faucetAmount} Satoshi`); + alert(`We've sent you ${faucetAmount} sat`); setFaucetLoading(false); setShowFaucet(false); } @@ -125,7 +125,7 @@ export default function TestConnection() {

- To get started we send {faucetAmount} Satoshi to your wallet. + To get started we send {faucetAmount} sat to your wallet.
Please provide your email. We will notify you of updates (don't worry, we also hate spam) @@ -144,7 +144,7 @@ export default function TestConnection() { {faucetLoading ? ( ) : ( -

@@ -182,7 +182,7 @@ export default function TestConnection() { setShowFaucet(true); }} > - To get started we can send you some Sats... + To get started we can send you some Satoshis... {renderFaucet()} @@ -195,7 +195,7 @@ export default function TestConnection() { alias={accountInfo.alias} satoshis={ typeof accountInfo.balance === "number" - ? `${accountInfo.balance} Sats` + ? `${accountInfo.balance} sat` : "" } /> diff --git a/src/app/screens/Options/TestConnection/index.jsx b/src/app/screens/Options/TestConnection/index.jsx index 0d2dd3f1db..ff64933537 100644 --- a/src/app/screens/Options/TestConnection/index.jsx +++ b/src/app/screens/Options/TestConnection/index.jsx @@ -65,7 +65,7 @@ export default function TestConnection() { alias={accountInfo.alias} satoshis={ typeof accountInfo.balance === "number" - ? `${accountInfo.balance} Sats` + ? `${accountInfo.balance} sat` : "" } /> diff --git a/src/extension/background-script/events/notifications.js b/src/extension/background-script/events/notifications.js index 22c4022559..b897ae1baf 100644 --- a/src/extension/background-script/events/notifications.js +++ b/src/extension/background-script/events/notifications.js @@ -9,7 +9,7 @@ const paymentSuccessNotification = (message, data) => { const { total_amt } = route; return utils.notify({ - title: `Paid ${total_amt} Satoshi to ${recipient}`, + title: `Paid ${total_amt} sat to ${recipient}`, message: `pre image: ${paymentResponse.data.preimage}`, }); }; From 27a5db49ade464e68cf7b79596174160d5dd6b98 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 10 Nov 2021 11:55:15 +0100 Subject: [PATCH 05/22] feat: increase prompt height and make it responsive (#368) --- src/app/components/PaymentSummary.tsx | 2 +- src/common/lib/utils.ts | 2 +- static/views/prompt.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/PaymentSummary.tsx b/src/app/components/PaymentSummary.tsx index 5a9736cb56..cadd598b40 100644 --- a/src/app/components/PaymentSummary.tsx +++ b/src/app/components/PaymentSummary.tsx @@ -13,7 +13,7 @@ function PaymentSummary({ amount, amountAlt, description }: Props) {
Amount
-
{amount} sat
+
{amount} sat
{amountAlt &&
{amountAlt} sat
}
Description diff --git a/src/common/lib/utils.ts b/src/common/lib/utils.ts index 7fc35dc5b5..c5021e9c8d 100644 --- a/src/common/lib/utils.ts +++ b/src/common/lib/utils.ts @@ -106,7 +106,7 @@ const utils = { url: `${browser.runtime.getURL("prompt.html")}?${urlParams}`, type: "popup", width: 400, - height: 580, + height: 600, }) .then((window) => { let tabId: number | undefined; diff --git a/static/views/prompt.html b/static/views/prompt.html index 6bdbfc4a11..8e127f1fd7 100644 --- a/static/views/prompt.html +++ b/static/views/prompt.html @@ -7,7 +7,7 @@ Alby - +
From e76427352db1f66835ce943c9a130d760f0ce623 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Mon, 8 Nov 2021 22:52:21 +0100 Subject: [PATCH 06/22] feat: initial rethinking --- src/app/screens/Home/index.jsx | 14 ++------------ src/extension/background-script/index.js | 11 ----------- src/extension/content-script/batteries/index.ts | 8 ++++---- src/extension/content-script/index.js | 9 +++++++++ 4 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/app/screens/Home/index.jsx b/src/app/screens/Home/index.jsx index 2c6c7cae22..12888174b5 100644 --- a/src/app/screens/Home/index.jsx +++ b/src/app/screens/Home/index.jsx @@ -34,21 +34,11 @@ class Home extends React.Component { loadLightningDataFromCurrentWebsite() { // Enhancement data is loaded asynchronously (for example because we need to fetch additional data). - // Sadly we can not get return values from async code through executeScript() - // To work around this we write the enhancement data into a variable in the content script and access that variable here. - // Due to the async execution the variable could potentially not yet be loaded browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => { - const [currentTab] = tabs; browser.tabs - .executeScript(currentTab.id, { - code: "window.LBE_LIGHTNING_DATA;", - }) + .sendMessage(tabs[0].id, { type: "lightningData" }) .then((data) => { - // data is an array, see: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/executeScript#return_value - // we execute it only in the current Tab. Thus the array has only one entry - if (data[0]) { - this.setState({ lnData: data[0] }); - } + this.setState({ lnData: data }); }); }); } diff --git a/src/extension/background-script/index.js b/src/extension/background-script/index.js index 72e97b4935..2c336968a6 100644 --- a/src/extension/background-script/index.js +++ b/src/extension/background-script/index.js @@ -14,15 +14,6 @@ setInterval(() => { }, 5000); */ -const extractLightningDataFromPage = async (tabId, changeInfo, tabInfo) => { - if (changeInfo.status !== "complete" || !tabInfo.url?.startsWith("http")) { - return; - } - browser.tabs.executeScript(tabId, { - code: "if ((document.location.protocol === 'https:' || document.location.protocol === 'http:') && window.LBE_EXTRACT_LIGHTNING_DATA) { LBE_EXTRACT_LIGHTNING_DATA(); };", - }); -}; - const updateIcon = async (tabId, changeInfo, tabInfo) => { if (changeInfo.status !== "complete" || !tabInfo.url?.startsWith("http")) { return; @@ -110,8 +101,6 @@ async function init() { browser.runtime.onMessage.addListener(routeCalls); // TODO: make optional - browser.tabs.onUpdated.addListener(extractLightningDataFromPage); // extract LN data from websites - browser.tabs.onUpdated.addListener(updateIcon); // update Icon when there is an allowance } diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index 37246a4489..ea31580e37 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -15,7 +15,7 @@ declare global { const enhancements = [Monetization, Twitter, YouTubeVideo]; -function LBE_EXTRACT_LIGHTNING_DATA() { +async function LBE_EXTRACT_LIGHTNING_DATA() { // prevent the function from being called multiple times // this could happen because the browser.tabs.onUpdated event is fired multiple times if (window["LBE_EXTRACT_LIGHTNING_DATA_RUNNING"]) { @@ -43,8 +43,8 @@ function LBE_EXTRACT_LIGHTNING_DATA() { }); }); // reset lock - Promise.all(batteriesRunning).then(() => { - window.LBE_EXTRACT_LIGHTNING_DATA_RUNNING = false; - }); + await Promise.all(batteriesRunning); + window.LBE_EXTRACT_LIGHTNING_DATA_RUNNING = false; + return window.LBE_LIGHTNING_DATA; } export default LBE_EXTRACT_LIGHTNING_DATA; diff --git a/src/extension/content-script/index.js b/src/extension/content-script/index.js index e6e433bfdf..1cb590da77 100644 --- a/src/extension/content-script/index.js +++ b/src/extension/content-script/index.js @@ -11,6 +11,15 @@ if (shouldInject()) { // TODO: make optional window.LBE_EXTRACT_LIGHTNING_DATA = LBE_EXTRACT_LIGHTNING_DATA; + // extract LN data from websites + browser.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.type === "lightningData") { + LBE_EXTRACT_LIGHTNING_DATA().then(sendResponse); + return true; + } + }); + LBE_EXTRACT_LIGHTNING_DATA(); + // message listener to listen to inpage webln calls // those calls get passed on to the background script // (the inpage script can not do that directly, but only the inpage script can make webln availabe to the page) From 1a198022c3c59d08dc919a2e9e6f063713249f2a Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 09:12:55 +0100 Subject: [PATCH 07/22] feat: remove window properties --- src/app/screens/Home/index.jsx | 4 +++- .../content-script/batteries/index.ts | 21 +++++-------------- src/extension/content-script/index.js | 2 -- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/app/screens/Home/index.jsx b/src/app/screens/Home/index.jsx index 12888174b5..7f19391686 100644 --- a/src/app/screens/Home/index.jsx +++ b/src/app/screens/Home/index.jsx @@ -38,7 +38,9 @@ class Home extends React.Component { browser.tabs .sendMessage(tabs[0].id, { type: "lightningData" }) .then((data) => { - this.setState({ lnData: data }); + if (data) { + this.setState({ lnData: data }); + } }); }); } diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index ea31580e37..b596b3dad0 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -16,35 +16,24 @@ declare global { const enhancements = [Monetization, Twitter, YouTubeVideo]; async function LBE_EXTRACT_LIGHTNING_DATA() { - // prevent the function from being called multiple times - // this could happen because the browser.tabs.onUpdated event is fired multiple times - if (window["LBE_EXTRACT_LIGHTNING_DATA_RUNNING"]) { - return; - } - // reset potential previous data (e.g. if navigation happens through JS and not a full page load) - window.LBE_LIGHTNING_DATA = null; + let lightningData = null; + // get maching extractors/enhancements for the current URL // NOTE: this does not mean that data can be found. Because of that we run all possible ones const matching = enhancements.filter((e) => { return document.location.toString().match(e.urlMatcher); }); - // Set the running flag. This prevents the function from running multiple times - // because of the way web navigation events work the function call could be triggered multiple times - // there is no clear event to identify that a user has navigated on the website. we rely on the `browser.tabs.onUpdated` event. - window.LBE_EXTRACT_LIGHTNING_DATA_RUNNING = true; - const batteriesRunning = matching.map((enhancement) => { return enhancement.battery().then((data) => { if (data) { - window.LBE_LIGHTNING_DATA = data; + lightningData = data; utils.call("setIcon", { icon: "active" }); } }); }); - // reset lock + await Promise.all(batteriesRunning); - window.LBE_EXTRACT_LIGHTNING_DATA_RUNNING = false; - return window.LBE_LIGHTNING_DATA; + return lightningData; } export default LBE_EXTRACT_LIGHTNING_DATA; diff --git a/src/extension/content-script/index.js b/src/extension/content-script/index.js index 1cb590da77..04782db054 100644 --- a/src/extension/content-script/index.js +++ b/src/extension/content-script/index.js @@ -8,8 +8,6 @@ import LBE_EXTRACT_LIGHTNING_DATA from "./batteries"; if (shouldInject()) { injectScript(); - // TODO: make optional - window.LBE_EXTRACT_LIGHTNING_DATA = LBE_EXTRACT_LIGHTNING_DATA; // extract LN data from websites browser.runtime.onMessage.addListener((request, sender, sendResponse) => { From 9b02f6647bcd0e133a6ebd8356288e88b2693d89 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 09:20:45 +0100 Subject: [PATCH 08/22] feat: remove global window declaration --- src/extension/content-script/batteries/index.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index b596b3dad0..51a8af6fe9 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -1,18 +1,10 @@ import utils from "../../../common/lib/utils"; -import { Battery } from "../../../types"; // import GitHubRepo from "./GitHubRepo"; import Monetization from "./Monetization"; import Twitter from "./Twitter"; import YouTubeVideo from "./YouTubeVideo"; // import YouTubeChannel from "./YouTubeChannel"; -declare global { - interface Window { - LBE_LIGHTNING_DATA: [Battery] | null; - LBE_EXTRACT_LIGHTNING_DATA_RUNNING: boolean; - } -} - const enhancements = [Monetization, Twitter, YouTubeVideo]; async function LBE_EXTRACT_LIGHTNING_DATA() { From 8168db6bcba230209ee630a6a34f8aecdfdcf228 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 09:52:25 +0100 Subject: [PATCH 09/22] fix: import browser pkg --- src/extension/background-script/actions/setup/setIcon.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extension/background-script/actions/setup/setIcon.js b/src/extension/background-script/actions/setup/setIcon.js index 387650bc57..fa6a5b237d 100644 --- a/src/extension/background-script/actions/setup/setIcon.js +++ b/src/extension/background-script/actions/setup/setIcon.js @@ -1,3 +1,5 @@ +import browser from "webextension-polyfill"; + const setIcon = async (message, sender) => { // TODO: refactor names / rename files? const names = { From e36d8eecab9d67c0fe252f47f40aee86af4633ae Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 09:56:35 +0100 Subject: [PATCH 10/22] refactor: implicit return --- src/extension/content-script/batteries/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index 51a8af6fe9..3240f4f2e8 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -12,9 +12,9 @@ async function LBE_EXTRACT_LIGHTNING_DATA() { // get maching extractors/enhancements for the current URL // NOTE: this does not mean that data can be found. Because of that we run all possible ones - const matching = enhancements.filter((e) => { - return document.location.toString().match(e.urlMatcher); - }); + const matching = enhancements.filter((e) => + document.location.toString().match(e.urlMatcher) + ); const batteriesRunning = matching.map((enhancement) => { return enhancement.battery().then((data) => { From 53747ddd59e6f71889c7a1ee96ea41e16e51dbd4 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 10:50:56 +0100 Subject: [PATCH 11/22] feat: notify the content script when tab was updated --- src/extension/background-script/index.js | 9 +++++++++ src/extension/content-script/index.js | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/extension/background-script/index.js b/src/extension/background-script/index.js index 2c336968a6..bd806eec3e 100644 --- a/src/extension/background-script/index.js +++ b/src/extension/background-script/index.js @@ -102,6 +102,15 @@ async function init() { // TODO: make optional browser.tabs.onUpdated.addListener(updateIcon); // update Icon when there is an allowance + + // Notify the content script that the tab has been updated. + browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { + if (changeInfo.status === "complete") { + browser.tabs.sendMessage(tabId, { + type: "tabUpdated", + }); + } + }); } // The onInstalled event is fired directly after the code is loaded. diff --git a/src/extension/content-script/index.js b/src/extension/content-script/index.js index 04782db054..fe9ae8a693 100644 --- a/src/extension/content-script/index.js +++ b/src/extension/content-script/index.js @@ -12,11 +12,13 @@ if (shouldInject()) { // extract LN data from websites browser.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request.type === "lightningData") { + // Lightning data was requested from the popup. LBE_EXTRACT_LIGHTNING_DATA().then(sendResponse); return true; + } else if (request.type === "tabUpdated") { + LBE_EXTRACT_LIGHTNING_DATA(); } }); - LBE_EXTRACT_LIGHTNING_DATA(); // message listener to listen to inpage webln calls // those calls get passed on to the background script From 6218ab3fb0343031a3a7e8fec31a01929e720791 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 10:59:27 +0100 Subject: [PATCH 12/22] refactor: extract into func --- src/extension/background-script/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/extension/background-script/index.js b/src/extension/background-script/index.js index bd806eec3e..098f22b017 100644 --- a/src/extension/background-script/index.js +++ b/src/extension/background-script/index.js @@ -14,6 +14,14 @@ setInterval(() => { }, 5000); */ +const notifyContentScript = (tabId, changeInfo, tab) => { + if (changeInfo.status === "complete" && tab.url?.startsWith("http")) { + browser.tabs.sendMessage(tabId, { + type: "tabUpdated", + }); + } +}; + const updateIcon = async (tabId, changeInfo, tabInfo) => { if (changeInfo.status !== "complete" || !tabInfo.url?.startsWith("http")) { return; @@ -104,13 +112,7 @@ async function init() { browser.tabs.onUpdated.addListener(updateIcon); // update Icon when there is an allowance // Notify the content script that the tab has been updated. - browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { - if (changeInfo.status === "complete") { - browser.tabs.sendMessage(tabId, { - type: "tabUpdated", - }); - } - }); + browser.tabs.onUpdated.addListener(notifyContentScript); } // The onInstalled event is fired directly after the code is loaded. From ef85d8b1a2d460e6ced6b0b7e32ec744bfa8f2ad Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Tue, 9 Nov 2021 16:08:59 +0100 Subject: [PATCH 13/22] refactor: replace promises by messaging --- src/app/screens/Home/index.jsx | 32 ++-- src/extension/background-script/index.js | 6 +- .../content-script/batteries/Monetization.ts | 10 +- .../content-script/batteries/Twitter.ts | 140 +++++++++--------- .../content-script/batteries/YouTubeVideo.ts | 22 ++- .../content-script/batteries/index.ts | 27 +--- src/extension/content-script/index.js | 10 +- .../content-script/setLightningData.ts | 14 ++ 8 files changed, 130 insertions(+), 131 deletions(-) create mode 100644 src/extension/content-script/setLightningData.ts diff --git a/src/app/screens/Home/index.jsx b/src/app/screens/Home/index.jsx index 7f19391686..2c2f12ef47 100644 --- a/src/app/screens/Home/index.jsx +++ b/src/app/screens/Home/index.jsx @@ -32,19 +32,6 @@ class Home extends React.Component { }; } - loadLightningDataFromCurrentWebsite() { - // Enhancement data is loaded asynchronously (for example because we need to fetch additional data). - browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => { - browser.tabs - .sendMessage(tabs[0].id, { type: "lightningData" }) - .then((data) => { - if (data) { - this.setState({ lnData: data }); - } - }); - }); - } - loadAllowance = () => { browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => { const [currentTab] = tabs; @@ -66,14 +53,25 @@ class Home extends React.Component { }); } - initialize() { + handleLightningDataMessage = (response) => { + if (response.type === "lightningData") { + this.setState({ lnData: response.args }); + } + }; + + componentDidMount() { this.loadPayments(); this.loadAllowance(); + + // Enhancement data is loaded asynchronously (for example because we need to fetch additional data). + browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => { + browser.tabs.sendMessage(tabs[0].id, { type: "extractLightningData" }); + }); + browser.runtime.onMessage.addListener(this.handleLightningDataMessage); } - componentDidMount() { - this.initialize(); - this.loadLightningDataFromCurrentWebsite(); + componentWillUnmount() { + browser.runtime.onMessage.removeListener(this.handleLightningDataMessage); } renderAllowanceView() { diff --git a/src/extension/background-script/index.js b/src/extension/background-script/index.js index 098f22b017..68c2610659 100644 --- a/src/extension/background-script/index.js +++ b/src/extension/background-script/index.js @@ -14,10 +14,10 @@ setInterval(() => { }, 5000); */ -const notifyContentScript = (tabId, changeInfo, tab) => { +const extractLightningData = (tabId, changeInfo, tab) => { if (changeInfo.status === "complete" && tab.url?.startsWith("http")) { browser.tabs.sendMessage(tabId, { - type: "tabUpdated", + type: "extractLightningData", }); } }; @@ -112,7 +112,7 @@ async function init() { browser.tabs.onUpdated.addListener(updateIcon); // update Icon when there is an allowance // Notify the content script that the tab has been updated. - browser.tabs.onUpdated.addListener(notifyContentScript); + browser.tabs.onUpdated.addListener(extractLightningData); } // The onInstalled event is fired directly after the code is loaded. diff --git a/src/extension/content-script/batteries/Monetization.ts b/src/extension/content-script/batteries/Monetization.ts index 729f69f66e..db5d7765cf 100644 --- a/src/extension/content-script/batteries/Monetization.ts +++ b/src/extension/content-script/batteries/Monetization.ts @@ -1,19 +1,19 @@ import getOriginData from "../originData"; -import { Battery } from "../../../types"; +import setLightningData from "../setLightningData"; const urlMatcher = /^https?:\/\/.*/i; -const battery = (): Promise<[Battery] | void> => { +const battery = (): void => { const monetizationTag = document.querySelector( - 'head > meta[name="lightning"][content^="lnurlp:" i]' + 'head > meta[name="lightning"]' ); if (!monetizationTag) { - return Promise.resolve(); + return; } const recipient = monetizationTag.content.replace(/lnurlp:/i, ""); const metaData = getOriginData(); - return Promise.resolve([ + setLightningData([ { method: "lnurlp", recipient: recipient, diff --git a/src/extension/content-script/batteries/Twitter.ts b/src/extension/content-script/batteries/Twitter.ts index a4651bfae2..7c22f04e23 100644 --- a/src/extension/content-script/batteries/Twitter.ts +++ b/src/extension/content-script/batteries/Twitter.ts @@ -1,5 +1,11 @@ import getOriginData from "../originData"; -import { Battery } from "../../../types"; +import setLightningData from "../setLightningData"; + +declare global { + interface Window { + LBE_TWITTER_MUTATION_OBSERVER: MutationObserver; + } +} const urlMatcher = /^https:\/\/twitter\.com\/(\w+).*/; @@ -61,86 +67,78 @@ function getUserData(username: string) { return null; } -function battery(): Promise<[Battery] | void> { +function battery(): void { // Twitter loads everything async...so we observe DOM changes to check if data finished loading. - let timer: NodeJS.Timeout; - const timeout = 1500; // Observing should auto-stop after timeout (when nothing found). - - return new Promise((resolve, reject) => { - function twitterDOMChanged( - _: MutationRecord[], - observer: MutationObserver - ) { - const username = getUsername(); - let userData; - if ((userData = getUserData(username))) { - observer.disconnect(); - clearTimeout(timer); - console.log({ userData }); + function twitterDOMChanged(_: MutationRecord[], observer: MutationObserver) { + const username = getUsername(); + let userData; + if ((userData = getUserData(username))) { + observer.disconnect(); + console.log({ userData }); - let match; - let recipient; - // extract lnurlp: from the description text - if ( - (match = (userData.element.textContent || "").match(/lnurlp:(\S+)/i)) - ) { - recipient = match[1]; - } else { - // if we did not find anything let's look for an ⚡ emoji - const zapElement = userData.element.querySelector( - 'img[src*="26a1.svg"]' - ); - // it is hard to find the :zap: emoij. Twitter uses images for that but has an alt text with the emoij - // but there could be some control characters somewhere...somehow...no idea... - // for that reason we check if there is any character with the zap char code in the alt string. + let match; + let recipient; + // extract lnurlp: from the description text + if ( + (match = (userData.element.textContent || "").match(/lnurlp:(\S+)/i)) + ) { + recipient = match[1]; + } else { + // if we did not find anything let's look for an ⚡ emoji + const zapElement = userData.element.querySelector( + 'img[src*="26a1.svg"]' + ); + // it is hard to find the :zap: emoij. Twitter uses images for that but has an alt text with the emoij + // but there could be some control characters somewhere...somehow...no idea... + // for that reason we check if there is any character with the zap char code in the alt string. - //const emojis = userData.element.querySelectorAll("img"); - //const zapElement = Array.from(emojis).find((img) => { - // return Array.from(img.alt.trim()).some( - // (c) => c.charCodeAt(0) === 9889 - // ); - //}); - // if we find a ⚡ emoji we use the text of the next sibling and try to extract a lnurl - if (zapElement) { - if ( - (match = (zapElement.nextSibling?.textContent || "").match( - /(\S+@\S+)/ - )) - ) { - recipient = match[1]; - } + //const emojis = userData.element.querySelectorAll("img"); + //const zapElement = Array.from(emojis).find((img) => { + // return Array.from(img.alt.trim()).some( + // (c) => c.charCodeAt(0) === 9889 + // ); + //}); + // if we find a ⚡ emoji we use the text of the next sibling and try to extract a lnurl + if (zapElement) { + if ( + (match = (zapElement.nextSibling?.textContent || "").match( + /(\S+@\S+)/ + )) + ) { + recipient = match[1]; } } + } - // if we still did not find anything ignore it. - if (!recipient) { - resolve(); - return; - } - - resolve([ - { - method: "lnurl", - recipient, - ...getOriginData(), - icon: userData.imageUrl, - name: userData.name, - }, - ]); + // if we still did not find anything ignore it. + if (!recipient) { + return; } - } - const observer = new MutationObserver(twitterDOMChanged); - observer.observe(document, { childList: true, subtree: true }); - // On slow connections the observer is added after the DOM is fully loaded. - // Therefore the callback twitterDOMChanged needs to also be called manually. - twitterDOMChanged([], observer); + setLightningData([ + { + method: "lnurl", + recipient, + ...getOriginData(), + icon: userData.imageUrl, + name: userData.name, + }, + ]); + } + } - timer = setTimeout(() => { - observer.disconnect(); - resolve(); - }, timeout); + if (!window.LBE_TWITTER_MUTATION_OBSERVER) { + window.LBE_TWITTER_MUTATION_OBSERVER = new MutationObserver( + twitterDOMChanged + ); + } + window.LBE_TWITTER_MUTATION_OBSERVER.observe(document, { + childList: true, + subtree: true, }); + // On slow connections the observer is added after the DOM is fully loaded. + // Therefore the callback twitterDOMChanged needs to also be called manually. + twitterDOMChanged([], window.LBE_TWITTER_MUTATION_OBSERVER); } const twitter = { diff --git a/src/extension/content-script/batteries/YouTubeVideo.ts b/src/extension/content-script/batteries/YouTubeVideo.ts index 0baf728a63..185e1752a3 100644 --- a/src/extension/content-script/batteries/YouTubeVideo.ts +++ b/src/extension/content-script/batteries/YouTubeVideo.ts @@ -1,13 +1,17 @@ import getOriginData from "../originData"; -import { Battery } from "../../../types"; +import setLightningData from "../setLightningData"; const urlMatcher = /^https:\/\/www\.youtube.com\/watch.*/; -const battery = (): Promise<[Battery] | void> => { - const videoDescription = document.querySelector("#description .content"); - const channelLink = document.querySelector(".ytd-channel-name a"); +const battery = (): void => { + const videoDescription = document.querySelector( + "#columns #primary #primary-inner #meta-contents #description .content" + ); + const channelLink = document.querySelector( + "#columns #primary #primary-inner #meta-contents .ytd-channel-name a" + ); if (!videoDescription || !channelLink) { - return Promise.resolve(); + return; } const text = videoDescription.textContent || ""; let match; @@ -21,13 +25,15 @@ const battery = (): Promise<[Battery] | void> => { else if ((match = text.match(/(⚡️:?|lightning:|lnurl:)(\S+@\S+)/i))) { recipient = match[2]; } else { - return Promise.resolve(); + return; } const name = channelLink.textContent || ""; const imageUrl = - document.querySelector("#meta-contents img")?.src || ""; - return Promise.resolve([ + document.querySelector( + "#columns #primary #primary-inner #meta-contents img" + )?.src || ""; + setLightningData([ { method: "lnurl", recipient, diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index 3240f4f2e8..4fa46de6a2 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -1,31 +1,18 @@ -import utils from "../../../common/lib/utils"; // import GitHubRepo from "./GitHubRepo"; import Monetization from "./Monetization"; import Twitter from "./Twitter"; import YouTubeVideo from "./YouTubeVideo"; // import YouTubeChannel from "./YouTubeChannel"; -const enhancements = [Monetization, Twitter, YouTubeVideo]; +const enhancements = [Twitter, YouTubeVideo, Monetization]; -async function LBE_EXTRACT_LIGHTNING_DATA() { - let lightningData = null; - - // get maching extractors/enhancements for the current URL - // NOTE: this does not mean that data can be found. Because of that we run all possible ones - const matching = enhancements.filter((e) => +async function extractLightningData() { + const match = enhancements.find((e) => document.location.toString().match(e.urlMatcher) ); - const batteriesRunning = matching.map((enhancement) => { - return enhancement.battery().then((data) => { - if (data) { - lightningData = data; - utils.call("setIcon", { icon: "active" }); - } - }); - }); - - await Promise.all(batteriesRunning); - return lightningData; + if (match) { + match.battery(); + } } -export default LBE_EXTRACT_LIGHTNING_DATA; +export default extractLightningData; diff --git a/src/extension/content-script/index.js b/src/extension/content-script/index.js index fe9ae8a693..25a8b58fc9 100644 --- a/src/extension/content-script/index.js +++ b/src/extension/content-script/index.js @@ -4,19 +4,15 @@ import shouldInject from "./shouldInject"; import injectScript from "./injectScript"; //import { enhancements, loadEnhancements } from "../inpage-script/enhancements"; -import LBE_EXTRACT_LIGHTNING_DATA from "./batteries"; +import extractLightningData from "./batteries"; if (shouldInject()) { injectScript(); // extract LN data from websites browser.runtime.onMessage.addListener((request, sender, sendResponse) => { - if (request.type === "lightningData") { - // Lightning data was requested from the popup. - LBE_EXTRACT_LIGHTNING_DATA().then(sendResponse); - return true; - } else if (request.type === "tabUpdated") { - LBE_EXTRACT_LIGHTNING_DATA(); + if (request.type === "extractLightningData") { + extractLightningData(); } }); diff --git a/src/extension/content-script/setLightningData.ts b/src/extension/content-script/setLightningData.ts new file mode 100644 index 0000000000..75fa4beec0 --- /dev/null +++ b/src/extension/content-script/setLightningData.ts @@ -0,0 +1,14 @@ +import browser from "webextension-polyfill"; + +import utils from "../../common/lib/utils"; +import { Battery } from "../../types"; + +const setLightningData = (data: [Battery]): void => { + browser.runtime.sendMessage({ + application: "LBE", + type: "lightningData", + args: data, + }); + utils.call("setIcon", { icon: "active" }); +}; +export default setLightningData; From a84947208f4eb9e3babd3bcb39f39c568a9d6c0c Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 9 Nov 2021 18:44:24 +0100 Subject: [PATCH 14/22] Update src/extension/content-script/batteries/index.ts Co-authored-by: Michael Bumann --- src/extension/content-script/batteries/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extension/content-script/batteries/index.ts b/src/extension/content-script/batteries/index.ts index 4fa46de6a2..a656a3f490 100644 --- a/src/extension/content-script/batteries/index.ts +++ b/src/extension/content-script/batteries/index.ts @@ -4,6 +4,7 @@ import Twitter from "./Twitter"; import YouTubeVideo from "./YouTubeVideo"; // import YouTubeChannel from "./YouTubeChannel"; +// Order is important as the first one for which the URL matches will be used const enhancements = [Twitter, YouTubeVideo, Monetization]; async function extractLightningData() { From be43b3e1734e7f0f6bfbe784905855754e7842ea Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 9 Nov 2021 19:33:55 +0100 Subject: [PATCH 15/22] We need the tabs permission to get the URL of the tab otherwise we can not check for existing allowances --- src/manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/manifest.json b/src/manifest.json index 26b56a0ab5..c67396d859 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -15,6 +15,7 @@ "permissions": [ "notifications", "activeTab", + "tabs", "storage", "unlimitedStorage", "*://*/*" From eed7f6abcd3cac3d7de0168406d7d21714486915 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 9 Nov 2021 19:35:19 +0100 Subject: [PATCH 16/22] Highlight the icon after the when webln is enabled --- .../background-script/actions/allowances/enable.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extension/background-script/actions/allowances/enable.js b/src/extension/background-script/actions/allowances/enable.js index 153a504553..2f5c5fe5f3 100644 --- a/src/extension/background-script/actions/allowances/enable.js +++ b/src/extension/background-script/actions/allowances/enable.js @@ -1,6 +1,6 @@ -import state from "../../state"; import db from "../../db"; import utils from "../../../../common/lib/utils"; +import setIcon from "../setup/setIcon"; const enable = async (message, sender) => { const host = message.origin.host || message.args.host; @@ -10,13 +10,17 @@ const enable = async (message, sender) => { .first(); if (allowance && allowance.enabled) { + setIcon({ args: { icon: "active" } }, sender); // highlight the icon when enabled return { data: { enabled: true }, }; } else { try { const response = await utils.openPrompt(message); - // if the response should be saved/rememberd we update the allowance for the domain + if (response.data.enabled) { + setIcon({ args: { icon: "active" } }, sender); // highlight the icon when enabled + } + // if the response should be saved/remembered we update the allowance for the domain // as this returns a promise we must wait until it resolves if (response.data.enabled && response.data.remember) { if (allowance) { From eea3e9d886accdf3e2e56d81804d6fb8dadcbb33 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Wed, 10 Nov 2021 17:47:04 +0100 Subject: [PATCH 17/22] v1.0.1 --- package.json | 2 +- src/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6869f68b4a..88f70f3cec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lightning-browser-extension", - "version": "1.0.0", + "version": "1.0.1", "description": "Lightning browser extension", "private": true, "repository": "https://github.com/bumi/lightning-browser-extension.git", diff --git a/src/manifest.json b/src/manifest.json index c67396d859..915351b79c 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Alby", - "version": "1.0.0", + "version": "1.0.1", "icons": { "16": "assets/icons/satsymbol-black-16.png", From 5fc16b08fed7516cc8ea56f8f4b99f5e5f732118 Mon Sep 17 00:00:00 2001 From: Dylan Companjen Date: Wed, 10 Nov 2021 18:06:26 +0100 Subject: [PATCH 18/22] fix: cannot stop scanner bug --- src/app/components/QrcodeScanner/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/components/QrcodeScanner/index.tsx b/src/app/components/QrcodeScanner/index.tsx index 54f28f4ee3..11d4721598 100644 --- a/src/app/components/QrcodeScanner/index.tsx +++ b/src/app/components/QrcodeScanner/index.tsx @@ -93,7 +93,15 @@ function QrcodeScanner({ async function handleStopScanning(isMounted = true) { try { if (html5QrCodeRef.current) { - await html5QrCodeRef.current.stop(); + const scannerState = html5QrCodeRef.current.getState(); + if ( + [ + Html5QrcodeScannerState.PAUSED, + Html5QrcodeScannerState.SCANNING, + ].includes(scannerState) + ) { + await html5QrCodeRef.current.stop(); + } html5QrCodeRef.current.clear(); if (isMounted) setScanning(false); } From 142aa55d1181eb3c3520f573230233feedbec9d4 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 23:11:30 +0000 Subject: [PATCH 19/22] Update postcss-cli to version 9.0.2 --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 88f70f3cec..9e89723450 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "html5-qrcode": "^2.1.1", "invoices": "^2.0.0", "memoizee": "^0.4.15", - "postcss-cli": "^9.0.1", + "postcss-cli": "^9.0.2", "pubsub-js": "^1.9.3", "query-string": "^7.0.0", "react": "^17.0.2", diff --git a/yarn.lock b/yarn.lock index f19511edb9..d5bdeba24e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11810,7 +11810,7 @@ nan@^2.12.1, nan@^2.13.2: resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== -nanocolors@^0.2.11, nanocolors@^0.2.12, nanocolors@^0.2.2, nanocolors@^0.2.8: +nanocolors@^0.2.12, nanocolors@^0.2.2, nanocolors@^0.2.8: version "0.2.12" resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.2.12.tgz#4d05932e70116078673ea4cc6699a1c56cc77777" integrity sha512-SFNdALvzW+rVlzqexid6epYdt8H9Zol7xDoQarioEFcFN0JHo4CYNztAxmtfgGTVRCmFlEOqqhBpoFGKqSAMug== @@ -12826,17 +12826,17 @@ postcss-calc@^8.0.0: postcss-selector-parser "^6.0.2" postcss-value-parser "^4.0.2" -postcss-cli@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/postcss-cli/-/postcss-cli-9.0.1.tgz#4c3c5dac092fd048457ffc337eeff9e6415d55e7" - integrity sha512-zO160OBaAZBFUWO+QZIzEKMjnPIc5c61dMg1d7xafblh9cxbNb6s16ahJuP91PcVsu//gqr7BKllJxRiRDsSYw== +postcss-cli@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/postcss-cli/-/postcss-cli-9.0.2.tgz#96081b2fe1e94e7c4a0b4d6bb361aba16d541045" + integrity sha512-08Wujoy7YGhKCFrGsT9OXqWjtHlGQ+JmyaD/4McjCiwor2IUTRVzXiJd+xmLTGdSWjceS6/TePaJQwBlkVWHiw== dependencies: chokidar "^3.3.0" dependency-graph "^0.11.0" fs-extra "^10.0.0" get-stdin "^9.0.0" globby "^12.0.0" - nanocolors "^0.2.11" + picocolors "^1.0.0" postcss-load-config "^3.0.0" postcss-reporter "^7.0.0" pretty-hrtime "^1.0.3" From 5480013e80db1979589552b0273f1cdbae926d2d Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 12:56:31 +0000 Subject: [PATCH 20/22] Update zustand to version 3.6.4 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9e89723450..8bc3fe8365 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "webextension-polyfill": "^0.8.0", "webpack-dev-server": "^4.4.0", "webpack-sources": "^3.2.1", - "zustand": "^3.5.12" + "zustand": "^3.6.4" }, "devDependencies": { "@babel/core": "^7.15.4", diff --git a/yarn.lock b/yarn.lock index d5bdeba24e..246bbce428 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17141,10 +17141,10 @@ zip-stream@^4.1.0: compress-commons "^4.1.0" readable-stream "^3.6.0" -zustand@^3.5.12: - version "3.5.12" - resolved "https://registry.yarnpkg.com/zustand/-/zustand-3.5.12.tgz#407a8685eb286a32d7f560e74966993bbff1dae8" - integrity sha512-Cv9fX/yM5HXYODkn3Q/HMmMofnmZw3yqM73VT/3rQEvI/04Yl0OFNO24qMofhN82xTPWcCffkGPFCMq8r67Whg== +zustand@^3.6.4: + version "3.6.4" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-3.6.4.tgz#2aed404072e3d4538fbc380bcf4eee88b174051d" + integrity sha512-liH2ZaEOSiEaVEl7N0CVzoKYZCQPpibfsIgB2ksrjvfu17WME8Eh7XV/MCi5OQM5AnbuYbLowplR03UP5yrNYw== zwitch@^1.0.0: version "1.0.5" From 39bccaa4ffa11d003a1b2d861c38e2e6195490ef Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:11:51 +0000 Subject: [PATCH 21/22] Update axios to version 0.24.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8bc3fe8365..698e9fa157 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@heroicons/react": "^1.0.5", "@tailwindcss/forms": "^0.3.4", "assert": "^2.0.0", - "axios": "^0.23.0", + "axios": "^0.24.0", "bech32": "^2.0.0", "browser-polyfill": "^3.20.2", "crypto-browserify": "^3.12.0", diff --git a/yarn.lock b/yarn.lock index 246bbce428..9052291d57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4868,10 +4868,10 @@ axe-core@^4.0.2: resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.2.3.tgz" integrity sha512-pXnVMfJKSIWU2Ml4JHP7pZEPIrgBO1Fd3WGx+fPBsS+KRGhE4vxooD8XBGWbQOIVSZsVK7pUDBBkCicNu80yzQ== -axios@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.23.0.tgz#b0fa5d0948a8d1d75e3d5635238b6c4625b05149" - integrity sha512-NmvAE4i0YAv5cKq8zlDoPd1VLKAqX5oLuZKs8xkJa4qi6RGn0uhCYFjWtHHC9EM/MwOwYWOs53W+V0aqEXq1sg== +axios@^0.24.0: + version "0.24.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" + integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA== dependencies: follow-redirects "^1.14.4" From f28e49651c295aeedf8a465fc990a4b943ec8e34 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Fri, 5 Nov 2021 04:11:27 +0000 Subject: [PATCH 22/22] Update invoices to version 2.0.1 --- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 698e9fa157..298d167706 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "dexie": "^3.0.3", "elliptic": "^6.5.4", "html5-qrcode": "^2.1.1", - "invoices": "^2.0.0", + "invoices": "^2.0.1", "memoizee": "^0.4.15", "postcss-cli": "^9.0.2", "pubsub-js": "^1.9.3", diff --git a/yarn.lock b/yarn.lock index 9052291d57..0e1fc2b64b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5297,17 +5297,17 @@ body-parser@1.19.0: raw-body "2.4.0" type-is "~1.6.17" -bolt07@1.7.3: - version "1.7.3" - resolved "https://registry.npmjs.org/bolt07/-/bolt07-1.7.3.tgz" - integrity sha512-zXhf60qEpFXwRTeoaJ+0SyPw/jzBtIHZLCJBvaa0rFGiiQKdWXdaiIWeyIkxl74p/UGUv4BQsbkAgB0Em/1QOQ== +bolt07@1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/bolt07/-/bolt07-1.7.4.tgz#40787ed2c8e744224ffc2d828d5737907289ae56" + integrity sha512-y82Na9vEBY+rqjJhjYMFAch70nWvbL5OiEPFqNf7cGTtQfG7g/Vui2KnemrX1mxEw2SgccF+Rn1NSRm9HFtu3w== dependencies: bn.js "5.2.0" -bolt09@0.1.5: - version "0.1.5" - resolved "https://registry.npmjs.org/bolt09/-/bolt09-0.1.5.tgz" - integrity sha512-oT1+erg21vat55oXNd7nNEkCO0FQnmaraFZuyXFyeVk7dZCm/3vgic0qK1VuUSV+ksYXJfRKYC4AqfYrtHNPZg== +bolt09@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/bolt09/-/bolt09-0.2.0.tgz#dd34a527359a834d90ae3ad3895d4dca775706ab" + integrity sha512-s6QWo7qqu6fKGLISGMSG+vFxIRzeUT3KQHDiHpvhflyI3TQD6zdaMu4fEpP7PoyMFJt2Ve26SBvvRP3MM7V0bw== bonjour@^3.5.0: version "3.5.0" @@ -9565,16 +9565,16 @@ invariant@^2.2.3, invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -invoices@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invoices/-/invoices-2.0.0.tgz#f84185150720b7d7799bbe10dbb772c7fabf93d4" - integrity sha512-UnU0bS3+cMA2UvYrF5RXp/Hm7v/nYiA3F0GVCOeRmDiZmXAt/eO7KdqyRzewopvhBlev7F7t7GZzRRYY1XE3xg== +invoices@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/invoices/-/invoices-2.0.1.tgz#f8c9d72a88fd5f4675d52a3f6979ca9f9e16aab5" + integrity sha512-qd6Os70iotC/P09ArTWsXB3/G8MJRYMkrJQ1k2983kzdKVlROgWobKmdvrA/IFmjg0Ztg/wDkhx49dIQqT8PzQ== dependencies: bech32 "2.0.0" bitcoinjs-lib "5.2.0" bn.js "5.2.0" - bolt07 "1.7.3" - bolt09 "0.1.5" + bolt07 "1.7.4" + bolt09 "0.2.0" secp256k1 "4.0.2" ip-regex@^4.0.0: