donau-httpd_terms.c (2278B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2024 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file donau-httpd_terms.c 18 * @brief Handle /terms requests to return the terms of service 19 * @author Christian Grothoff 20 */ 21 #include <donau_config.h> 22 #include <gnunet/gnunet_util_lib.h> 23 #include <gnunet/gnunet_json_lib.h> 24 #include <jansson.h> 25 #include <microhttpd.h> 26 #include <taler/taler_mhd_lib.h> 27 #include "donau-httpd_terms.h" 28 29 /** 30 * Our terms of service. 31 */ 32 static struct TALER_MHD_Legal *tos; 33 34 35 /** 36 * Our privacy policy. 37 */ 38 static struct TALER_MHD_Legal *pp; 39 40 41 enum MHD_Result 42 DH_handler_terms (struct DH_RequestContext *rc, 43 const char *const args[]) 44 { 45 (void) args; 46 return TALER_MHD_reply_legal (rc->connection, 47 tos); 48 } 49 50 51 enum MHD_Result 52 DH_handler_privacy (struct DH_RequestContext *rc, 53 const char *const args[]) 54 { 55 (void) args; 56 return TALER_MHD_reply_legal (rc->connection, 57 pp); 58 } 59 60 61 void 62 DH_load_terms (const struct GNUNET_CONFIGURATION_Handle *cfg) 63 { 64 tos = TALER_MHD_legal_load (cfg, 65 "donau", 66 "TERMS_DIR", 67 "TERMS_ETAG"); 68 if (NULL == tos) 69 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 70 "Terms of service not configured\n"); 71 pp = TALER_MHD_legal_load (cfg, 72 "donau", 73 "PRIVACY_DIR", 74 "PRIVACY_ETAG"); 75 if (NULL == pp) 76 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 77 "Privacy policy not configured\n"); 78 } 79 80 81 /* end of donau-httpd_terms.c */