From b72a31ac09e23312277b7c90d17fc55dbcddd3f3 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Fri, 31 May 2024 16:52:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20build=20web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/background.d.ts | 11 +++++++---- web/background.js | 4 ++-- web/index.html | 2 ++ web/manifest.json | 3 +-- web/popup_singleton_guard.js | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 web/popup_singleton_guard.js diff --git a/web/background.d.ts b/web/background.d.ts index 9a3223bac..69e53342f 100644 --- a/web/background.d.ts +++ b/web/background.d.ts @@ -1,5 +1,8 @@ -declare function findExtensionWindowId(): Promise; +/// +declare function extensionUrl(): string; +declare function focusExtensionPopup(): Promise; +declare function findExtensionTab(): Promise; declare function openExtensionPopup(): Promise; -declare function extensionPopupExists(): Promise; -declare function isExtensionPopupReady(): Promise; -declare function waitForExtensionPopup(): Promise; +declare function isExtensionPopupOpened(): Promise; +declare function areMultipleExtensionPopupsOpened(): Promise; +declare function ensureExtensionPopupOpened(): Promise; diff --git a/web/background.js b/web/background.js index b85c85fcd..9fe7fba85 100644 --- a/web/background.js +++ b/web/background.js @@ -1,2 +1,2 @@ -var background;(()=>{"use strict";async function e(){const e=await chrome.tabs.query({url:`chrome-extension://${chrome.runtime.id}/index.html`});return 0===e.length?null:e[0].windowId}chrome.runtime.onMessageExternal.addListener(((n,o,t)=>{"waitForExtensionPopup"===n&&async function(){return new Promise((async n=>{if(await async function(){return!!await async function(){return null!==await e()}()&&await chrome.runtime.sendMessage("isExtensionPopupReady")}())return void n();const o=e=>{"extensionPopupReady"===e&&(console.log("Extension popup ready"),chrome.runtime.onMessage.removeListener(o),n())};chrome.runtime.onMessage.addListener(o),async function(){const n=await e();if(null!==n)return console.log("Extension popup already exists."),void chrome.windows.update(n,{focused:!0});chrome.windows.create({url:"index.html",width:370,height:800,type:"panel",focused:!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2VkIiwiY3JlYXRlIiwid2lkdGgiLCJoZWlnaHQiLCJ0eXBlIiwib3BlbkV4dGVuc2lvblBvcHVwIiwid2FpdEZvckV4dGVuc2lvblBvcHVwIiwidGhlbiJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file +var background;(()=>{"use strict";function n(){return`chrome-extension://${chrome.runtime.id}/index.html`}async function t(){const n=await e();return null!==n&&(await chrome.windows.update(n.windowId,{focused:!0}),void 0!==n.id&&await chrome.tabs.update(n.id,{active:!0}),!0)}async function e(){const t=await chrome.tabs.query({url:n()});return 0===t.length?null:t[0]}async function a(){if(await t())return;const n=await chrome.windows.getCurrent();let e=Math.round((n.left??200)+(n.width??0)-370-32),a=Math.round((n.top??200)+64);await chrome.windows.create({url:"index.html",width:370,height:800,type:"panel",focused:!0,left:e,top:a})}chrome.runtime.onMessageExternal.addListener(((n,t,i)=>{if("ensureExtensionPopupOpened"===n)return async function(){await async function(){return null!==await e()}()||await a()}().then((()=>{i()})),!0})),chrome.runtime.onMessage.addListener(((e,a,i)=>"areMultipleExtensionPopupsOpened"===e?(async function(){return(await chrome.tabs.query({url:n()})).length>1}().then((n=>{i(n)})),!0):"focusExtensionPopup"===e?(t().then((n=>{i(n)})),!0):void 0)),chrome.action.onClicked.addListener((async function(n){await a()})),background={}})(); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFja2dyb3VuZC5qcyIsIm1hcHBpbmdzIjoia0NBMkJBLFNBQVNBLElBQ0wsTUFBTyxzQkFBc0JDLE9BQU9DLFFBQVFDLGVBQ2hELENBS0FDLGVBQWVDLElBQ1gsTUFBTUMsUUFBcUJDLElBQzNCLE9BQXFCLE9BQWpCRCxVQUNNTCxPQUFPTyxRQUFRQyxPQUNqQkgsRUFBYUksU0FDYixDQUFFQyxTQUFTLFNBRVNDLElBQXBCTixFQUFhSCxVQUNQRixPQUFPWSxLQUFLSixPQUNkSCxFQUFhSCxHQUNiLENBQU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dGgiLCJ0b3AiLCJjcmVhdGUiLCJoZWlnaHQiLCJ0eXBlIiwib25NZXNzYWdlRXh0ZXJuYWwiLCJhZGRMaXN0ZW5lciIsIm1lc3NhZ2UiLCJzZW5kZXIiLCJzZW5kUmVzcG9uc2UiLCJpc0V4dGVuc2lvblBvcHVwT3BlbmVkIiwiZW5zdXJlRXh0ZW5zaW9uUG9wdXBPcGVuZWQiLCJ0aGVuIiwib25NZXNzYWdlIiwiYXJlTXVsdGlwbGVFeHRlbnNpb25Qb3B1cHNPcGVuZWQiLCJyZXNwb25zZSIsImFjdGlvbiIsIm9uQ2xpY2tlZCIsInRhYiJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/web/index.html b/web/index.html index 92e3dc86a..f4a2046f7 100644 --- a/web/index.html +++ b/web/index.html @@ -38,6 +38,8 @@ + diff --git a/web/manifest.json b/web/manifest.json index c2d6d6dee..e39bf3af3 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -7,7 +7,7 @@ "48": "icons/icon_48.png", "128": "icons/icon_128.png" }, - "version": "2.3.8.527", + "version": "2.3.8.528", "content_security_policy": { "extension_pages": "script-src 'self' ; object-src 'self'" }, @@ -48,7 +48,6 @@ ] }, "action": { - "default_popup": "index.html", "default_title": "Archethic Wallet", "default_icon": { "16": "icons/icon_16.png", diff --git a/web/popup_singleton_guard.js b/web/popup_singleton_guard.js new file mode 100644 index 000000000..f39471ec9 --- /dev/null +++ b/web/popup_singleton_guard.js @@ -0,0 +1 @@ +!async function(){document.addEventListener("DOMContentLoaded",(async function(){await chrome.runtime.sendMessage("areMultipleExtensionPopupsOpened",(e=>{e&&(chrome.runtime.sendMessage("focusExtensionPopup"),window.close())}))}))}(); \ No newline at end of file