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

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

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

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

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

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