adding informantion about the service worker version on the setting page
This commit is contained in:
parent
4a0512884d
commit
e0e33a88db
@ -571,7 +571,13 @@ export interface DepositInfo {
|
|||||||
export interface ExchangesListRespose {
|
export interface ExchangesListRespose {
|
||||||
exchanges: ExchangeListItem[];
|
exchanges: ExchangeListItem[];
|
||||||
}
|
}
|
||||||
|
export interface WalletCoreVersion {
|
||||||
|
hash: string | undefined;
|
||||||
|
version: string;
|
||||||
|
exchange: string;
|
||||||
|
merchant: string;
|
||||||
|
bank: string;
|
||||||
|
}
|
||||||
export interface KnownBankAccounts {
|
export interface KnownBankAccounts {
|
||||||
accounts: { [payto: string]: PaytoUri };
|
accounts: { [payto: string]: PaytoUri };
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,17 @@ import json from "@rollup/plugin-json";
|
|||||||
import builtins from "builtin-modules";
|
import builtins from "builtin-modules";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
import sourcemaps from "rollup-plugin-sourcemaps";
|
import sourcemaps from "rollup-plugin-sourcemaps";
|
||||||
|
import replace from '@rollup/plugin-replace';
|
||||||
|
import path from "path"
|
||||||
|
import fs from "fs"
|
||||||
|
|
||||||
|
const BASE = process.cwd()
|
||||||
|
|
||||||
|
let GIT_ROOT = BASE
|
||||||
|
while (!fs.existsSync(path.join(GIT_ROOT, '.git')) && GIT_ROOT !== '/') {
|
||||||
|
GIT_ROOT = path.join(GIT_ROOT, '../')
|
||||||
|
}
|
||||||
|
const GIT_HASH = GIT_ROOT === '/' ? undefined : git_hash()
|
||||||
|
|
||||||
const nodeEntryPoint = {
|
const nodeEntryPoint = {
|
||||||
input: "lib/index.node.js",
|
input: "lib/index.node.js",
|
||||||
@ -21,6 +32,10 @@ const nodeEntryPoint = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
sourcemaps(),
|
sourcemaps(),
|
||||||
|
replace({
|
||||||
|
'__VERSION__': `"${pkg.version}"`,
|
||||||
|
'__GIT_HASH__': `"${GIT_HASH}"`,
|
||||||
|
}),
|
||||||
|
|
||||||
commonjs({
|
commonjs({
|
||||||
include: [/node_modules/, /dist/],
|
include: [/node_modules/, /dist/],
|
||||||
@ -61,3 +76,12 @@ const browserEntryPoint = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default [nodeEntryPoint, browserEntryPoint];
|
export default [nodeEntryPoint, browserEntryPoint];
|
||||||
|
|
||||||
|
function git_hash() {
|
||||||
|
const rev = fs.readFileSync(path.join(GIT_ROOT, '.git', 'HEAD')).toString().trim().split(/.*[: ]/).slice(-1)[0];
|
||||||
|
if (rev.indexOf('/') === -1) {
|
||||||
|
return rev;
|
||||||
|
} else {
|
||||||
|
return fs.readFileSync(path.join(GIT_ROOT, '.git', rev)).toString().trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -86,6 +86,7 @@ import {
|
|||||||
TalerErrorCode,
|
TalerErrorCode,
|
||||||
URL,
|
URL,
|
||||||
WalletNotification,
|
WalletNotification,
|
||||||
|
WalletCoreVersion,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
|
import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
|
||||||
import {
|
import {
|
||||||
@ -206,6 +207,7 @@ import {
|
|||||||
} from "./util/promiseUtils.js";
|
} from "./util/promiseUtils.js";
|
||||||
import { DbAccess, GetReadWriteAccess } from "./util/query.js";
|
import { DbAccess, GetReadWriteAccess } from "./util/query.js";
|
||||||
import { TimerAPI, TimerGroup } from "./util/timer.js";
|
import { TimerAPI, TimerGroup } from "./util/timer.js";
|
||||||
|
import { WALLET_BANK_INTEGRATION_PROTOCOL_VERSION, WALLET_EXCHANGE_PROTOCOL_VERSION, WALLET_MERCHANT_PROTOCOL_VERSION } from "./versions.js";
|
||||||
import { WalletCoreApiClient } from "./wallet-api-types.js";
|
import { WalletCoreApiClient } from "./wallet-api-types.js";
|
||||||
|
|
||||||
const builtinAuditors: AuditorTrustRecord[] = [
|
const builtinAuditors: AuditorTrustRecord[] = [
|
||||||
@ -714,6 +716,11 @@ export async function getClientFromWalletState(
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare const __VERSION__: string;
|
||||||
|
declare const __GIT_HASH__: string;
|
||||||
|
|
||||||
|
const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev";
|
||||||
|
const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined;
|
||||||
/**
|
/**
|
||||||
* Implementation of the "wallet-core" API.
|
* Implementation of the "wallet-core" API.
|
||||||
*/
|
*/
|
||||||
@ -1064,6 +1071,16 @@ async function dispatchRequestInternal(
|
|||||||
await acceptPeerPullPayment(ws, req);
|
await acceptPeerPullPayment(ws, req);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
case "getVersion": {
|
||||||
|
const version: WalletCoreVersion = {
|
||||||
|
hash: GIT_HASH,
|
||||||
|
version: VERSION,
|
||||||
|
exchange: WALLET_EXCHANGE_PROTOCOL_VERSION,
|
||||||
|
merchant: WALLET_MERCHANT_PROTOCOL_VERSION,
|
||||||
|
bank: WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw TalerError.fromDetail(
|
throw TalerError.fromDetail(
|
||||||
TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN,
|
TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN,
|
||||||
|
@ -46,7 +46,7 @@ export type MessageFromBackend = {
|
|||||||
type: NotificationType;
|
type: NotificationType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface WalletVersion {
|
export interface WalletWebExVersion {
|
||||||
version_name?: string | undefined;
|
version_name?: string | undefined;
|
||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ export interface PlatformAPI {
|
|||||||
/**
|
/**
|
||||||
* Get the wallet version from manifest
|
* Get the wallet version from manifest
|
||||||
*/
|
*/
|
||||||
getWalletVersion(): WalletVersion;
|
getWalletWebExVersion(): WalletWebExVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend API
|
* Backend API
|
||||||
|
@ -31,7 +31,7 @@ const api: PlatformAPI = {
|
|||||||
isFirefox,
|
isFirefox,
|
||||||
findTalerUriInActiveTab,
|
findTalerUriInActiveTab,
|
||||||
getPermissionsApi,
|
getPermissionsApi,
|
||||||
getWalletVersion,
|
getWalletWebExVersion,
|
||||||
listenToWalletBackground,
|
listenToWalletBackground,
|
||||||
notifyWhenAppIsReady,
|
notifyWhenAppIsReady,
|
||||||
openWalletPage,
|
openWalletPage,
|
||||||
@ -338,7 +338,7 @@ interface WalletVersion {
|
|||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWalletVersion(): WalletVersion {
|
function getWalletWebExVersion(): WalletVersion {
|
||||||
const manifestData = chrome.runtime.getManifest();
|
const manifestData = chrome.runtime.getManifest();
|
||||||
return manifestData;
|
return manifestData;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ const api: PlatformAPI = {
|
|||||||
removeHostPermissions: async () => false,
|
removeHostPermissions: async () => false,
|
||||||
requestHostPermissions: async () => false,
|
requestHostPermissions: async () => false,
|
||||||
}),
|
}),
|
||||||
getWalletVersion: () => ({
|
getWalletWebExVersion: () => ({
|
||||||
version: "none",
|
version: "none",
|
||||||
}),
|
}),
|
||||||
notifyWhenAppIsReady: (fn: () => void) => {
|
notifyWhenAppIsReady: (fn: () => void) => {
|
||||||
|
@ -30,16 +30,32 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const version = {
|
||||||
|
coreVersion: {
|
||||||
|
exchange: "12:0:0",
|
||||||
|
merchant: "2:0:1",
|
||||||
|
bank: "0:0:0",
|
||||||
|
hash: "d439c3e1bc743f2aa47de4457953dba6ecb0e20f",
|
||||||
|
version: "0.9.0-dev.1",
|
||||||
|
},
|
||||||
|
webexVersion: {
|
||||||
|
version: "0.9.0.13",
|
||||||
|
hash: "d439c3e1bc743f2aa47de4457953dba6ecb0e20f",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export const AllOff = createExample(TestedComponent, {
|
export const AllOff = createExample(TestedComponent, {
|
||||||
deviceName: "this-is-the-device-name",
|
deviceName: "this-is-the-device-name",
|
||||||
permissionToggle: { value: false, button: {} },
|
permissionToggle: { value: false, button: {} },
|
||||||
setDeviceName: () => Promise.resolve(),
|
setDeviceName: () => Promise.resolve(),
|
||||||
|
...version,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const OneChecked = createExample(TestedComponent, {
|
export const OneChecked = createExample(TestedComponent, {
|
||||||
deviceName: "this-is-the-device-name",
|
deviceName: "this-is-the-device-name",
|
||||||
permissionToggle: { value: false, button: {} },
|
permissionToggle: { value: false, button: {} },
|
||||||
setDeviceName: () => Promise.resolve(),
|
setDeviceName: () => Promise.resolve(),
|
||||||
|
...version,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const WithOneExchange = createExample(TestedComponent, {
|
export const WithOneExchange = createExample(TestedComponent, {
|
||||||
@ -59,6 +75,7 @@ export const WithOneExchange = createExample(TestedComponent, {
|
|||||||
paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
|
paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
|
||||||
} as any, //TODO: complete with auditors, wireInfo and denominations
|
} as any, //TODO: complete with auditors, wireInfo and denominations
|
||||||
],
|
],
|
||||||
|
...version,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const WithExchangeInDifferentState = createExample(TestedComponent, {
|
export const WithExchangeInDifferentState = createExample(TestedComponent, {
|
||||||
@ -99,4 +116,5 @@ export const WithExchangeInDifferentState = createExample(TestedComponent, {
|
|||||||
paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
|
paytoUris: ["payto://x-taler-bank/bank.rpi.sebasjm.com/exchangeminator"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
...version,
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ExchangeListItem } from "@gnu-taler/taler-util";
|
import { ExchangeListItem, WalletCoreVersion } from "@gnu-taler/taler-util";
|
||||||
import { Fragment, h, VNode } from "preact";
|
import { Fragment, h, VNode } from "preact";
|
||||||
import { Checkbox } from "../components/Checkbox.js";
|
import { Checkbox } from "../components/Checkbox.js";
|
||||||
import { ErrorTalerOperation } from "../components/ErrorTalerOperation.js";
|
import { ErrorTalerOperation } from "../components/ErrorTalerOperation.js";
|
||||||
@ -38,26 +38,39 @@ import { ToggleHandler } from "../mui/handlers.js";
|
|||||||
import { Pages } from "../NavigationBar.js";
|
import { Pages } from "../NavigationBar.js";
|
||||||
import { buildTermsOfServiceStatus } from "../utils/index.js";
|
import { buildTermsOfServiceStatus } from "../utils/index.js";
|
||||||
import * as wxApi from "../wxApi.js";
|
import * as wxApi from "../wxApi.js";
|
||||||
|
import { platform } from "../platform/api.js";
|
||||||
|
|
||||||
|
const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined;
|
||||||
|
|
||||||
export function SettingsPage(): VNode {
|
export function SettingsPage(): VNode {
|
||||||
const permissionToggle = useExtendedPermissions();
|
const permissionToggle = useExtendedPermissions();
|
||||||
const { devMode, toggleDevMode } = useDevContext();
|
const { devMode, toggleDevMode } = useDevContext();
|
||||||
const { name, update } = useBackupDeviceName();
|
const { name, update } = useBackupDeviceName();
|
||||||
|
const webex = platform.getWalletWebExVersion();
|
||||||
|
|
||||||
const exchangesHook = useAsyncAsHook(wxApi.listExchanges);
|
const exchangesHook = useAsyncAsHook(async () => {
|
||||||
|
const list = await wxApi.listExchanges();
|
||||||
|
const version = await wxApi.getVersion();
|
||||||
|
return { exchanges: list.exchanges, version };
|
||||||
|
});
|
||||||
|
const { exchanges, version } =
|
||||||
|
!exchangesHook || exchangesHook.hasError
|
||||||
|
? { exchanges: [], version: undefined }
|
||||||
|
: exchangesHook.response;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsView
|
<SettingsView
|
||||||
knownExchanges={
|
knownExchanges={exchanges}
|
||||||
!exchangesHook || exchangesHook.hasError
|
|
||||||
? []
|
|
||||||
: exchangesHook.response.exchanges
|
|
||||||
}
|
|
||||||
deviceName={name}
|
deviceName={name}
|
||||||
setDeviceName={update}
|
setDeviceName={update}
|
||||||
permissionToggle={permissionToggle}
|
permissionToggle={permissionToggle}
|
||||||
developerMode={devMode}
|
developerMode={devMode}
|
||||||
toggleDeveloperMode={toggleDevMode}
|
toggleDeveloperMode={toggleDevMode}
|
||||||
|
webexVersion={{
|
||||||
|
version: webex.version,
|
||||||
|
hash: GIT_HASH,
|
||||||
|
}}
|
||||||
|
coreVersion={version}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -69,14 +82,19 @@ export interface ViewProps {
|
|||||||
developerMode: boolean;
|
developerMode: boolean;
|
||||||
toggleDeveloperMode: () => Promise<void>;
|
toggleDeveloperMode: () => Promise<void>;
|
||||||
knownExchanges: Array<ExchangeListItem>;
|
knownExchanges: Array<ExchangeListItem>;
|
||||||
|
coreVersion: WalletCoreVersion | undefined;
|
||||||
|
webexVersion: {
|
||||||
|
version: string;
|
||||||
|
hash: string | undefined;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev";
|
|
||||||
const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined;
|
|
||||||
|
|
||||||
export function SettingsView({
|
export function SettingsView({
|
||||||
knownExchanges,
|
knownExchanges,
|
||||||
permissionToggle,
|
permissionToggle,
|
||||||
developerMode,
|
developerMode,
|
||||||
|
coreVersion,
|
||||||
|
webexVersion,
|
||||||
toggleDeveloperMode,
|
toggleDeveloperMode,
|
||||||
}: ViewProps): VNode {
|
}: ViewProps): VNode {
|
||||||
const { i18n, lang, supportedLang, changeLanguage } = useTranslationContext();
|
const { i18n, lang, supportedLang, changeLanguage } = useTranslationContext();
|
||||||
@ -216,16 +234,42 @@ export function SettingsView({
|
|||||||
<SubTitle>
|
<SubTitle>
|
||||||
<i18n.Translate>Version</i18n.Translate>
|
<i18n.Translate>Version</i18n.Translate>
|
||||||
</SubTitle>
|
</SubTitle>
|
||||||
<Part
|
{coreVersion && (
|
||||||
title={<i18n.Translate>Release</i18n.Translate>}
|
|
||||||
text={<span>{VERSION}</span>}
|
|
||||||
/>
|
|
||||||
{GIT_HASH && (
|
|
||||||
<Part
|
<Part
|
||||||
title={<i18n.Translate>Hash</i18n.Translate>}
|
title={<i18n.Translate>Wallet Core</i18n.Translate>}
|
||||||
text={<span>{GIT_HASH}</span>}
|
text={
|
||||||
|
<span>
|
||||||
|
{coreVersion.version}{" "}
|
||||||
|
<JustInDevMode>{coreVersion.hash}</JustInDevMode>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Web Extension</i18n.Translate>}
|
||||||
|
text={
|
||||||
|
<span>
|
||||||
|
{webexVersion.version}{" "}
|
||||||
|
<JustInDevMode>{webexVersion.hash}</JustInDevMode>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
{coreVersion && (
|
||||||
|
<JustInDevMode>
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Exchange compatibility</i18n.Translate>}
|
||||||
|
text={<span>{coreVersion.exchange}</span>}
|
||||||
|
/>
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Merchant compatibility</i18n.Translate>}
|
||||||
|
text={<span>{coreVersion.merchant}</span>}
|
||||||
|
/>
|
||||||
|
<Part
|
||||||
|
title={<i18n.Translate>Bank compatibility</i18n.Translate>}
|
||||||
|
text={<span>{coreVersion.bank}</span>}
|
||||||
|
/>
|
||||||
|
</JustInDevMode>
|
||||||
|
)}
|
||||||
</section>
|
</section>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
@ -65,6 +65,7 @@ import {
|
|||||||
SetWalletDeviceIdRequest,
|
SetWalletDeviceIdRequest,
|
||||||
TransactionsResponse,
|
TransactionsResponse,
|
||||||
WalletDiagnostics,
|
WalletDiagnostics,
|
||||||
|
WalletCoreVersion,
|
||||||
WithdrawUriInfoResponse,
|
WithdrawUriInfoResponse,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
@ -77,7 +78,7 @@ import {
|
|||||||
} from "@gnu-taler/taler-wallet-core";
|
} from "@gnu-taler/taler-wallet-core";
|
||||||
import type { DepositGroupFees } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
import type { DepositGroupFees } from "@gnu-taler/taler-wallet-core/src/operations/deposits";
|
||||||
import type { ExchangeWithdrawDetails } from "@gnu-taler/taler-wallet-core/src/operations/withdraw";
|
import type { ExchangeWithdrawDetails } from "@gnu-taler/taler-wallet-core/src/operations/withdraw";
|
||||||
import { platform, MessageFromBackend } from "./platform/api.js";
|
import { platform, MessageFromBackend, WalletWebExVersion } from "./platform/api.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -249,6 +250,9 @@ export function listKnownCurrencies(): Promise<ListOfKnownCurrencies> {
|
|||||||
export function listExchanges(): Promise<ExchangesListRespose> {
|
export function listExchanges(): Promise<ExchangesListRespose> {
|
||||||
return callBackend("listExchanges", {});
|
return callBackend("listExchanges", {});
|
||||||
}
|
}
|
||||||
|
export function getVersion(): Promise<WalletCoreVersion> {
|
||||||
|
return callBackend("getVersion", {});
|
||||||
|
}
|
||||||
export function listKnownBankAccounts(
|
export function listKnownBankAccounts(
|
||||||
currency?: string,
|
currency?: string,
|
||||||
): Promise<KnownBankAccounts> {
|
): Promise<KnownBankAccounts> {
|
||||||
|
@ -71,7 +71,7 @@ const walletInit: OpenedPromise<void> = openPromise<void>();
|
|||||||
const logger = new Logger("wxBackend.ts");
|
const logger = new Logger("wxBackend.ts");
|
||||||
|
|
||||||
async function getDiagnostics(): Promise<WalletDiagnostics> {
|
async function getDiagnostics(): Promise<WalletDiagnostics> {
|
||||||
const manifestData = platform.getWalletVersion();
|
const manifestData = platform.getWalletWebExVersion();
|
||||||
const errors: string[] = [];
|
const errors: string[] = [];
|
||||||
let firefoxIdbProblem = false;
|
let firefoxIdbProblem = false;
|
||||||
let dbOutdated = false;
|
let dbOutdated = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user