aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-webextension/.gitignore1
-rw-r--r--packages/taler-wallet-webextension/manifest.json (renamed from packages/taler-wallet-webextension/webextension/manifest.json)10
-rwxr-xr-xpackages/taler-wallet-webextension/pack.sh15
-rw-r--r--packages/taler-wallet-webextension/package.json5
-rw-r--r--packages/taler-wallet-webextension/rollup.config.js166
-rw-r--r--packages/taler-wallet-webextension/src/browserCryptoWorkerFactory.ts2
-rw-r--r--packages/taler-wallet-webextension/src/wxBackend.ts15
-rw-r--r--packages/taler-wallet-webextension/static/add-auditor.html (renamed from packages/taler-wallet-webextension/webextension/static/add-auditor.html)0
-rw-r--r--packages/taler-wallet-webextension/static/auditors.html (renamed from packages/taler-wallet-webextension/webextension/static/auditors.html)0
-rw-r--r--packages/taler-wallet-webextension/static/background.html (renamed from packages/taler-wallet-webextension/webextension/static/background.html)4
-rw-r--r--packages/taler-wallet-webextension/static/benchmark.html (renamed from packages/taler-wallet-webextension/webextension/static/benchmark.html)0
-rw-r--r--packages/taler-wallet-webextension/static/img/icon.png (renamed from packages/taler-wallet-webextension/webextension/static/img/icon.png)bin830 -> 830 bytes
-rw-r--r--packages/taler-wallet-webextension/static/img/logo-2015-medium.png (renamed from packages/taler-wallet-webextension/webextension/static/img/logo-2015-medium.png)bin65674 -> 65674 bytes
l---------packages/taler-wallet-webextension/static/img/logo.png (renamed from packages/taler-wallet-webextension/webextension/static/img/logo.png)0
-rw-r--r--packages/taler-wallet-webextension/static/img/spinner-bars.svg (renamed from packages/taler-wallet-webextension/webextension/static/img/spinner-bars.svg)0
-rw-r--r--packages/taler-wallet-webextension/static/pay.html (renamed from packages/taler-wallet-webextension/webextension/static/pay.html)0
-rw-r--r--packages/taler-wallet-webextension/static/payback.html (renamed from packages/taler-wallet-webextension/webextension/static/payback.html)0
-rw-r--r--packages/taler-wallet-webextension/static/popup.html (renamed from packages/taler-wallet-webextension/webextension/static/popup.html)0
-rw-r--r--packages/taler-wallet-webextension/static/refund.html (renamed from packages/taler-wallet-webextension/webextension/static/refund.html)0
-rw-r--r--packages/taler-wallet-webextension/static/reset-required.html (renamed from packages/taler-wallet-webextension/webextension/static/reset-required.html)0
-rw-r--r--packages/taler-wallet-webextension/static/return-coins.html (renamed from packages/taler-wallet-webextension/webextension/static/return-coins.html)0
-rw-r--r--packages/taler-wallet-webextension/static/style/popup.css (renamed from packages/taler-wallet-webextension/webextension/static/style/popup.css)0
-rw-r--r--packages/taler-wallet-webextension/static/style/pure.css (renamed from packages/taler-wallet-webextension/webextension/static/style/pure.css)0
-rw-r--r--packages/taler-wallet-webextension/static/style/wallet.css (renamed from packages/taler-wallet-webextension/webextension/static/style/wallet.css)0
-rw-r--r--packages/taler-wallet-webextension/static/tip.html (renamed from packages/taler-wallet-webextension/webextension/static/tip.html)0
-rw-r--r--packages/taler-wallet-webextension/static/welcome.html (renamed from packages/taler-wallet-webextension/webextension/static/welcome.html)0
-rw-r--r--packages/taler-wallet-webextension/static/withdraw.html (renamed from packages/taler-wallet-webextension/webextension/static/withdraw.html)0
-rw-r--r--packages/taler-wallet-webextension/tsconfig.json11
-rwxr-xr-xpackages/taler-wallet-webextension/webextension/pack.sh23
29 files changed, 70 insertions, 182 deletions
diff --git a/packages/taler-wallet-webextension/.gitignore b/packages/taler-wallet-webextension/.gitignore
new file mode 100644
index 000000000..a6178770e
--- /dev/null
+++ b/packages/taler-wallet-webextension/.gitignore
@@ -0,0 +1 @@
+taler-wallet-*.zip
diff --git a/packages/taler-wallet-webextension/webextension/manifest.json b/packages/taler-wallet-webextension/manifest.json
index b09e3ecbd..5858d208d 100644
--- a/packages/taler-wallet-webextension/webextension/manifest.json
+++ b/packages/taler-wallet-webextension/manifest.json
@@ -18,8 +18,8 @@
},
"icons": {
- "32": "img/icon.png",
- "128": "img/logo.png"
+ "32": "static/img/icon.png",
+ "128": "static/img/logo.png"
},
"permissions": [
@@ -36,14 +36,14 @@
"browser_action": {
"default_icon": {
- "32": "img/icon.png"
+ "32": "static/img/icon.png"
},
"default_title": "Taler",
- "default_popup": "popup.html"
+ "default_popup": "static/popup.html"
},
"background": {
- "page": "background.html",
+ "page": "static/background.html",
"persistent": true
}
}
diff --git a/packages/taler-wallet-webextension/pack.sh b/packages/taler-wallet-webextension/pack.sh
new file mode 100755
index 000000000..65837f493
--- /dev/null
+++ b/packages/taler-wallet-webextension/pack.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -eu
+
+if [[ ! -e package.json ]]; then
+ echo "Please run this from the root of the repo.">&2
+ exit 1
+fi
+
+vers_manifest=$(jq -r '.version' manifest.json)
+
+zipfile="taler-wallet-${vers_manifest}.zip"
+
+rm -f -- "$zipfile"
+zip -r "$zipfile" dist static manifest.json
diff --git a/packages/taler-wallet-webextension/package.json b/packages/taler-wallet-webextension/package.json
index b60d4ea98..3702f2242 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -9,7 +9,8 @@
"private": false,
"scripts": {
"test": "tsc && ava",
- "compile": "tsc"
+ "clean": "rimraf dist lib tsconfig.tsbuildinfo",
+ "compile": "tsc && rollup -c"
},
"dependencies": {
"moment": "^2.27.0",
@@ -33,7 +34,9 @@
"enzyme-adapter-react-16": "^1.15.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
+ "rimraf": "^3.0.2",
"rollup": "^2.23.0",
+ "rollup-plugin-ignore": "^1.0.9",
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-terser": "^6.1.0",
"typescript": "^3.9.7"
diff --git a/packages/taler-wallet-webextension/rollup.config.js b/packages/taler-wallet-webextension/rollup.config.js
index 25ce768b4..6f2d84509 100644
--- a/packages/taler-wallet-webextension/rollup.config.js
+++ b/packages/taler-wallet-webextension/rollup.config.js
@@ -2,210 +2,96 @@
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import json from "@rollup/plugin-json";
-import replace from "@rollup/plugin-replace";
import builtins from "builtin-modules";
-import { terser } from "rollup-plugin-terser";
-import typescript from "@rollup/plugin-typescript";
-
-// Base settings to use
-const baseTypescriptCompilerSettings = {
- target: "ES6",
- jsx: "react",
- reactNamespace: "React",
- moduleResolution: "node",
- sourceMap: true,
- lib: ["es6", "dom"],
- noImplicitReturns: true,
- noFallthroughCasesInSwitch: true,
- strict: true,
- strictPropertyInitialization: false,
- noImplicitAny: true,
- noImplicitThis: true,
- allowJs: true,
- checkJs: true,
- incremental: false,
- esModuleInterop: true,
- importHelpers: true,
- module: "ESNext",
- include: ["src/**/*.+(ts|tsx)"],
- rootDir: "./src",
-};
-
-const walletCli = {
- input: "src/headless/taler-wallet-cli.ts",
- output: {
- file: "dist/standalone/taler-wallet-cli.js",
- format: "cjs",
- },
- external: builtins,
- plugins: [
- nodeResolve({
- preferBuiltins: true,
- }),
-
- commonjs({
- include: ["node_modules/**", "dist/node/**"],
- extensions: [".js", ".ts"],
- ignoreGlobal: false, // Default: false
- sourceMap: false,
- ignore: ["taler-wallet"],
- }),
-
- json(),
-
- typescript({
- tsconfig: false,
- ...baseTypescriptCompilerSettings,
- sourceMap: false,
- }),
- ],
-};
-
-const walletAndroid = {
- input: "src/android/index.ts",
- output: {
- //dir: "dist/standalone",
- file: "dist/standalone/taler-wallet-android.js",
- format: "cjs",
- exports: "named",
- },
- external: builtins,
- plugins: [
- json(),
-
- nodeResolve({
- preferBuiltins: true,
- }),
-
- commonjs({
- include: ["node_modules/**"],
- extensions: [".js"],
- sourceMap: false,
- ignore: ["taler-wallet"],
- }),
+import replace from "@rollup/plugin-replace";
+import ignore from "rollup-plugin-ignore"
- typescript({
- tsconfig: false,
- ...baseTypescriptCompilerSettings,
- sourceMap: false,
- }),
- ],
-};
const webExtensionPageEntryPoint = {
- input: "src/webex/pageEntryPoint.ts",
+ input: "lib/pageEntryPoint.js",
output: {
- file: "dist/webextension/pageEntryPoint.js",
+ file: "dist/pageEntryPoint.js",
format: "iife",
exports: "none",
name: "webExtensionPageEntry",
},
- external: builtins,
plugins: [
json(),
+ ignore(builtins),
+
nodeResolve({
- preferBuiltins: true,
+ browser: true,
}),
- terser(),
+ //terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
+ "__filename": "'__webextension__'",
}),
- commonjs({
- include: ["node_modules/**", "dist/node/**"],
- extensions: [".js"],
- sourceMap: false,
- ignore: ["taler-wallet"],
- }),
-
- typescript({
- tsconfig: false,
- ...baseTypescriptCompilerSettings,
- sourceMap: false,
- }),
+ commonjs(),
],
};
const webExtensionBackgroundPageScript = {
- input: "src/webex/background.ts",
+ input: "lib/background.js",
output: {
- file: "dist/webextension/background.js",
+ file: "dist/background.js",
format: "iife",
exports: "none",
name: "webExtensionBackgroundScript",
},
- external: builtins,
plugins: [
json(),
+ ignore(builtins),
+
nodeResolve({
- preferBuiltins: true,
+ browser: true,
}),
- terser(),
+ //terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
+ "__filename": "'__webextension__'",
}),
- commonjs({
- include: ["node_modules/**", "dist/node/**"],
- extensions: [".js"],
- sourceMap: false,
- ignore: ["taler-wallet", "crypto"],
- }),
-
- typescript({
- tsconfig: false,
- ...baseTypescriptCompilerSettings,
- sourceMap: false,
- }),
+ commonjs()
],
};
const webExtensionCryptoWorker = {
- input: "src/crypto/workers/browserWorkerEntry.ts",
+ input: "lib/browserWorkerEntry.js",
output: {
- file: "dist/webextension/browserWorkerEntry.js",
+ file: "dist/browserWorkerEntry.js",
format: "iife",
exports: "none",
name: "webExtensionCryptoWorker",
},
- external: builtins,
plugins: [
json(),
+ ignore(builtins),
+
nodeResolve({
- preferBuiltins: true,
+ browser: true,
}),
- terser(),
+ //terser(),
replace({
"process.env.NODE_ENV": JSON.stringify("production"),
+ "__filename": "'__webextension__'",
}),
- commonjs({
- include: ["node_modules/**", "dist/node/**"],
- extensions: [".js"],
- sourceMap: false,
- ignore: ["taler-wallet", "crypto"],
- }),
-
- typescript({
- tsconfig: false,
- ...baseTypescriptCompilerSettings,
- sourceMap: false,
- }),
+ commonjs(),
],
};
export default [
- walletCli,
- walletAndroid,
webExtensionPageEntryPoint,
webExtensionBackgroundPageScript,
webExtensionCryptoWorker,
diff --git a/packages/taler-wallet-webextension/src/browserCryptoWorkerFactory.ts b/packages/taler-wallet-webextension/src/browserCryptoWorkerFactory.ts
index b91f49f17..a0a440574 100644
--- a/packages/taler-wallet-webextension/src/browserCryptoWorkerFactory.ts
+++ b/packages/taler-wallet-webextension/src/browserCryptoWorkerFactory.ts
@@ -24,7 +24,7 @@ import type { CryptoWorker, CryptoWorkerFactory } from "taler-wallet-core";
export class BrowserCryptoWorkerFactory implements CryptoWorkerFactory {
startWorker(): CryptoWorker {
const workerCtor = Worker;
- const workerPath = "/browserWorkerEntry.js";
+ const workerPath = "/dist/browserWorkerEntry.js";
return new workerCtor(workerPath) as CryptoWorker;
}
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts b/packages/taler-wallet-webextension/src/wxBackend.ts
index 3adc9a82d..8575c150a 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -496,7 +496,8 @@ function setupHeaderListener(): void {
// Handlers for catching HTTP requests
getPermissionsApi().contains(extendedPermissions, (result: boolean) => {
if (
- chrome.webRequest.onHeadersReceived &&
+ "webRequest" in chrome &&
+ "onHeadersReceived" in chrome.webRequest &&
chrome.webRequest.onHeadersReceived.hasListener(headerListener)
) {
chrome.webRequest.onHeadersReceived.removeListener(headerListener);
@@ -509,11 +510,13 @@ function setupHeaderListener(): void {
["responseHeaders", "blocking"],
);
}
- chrome.webRequest.handlerBehaviorChanged(() => {
- if (chrome.runtime.lastError) {
- console.error(chrome.runtime.lastError);
- }
- });
+ if ("webRequest" in chrome) {
+ chrome.webRequest.handlerBehaviorChanged(() => {
+ if (chrome.runtime.lastError) {
+ console.error(chrome.runtime.lastError);
+ }
+ });
+ }
});
}
diff --git a/packages/taler-wallet-webextension/webextension/static/add-auditor.html b/packages/taler-wallet-webextension/static/add-auditor.html
index 47a97c075..47a97c075 100644
--- a/packages/taler-wallet-webextension/webextension/static/add-auditor.html
+++ b/packages/taler-wallet-webextension/static/add-auditor.html
diff --git a/packages/taler-wallet-webextension/webextension/static/auditors.html b/packages/taler-wallet-webextension/static/auditors.html
index 15261290d..15261290d 100644
--- a/packages/taler-wallet-webextension/webextension/static/auditors.html
+++ b/packages/taler-wallet-webextension/static/auditors.html
diff --git a/packages/taler-wallet-webextension/webextension/static/background.html b/packages/taler-wallet-webextension/static/background.html
index b89c05588..4cd144796 100644
--- a/packages/taler-wallet-webextension/webextension/static/background.html
+++ b/packages/taler-wallet-webextension/static/background.html
@@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
- <script src="/background.js"></script>
+ <script src="/dist/background.js"></script>
<title>(wallet bg page)</title>
</head>
<body>
- <img id="taler-logo" src="/img/icon.png" />
+ <img id="taler-logo" src="/static/img/icon.png" />
</body>
</html>
diff --git a/packages/taler-wallet-webextension/webextension/static/benchmark.html b/packages/taler-wallet-webextension/static/benchmark.html
index a29fe0725..a29fe0725 100644
--- a/packages/taler-wallet-webextension/webextension/static/benchmark.html
+++ b/packages/taler-wallet-webextension/static/benchmark.html
diff --git a/packages/taler-wallet-webextension/webextension/static/img/icon.png b/packages/taler-wallet-webextension/static/img/icon.png
index b4733bebc..b4733bebc 100644
--- a/packages/taler-wallet-webextension/webextension/static/img/icon.png
+++ b/packages/taler-wallet-webextension/static/img/icon.png
Binary files differ
diff --git a/packages/taler-wallet-webextension/webextension/static/img/logo-2015-medium.png b/packages/taler-wallet-webextension/static/img/logo-2015-medium.png
index acf84baaf..acf84baaf 100644
--- a/packages/taler-wallet-webextension/webextension/static/img/logo-2015-medium.png
+++ b/packages/taler-wallet-webextension/static/img/logo-2015-medium.png
Binary files differ
diff --git a/packages/taler-wallet-webextension/webextension/static/img/logo.png b/packages/taler-wallet-webextension/static/img/logo.png
index 1ddb87d2c..1ddb87d2c 120000
--- a/packages/taler-wallet-webextension/webextension/static/img/logo.png
+++ b/packages/taler-wallet-webextension/static/img/logo.png
diff --git a/packages/taler-wallet-webextension/webextension/static/img/spinner-bars.svg b/packages/taler-wallet-webextension/static/img/spinner-bars.svg
index f6f7dfcb3..f6f7dfcb3 100644
--- a/packages/taler-wallet-webextension/webextension/static/img/spinner-bars.svg
+++ b/packages/taler-wallet-webextension/static/img/spinner-bars.svg
diff --git a/packages/taler-wallet-webextension/webextension/static/pay.html b/packages/taler-wallet-webextension/static/pay.html
index 452c56df0..452c56df0 100644
--- a/packages/taler-wallet-webextension/webextension/static/pay.html
+++ b/packages/taler-wallet-webextension/static/pay.html
diff --git a/packages/taler-wallet-webextension/webextension/static/payback.html b/packages/taler-wallet-webextension/static/payback.html
index 7ca9dc974..7ca9dc974 100644
--- a/packages/taler-wallet-webextension/webextension/static/payback.html
+++ b/packages/taler-wallet-webextension/static/payback.html
diff --git a/packages/taler-wallet-webextension/webextension/static/popup.html b/packages/taler-wallet-webextension/static/popup.html
index 83f2f2861..83f2f2861 100644
--- a/packages/taler-wallet-webextension/webextension/static/popup.html
+++ b/packages/taler-wallet-webextension/static/popup.html
diff --git a/packages/taler-wallet-webextension/webextension/static/refund.html b/packages/taler-wallet-webextension/static/refund.html
index 3c1d78a24..3c1d78a24 100644
--- a/packages/taler-wallet-webextension/webextension/static/refund.html
+++ b/packages/taler-wallet-webextension/static/refund.html
diff --git a/packages/taler-wallet-webextension/webextension/static/reset-required.html b/packages/taler-wallet-webextension/static/reset-required.html
index 84943fbf1..84943fbf1 100644
--- a/packages/taler-wallet-webextension/webextension/static/reset-required.html
+++ b/packages/taler-wallet-webextension/static/reset-required.html
diff --git a/packages/taler-wallet-webextension/webextension/static/return-coins.html b/packages/taler-wallet-webextension/static/return-coins.html
index 90703b447..90703b447 100644
--- a/packages/taler-wallet-webextension/webextension/static/return-coins.html
+++ b/packages/taler-wallet-webextension/static/return-coins.html
diff --git a/packages/taler-wallet-webextension/webextension/static/style/popup.css b/packages/taler-wallet-webextension/static/style/popup.css
index cca002399..cca002399 100644
--- a/packages/taler-wallet-webextension/webextension/static/style/popup.css
+++ b/packages/taler-wallet-webextension/static/style/popup.css
diff --git a/packages/taler-wallet-webextension/webextension/static/style/pure.css b/packages/taler-wallet-webextension/static/style/pure.css
index 88a4bb7d7..88a4bb7d7 100644
--- a/packages/taler-wallet-webextension/webextension/static/style/pure.css
+++ b/packages/taler-wallet-webextension/static/style/pure.css
diff --git a/packages/taler-wallet-webextension/webextension/static/style/wallet.css b/packages/taler-wallet-webextension/static/style/wallet.css
index 7c06f2386..7c06f2386 100644
--- a/packages/taler-wallet-webextension/webextension/static/style/wallet.css
+++ b/packages/taler-wallet-webextension/static/style/wallet.css
diff --git a/packages/taler-wallet-webextension/webextension/static/tip.html b/packages/taler-wallet-webextension/static/tip.html
index 00ed4d248..00ed4d248 100644
--- a/packages/taler-wallet-webextension/webextension/static/tip.html
+++ b/packages/taler-wallet-webextension/static/tip.html
diff --git a/packages/taler-wallet-webextension/webextension/static/welcome.html b/packages/taler-wallet-webextension/static/welcome.html
index 07ecac707..07ecac707 100644
--- a/packages/taler-wallet-webextension/webextension/static/welcome.html
+++ b/packages/taler-wallet-webextension/static/welcome.html
diff --git a/packages/taler-wallet-webextension/webextension/static/withdraw.html b/packages/taler-wallet-webextension/static/withdraw.html
index 5137204bd..5137204bd 100644
--- a/packages/taler-wallet-webextension/webextension/static/withdraw.html
+++ b/packages/taler-wallet-webextension/static/withdraw.html
diff --git a/packages/taler-wallet-webextension/tsconfig.json b/packages/taler-wallet-webextension/tsconfig.json
index c3c4144bf..4b1bb19be 100644
--- a/packages/taler-wallet-webextension/tsconfig.json
+++ b/packages/taler-wallet-webextension/tsconfig.json
@@ -3,17 +3,20 @@
"composite": true,
"lib": ["es6", "DOM"],
"jsx": "react",
+ "moduleResolution": "Node",
"reactNamespace": "React",
- "module": "commonjs",
- "target": "es5",
+ "module": "ESNext",
+ "target": "ES6",
"noImplicitAny": true,
"outDir": "lib",
- "declaration": true,
"noEmitOnError": true,
"strict": true,
"incremental": true,
"sourceMap": true,
- "esModuleInterop": true
+ "esModuleInterop": true,
+ "importHelpers": true,
+ "rootDir": "./src",
+ "typeRoots": ["./node_modules/@types"]
},
"include": ["src/**/*"]
}
diff --git a/packages/taler-wallet-webextension/webextension/pack.sh b/packages/taler-wallet-webextension/webextension/pack.sh
deleted file mode 100755
index ef005014f..000000000
--- a/packages/taler-wallet-webextension/webextension/pack.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-
-set -eu
-
-if [[ ! -e package.json ]]; then
- echo "Please run this from the root of the repo.">&2
- exit 1
-fi
-
-vers_manifest=$(jq -r '.version' webextension/manifest.json)
-
-rm -rf dist/wx
-mkdir -p dist/wx
-cp webextension/manifest.json dist/wx/
-cp -r webextension/static/* dist/wx/
-cp -r dist/webextension/* dist/wx/
-
-cd dist/wx
-
-zipfile="../taler-wallet-${vers_manifest}.zip"
-
-rm -f -- "$zipfile"
-zip -r "$zipfile" ./*