[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taldir] branch master updated: generated tos and pp integrated
From: |
gnunet |
Subject: |
[taler-taldir] branch master updated: generated tos and pp integrated |
Date: |
Tue, 12 Jul 2022 19:00:31 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new b2031d1 generated tos and pp integrated
b2031d1 is described below
commit b2031d107f9d7776f1d67a451bb2ca8cb011defc
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jul 12 19:00:28 2022 +0200
generated tos and pp integrated
---
README.md | 20 ++++++++++++++++++++
config/taldir-example.conf | 5 +++--
pkg/rest/taldir.go | 31 ++++++++++++++++++-------------
terms/de-DE.md | 1 -
4 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index 9d8716b..f221710 100644
--- a/README.md
+++ b/README.md
@@ -86,3 +86,23 @@ $ validator-test <address> <code>
The first argument of the validator command is the address in a validation
method-specific format.
For example, the email validation expects an email address, the Twitter
validator expects a Twitter handle, etc.
The second argument is the activation code generated by Taldir and which is
expected to be transferred using the validation method to the user.
+
+# Terms of Service and Privacy Policy
+
+You may edit the document templates under `contrib/pp` and `contrib/tos`
+to your needs.
+You can build the documents using:
+
+```
+$ make update-tos
+$ make update-pp
+```
+
+And configure/copy the built localized documents into your configured
+paths, e.g.:
+
+```
+$ cp -r contrib/tos/en terms/
+$ cp -r contrib/pp/en terms/
+```
+
diff --git a/config/taldir-example.conf b/config/taldir-example.conf
index 571ae05..6feba2a 100644
--- a/config/taldir-example.conf
+++ b/config/taldir-example.conf
@@ -5,10 +5,11 @@ host = "https://taldir.gnunet.org"
bind_to = "localhost:11000"
salt = "ChangeMe"
monthly_fee = KUDOS:1
-default_doc_filetype = text/markdown
+default_doc_filetype = text/html
default_doc_lang = en-US
default_tos_path = terms/
default_pp_path = privacy/
+supported_doc_filetypes = text/html application/pdf application/epub
application/xml text/plain
challenge_bytes = 16
validation_initiation_max = 3
solution_attempt_max = 3
@@ -16,7 +17,7 @@ validation_timeframe = 10m
solution_attempt_timeframe = 1h
merchant_baseurl_private = http://merchant.taldir/instances/myInstance
merchant_token = superSecretToken
-validation_landing = testdata/templates/validation_landing.html
+validation_landing = templates/validation_landing.html
validation_expiration = 24h
[taldir-email]
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
index 61c9a9e..42d7195 100644
--- a/pkg/rest/taldir.go
+++ b/pkg/rest/taldir.go
@@ -639,7 +639,7 @@ func (t *Taldir) ClearDatabase() {
}
func (t *Taldir) termsResponse(w http.ResponseWriter, r *http.Request) {
- fileType :=
t.Cfg.Section("taldir").Key("default_doc_filetype").MustString("text/markdown")
+ fileType :=
t.Cfg.Section("taldir").Key("default_doc_filetype").MustString("text/html")
termsLocation :=
t.Cfg.Section("taldir").Key("default_tos_path").MustString("terms/")
for _, typ := range r.Header["Accept"] {
for _, a := range
strings.Split(t.Cfg.Section("taldir").Key("supported_doc_filetypes").String(),
" ") {
@@ -654,8 +654,9 @@ func (t *Taldir) termsResponse(w http.ResponseWriter, r
*http.Request) {
for _, lang := range acceptLangs {
extensions, _ := mime.ExtensionsByType(fileType)
for _, ext := range extensions {
- log.Printf("Trying %s\n", termsLocation + lang.String() + ext)
- fileBytes, err := ioutil.ReadFile(termsLocation + lang.String() + ext)
+ docFile := fmt.Sprintf("%s/%s/0.%s", termsLocation, lang.String, ext)
+ log.Printf("Trying %s\n", docFile)
+ fileBytes, err := ioutil.ReadFile(docFile)
if nil == err {
w.Header().Set("Content-Type", fileType)
w.Write(fileBytes)
@@ -663,21 +664,23 @@ func (t *Taldir) termsResponse(w http.ResponseWriter, r
*http.Request) {
}
}
}
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
return
}
// Default document in expected/default format
- defaultLanguage :=
t.Cfg.Section("taldir").Key("default_doc_lang").MustString("en-US")
+ defaultLanguage :=
t.Cfg.Section("taldir").Key("default_doc_lang").MustString("en")
extensions, _ := mime.ExtensionsByType(fileType)
for _, ext := range extensions {
- fileBytes, err := ioutil.ReadFile(termsLocation + defaultLanguage + ext)
+ docFile := fmt.Sprintf("%s/%s/0%s", termsLocation, defaultLanguage, ext)
+ log.Println("Trying " + docFile)
+ fileBytes, err := ioutil.ReadFile(docFile)
if nil == err {
w.Header().Set("Content-Type", fileType)
w.Write(fileBytes)
return
}
}
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
}
func (t *Taldir) privacyResponse(w http.ResponseWriter, r *http.Request) {
@@ -696,8 +699,9 @@ func (t *Taldir) privacyResponse(w http.ResponseWriter, r
*http.Request) {
for _, lang := range acceptLangs {
extensions, _ := mime.ExtensionsByType(fileType)
for _, ext := range extensions {
- log.Printf("Trying %s\n", termsLocation + lang.String() + ext)
- fileBytes, err := ioutil.ReadFile(termsLocation + lang.String() + ext)
+ docFile := fmt.Sprintf("%s/%s/0.%s", termsLocation, lang.String, ext)
+ log.Printf("Trying %s\n", docFile)
+ fileBytes, err := ioutil.ReadFile(docFile)
if nil == err {
w.Header().Set("Content-Type", fileType)
w.Write(fileBytes)
@@ -705,21 +709,22 @@ func (t *Taldir) privacyResponse(w http.ResponseWriter, r
*http.Request) {
}
}
}
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
return
}
// Default document in expected/default format
- defaultLanguage :=
t.Cfg.Section("taldir").Key("default_doc_lang").MustString("en-US")
+ defaultLanguage :=
t.Cfg.Section("taldir").Key("default_doc_lang").MustString("en")
extensions, _ := mime.ExtensionsByType(fileType)
for _, ext := range extensions {
- fileBytes, err := ioutil.ReadFile(termsLocation + defaultLanguage + ext)
+ docFile := fmt.Sprintf("%s/%s/0.%s", termsLocation, defaultLanguage, ext)
+ fileBytes, err := ioutil.ReadFile(docFile)
if nil == err {
w.Header().Set("Content-Type", fileType)
w.Write(fileBytes)
return
}
}
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
}
diff --git a/terms/de-DE.md b/terms/de-DE.md
deleted file mode 100644
index 16feec6..0000000
--- a/terms/de-DE.md
+++ /dev/null
@@ -1 +0,0 @@
-# TOS
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taldir] branch master updated: generated tos and pp integrated,
gnunet <=