gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: added back terms


From: gnunet
Subject: [taler-donau] branch master updated: added back terms
Date: Mon, 08 Jan 2024 22:36:14 +0100

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 3a42b4c  added back terms
3a42b4c is described below

commit 3a42b4c8f95b703ab2bfd733059ff0a815dfefc9
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Mon Jan 8 22:35:37 2024 +0100

    added back terms
---
 src/donau/Makefile.am         |  3 +-
 src/donau/donau-httpd.c       | 46 +++++++++++++++---------
 src/donau/donau-httpd_terms.c | 82 +++++++++++++++++++++++++++++++++++++++++++
 src/donau/donau-httpd_terms.h | 66 ++++++++++++++++++++++++++++++++++
 4 files changed, 179 insertions(+), 18 deletions(-)

diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
index e89f2ff..eb26988 100644
--- a/src/donau/Makefile.am
+++ b/src/donau/Makefile.am
@@ -42,7 +42,8 @@ donau_httpd_SOURCES = \
   donau-httpd_keys.c donau-httpd_keys.h \
   donau-httpd_config.c donau-httpd_config.h \
   donau-httpd_get-charities.c donau_httpd_charity.h \
-  donau-httpd_get-charity.c donau-httpd_post-charity.c
+  donau-httpd_get-charity.c donau-httpd_post-charity.c \
+  donau-httpd_terms.c donau-httpd_terms.h
 
 # Testcases
 
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
index cb70cf8..c3b7320 100644
--- a/src/donau/donau-httpd.c
+++ b/src/donau/donau-httpd.c
@@ -30,12 +30,13 @@
 // #include "taler/taler_templating_lib.h"
 #include "taler/taler_mhd_lib.h"
 #include "donaudb_lib.h"
-#include "donaudb_plugin.h"
-#include <gnunet/gnunet_mhd_compat.h>
 #include "donau_util.h"
 #include "donau-httpd_config.h"
 #include "donau-httpd_keys.h"
 #include "donau-httpd_charity.h"
+#include "donau-httpd_terms.h"
+#include "donaudb_plugin.h"
+#include <gnunet/gnunet_mhd_compat.h>
 
 /**
  * Backlog for listen operation on unix domain sockets.
@@ -243,20 +244,19 @@ handle_mhd_completion_callback (void *cls,
 
   TALER_MHD_parse_post_cleanup_callback (rc->opaque_post_parsing_context);
   /* Sanity-check that we didn't leave any transactions hanging */
