Store download URLs in database, turn pages into templates

master
Alice 5 years ago
parent f8cb99c6df
commit 08fd5ee73b

@ -44,6 +44,7 @@ INSTALLED_APPS = (
'lambdainst',
'payments',
'tickets',
'downloads',
'constance',
'constance.backends.database',
)
@ -94,8 +95,6 @@ LOGOUT_URL = 'account:logout'
LOGIN_REDIRECT_URL = 'account:index'
LOGOUT_REDIRECT_URL = '/'
PAGES_DIR = BASE_DIR + '/pages/'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'ccvpn.passwords.LegacyPasswordHasher',

@ -5,6 +5,7 @@ import markdown
from markdown.extensions.codehilite import CodeHiliteExtension
from django.http import HttpResponseNotFound
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.conf import settings
from django.utils.translation import ugettext as _, get_language
from django import http
@ -12,12 +13,14 @@ 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 constance import config
from downloads.models import Version
from .common import get_price_float
md = markdown.Markdown(extensions=[
MARKDOWN = markdown.Markdown(extensions=[
'markdown.extensions.toc',
'markdown.extensions.meta',
CodeHiliteExtension(noclasses=True),
@ -59,18 +62,15 @@ def set_lang(request):
return response
@cache_page(5 * 60)
def page(request, name):
if not re.match('^[a-z0-9_-]{1,50}$', name):
return HttpResponseNotFound()
basename = settings.PAGES_DIR + '/' + name
username = request.user.username
page_replace = {
'USERNAME': username or '[username]',
}
basename = 'pages/' + name
# For "pages", entire files are translated. We try the most
# specific first
files = [
basename + '.' + get_language() + '.md',
basename + '.en.md',
@ -78,18 +78,17 @@ def page(request, name):
]
for file in files:
if not os.path.isfile(file):
try:
template = get_template(file)
except TemplateDoesNotExist:
continue
with open(file, encoding='utf8') as fh:
page = fh.read()
for s, r in page_replace.items():
page = page.replace('{' + s + '}', r)
page = md.convert(page)
page_md = template.render(None, request)
page_html = MARKDOWN.convert(page_md)
title = MARKDOWN.Meta.get('title', [None])[0]
title = md.Meta.get('title', [None])[0]
ctx = dict(content=page, title=title)
return render(request, 'ccvpn/page.html', ctx)
ctx = dict(content=page_html, title=title)
return render(request, 'ccvpn/page.html', ctx)
return HttpResponseNotFound()

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-12 16:03+0000\n"
"POT-Creation-Date: 2019-05-14 18:25+0000\n"
"PO-Revision-Date: 2016-04-07 01:32+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -27,10 +27,14 @@ msgstr ""
msgid "hash"
msgstr ""
#: ccvpn/views.py:37 templates/tickets/layout.html:11
#: ccvpn/views.py:39 templates/tickets/layout.html:11
msgid "Live Chat"
msgstr "Chat Live"
#: downloads/templatetags/dltags.py:19
msgid "Download {} v{}"
msgstr "Télécharger {} v{}"
#: lambdainst/admin.py:23
msgid "Code must be [a-zA-Z0-9]"
msgstr ""
@ -260,19 +264,19 @@ msgstr "Config"
msgid "Status"
msgstr "État"
#: payments/admin.py:9
#: payments/admin.py:11
msgid "Mark as cancelled (do not actually cancel)"
msgstr "Marquer comme annulé (n'annule pas)"
#: payments/admin.py:22 payments/admin.py:77
#: payments/admin.py:36 payments/admin.py:91
msgid "Payment Data"
msgstr "Données de paiement"
#: payments/admin.py:45
#: payments/admin.py:59
msgid "Amount"
msgstr "Montant"
#: payments/admin.py:49
#: payments/admin.py:63
msgid "Paid amount"
msgstr "Montant payé"
@ -318,16 +322,14 @@ msgid "Bitcoin with CoinBase"
msgstr "Bitcoin avec CoinBase"
#: payments/backends/coingate.py:24
#, fuzzy
#| msgid "Coinbase"
msgid "CoinGate"
msgstr "Coinbase"
msgstr "CoinGate"
#: payments/backends/coingate.py:25
msgid "Cryptocurrencies"
msgstr "Cryptomonnaies"
#: payments/backends/coingate.py:106
#: payments/backends/coingate.py:109
msgid "Confirming transaction"
msgstr "Confirmation de la transaction"
@ -343,82 +345,70 @@ msgstr ""
"En attente de la confirmation par Paypal... Cette étape peut durer quelques "
"minutes..."
#: payments/backends/stripe.py:11
#: payments/backends/stripe.py:10
msgid "Stripe"
msgstr "Stripe"
#: payments/backends/stripe.py:12
#: payments/backends/stripe.py:11
msgid "Credit Card"
msgstr "Carte"
#: payments/backends/stripe.py:118
msgid "No payment information was received."
msgstr "Aucune information de paiement reçue."
#: payments/backends/stripe.py:135
msgid "The payment has been refunded or rejected."
msgstr "Le paiement a été remboursé ou rejeté."
#: payments/backends/stripe.py:143
msgid "The paid amount is under the required amount."
msgstr "La montant payé est inférieur au montant requis."
#: payments/models.py:16 payments/models.py:30
#: payments/models.py:19 payments/models.py:33
msgid "Waiting for payment"
msgstr "En attente du paiement"
#: payments/models.py:17
#: payments/models.py:20
msgid "Confirmed"
msgstr "Confirmé"
#: payments/models.py:18 payments/models.py:32
#: payments/models.py:21 payments/models.py:35
msgid "Cancelled"
msgstr "Annullé"
#: payments/models.py:19
#: payments/models.py:22
msgid "Rejected by processor"
msgstr "Rejeté"
#: payments/models.py:20
#: payments/models.py:23
msgid "Payment processing failed"
msgstr "Traitement échoué"
#: payments/models.py:29
#: payments/models.py:32
msgid "Created"
msgstr "Crée"
#: payments/models.py:31
#: payments/models.py:34
msgid "Active"
msgstr "Actif"
#: payments/models.py:33
#: payments/models.py:36
msgid "Error"
msgstr "Error"
#: payments/models.py:37
#: payments/models.py:40
msgid "Every 3 months"
msgstr "Tous les 3 mois"
#: payments/models.py:38
#: payments/models.py:41
msgid "Every 6 months"
msgstr "Tous les 6 mois"
#: payments/models.py:39
#: payments/models.py:42
msgid "Every year"
msgstr "Tous les ans"
#: payments/views.py:141
#: payments/views.py:144
msgid ""
"Error subscribing. It usually means you don't have enough money available."
msgstr ""
"Il y a une erreur à l'inscription. C'est le plus souvent un manque de fonds "
"sur la carte."
#: payments/views.py:144
#: payments/views.py:147
msgid "Subscribed!"
msgstr "Abonné!"
#: payments/views.py:183
#: payments/views.py:185
msgid "Subscription cancelled!"
msgstr "Abonnement annulé!"
@ -549,19 +539,24 @@ msgstr "Créez un compte et profitez de l'essai gratuit"
#: templates/ccvpn/index.html:72
msgid "<b>Hide your IP address</b> to disrupt tracking and geolocation."
msgstr "<b>Cachez votre adresse IP</b> pour perturber le traçage et la localisation."
msgstr ""
"<b>Cachez votre adresse IP</b> pour perturber le traçage et la localisation."
#: templates/ccvpn/index.html:75
msgid ""
"<b>Protect your privacy</b> on insecure networks with AES GCM 256 bits, RSA "
"4096 bits."
msgstr "<b>Protégez votre vie privée</b> avec un chiffrement AES GCM 256 bits, RSA 4096 bits."
msgstr ""
"<b>Protégez votre vie privée</b> avec un chiffrement AES GCM 256 bits, RSA "
"4096 bits."
#: templates/ccvpn/index.html:79
msgid ""
"<b>Get a clean and neutral access</b> without censorship, interception, or "
"manipulation."
msgstr "<b>Un accès propre et neutre</b> qui ne censure pas et ne manipule pas votre connection."
msgstr ""
"<b>Un accès propre et neutre</b> qui ne censure pas et ne manipule pas votre "
"connection."
#: templates/ccvpn/index.html:82
msgid "<b>Bypass firewalls</b> in restricted network environments."
@ -571,15 +566,17 @@ msgstr "<b>Contournez les firewalls</b> sur les réseaux restraints."
msgid ""
"<b>Transparently compress your traffic</b> to save data and gain speed on "
"slow connections."
msgstr "<b>Compressez votre traffic</> pour économiser des données et améliorer"
"les performances."
msgstr ""
"<b>Compressez votre traffic</> pour économiser des données et améliorerles "
"performances."
#: templates/ccvpn/index.html:90
msgid ""
"<b>Get IPv6 connectivity</b> on IPv4-only networks or where IPv6 is not "
"equally supported."
msgstr "<b>Profitez de l'IPv6</b> même sur les réseaux qui ne supportent pas "
"ou mal l'IPv6."
msgstr ""
"<b>Profitez de l'IPv6</b> même sur les réseaux qui ne supportent pas ou mal "
"l'IPv6."
#: templates/ccvpn/page.html:8
msgid "Help"

@ -402,6 +402,11 @@ ul.errorlist {
margin: 1.5em 0;
}
.download-button {
text-align: center;
margin-top: 0.5em;
}
/***************************************************/
/********************* Home Page */

@ -1,11 +1,11 @@
Title: Install on Windows
{% load dltags %}
With CCVPNGUI (recommended, simple)
With CCVPN GUI (recommended, simple)
-------------
CCVPNGUI is made for CCrypto VPN and contains everything it needs. Just download and run:
<https://dl.ccrypto.org/ccvpngui/releases/ccvpngui-1.0.0-1.exe>
[(sig)](https://dl.ccrypto.org/ccvpngui/releases/ccvpngui-1.0.0-1.exe.asc)
CCVPN GUI is made for CCrypto VPN and contains everything it needs.
{% download_button "ccvpngui" "windows" %}
The installer will ask if you want to create a desktop icon.
Once installed, you will only have to right click the icon in the notification

@ -1,11 +1,11 @@
Title: Installation sous Windows
{% load dltags %}
Avec CCVPNGUI (recommandé, simple)
Avec CCVPN GUI (recommandé, simple)
-------------
CCVPNGUI est fait pour CCrypto VPN et contient tout ce qu'il faut. Téléchargez et lancez juste :
<https://dl.ccrypto.org/ccvpngui/releases/ccvpngui-1.0.0-1.exe>
[(sig)](https://dl.ccrypto.org/ccvpngui/releases/ccvpngui-1.0.0-1.exe.asc)
CCVPN GUI est fait pour CCrypto VPN et contient tout ce qu'il faut.
{% download_button "ccvpngui" "windows" %}
À l'installation, il vous sera proposé d'installer une icône sur le bureau.
Vous aurez ensuite à faire un clic-droit sur l'icône dans la zone de notification,
Loading…
Cancel
Save