Browse Source

update django + django_lcore, fix every broken thing

master
alice 6 months ago
parent
commit
523d374f5b
16 changed files with 484 additions and 383 deletions
  1. +1
    -1
      ccvpn/passwords.py
  2. +1
    -0
      ccvpn/urls.py
  3. +16
    -11
      ccvpn/views.py
  4. +1
    -1
      downloads/templatetags/dltags.py
  5. +2
    -2
      lambdainst/admin.py
  6. +1
    -1
      lambdainst/forms.py
  7. +1
    -1
      lambdainst/models.py
  8. +1
    -1
      lambdainst/openvpn.py
  9. +8
    -8
      lambdainst/templatetags/bw.py
  10. +1
    -1
      lambdainst/views.py
  11. +440
    -345
      poetry.lock
  12. +7
    -7
      pyproject.toml
  13. +1
    -1
      tickets/admin.py
  14. +1
    -1
      tickets/forms.py
  15. +1
    -1
      tickets/models.py
  16. +1
    -1
      tickets/views.py

+ 1
- 1
ccvpn/passwords.py View File

@@ -3,7 +3,7 @@ import binascii
from collections import OrderedDict

from django.contrib.auth.hashers import BasePasswordHasher
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _


class LegacyPasswordHasher(BasePasswordHasher):


+ 1
- 0
ccvpn/urls.py View File

@@ -3,6 +3,7 @@ from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic.base import RedirectView
import django_lcore
import django_lcore.urls

from lambdainst import views as account_views



+ 16
- 11
ccvpn/views.py View File

@@ -7,12 +7,10 @@ from markdown.extensions.toc import TocExtension
from django.http import HttpResponseNotFound
from django.shortcuts import render
from django.conf import settings
from django.utils.translation import ugettext as _, get_language
from django.utils.translation import gettext as _, get_language
from django import http
from django.utils.http import is_safe_url
from django.utils.translation import (
LANGUAGE_SESSION_KEY, check_for_language,
)
from django.utils.http import url_has_allowed_host_and_scheme
from django.utils.translation import check_for_language
from django.template.loader import TemplateDoesNotExist, get_template, select_template
from django.template import Template
from django.template.response import TemplateResponse
@@ -61,17 +59,24 @@ def set_lang(request):
""" django.views.i18n.set_language() with GET """

next = request.GET.get('next', request.GET.get('next'))
if not is_safe_url(url=next, allowed_hosts={request.get_host()}):
if not url_has_allowed_host_and_scheme(url=next, allowed_hosts={request.get_host()}):
next = request.META.get('HTTP_REFERER')
if not is_safe_url(url=next, allowed_hosts={request.get_host()}):
if not url_has_allowed_host_and_scheme(url=next, allowed_hosts={request.get_host()}):
next = '/'
response = http.HttpResponseRedirect(next)
lang_code = request.GET.get('lang', None)
if lang_code and check_for_language(lang_code):
response.set_cookie(settings.LANGUAGE_COOKIE_NAME, lang_code,
max_age=settings.LANGUAGE_COOKIE_AGE,
path=settings.LANGUAGE_COOKIE_PATH,
domain=settings.LANGUAGE_COOKIE_DOMAIN)

response.set_cookie(
settings.LANGUAGE_COOKIE_NAME,
lang_code,
max_age=settings.LANGUAGE_COOKIE_AGE,
path=settings.LANGUAGE_COOKIE_PATH,
domain=settings.LANGUAGE_COOKIE_DOMAIN,
secure=settings.LANGUAGE_COOKIE_SECURE,
httponly=settings.LANGUAGE_COOKIE_HTTPONLY,
samesite=settings.LANGUAGE_COOKIE_SAMESITE,
)
return response




+ 1
- 1
downloads/templatetags/dltags.py View File

@@ -1,7 +1,7 @@
from django import template
from django.utils.html import format_html
from downloads.models import Version, Platform
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

register = template.Library()



+ 2
- 2
lambdainst/admin.py View File

@@ -5,7 +5,7 @@ from django.contrib import admin
from django.contrib import messages
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils.html import format_html
import django_lcore
import lcoreapi
@@ -81,7 +81,7 @@ class UserAdmin(UserAdmin):
),
)
readonly_fields = ("last_login", "date_joined", "links")
actions = (django_lcore.core_sync_action,)
actions = (django_lcore.admin.core_sync_action,)

def is_paid(self, object):
return object.vpnuser.is_paid


+ 1
- 1
lambdainst/forms.py View File

@@ -1,7 +1,7 @@
import base64
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils.safestring import mark_safe




+ 1
- 1
lambdainst/models.py View File

