diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-04-07 01:23:29 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-04-07 01:23:29 +0530 |
commit | 1471aae8927c20d646cc2aa5ab0e20c1a7f2c0ca (patch) | |
tree | 32d32d7f33b2ca64cf101006442b1b17bfaf61aa /src/webex | |
parent | 47787c0b0b846d5f4a057661efdd05d8786032f1 (diff) | |
download | wallet-core-1471aae8927c20d646cc2aa5ab0e20c1a7f2c0ca.tar.xz |
linter / simpler webextension pack
Diffstat (limited to 'src/webex')
-rw-r--r-- | src/webex/pages/add-auditor.tsx | 8 | ||||
-rw-r--r-- | src/webex/pages/popup.tsx | 11 | ||||
-rw-r--r-- | src/webex/renderHtml.tsx | 4 | ||||
-rw-r--r-- | src/webex/wxBackend.ts | 12 |
4 files changed, 14 insertions, 21 deletions
diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx index 4e3f8615c..fc7de920f 100644 --- a/src/webex/pages/add-auditor.tsx +++ b/src/webex/pages/add-auditor.tsx @@ -78,7 +78,7 @@ function ConfirmAuditor(props: ConfirmAuditorProps): JSX.Element { setAddDone(true); }; - const back = () => { + const back = (): void => { window.history.back(); }; @@ -86,12 +86,12 @@ function ConfirmAuditor(props: ConfirmAuditorProps): JSX.Element { <div id="main"> <p> Do you want to let <strong>{props.auditorPub}</strong> audit the - currency "{props.currency}"? + currency "{props.currency}"? </p> {addDone ? ( <div> Auditor was added! You can also{" "} - <a href={chrome.extension.getURL("/src/webex/pages/auditors.html")}> + <a href={chrome.extension.getURL("/auditors.html")}> view and edit </a>{" "} auditors. @@ -113,7 +113,7 @@ function ConfirmAuditor(props: ConfirmAuditorProps): JSX.Element { ); } -export function makeAddAuditorPage() { +export function makeAddAuditorPage(): JSX.Element { const walletPageUrl = new URL(document.location.href); const url = walletPageUrl.searchParams.get("url"); if (!url) { diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx index c2f050e2a..f62f64b73 100644 --- a/src/webex/pages/popup.tsx +++ b/src/webex/pages/popup.tsx @@ -734,21 +734,18 @@ function WalletDebug(props: any): JSX.Element { return ( <div> <p>Debug tools:</p> - <button onClick={openExtensionPage("/src/webex/pages/popup.html")}> + <button onClick={openExtensionPage("/popup.html")}> wallet tab </button> - <button onClick={openExtensionPage("/src/webex/pages/benchmark.html")}> + <button onClick={openExtensionPage("/benchmark.html")}> benchmark </button> - <button onClick={openExtensionPage("/src/webex/pages/show-db.html")}> + <button onClick={openExtensionPage("/show-db.html")}> show db </button> - <button onClick={openExtensionPage("/src/webex/pages/tree.html")}> + <button onClick={openExtensionPage("/tree.html")}> show tree </button> - <button onClick={openExtensionPage("/src/webex/pages/logs.html")}> - show logs - </button> <br /> <button onClick={confirmReset}>reset</button> <button onClick={reload}>reload chrome extension</button> diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx index 8fc6a6a63..f5a6a7e4d 100644 --- a/src/webex/renderHtml.tsx +++ b/src/webex/renderHtml.tsx @@ -335,9 +335,9 @@ export function ProgressButton( export function PageLink( props: React.PropsWithChildren<{ pageName: string }>, ): JSX.Element { - const url = chrome.extension.getURL(`/src/webex/pages/${props.pageName}`); + const url = chrome.extension.getURL(`/${props.pageName}`); return ( - <a className="actionLink" href={url} target="_blank"> + <a className="actionLink" href={url} target="_blank" rel="noopener noreferrer"> {props.children} </a> ); diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts index f26c14d37..8fbb1431f 100644 --- a/src/webex/wxBackend.ts +++ b/src/webex/wxBackend.ts @@ -358,7 +358,7 @@ function makeSyncWalletRedirect( oldUrl: string, params?: { [name: string]: string | undefined }, ): object { - const innerUrl = new URL(chrome.extension.getURL("/src/webex/pages/" + url)); + const innerUrl = new URL(chrome.extension.getURL("/" + url)); if (params) { for (const key in params) { const p = params[key]; @@ -367,10 +367,6 @@ function makeSyncWalletRedirect( } } } - const outerUrl = new URL( - chrome.extension.getURL("/src/webex/pages/redirect.html"), - ); - outerUrl.searchParams.set("url", innerUrl.href); if (isFirefox()) { // Some platforms don't support the sync redirect (yet), so fall back to // async redirect after a timeout. @@ -378,12 +374,12 @@ function makeSyncWalletRedirect( await waitMs(150); const tab = await getTab(tabId); if (tab.url === oldUrl) { - chrome.tabs.update(tabId, { url: outerUrl.href }); + chrome.tabs.update(tabId, { url: innerUrl.href }); } }; doit(); } - return { redirectUrl: outerUrl.href }; + return { redirectUrl: innerUrl.href }; } async function reinitWallet(): Promise<void> { @@ -447,7 +443,7 @@ try { chrome.runtime.onInstalled.addListener((details) => { console.log("onInstalled with reason", details.reason); if (details.reason === "install") { - const url = chrome.extension.getURL("/src/webex/pages/welcome.html"); + const url = chrome.extension.getURL("/welcome.html"); chrome.tabs.create({ active: true, url: url }); } }); |