diff --git a/ccvpn/views.py b/ccvpn/views.py
index 7b3dc38..c7a6bdc 100644
--- a/ccvpn/views.py
+++ b/ccvpn/views.py
@@ -13,8 +13,9 @@ from django.utils.http import is_safe_url
from django.utils.translation import (
LANGUAGE_SESSION_KEY, check_for_language,
)
-from django.template.loader import TemplateDoesNotExist, get_template
+from django.template.loader import TemplateDoesNotExist, get_template, select_template
from django.template import Template
+from django.template.response import TemplateResponse
import django_lcore
from constance import config
import frontmatter
@@ -80,44 +81,29 @@ def page(request, name):
basename = 'pages/' + name
- # For "pages", entire files are translated. We try the most
- # specific first
- files = [
- basename + '.' + get_language() + '.md',
- basename + '.en.md',
- basename + '.md',
- ]
-
+ # Try to render a HTML template
try:
- #html_template = get_template(basename + '.html')
- return render(request, basename + '.html')
- except TemplateDoesNotExist as e:
- print(basename + '.html', "not found, looking for md", repr(e))
+ html_template = get_template(basename + '.html')
+ return TemplateResponse(request, html_template).render()
+ except TemplateDoesNotExist:
pass
- for file in files:
- try:
- template = get_template(file)
- except TemplateDoesNotExist:
- continue
-
- page_source = template.render(None, request)
- page = frontmatter.loads(page_source)
- page_md = page.content
-
- title = page.metadata.get('Title', "")
- toc_depth = int(page.metadata.get('TocDepth', 6))
-
- md = markdown.Markdown(extensions=[
- TocExtension(toc_depth=toc_depth),
- 'markdown.extensions.meta',
- CodeHiliteExtension(noclasses=True),
- ])
- page_html = md.convert(page_md)
+ md_template = select_template([
+ basename + '.' + get_language() + '.md',
+ basename + '.en.md',
+ ])
+ page_source = md_template.render(None, request)
+ page_fm = frontmatter.loads(page_source)
+ page_md = page_fm.content
- ctx = dict(content=page_html, title=title)
- return render(request, 'ccvpn/page.html', ctx)
+ title = page_fm.metadata.get('Title', "")
+ md_inst = markdown.Markdown(extensions=[
+ 'markdown.extensions.meta',
+ CodeHiliteExtension(noclasses=True),
+ ])
+ page_html = md_inst.convert(page_md)
- return HttpResponseNotFound()
+ ctx = dict(content=page_html, title=title)
+ return render(request, 'ccvpn/page.html', ctx)
diff --git a/templates/pages/advanced-tor.md b/templates/pages/advanced-tor.en.md
similarity index 100%
rename from templates/pages/advanced-tor.md
rename to templates/pages/advanced-tor.en.md
diff --git a/templates/pages/install-chromeos.fr.md b/templates/pages/install-chromeos.fr.md
deleted file mode 100644
index de4228c..0000000
--- a/templates/pages/install-chromeos.fr.md
+++ /dev/null
@@ -1,26 +0,0 @@
----
-Title: Install on Chrome OS
----
-
-1. Téléchargez le fichier .onc requis dans [votre compte](/account/config), en choisissant
- Chrome OS comme OS.
-
-2. Allez sur [chrome://net-internals/](chrome://net-internals/#chromeos), partie ChromeOS, et importez le fichier téléchargé.
- Aucun message ne sera affiché, mais il devrait avoir été importé quand même.
-
-
-
-3. Ouvrez les options de Chrome OS, cliquez sur Private Network (en dessous de Ethernet et Wi-Fi),
- et sélectionnez CCrypto VPN.
-
-
-
-4. Cliquez ensuite sur le bouton Connect, entrez votre mot de passe, et appuyez sur Connect
- à nouveau.
-
-
-
-5. Attendez quelques secondes et le VPN devrait être connecté.
-
-
-
diff --git a/templates/pages/privacy.en.md b/templates/pages/privacy.en.md
index bd0e35e..a4e17fe 100644
--- a/templates/pages/privacy.en.md
+++ b/templates/pages/privacy.en.md
@@ -20,9 +20,6 @@ See our published source code for technical details.
We use no additional external analytics or advertisement network on our website.
All these informations are strictly kept by CCrypto and will not be shared to a third party unless required by law (see 4.).
-Our websites embeds a support chat widget operated by Tawk.to. It can be blocked
-without breaking the rest of the website and tickets can be used for secure communication.
-
### 2. VPN Logging