commit a484bb2e36582c54c54257b10c82aaaeafbed127
parent a4d263a1e5e909a5a59c8cdf11f1644a050e421c
Author: Florian Dold <florian@dold.me>
Date: Tue, 9 Jun 2026 21:05:29 +0200
depend on taler-merchant-webui, serve fallback page by default
Diffstat:
8 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/contrib/check-prebuilt b/contrib/check-prebuilt
@@ -1,15 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import sys
-
-contrib = os.path.abspath(os.path.dirname(__file__))
-
-merchant_spa_ver_lock = open(contrib + "/" + "merchant-spa.lock").read().strip()
-merchant_spa_ver_prebuilt = open(contrib + "/" + "wallet-core/backoffice/version.txt").read().strip()
-
-if merchant_spa_ver_lock != merchant_spa_ver_prebuilt:
- print("merchant SPA version mismatch: merchant-spa.lock")
- print("lockfile has version", merchant_spa_ver_lock)
- print("prebuilt has version", merchant_spa_ver_prebuilt)
- sys.exit(1)
diff --git a/contrib/merchant-spa.lock b/contrib/merchant-spa.lock
@@ -1 +0,0 @@
-1.5.14
-\ No newline at end of file
diff --git a/contrib/meson.build b/contrib/meson.build
@@ -40,7 +40,7 @@ install_data(
)
install_subdir(
- 'wallet-core' / 'backoffice',
+ 'spa',
strip_directory: true,
install_dir: get_option('datadir') / 'taler-merchant' / 'spa',
)
diff --git a/contrib/spa/index.html b/contrib/spa/index.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <h1>Taler Merchant Web UI not installed</h1>
+ <p>This is a fallback page shown when the Taler Merchant Web UI is not
+ available.</p>
+ <p>Please make sure the page is installed and the
+ <code>BACKOFFICE_SPA_DIR</code> option in the <code>[merchant]</code> section of
+ the taler-merchant configuration is set correctly.</p>
+</body>
+</html>
diff --git a/debian/control b/debian/control
@@ -53,6 +53,7 @@ Pre-Depends:
Depends:
libtalermerchant (= ${binary:Version}),
libtalerexchange (>= 1.5.0),
+ taler-merchant-webui,
adduser,
lsb-base,
netbase,
diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf
@@ -63,6 +63,8 @@ DEFAULT_PAY_DELAY = 1 day
# Where are the Typst templates for form rendering.
TYPST_TEMPLATES = @taler-merchant
+# Where is the webui installed?
+BACKOFFICE_SPA_DIR = $PREFIX/share/taler-merchant-webui/
[merchant-kyccheck]
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -1529,10 +1529,10 @@ run (void *cls,
}
}
if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_string (TMH_cfg,
- "merchant",
- "BACKOFFICE_SPA_DIR",
- &TMH_spa_dir))
+ GNUNET_CONFIGURATION_get_value_filename (TMH_cfg,
+ "merchant",
+ "BACKOFFICE_SPA_DIR",
+ &TMH_spa_dir))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Loading merchant SPA from %s\n",
diff --git a/src/backend/taler-merchant-httpd_get-webui.c b/src/backend/taler-merchant-httpd_get-webui.c
@@ -19,6 +19,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#include <sys/stat.h>
#include <gnunet/gnunet_util_lib.h>
#include <taler/taler_util.h>
#include <taler/taler_mhd_lib.h>
@@ -54,7 +55,19 @@ TMH_return_spa (const struct TMH_RequestHandler *rh,
enum GNUNET_GenericReturnValue
TMH_spa_init (const char *spa_dir)
{
- if (NULL == spa_dir)
+ bool have_spa = false;
+ if (NULL != spa_dir)
+ {
+ struct stat sb;
+ have_spa = stat (spa_dir, &sb) == 0 && S_ISDIR (sb.st_mode);
+ if (! have_spa)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "SPA not found at '%s', using fallback\n",
+ spa_dir);
+ }
+ }
+ if (! have_spa)
spa = TALER_MHD_spa_load (TALER_MERCHANT_project_data (),
"spa/");
else