-  // GNUNET_break (GNUNET_OK ==
-  //               DH_plugin->preflight (DH_plugin->cls));
-  // {
-  //   struct GNUNET_TIME_Relative latency;
-
-  //   latency = GNUNET_TIME_absolute_get_duration (rc->start_time);
-  //   if (latency.rel_value_us >
-  //       WARN_LATENCY.rel_value_us)
-  //     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-  //                 "Request for `%s' took %s\n",
-  //                 rc->url,
-  //                 GNUNET_STRINGS_relative_time_to_string (latency,
-  //                                                         GNUNET_YES));
-  // }
+  GNUNET_break (GNUNET_OK ==
+                DH_plugin->preflight (DH_plugin->cls));
+  {
+    struct GNUNET_TIME_Relative latency;
+    latency = GNUNET_TIME_absolute_get_duration (rc->start_time);
+    if (latency.rel_value_us >
+        WARN_LATENCY.rel_value_us)
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Request for `%s' took %s\n",
+                  rc->url,
+                  GNUNET_STRINGS_relative_time_to_string (latency,
+                                                          GNUNET_YES));
+  }
   GNUNET_free (rc);
   *con_cls = NULL;
   GNUNET_async_scope_restore (&old_scope);
@@ -420,6 +420,18 @@ handle_mhd_request (void *cls,
       .data = "User-agent: *\nDisallow: /\n",
       .response_code = MHD_HTTP_OK
     },
+    /* Terms of service */
+    {
+      .url = "terms",
+      .method = MHD_HTTP_METHOD_GET,
+      .handler.get = &DH_handler_terms
+    },
+    /* Privacy policy */
+    {
+      .url = "privacy",
+      .method = MHD_HTTP_METHOD_GET,
+      .handler.get = &DH_handler_privacy
+    },
     /* Configuration */
     {
       .url = "config",
@@ -872,7 +884,7 @@ run (void *cls,
     return;
   }
 
-  // DH_load_terms (DH_cfg);
+  DH_load_terms (DH_cfg);
   DH_curl_ctx
     = GNUNET_CURL_init (&GNUNET_CURL_gnunet_scheduler_reschedule,
                         &donau_curl_rc);
diff --git a/src/donau/donau-httpd_terms.c b/src/donau/donau-httpd_terms.c
new file mode 100644
index 0000000..e7d095e
--- /dev/null
+++ b/src/donau/donau-httpd_terms.c
@@ -0,0 +1,82 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2019, 2021 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU Affero 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 MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+  You should have received a copy of the GNU Affero General Public License 
along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_terms.c
+ * @brief Handle /terms requests to return the terms of service
+ * @author Christian Grothoff
+ */
+#include "taler/platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_json_lib.h>
+#include <jansson.h>
+#include <microhttpd.h>
+#include "taler/taler_mhd_lib.h"
+#include "donau-httpd_terms.h"
+// #include "donau-httpd_responses.h"
+
+/**
+ * Our terms of service.
+ */
+static struct TALER_MHD_Legal *tos;
+
+
+/**
+ * Our privacy policy.
+ */
+static struct TALER_MHD_Legal *pp;
+
+
+MHD_RESULT
+DH_handler_terms (struct DH_RequestContext *rc,
+                  const char *const args[])
+{
+  (void) args;
+  return TALER_MHD_reply_legal (rc->connection,
+                                tos);
+}
+
+
+MHD_RESULT
+DH_handler_privacy (struct DH_RequestContext *rc,
+                    const char *const args[])
+{
+  (void) args;
+  return TALER_MHD_reply_legal (rc->connection,
+                                pp);
+}
+
+
+void
+DH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  tos = TALER_MHD_legal_load (cfg,
+                              "donau",
+                              "TERMS_DIR",
+                              "TERMS_ETAG");
+  if (NULL == tos)
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Terms of service not configured\n");
+  pp = TALER_MHD_legal_load (cfg,
+                             "donau",
+                             "PRIVACY_DIR",
+                             "PRIVACY_ETAG");
+  if (NULL == pp)
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Privacy policy not configured\n");
+}
+
+
+/* end of donau-httpd_terms.c */
diff --git a/src/donau/donau-httpd_terms.h b/src/donau/donau-httpd_terms.h
new file mode 100644
index 0000000..1dbf328
--- /dev/null
+++ b/src/donau/donau-httpd_terms.h
@@ -0,0 +1,66 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2019, 2021 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU Affero 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 MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more 
details.
+
+  You should have received a copy of the GNU Affero General Public License 
along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_terms.h
+ * @brief Handle /terms requests to return the terms of service
+ * @author Christian Grothoff
+ */
+#ifndef DONAU_HTTPD_TERMS_H
+#define DONAU_HTTPD_TERMS_H
+#include "taler/platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_json_lib.h>
+#include <jansson.h>
+#include <microhttpd.h>
+#include "taler/taler_mhd_lib.h"
+#include "donau-httpd.h"
+// #include "donau-httpd_responses.h"
+
+
+/**
+ * Handle a "/terms" request.
+ *
+ * @param rc request context
+ * @param args array of additional options (must be empty for this function)
+ * @return MHD result code
+ */
+MHD_RESULT
+DH_handler_terms (struct DH_RequestContext *rc,
+                  const char *const args[]);
+
+
+/**
+ * Handle a "/privacy" request.
+ *
+ * @param rc request context
+ * @param args array of additional options (must be empty for this function)
+ * @return MHD result code
+ */
+MHD_RESULT
+DH_handler_privacy (struct DH_RequestContext *rc,
+                    const char *const args[]);
+
+
+/**
+ * Load our terms of service as per configuration.
+ *
+ * @param cfg configuration to process
+ */
+void
+DH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
+#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]