chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ta / taler-exchange / 0001-add-TALER_TEMPLATING_init_path.patch
blob60ea8051366e175a81c946a7b2bd68d090609042
1 From 3ca51717bbb7643eb0629729d0680cca75ce34c8 Mon Sep 17 00:00:00 2001
2 From: eljamm <fedi.jamoussi@protonmail.ch>
3 Date: Wed, 14 Aug 2024 11:14:41 +0100
4 Subject: [PATCH] add TALER_TEMPLATING_init_path
6 The merchant uses `TALER_TEMPLATING_init` function from the exchange's
7 headers, which makes it harder to patch in the correct directory.
9 To circumvent this, a similar function that takes the templates path
10 directly is added.
11 ---
12 src/include/taler_templating_lib.h | 9 +++++++++
13 src/templating/templating_api.c | 25 +++++++++++++++++++++++++
14 2 files changed, 34 insertions(+)
16 diff --git a/src/include/taler_templating_lib.h b/src/include/taler_templating_lib.h
17 index 6af6db715..343004ef1 100644
18 --- a/src/include/taler_templating_lib.h
19 +++ b/src/include/taler_templating_lib.h
20 @@ -120,6 +120,16 @@ TALER_TEMPLATING_reply_error (struct MHD_Connection *connection,
21 enum GNUNET_GenericReturnValue
22 TALER_TEMPLATING_init (const char *subsystem);
24 +/**
25 + * Preload templates from path.
26 + *
27 + * @param subsystem name of the subsystem, "merchant" or "exchange"
28 + * @param path name of the absolute template path
29 + * @return #GNUNET_OK on success
30 + */
31 +enum GNUNET_GenericReturnValue
32 +TALER_TEMPLATING_init_path (const char *subsystem, const char *path);
35 /**
36 * Nicely shut down templating subsystem.
37 diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c
38 index 88a17c682..a9afa2b70 100644
39 --- a/src/templating/templating_api.c
40 +++ b/src/templating/templating_api.c
41 @@ -506,6 +506,31 @@ TALER_TEMPLATING_init (const char *subsystem)
45 +enum GNUNET_GenericReturnValue
46 +TALER_TEMPLATING_init_path (const char *subsystem, const char *path)
48 + char *dn;
49 + int ret;
51 + {
52 + GNUNET_asprintf (&dn,
53 + "%s/%s/templates/",
54 + path,
55 + subsystem);
56 + }
57 + ret = GNUNET_DISK_directory_scan (dn,
58 + &load_template,
59 + NULL);
60 + GNUNET_free (dn);
61 + if (-1 == ret)
62 + {
63 + GNUNET_break (0);
64 + return GNUNET_SYSERR;
65 + }
66 + return GNUNET_OK;
70 void
71 TALER_TEMPLATING_done (void)
74 2.45.2