summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-24 21:39:39 +0200
committerChristian Grothoff <christian@grothoff.org>2020-10-24 21:39:39 +0200
commit8ce0d0f2d65974f98b2792a546734e6742980a1f (patch)
tree4d5812c4700d5de7592bdce23ebfa0a8f74d1df4
parentffbfe901bb434bb5cea9b9b9a2fb55c6f3c4e447 (diff)
downloadauditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.tar.gz
auditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.tar.bz2
auditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.zip
some minimal love for the auditor page, not working yet though
-rw-r--r--.gitmodules10
-rw-r--r--Makefile80
-rwxr-xr-xbootstrap16
-rw-r--r--build-system/configure.py23
m---------build-system/taler-build-scripts0
-rw-r--r--config.mk7
-rw-r--r--i18nfix.py34
m---------inc0
-rw-r--r--index.html.j297
-rw-r--r--locale/babel.map6
-rw-r--r--locale/en/LC_MESSAGES/messages.po70
-rw-r--r--locale/messages.pot77
-rwxr-xr-xmake_site.py57
m---------static/web-common0
-rwxr-xr-xtemplate.py92
-rw-r--r--template/index.html.j296
m---------web-common0
-rw-r--r--www.yml17
18 files changed, 368 insertions, 314 deletions
diff --git a/.gitmodules b/.gitmodules
index 213f8f3..86ee36b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,7 +1,9 @@
-[submodule "static/web-common"]
- path = static/web-common
- url = git://taler.net/web-common
- branch = master
[submodule "web-common"]
path = web-common
url = git://git.taler.net/web-common
+[submodule "build-system/taler-build-scripts"]
+ path = build-system/taler-build-scripts
+ url = https://git.taler.net/build-common.git
+[submodule "inc"]
+ path = inc
+ url = https://git.gnunet.org/www_shared.git
diff --git a/Makefile b/Makefile
index 6992536..7b94180 100644
--- a/Makefile
+++ b/Makefile
@@ -1,70 +1,70 @@
# This file is in the public domain.
-# Hardly anyone seems to read README files anymore, so keep this note here:
-# Don't remove the variables for python etc. They exist
-# because one system sticks with PEPs, and others opt
-# for installing every version side-by-side,
-# Same goes for babel.
+include build-system/config.mk
-include config.mk
+# List of all supported languages, add new languages here!
+LANGUAGES="en"
# All: build HTML pages in all languages and compile the
# TypeScript logic in web-common.
+.PHONY: all
all: locale template
-# cd web-common && $(TSC)
-
-requirements:
- pip3 install --user -r requirements.txt
+ (cd web-common && $(tsc))
+ (for lang in `echo $(LANGUAGES)` ; do \
+ $(cp) -R web-common/*.css web-common/*.ico rendered/static/ ; \
+ done)
# Extract translateable strings from jinja2 templates.
-locale/messages.pot: requirements *.j2 # common/*.j2 common/*.j2.inc
- env PYTHONPATH="." $(BABEL) extract -F locale/babel.map -o locale/messages.pot .
+locale/messages.pot: template/*.j2
+ $(python) inc/mybabel.py $(pybabel) extract -F locale/babel.map -o locale/messages.pot .
# Update translation (.po) files with new strings.
+.PHONY: locale-update
locale-update: locale/messages.pot
- msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po locale/messages.pot
+ (for lang in `echo $(LANGUAGES)`; do \
+ $(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
+ done)
- @if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
+ if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then $(echo) -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
# Compile translation files for use.
+.PHONY: locale-compile
locale-compile:
- $(BABEL) compile -d locale -l en --use-fuzzy
+ (for lang in `echo $(LANGUAGES)`; do \
+ $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
+ done)
# Process everything related to gettext translations.
+.PHONY: locale
locale: locale-update locale-compile
# Run the jinja2 templating engine to expand templates to HTML
# incorporating translations.
template: locale-compile
- $(PYTHON) ./template.py
+ $(python) ./make_site.py
+.PHONY: run
run: all
- @[ "$(BROWSER)" ] || ( echo "You need to export the environment variable 'BROWSER' to run this."; exit 1 )
- $(RUN_BROWSER) http://0.0.0.0:8000 &
- # cd rendered && $(PYTHON) -m http.server
- $(PYTHON) -m http.server
+ $(browser) http://0.0.0.0:8000/rendered/en &
+ $(python) -m http.server
-clean:
- rm -rf __pycache__
- rm -rf en/ de/ fr/ it/ es/ ru/
- rm -rf rendered/
+ifndef variant
+$(error variant is not set)
+endif
-submodules/init:
- git submodule update --init --recursive
+.PHONY: install
+install: all
+ $(mkdir) -p $(prefix)/$(variant)
+ $(cp) -r rendered/* $(prefix)/$(variant)/
-submodules/update:
- git submodule update --recursive --remote
+.PHONY: uninstall
+uninstall:
+ $(rm) -rf $(prefix)/$(variant)
-.SILENT: show-help
+.PHONY: clean
+clean:
+ $(rm) -rf __pycache__ *.pyc *~ \.*~ \#*\#
+ $(rm) -rf rendered/
-show-help:
- printf "all:\t\t\tBuild the website\n"
- printf "locale/messages.pot:\tExtract translateable strings from jinja2 templates.\n"
- printf "locale-update:\t\tUpdate translation files with new strings.\n"
- printf "locale-compile:\t\tCompile translation files for use.\n"
- printf "locale:\t\t\tProcess everything related to gettext translations.\n"
- printf "template:\t\texpand jinja2 templates to html.\n"
- printf "run:\t\t\tspawn python webserver and open the current directory.\n"
- printf "clean:\t\t\tclean.\n"
- printf "submodules/init:\tinit git submodules\n"
- printf "submodules/update:\tupdate git submodules\n"
+submodules/update:
+ $(git) submodule update --recursive --remote
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..9ea2c21
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Bootstrap the repository. Used when the repository is checked out from git.
+# When using the source tarball, running this script is not necessary.
+
+set -eu
+
+if ! git --version >/dev/null; then
+ echo "git not installed"
+ exit 1
+fi
+
+git submodule sync
+git submodule update --init
+rm -f ./configure
+cp build-system/taler-build-scripts/configure ./configure
diff --git a/build-system/configure.py b/build-system/configure.py
new file mode 100644
index 0000000..6b13143
--- /dev/null
+++ b/build-system/configure.py
@@ -0,0 +1,23 @@
+import sys
+from pathlib import Path
+from talerbuildconfig import *
+
+b = BuildConfig()
+b.enable_prefix()
+b.enable_variant()
+b.enable_configmk()
+b.add_tool(PythonTool())
+b.add_tool(PyBabelTool())
+b.add_tool(PosixTool("cp"))
+b.add_tool(PosixTool("echo"))
+b.add_tool(PosixTool("env"))
+b.add_tool(PosixTool("printf"))
+b.add_tool(PosixTool("grep"))
+b.add_tool(PosixTool("mkdir"))
+b.add_tool(PosixTool("rm"))
+b.add_tool(PosixTool("sh"))
+b.add_tool(PosixTool("msgmerge"))
+b.add_tool(PosixTool("tsc"))
+b.add_tool(PosixTool("git"))
+b.add_tool(BrowserTool())
+b.run()
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
new file mode 160000
+Subproject c9abff9094f9e127b1b976dfd0702e6dce07c6d
diff --git a/config.mk b/config.mk
deleted file mode 100644
index 6d0dae0..0000000
--- a/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# config.mk Makefile fragment to set custom variables.
-
-TSC=tsc
-PYTHON=python3
-BABEL=pybabel
-
-RUN_BROWSER=$(BROWSER)
diff --git a/i18nfix.py b/i18nfix.py
deleted file mode 100644
index 9e4b26b..0000000
--- a/i18nfix.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python3
-# This file is in the public domain.
-
-"""
-Extract translations from a Jinja2 template, stripping leading newlines.
-
-@author Florian Dold
-"""
-
-import jinja2.ext
-import re
-
-def normalize(message):
- if isinstance(message, str):
- message = message.strip()
- # collapse whitespaces (including newlines) into one space.
- message = re.sub("\s+", " ", message)
- return message
-
-
-def babel_extract(fileobj, keywords, comment_tags, options):
- res = jinja2.ext.babel_extract(fileobj, keywords, comment_tags, options)
- for lineno, funcname, message, comments in res:
- message = normalize(message)
- yield lineno, funcname, message, comments
-
-def wrap_gettext(f):
- """
- Call gettext with whitespace normalized.
- """
- def wrapper(message):
- message = normalize(message)
- return f(message)
- return wrapper
diff --git a/inc b/inc
new file mode 160000
+Subproject 76bbc33ea45cd415081f34ae93109fe5c9718fe
diff --git a/index.html.j2 b/index.html.j2
deleted file mode 100644
index dfe5783..0000000
--- a/index.html.j2
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE html>
-<html lang="en" data-taler-nojs="true">
-<head profile="http://www.w3.org/2005/10/profile">
- <meta charset="utf-8"/>
- <title>{{ _("Taler Demo - Auditor") }}</title>
- <link rel="stylesheet" type="text/css" href="{{ url('static/web-common/pure.css') }}" />
- <link rel="stylesheet" type="text/css" href="{{ url('static/web-common/demo.css') }}" />
- <link rel="stylesheet" type="text/css" href="{{ url('static/web-common/taler-fallback.css') }}" id="taler-presence-stylesheet" />
- <link rel="icon" type="image/png" href="{{ url('static/web-common/favicon-taler.ico') }}" />
-
-
- <style type="text/css">
- a[disabled="true"] {
- pointer-events: none;
- color: grey;
- }
-
- .bluebox {
- background-color: #C2C6FF;
- border: solid;
- border-radius: 5px;
- padding: 0.5em;
- }
- .greenbox {
- background-color: #5EFF64;
- border: solid;
- border-radius: 5px;
- padding: 0.5em;
- }
- .graybox {
- background-color: #DDDDDD;
- border: solid;
- border-radius: 5px;
- padding: 0.5em;
- }
- </style>
-
- <script src="{{ url('static/web-common/taler-wallet-lib.js') }}"></script>
- <script>
- function addAuditor() {
- taler.addAuditor({
- url: "{{ auditor_url }}",
- currency: "{{ currency }}",
- auditorPub: "{{ auditor_pub }}",
- expirationStamp: (new Date(2027, 1)).getTime(),
- });
- }
- </script>
-</head>
-
-<body>
- <div class="demobar">
- <h1><span class="tt adorn-brackets">{{ _("Taler Demo") }}</span></h1>
- <h1><span class="it"><a href="#">{{ _("Auditor") }}</a></span></h1>
- <p>
- {{ _("This is an auditor for the %(curr)s currency.", curr=currency) }}
- </p>
- <ul>
- <li><a href="{{ intro_url }}">Introduction</a></li>
- <li><a href="{{ bank_url }}">Bank</a></li>
- <li><a href="{{ merchant_blog_url }}">Essay Shop</a></li>
- <li><a href="{{ merchant_donations_url }}">Donations</a></li>
- </ul>
- <p>
- {% trans %}
- You can learn more about Taler on our main <a href="https://taler.net/">website</a>.
- {% endtrans %}
- </p>
- </div>
- <section id="main" class="content">
- <h1>{{ _("%(curr)s Auditor", curr=currency) }} </h1>
- <p class="bluebox taler-installed-hide">
- {% trans %}
- You do not have the Taler wallet installed yet.<br>
- Install the wallet from the <a href="https://taler.net/wallet-installation.html">installation page</a>.
- It only takes one click.
- {% endtrans %}
- </p>
- <div class="taler-installed-show">
- <p style="color: black;">
- {{ _("This is the Web site of the auditor for the %(curr)s currency.",curr=currency) }}
- {% trans %}
- In the GNU Taler system, an auditor is responsible for verifying
- that an exchange operates correctly. If you trust us to do a good
- job auditing, please click here:
- {% endtrans %}
- </p>
- <div style="text-align: center;">
- <button class="pure-button pure-button-primary" style="text-allign: center;" click="addAuditor()">{{ _("Add Auditor") }}</button>
- </div>
- <p>
- {{ _("This will tell your wallet that you are willing to trust exchanges that we audit to handle the %(curr)s currency properly.",curr=currency) }}
- </p>
- </div>
- </section>
-</body>
-</html>
diff --git a/locale/babel.map b/locale/babel.map
index 72b6f99..e844572 100644
--- a/locale/babel.map
+++ b/locale/babel.map
@@ -1,12 +1,8 @@
[extractors]
jinja2 = i18nfix:babel_extract
-[jinja2: **.j2]
+[jinja2: template/**.j2]
encoding = utf-8
lstrip_blocks = True
trim_blocks = True
-[jinja2: **.j2.inc]
-encoding = utf-8
-lstrip_blocks = True
-ltrim_blocks = True
diff --git a/locale/en/LC_MESSAGES/messages.po b/locale/en/LC_MESSAGES/messages.po
index 9315e03..6e19b73 100644
--- a/locale/en/LC_MESSAGES/messages.po
+++ b/locale/en/LC_MESSAGES/messages.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2019-04-22 21:27+0200\n"
+"POT-Creation-Date: 2020-10-24 21:38+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: en <LL@li.org>\n"
@@ -13,60 +13,60 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n!=1)\n"
"Generated-By: Babel 2.3.4\n"
-#: index.html.j2:5
-msgid "Taler Demo - Auditor"
+#: template/index.html.j2:5 template/index.html.j2:52
+msgid "{curr} Auditor"
msgstr ""
-#: index.html.j2:53
-msgid "Taler Demo"
+#: template/index.html.j2:54
+msgid "This is an auditor for the {curr} currency."
msgstr ""
-#: index.html.j2:54
-msgid "Auditor"
+#: template/index.html.j2:59
+msgid "This is the Web site of the auditor for the {curr} currency."
msgstr ""
-#: index.html.j2:56
-#, python-format
-msgid "This is an auditor for the %(curr)s currency."
-msgstr ""
-
-#: index.html.j2:65
+#: template/index.html.j2:60
msgid ""
-"You can learn more about Taler on our main <a href=\"https://taler.net/"
-"\">website</a>."
+"In the GNU Taler system, an auditor is responsible for verifying that an "
+"exchange operates correctly. If you trust us to do a good job auditing, "
+"please click here:"
msgstr ""
-#: index.html.j2:71
-#, python-format
-msgid "%(curr)s Auditor"
+#: template/index.html.j2:67
+msgid "Add Auditor"
msgstr ""
-#: index.html.j2:73
+#: template/index.html.j2:70
msgid ""
-"You do not have the Taler wallet installed yet.<br> Install the wallet from "
-"the <a href=\"https://taler.net/wallet-installation.html\">installation "
-"page</a>. It only takes one click."
+"This will tell your wallet that you are willing to trust exchanges that we "
+"audit to handle the {curr} currency properly."
msgstr ""
-#: index.html.j2:81
-#, python-format
-msgid "This is the Web site of the auditor for the %(curr)s currency."
+#: template/index.html.j2:73
+msgid ""
+"If you do not have a Taler wallet installed, please first install the wallet "
+"from <a href=\"https://wallet.taler.net/\">wallet installation page</a>. It "
+"only takes one click."
msgstr ""
-#: index.html.j2:82
+#: template/index.html.j2:84
msgid ""
-"In the GNU Taler system, an auditor is responsible for verifying that an "
-"exchange operates correctly. If you trust us to do a good job auditing, "
-"please click here:"
+"GNU Taler is developed as part of the <a href='https://www.gnu.org/'>GNU "
+"project</a> for the GNU operating system."
msgstr ""
-#: index.html.j2:89
-msgid "Add Auditor"
+#: template/index.html.j2:86
+msgid "and"
msgstr ""
-#: index.html.j2:92
-#, python-format
+#: template/index.html.j2:89
msgid ""
-"This will tell your wallet that you are willing to trust exchanges that we "
-"audit to handle the %(curr)s currency properly."
+"We are grateful for support and free hosting of this site by <a "
+"href='https://www.bfh.ch/'>BFH</a>."
+msgstr ""
+
+#: template/index.html.j2:91
+msgid ""
+"This page was created using <a href='https://www.gnu.org/'>Free Software</a> "
+"only."
msgstr ""
diff --git a/locale/messages.pot b/locale/messages.pot
new file mode 100644
index 0000000..b2802be
--- /dev/null
+++ b/locale/messages.pot
@@ -0,0 +1,77 @@
+# Translations template for PROJECT.
+# Copyright (C) 2020 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2020.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2020-10-24 21:38+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.7.0\n"
+
+#: template/index.html.j2:5 template/index.html.j2:52
+msgid "{curr} Auditor"
+msgstr ""
+
+#: template/index.html.j2:54
+msgid "This is an auditor for the {curr} currency."
+msgstr ""
+
+#: template/index.html.j2:59
+msgid "This is the Web site of the auditor for the {curr} currency."
+msgstr ""
+
+#: template/index.html.j2:60
+msgid ""
+"In the GNU Taler system, an auditor is responsible for verifying that an "
+"exchange operates correctly. If you trust us to do a good job auditing, "
+"please click here:"
+msgstr ""
+
+#: template/index.html.j2:67
+msgid "Add Auditor"
+msgstr ""
+
+#: template/index.html.j2:70
+msgid ""
+"This will tell your wallet that you are willing to trust exchanges that "
+"we audit to handle the {curr} currency properly."
+msgstr ""
+
+#: template/index.html.j2:73
+msgid ""
+"If you do not have a Taler wallet installed, please first install the "
+"wallet from <a href=\"https://wallet.taler.net/\">wallet installation "
+"page</a>. It only takes one click."
+msgstr ""
+
+#: template/index.html.j2:84
+msgid ""
+"GNU Taler is developed as part of the <a href='https://www.gnu.org/'>GNU "
+"project</a> for the GNU operating system."
+msgstr ""
+
+#: template/index.html.j2:86
+msgid "and"
+msgstr ""
+
+#: template/index.html.j2:89
+msgid ""
+"We are grateful for support and free hosting of this site by <a "
+"href='https://www.bfh.ch/'>BFH</a>."
+msgstr ""
+
+#: template/index.html.j2:91
+msgid ""
+"This page was created using <a href='https://www.gnu.org/'>Free "
+"Software</a> only."
+msgstr ""
+
diff --git a/make_site.py b/make_site.py
new file mode 100755
index 0000000..baeed0f
--- /dev/null
+++ b/make_site.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python3
+# coding: utf-8
+#
+# This file is in the public domain.
+#
+# This script runs the jinja2 templating engine on an input template-file
+# using the specified locale for gettext translations, and outputs
+# the resulting (HTML) ouptut-file.
+#
+# Note that the gettext files need to be prepared first. This script
+# is thus to be invoked via the Makefile.
+import jinja2
+import sys
+from pathlib import Path, PurePath
+
+# Make sure the current directory is in the search path when trying
+# to import i18nfix.
+sys.path.insert(0, ".")
+sys.path.insert(0, "inc/")
+
+from inc.site import gen_site
+from inc.fileproc import copy_files
+
+env = jinja2.Environment(loader=jinja2.FileSystemLoader(str(PurePath(__file__).parent)),
+ extensions=["jinja2.ext.i18n"],
+ lstrip_blocks=True,
+ trim_blocks=True,
+ undefined=jinja2.StrictUndefined,
+ autoescape=False)
+
+if len(sys.argv) >= 2 and sys.argv[1] == "-vv":
+ DEBUG=1
+elif len(sys.argv) >= 2 and sys.argv[1] == "-vvv":
+ DEBUG=2
+elif len(sys.argv) >= 2 and sys.argv[1] == "-vvvv":
+ DEBUG=3
+else:
+ DEBUG=0
+
+def main():
+ x = gen_site(DEBUG)
+ conf = x.load_config("www.yml")
+ if DEBUG:
+ print("generating html from jinja2 templates...")
+ x.run("template", conf, env)
+ if DEBUG >= 2:
+ print(Path.cwd())
+ _ = Path("rendered")
+ for child in _.iterdir():
+ print(child)
+ if DEBUG >= 2:
+ print(Path.cwd())
+ if DEBUG:
+ print("copying directories...")
+
+if __name__ == "__main__":
+ main()
diff --git a/static/web-common b/static/web-common
deleted file mode 160000
-Subproject 68cb09ce78e261dbcddc69b174b8766f9679497
diff --git a/template.py b/template.py
deleted file mode 100755
index c8153cc..0000000
--- a/template.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python3
-# This file is in the public domain.
-#
-# This script runs the jinja2 templating engine on an input template-file
-# using the specified locale for gettext translations, and outputs
-# the resulting (HTML) ouptut-file.
-#
-# Note that the gettext files need to be prepared first. This script
-# is thus to be invoked via the Makefile.
-import os
-import os.path
-import sys
-import re
-import gettext
-import subprocess
-import jinja2
-import glob
-import codecs
-import os
-sys.path.append(os.getcwd())
-import i18nfix
-
-env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
- extensions=["jinja2.ext.i18n"],
- lstrip_blocks=True,
- trim_blocks=True,
- undefined=jinja2.StrictUndefined,
- autoescape=False)
-
-default_ctx = {}
-default_ctx["merchant_blog_url"] = os.environ.get("TALER_ENV_URL_MERCHANT_BLOG", "#")
-default_ctx["merchant_donations_url"] = os.environ.get("TALER_ENV_URL_MERCHANT_DONATIONS", "#")
-default_ctx["intro_url"] = os.environ.get("TALER_ENV_URL_INTRO", "#")
-default_ctx["bank_url"] = os.environ.get("TALER_ENV_URL_BANK", "#")
-default_ctx["auditor_url"] = os.environ.get("TALER_ENV_URL_AUDITOR", "#")
-default_ctx["currency"] = os.environ.get("TALER_CONFIG_CURRENCY", "??")
-auditor_priv_file = os.path.expanduser("~/.local/share/taler/auditor/offline-keys/auditor.priv")
-default_ctx["auditor_pub"] = subprocess.check_output(["gnunet-ecc", "-p", auditor_priv_file]).decode("utf-8").strip()
-
-
-langs_full = {"en": "English" }
-
-for in_file in glob.glob("*.j2"):
- name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
- tmpl = env.get_template(in_file)
-
- def self_localized(other_locale):
- """
- Return URL for the current page in another locale.
- """
- return "../" + other_locale + "/" + in_file.rstrip(".j2")
-
- def url_localized(filename):
- return "../" + locale + "/" + filename
-
- def svg_localized(filename):
- lf = filename + "." + locale + ".svg"
- if "en" == locale or not os.path.isfile (lf):
- return "../" + filename + ".svg"
- else:
- return "../" + lf
-
- def url(x):
- # TODO: look at the app root environment variable
- # TODO: check if file exists
- return "../" + x
-
- for l in glob.glob("locale/*/"):
- locale = os.path.basename(l[:-1])
-
- tr = gettext.translation("messages",
- localedir="locale",
- languages=[locale])
-
- tr.gettext = i18nfix.wrap_gettext(tr.gettext)
-
- env.install_gettext_translations(tr, newstyle=True)
-
- ctx = dict(lang=locale,
- lang_full=langs_full[locale],
- url=url,
- self_localized=self_localized,
- url_localized=url_localized,
- svg_localized=svg_localized,
- filename=name + "." + ext)
- ctx.update(default_ctx)
- content = tmpl.render(**ctx)
-
- out_name = "./" + locale + "/" + in_file.rstrip(".j2")
- os.makedirs("./" + locale, exist_ok=True)
- with codecs.open(out_name, "w", "utf-8") as f:
- f.write(content)
diff --git a/template/index.html.j2 b/template/index.html.j2
new file mode 100644
index 0000000..fbd1218
--- /dev/null
+++ b/template/index.html.j2
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html lang="en" data-taler-nojs="true">
+<head profile="http://www.w3.org/2005/10/profile">
+ <meta charset="utf-8"/>
+ <title>{{ _("{curr} Auditor").format(curr=conf['currency']) }}</title>
+ <link rel="stylesheet" type="text/css" href="{{ url('static/pure.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ url('static/demo.css') }}" />
+ <link rel="stylesheet" type="text/css" href="{{ url('static/taler-fallback.css') }}" id="taler-presence-stylesheet" />
+ <link rel="icon" type="image/png" href="{{ url('static/favicon-taler.ico') }}" />
+
+
+ <style type="text/css">
+ a[disabled="true"] {
+ pointer-events: none;
+ color: grey;
+ }
+
+ .bluebox {
+ background-color: #C2C6FF;
+ border: solid;
+ border-radius: 5px;
+ padding: 0.5em;
+ }
+ .greenbox {
+ background-color: #5EFF64;
+ border: solid;
+ border-radius: 5px;
+ padding: 0.5em;
+ }
+ .graybox {
+ background-color: #DDDDDD;
+ border: solid;
+ border-radius: 5px;
+ padding: 0.5em;
+ }
+ </style>
+
+ <script>
+ function addAuditor() {
+ taler.addAuditor({
+ url: "{{ conf['auditor_url'] }}",
+ currency: "{{ conf['currency'] }}",
+ auditorPub: "{{ conf['auditor_pub'] }}",
+ expirationStamp: (new Date(2027, 1)).getTime(),
+ });
+ }
+ </script>
+</head>
+
+<body>
+ <div class="demobar">
+ <h1><span class="it">{{ _("{curr} Auditor").format(curr=conf['currency']) }}</span></h1>
+ <p>
+ {{ _("This is an auditor for the {curr} currency.").format(curr=conf['currency']) }}
+ </p>
+ </div>
+ <section id="main" class="content">
+ <p style="color: black;">
+ {{ _("This is the Web site of the auditor for the {curr} currency.").format(curr=conf['currency']) }}
+ {% trans %}
+ In the GNU Taler system, an auditor is responsible for verifying
+ that an exchange operates correctly. If you trust us to do a good
+ job auditing, please click here:
+ {% endtrans %}
+ </p>
+ <div style="text-align: center;">
+ <button class="pure-button pure-button-primary" style="text-allign: center;" click="addAuditor()">{{ _("Add Auditor") }}</button>
+ </div>
+ <p>
+ {{ _("This will tell your wallet that you are willing to trust exchanges that we audit to handle the {curr} currency properly.").format(curr=conf['currency']) }}
+ </p>
+ <p>
+ {% trans %}
+ If you do not have a Taler wallet installed, please
+ first install the wallet from <a href="https://wallet.taler.net/">wallet installation page</a>.
+ It only takes one click.
+ {% endtrans %}
+ </p>
+ </div>
+ </section>
+ <footer id="footer">
+ <div class="demobar">
+ <p>
+ {{ _("GNU Taler is developed as part of the <a href='https://www.gnu.org/'>GNU project</a> for the GNU operating system.") }}
+ <br>
+ &copy; <a href="https://gnunet.org/en/ev.html">GNUnet e.V.</a> {{_("and") }}
+ Taler Systems SA 2015-2020
+ <br>
+ {{ _("We are grateful for support and free hosting of this site by <a href='https://www.bfh.ch/'>BFH</a>.") }}
+ <br>
+ {{ _("This page was created using <a href='https://www.gnu.org/'>Free Software</a> only.") }}
+ </p>
+ </div>
+ </footer>
+</body>
+</html>
diff --git a/web-common b/web-common
-Subproject ba4a54c65786f35922616175b644f9db7897c87
+Subproject 2457613ecc8b8971bd47119b1a02a2f290bb483
diff --git a/www.yml b/www.yml
new file mode 100644
index 0000000..e620a00
--- /dev/null
+++ b/www.yml
@@ -0,0 +1,17 @@
+currency: KUDOS
+auditor_url: https://auditor.taler.net/
+auditor_pub: KEY
+siteconf:
+ - baseurl: auditor.taler.net
+langs_full: &langs
+ en: English
+ fr: Français
+ it: Italiano
+ es: Español
+ de: Deutsch
+ ru: Ру́сский язы́к
+ pt: Português
+ jp: 日本語
+meetingnotes:
+newsposts:
+videoslist: