gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated (5fcddeed9 -> fcaf43c67)


From: gnunet
Subject: [taler-exchange] branch master updated (5fcddeed9 -> fcaf43c67)
Date: Fri, 23 Aug 2024 09:29:41 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository exchange.

    from 5fcddeed9 fix wire-credit
     new 203719c7a add logic to serve SPA
     new fcaf43c67 work on spa

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 contrib/wallet-core                                |  2 +-
 src/auditor/Makefile.am                            |  1 +
 src/auditor/taler-auditor-httpd.c                  | 16 ++++-
 src/auditor/taler-auditor-httpd.h                  |  1 -
 src/auditor/taler-auditor-httpd_spa.c              | 78 ++++++++++++++++++++++
 .../taler-auditor-httpd_spa.h}                     | 45 ++++++-------
 6 files changed, 114 insertions(+), 29 deletions(-)
 create mode 100644 src/auditor/taler-auditor-httpd_spa.c
 copy src/{exchange/taler-exchange-httpd_spa.h => 
auditor/taler-auditor-httpd_spa.h} (51%)

diff --git a/contrib/wallet-core b/contrib/wallet-core
index 5934e007f..e78b41204 160000
--- a/contrib/wallet-core
+++ b/contrib/wallet-core
@@ -1 +1 @@
-Subproject commit 5934e007f637bd9834a811e67c0a030d7a59f2c0
+Subproject commit e78b4120493e89d836b0a87473eea572ad6c2bbd
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am
index ab25b30f3..622794b78 100644
--- a/src/auditor/Makefile.am
+++ b/src/auditor/Makefile.am
@@ -179,6 +179,7 @@ taler_helper_auditor_wire_debit_LDADD = \
 
 taler_auditor_httpd_SOURCES = \
   taler-auditor-httpd.c taler-auditor-httpd.h \
+  taler-auditor-httpd_spa.c taler-auditor-httpd_spa.h \
   taler-auditor-httpd_deposit-confirmation.c 
taler-auditor-httpd_deposit-confirmation.h \
   taler-auditor-httpd_deposit-confirmation-get.c 
taler-auditor-httpd_deposit-confirmation-get.h \
   taler-auditor-httpd_deposit-confirmation-del.c 
taler-auditor-httpd_deposit-confirmation-del.h \
diff --git a/src/auditor/taler-auditor-httpd.c 
b/src/auditor/taler-auditor-httpd.c
index bda028faf..372d3106b 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -30,6 +30,7 @@
 #include "taler_mhd_lib.h"
 #include "taler_auditordb_lib.h"
 #include "taler_exchangedb_lib.h"
+#include "taler-auditor-httpd_spa.h"
 #include "taler-auditor-httpd_deposit-confirmation.h"
 #include "taler-auditor-httpd_deposit-confirmation-del.h"
 #include "taler-auditor-httpd_deposit-confirmation-get.h"