@@ -2,7 +2,7 @@ import random
from datetime import timedelta
from django.db import models, IntegrityError
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils import timezone
from django_lcore.core import (
LcoreUserProfileMethods,


+ 1
- 1
lambdainst/openvpn.py View File

@@ -1,6 +1,6 @@
import json
import uuid
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.conf import settings




+ 8
- 8
lambdainst/templatetags/bw.py View File

@@ -1,4 +1,4 @@
from django.utils.translation import ugettext, ungettext
from django.utils.translation import gettext, ngettext
from django.template import Library
from django.utils.html import avoid_wrapping
from django.utils import formats
@@ -11,7 +11,7 @@ def bwformat(bps):
try:
bps = float(bps)
except (TypeError, ValueError, UnicodeDecodeError):
value = ungettext("%(bw)d bps", "%(bw)d bps", 0) % {"bw": 0}
value = ngettext("%(bw)d bps", "%(bw)d bps", 0) % {"bw": 0}
return avoid_wrapping(value)

filesize_number_format = lambda value: formats.number_format(round(value, 1), -1)
@@ -23,16 +23,16 @@ def bwformat(bps):
P = 1 * 10 ** 15

if bps < K:
value = ungettext("%(size)d bps", "%(size)d bps", bps) % {"size": bps}
value = ngettext("%(size)d bps", "%(size)d bps", bps) % {"size": bps}
elif bps < M:
value = ugettext("%s Kbps") % filesize_number_format(bps / K)
value = gettext("%s Kbps") % filesize_number_format(bps / K)
elif bps < G:
value = ugettext("%s Mbps") % filesize_number_format(bps / M)
value = gettext("%s Mbps") % filesize_number_format(bps / M)
elif bps < T:
value = ugettext("%s Gbps") % filesize_number_format(bps / G)
value = gettext("%s Gbps") % filesize_number_format(bps / G)
elif bps < P:
value = ugettext("%s Tbps") % filesize_number_format(bps / T)
value = gettext("%s Tbps") % filesize_number_format(bps / T)
else:
value = ugettext("%s Pbps") % filesize_number_format(bps / P)
value = gettext("%s Pbps") % filesize_number_format(bps / P)

return avoid_wrapping(value)

+ 1
- 1
lambdainst/views.py View File

@@ -22,7 +22,7 @@ from django.http import (
)
from django.shortcuts import redirect, render
from django.utils import timezone
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.template.loader import render_to_string
from django_countries import countries
import django_lcore


+ 440
- 345
poetry.lock
File diff suppressed because it is too large
View File


+ 7
- 7
pyproject.toml View File

@@ -5,28 +5,28 @@ description = ""
authors = ["CCrypto <code@ccrypto.org>"]

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
django = "^3.0"
python = ">=3.8,<4.0"
django = "^4.0.0"
jsonfield = "^3.1"
django_countries = "^7"
markdown = "^3.1"
requests = "^2.21"
pygal = "^2.4"
pytz = "^2021.1"
pygal = "^3.0"
pytz = "^2022.1"
stripe = "^2.24"
django-constance = {version = "^2.7",extras = ["database"]}
lcoreapi = {git = "https://git.packetimpact.net/lvpn/lcoreapi.git", tag = "v1.1.1"}
pygments = "^2.3"
psycopg2-binary = "^2.8"
python-frontmatter = "^1"
django-tinymce4-lite = "^1.7"
django-tinymce4-widget = "^6.3"
django-admin-list-filter-dropdown = "^1.0"
django-lcore = {git = "https://git.packetimpact.net/lvpn/django-lcore.git"}
django-pipayments = {git = "git@git.packetimpact.net:lvpn/django-pipayments.git", branch = "main"}
#django-pipayments = {path = "../lvpn/django-pipayments", develop=true}
celery = "^5"
django-celery-beat = "^2.0.0"
redis = "^3.5.3"
django-celery-beat = {git="https://github.com/celery/django-celery-beat",rev="10123d357567ae31f241f89d98561220887799ae"}
redis = "^4.3"
flower = "^1"
django-extensions = "^3.1.3"



+ 1
- 1
tickets/admin.py View File

@@ -1,7 +1,7 @@
from django.contrib import admin
from django.shortcuts import resolve_url
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.utils import formats
from .models import Ticket, TicketMessage, TicketNotifyAddress



+ 1
- 1
tickets/forms.py View File

@@ -1,6 +1,6 @@
from django import forms
from .models import TicketMessage, CATEGORY_CHOICES
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class NewTicketForm(forms.Form):


+ 1
- 1
tickets/models.py View File

@@ -1,6 +1,6 @@
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.urls import reverse
from django.template.loader import get_template
from django.core.mail import send_mail


+ 1
- 1
tickets/views.py View File

@@ -3,7 +3,7 @@ from django.contrib.auth.decorators import login_required
from django.http.response import HttpResponseNotFound
from django.utils import timezone
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _

from ccvpn.common import get_client_ip
from .models import Ticket, TicketMessage


Loading…
Cancel
Save