diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/platform')
-rw-r--r-- | packages/taler-wallet-webextension/src/platform/chrome.ts | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts index f951685d2..b7b0c6640 100644 --- a/packages/taler-wallet-webextension/src/platform/chrome.ts +++ b/packages/taler-wallet-webextension/src/platform/chrome.ts @@ -83,13 +83,14 @@ const hostPermissions = { export function containsClipboardPermissions(): Promise<boolean> { return new Promise((res, rej) => { - chrome.permissions.contains({ permissions: ["clipboardRead"] }, (resp) => { - const le = chrome.runtime.lastError?.message; - if (le) { - rej(le); - } - res(resp); - }); + res(false); + // chrome.permissions.contains({ permissions: ["clipboardRead"] }, (resp) => { + // const le = chrome.runtime.lastError?.message; + // if (le) { + // rej(le); + // } + // res(resp); + // }); }); } @@ -107,13 +108,14 @@ export function containsHostPermissions(): Promise<boolean> { export async function requestClipboardPermissions(): Promise<boolean> { return new Promise((res, rej) => { - chrome.permissions.request({ permissions: ["clipboardRead"] }, (resp) => { - const le = chrome.runtime.lastError?.message; - if (le) { - rej(le); - } - res(resp); - }); + res(false); + // chrome.permissions.request({ permissions: ["clipboardRead"] }, (resp) => { + // const le = chrome.runtime.lastError?.message; + // if (le) { + // rej(le); + // } + // res(resp); + // }); }); } @@ -187,13 +189,14 @@ export async function removeHostPermissions(): Promise<boolean> { export function removeClipboardPermissions(): Promise<boolean> { return new Promise((res, rej) => { - chrome.permissions.remove({ permissions: ["clipboardRead"] }, (resp) => { - const le = chrome.runtime.lastError?.message; - if (le) { - rej(le); - } - res(resp); - }); + res(true); + // chrome.permissions.remove({ permissions: ["clipboardRead"] }, (resp) => { + // const le = chrome.runtime.lastError?.message; + // if (le) { + // rej(le); + // } + // res(resp); + // }); }); } @@ -775,21 +778,23 @@ async function timeout(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } async function findTalerUriInClipboard(): Promise<string | undefined> { - try { - //It looks like clipboard promise does not return, so we need a timeout - const textInClipboard = await Promise.any([ - timeout(100), - window.navigator.clipboard.readText(), - ]); - if (!textInClipboard) return; - return textInClipboard.startsWith("taler://") || - textInClipboard.startsWith("taler+http://") - ? textInClipboard - : undefined; - } catch (e) { - logger.error("could not read clipboard", e); - return undefined; - } + //FIXME: add clipboard feature + // try { + // //It looks like clipboard promise does not return, so we need a timeout + // const textInClipboard = await Promise.any([ + // timeout(100), + // window.navigator.clipboard.readText(), + // ]); + // if (!textInClipboard) return; + // return textInClipboard.startsWith("taler://") || + // textInClipboard.startsWith("taler+http://") + // ? textInClipboard + // : undefined; + // } catch (e) { + // logger.error("could not read clipboard", e); + // return undefined; + // } + return undefined; } async function findTalerUriInActiveTab(): Promise<string | undefined> { |