@@ -406,8 +407,12 @@ handle_mhd_request (void *cls,
       .method = MHD_HTTP_METHOD_PUT,
       .mime_type = "application/json",
       .handler = &TAH_DEPOSIT_CONFIRMATION_handler,
-      .response_code = MHD_HTTP_OK,
-      .requires_auth = true
+      .response_code = MHD_HTTP_OK
+    },
+    {
+      .url = "/spa/",
+      .method = MHD_HTTP_METHOD_GET,
+      .handler = &TAH_spa_handler
     },
     {
       "/monitoring/deposit-confirmation",
@@ -1140,6 +1145,13 @@ run (void *cls,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  if (GNUNET_OK !=
+      TAH_spa_init ())
+  {
+    global_ret = EXIT_NOTCONFIGURED;
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
   TEAH_DEPOSIT_CONFIRMATION_init ();
   fh = TALER_MHD_bind (cfg,
                        "auditor",
diff --git a/src/auditor/taler-auditor-httpd.h 
b/src/auditor/taler-auditor-httpd.h
index 374963cca..3480508aa 100644
--- a/src/auditor/taler-auditor-httpd.h
+++ b/src/auditor/taler-auditor-httpd.h
@@ -84,7 +84,6 @@ struct TAH_RequestHandler
    * Function to call to handle the request.
    *
    * @param rh this struct
-   * @param mime_type the @e mime_type for the reply (hint, can be NULL)
    * @param connection the MHD connection to handle
    * @param[in,out] connection_cls the connection's closure (can be updated)
    * @param upload_data upload data
diff --git a/src/auditor/taler-auditor-httpd_spa.c 
b/src/auditor/taler-auditor-httpd_spa.c
new file mode 100644
index 000000000..fa9a5a540
--- /dev/null
+++ b/src/auditor/taler-auditor-httpd_spa.c
@@ -0,0 +1,78 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2020, 2023, 2024 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU General Public License as published by the Free Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of EXCHANGEABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file taler-auditor-httpd_spa.c
+ * @brief logic to load single page app (/spa)
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include "taler_util.h"
+#include "taler_mhd_lib.h"
+#include <gnunet/gnunet_mhd_compat.h>
+#include "taler-auditor-httpd_spa.h"
+
+
+/**
+ * Resources of the auditor SPA.
+ */
+static struct TALER_MHD_Spa *spa;
+
+
+MHD_RESULT
+TAH_spa_handler (
+  /* const */ struct TAH_RequestHandler *rh,
+  struct MHD_Connection *connection,
+  void **connection_cls,
+  const char *upload_data,
+  size_t *upload_data_size,
+  const char *const args[])
+{
+  const char *path = args[0];
+
+  if (NULL == path)
+    path = "index.html";
+  return TALER_MHD_spa_handler (spa,
+                                connection,
+                                path);
+}
+
+
+enum GNUNET_GenericReturnValue
+TAH_spa_init ()
+{
+  spa = TALER_MHD_spa_load ("auditor/spa/");
+  if (NULL == spa)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_OK;
+}
+
+
+/**
+ * Nicely shut down.
+ */
+void __attribute__ ((destructor))
+get_spa_fini ()
+{
+  if (NULL != spa)
+  {
+    TALER_MHD_spa_free (spa);
+    spa = NULL;
+  }
+}
diff --git a/src/exchange/taler-exchange-httpd_spa.h 
b/src/auditor/taler-auditor-httpd_spa.h
similarity index 51%
copy from src/exchange/taler-exchange-httpd_spa.h
copy to src/auditor/taler-auditor-httpd_spa.h
index 0cdd307f6..5734c29fa 100644
--- a/src/exchange/taler-exchange-httpd_spa.h
+++ b/src/auditor/taler-auditor-httpd_spa.h
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2023 Taler Systems SA
+  Copyright (C) 2024 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -14,41 +14,36 @@
   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
 /**
- * @file taler-exchange-httpd_spa.h
+ * @file taler-auditor-httpd_spa.h
  * @brief logic to preload and serve static files
  * @author Christian Grothoff
  */
-#ifndef TALER_EXCHANGE_HTTPD_SPA_H
-#define TALER_EXCHANGE_HTTPD_SPA_H
+#ifndef TALER_AUDITOR_HTTPD_SPA_H
+#define TALER_AUDITOR_HTTPD_SPA_H
 
 #include <microhttpd.h>
-#include "taler-exchange-httpd.h"
+#include "taler-auditor-httpd.h"
 
 
 /**
  * Return our single-page-app user interface
- * for AML staff (see contrib/wallet-core/).
+ * for staff (see contrib/wallet-core/).
  *
- * @param rc context of the handler
- * @param[in,out] args remaining arguments (ignored)
- * @return #MHD_YES on success (reply queued), #MHD_NO on error (close 
connection)
+ * @param rh request context
+ * @param connection the MHD connection to handle
+ * @param[in,out] connection_cls the connection's closure (can be updated)
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @return MHD result code
  */
 MHD_RESULT
-TEH_handler_aml_spa (struct TEH_RequestContext *rc,
-                     const char *const args[]);
-
-
-/**
- * Return our single-page-app user interface
- * for the KYC process (see contrib/wallet-core/).
- *
- * @param rc context of the handler
- * @param[in,out] args remaining arguments (ignored)
- * @return #MHD_YES on success (reply queued), #MHD_NO on error (close 
connection)
- */
-MHD_RESULT
-TEH_handler_kyc_spa (struct TEH_RequestContext *rc,
-                     const char *const args[]);
+TAH_spa_handler (
+  /* const */ struct TAH_RequestHandler *rh,
+  struct MHD_Connection *connection,
+  void **connection_cls,
+  const char *upload_data,
+  size_t *upload_data_size,
+  const char *const args[]);
 
 
 /**
@@ -57,7 +52,7 @@ TEH_handler_kyc_spa (struct TEH_RequestContext *rc,
  * @return #GNUNET_OK on success
  */
 enum GNUNET_GenericReturnValue
-TEH_spa_init (void);
+TAH_spa_init (void);
 
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]