Browse Source

clean up pages and view

master
alice 3 days ago
parent
commit
2dd5a01872
4 changed files with 21 additions and 64 deletions
  1. +21
    -35
      ccvpn/views.py
  2. +0
    -0
      templates/pages/advanced-tor.en.md
  3. +0
    -26
      templates/pages/install-chromeos.fr.md
  4. +0
    -3
      templates/pages/privacy.en.md

+ 21
- 35
ccvpn/views.py View File

@@ -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)


templates/pages/advanced-tor.md → templates/pages/advanced-tor.en.md View File


+ 0
- 26
templates/pages/install-chromeos.fr.md View File

@@ -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.

<img src="/static/pageimg/install_chromeos_1_arrows.png" alt="screenshot" />

3. Ouvrez les options de Chrome OS, cliquez sur Private Network (en dessous de Ethernet et Wi-Fi),
et sélectionnez CCrypto VPN.

<img src="/static/pageimg/install_chromeos_2.png" alt="screenshot" />

4. Cliquez ensuite sur le bouton Connect, entrez votre mot de passe, et appuyez sur Connect
à nouveau.

<img src="/static/pageimg/install_chromeos_3.png" alt="screenshot" />

5. Attendez quelques secondes et le VPN devrait être connecté.

<img src="/static/pageimg/install_chromeos_4.png" alt="screenshot" />


+ 0
- 3
templates/pages/privacy.en.md View File

@@ -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



Loading…
Cancel
Save