diff options
author | Florian Dold <florian@dold.me> | 2024-01-23 22:29:21 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-23 22:29:21 +0100 |
commit | 937d9204e6c66bdc13e7b770a125d008bdfc6587 (patch) | |
tree | f41be3147e18011122e315a1fe4f198facd2f9e8 /packages/taler-wallet-core | |
parent | 7e7306ec4585c5fd7a2ceb727177e7d249ae6031 (diff) | |
download | wallet-core-937d9204e6c66bdc13e7b770a125d008bdfc6587.tar.xz |
wallet-core: expose build version info via request
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/versions.ts | 16 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/versions.ts b/packages/taler-wallet-core/src/versions.ts index 023cbb1ff..bf8a9f7c8 100644 --- a/packages/taler-wallet-core/src/versions.ts +++ b/packages/taler-wallet-core/src/versions.ts @@ -68,3 +68,19 @@ export const WALLET_CORE_API_IMPLEMENTATION_VERSION = "3:0:2"; * If any interfaces have been removed or changed since the last public * release, then set age to 0. */ + +// Provided either by bundler or in the next lines. +declare global { + const walletCoreBuildInfo: { + implementationSemver: string; + implementationGitHash: string; + }; +} + +// Provide walletCoreBuildInfo if the bundler does not override it. +if (!("walletCoreBuildInfo" in globalThis)) { + (globalThis as any).walletCoreBuildInfo = { + implementationSemver: "unknown", + implementationGitHash: "unknown", + } satisfies typeof walletCoreBuildInfo; +} diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 831f72259..72e9750bc 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1556,6 +1556,8 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( export function getVersion(ws: InternalWalletState): WalletCoreVersion { const result: WalletCoreVersion = { + implementationSemver: walletCoreBuildInfo.implementationSemver, + implementationGitHash: walletCoreBuildInfo.implementationGitHash, hash: undefined, version: WALLET_CORE_API_IMPLEMENTATION_VERSION, exchange: WALLET_EXCHANGE_PROTOCOL_VERSION, |