aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/platform')
-rw-r--r--packages/taler-wallet-webextension/src/platform/api.ts8
-rw-r--r--packages/taler-wallet-webextension/src/platform/chrome.ts17
-rw-r--r--packages/taler-wallet-webextension/src/platform/dev.ts4
3 files changed, 13 insertions, 16 deletions
diff --git a/packages/taler-wallet-webextension/src/platform/api.ts b/packages/taler-wallet-webextension/src/platform/api.ts
index f8fa0a848..f985cc4f8 100644
--- a/packages/taler-wallet-webextension/src/platform/api.ts
+++ b/packages/taler-wallet-webextension/src/platform/api.ts
@@ -14,7 +14,11 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { CoreApiResponse, NotificationType } from "@gnu-taler/taler-util";
+import {
+ CoreApiResponse,
+ NotificationType,
+ TalerUri,
+} from "@gnu-taler/taler-util";
import {
WalletConfig,
WalletConfigParameter,
@@ -229,7 +233,7 @@ export interface ForegroundPlatformAPI {
*
* @param talerUri
*/
- openWalletURIFromPopup(talerUri: string): void;
+ openWalletURIFromPopup(talerUri: TalerUri): void;
/**
* Popup API
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts
index 51cf2f64e..0f6b5fb0d 100644
--- a/packages/taler-wallet-webextension/src/platform/chrome.ts
+++ b/packages/taler-wallet-webextension/src/platform/chrome.ts
@@ -20,6 +20,8 @@ import {
TalerUriAction,
TalerError,
parseTalerUri,
+ TalerUri,
+ stringifyTalerUri,
} from "@gnu-taler/taler-util";
import { WalletOperations } from "@gnu-taler/taler-wallet-core";
import { BackgroundOperations } from "../wxApi.js";
@@ -247,17 +249,8 @@ function notifyWhenAppIsReady(): Promise<void> {
});
}
-function openWalletURIFromPopup(maybeTalerUri: string): void {
- const talerUri = maybeTalerUri.startsWith("ext+")
- ? maybeTalerUri.substring(4)
- : maybeTalerUri;
- const uri = parseTalerUri(talerUri);
- if (!uri) {
- logger.warn(
- `Response with HTTP 402 the Taler header but could not classify ${talerUri}`,
- );
- return;
- }
+function openWalletURIFromPopup(uri: TalerUri): void {
+ const talerUri = stringifyTalerUri(uri);
//FIXME: this should redirect to just one place
// the target pathname should handle what happens if the endpoint is not there
// like "trying to open from popup but this uri is not handled"
@@ -335,7 +328,7 @@ function openWalletURIFromPopup(maybeTalerUri: string): void {
}
}
- chrome.tabs.create({ active: true, url }, () => {
+ chrome.tabs.update({ active: true, url }, () => {
window.close();
});
}
diff --git a/packages/taler-wallet-webextension/src/platform/dev.ts b/packages/taler-wallet-webextension/src/platform/dev.ts
index 1a4183bec..1d43ad549 100644
--- a/packages/taler-wallet-webextension/src/platform/dev.ts
+++ b/packages/taler-wallet-webextension/src/platform/dev.ts
@@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { CoreApiResponse } from "@gnu-taler/taler-util";
+import { CoreApiResponse, TalerUri } from "@gnu-taler/taler-util";
import { WalletOperations } from "@gnu-taler/taler-wallet-core";
import { BackgroundOperations } from "../wxApi.js";
import {
@@ -73,7 +73,7 @@ const api: BackgroundPlatformAPI & ForegroundPlatformAPI = {
window.parent.frames["wallet" as any].location = `/wallet.html#${page}`;
window.location.href = "about:blank";
},
- openWalletURIFromPopup: (page: string) => {
+ openWalletURIFromPopup: (page: TalerUri) => {
alert("openWalletURIFromPopup not implemented yet");
},
redirectTabToWalletPage: (tabId: number, page: string) => {