wagtail-cjkcms 24.6.1__py2.py3-none-any.whl → 24.6.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cjkcms/__init__.py +1 -1
- cjkcms/settings.py +3 -0
- cjkcms/urls.py +3 -0
- cjkcms/views.py +37 -43
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/METADATA +1 -1
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/RECORD +10 -10
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/LICENSE +0 -0
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/WHEEL +0 -0
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/entry_points.txt +0 -0
- {wagtail_cjkcms-24.6.1.dist-info → wagtail_cjkcms-24.6.2.dist-info}/top_level.txt +0 -0
cjkcms/__init__.py
CHANGED
cjkcms/settings.py
CHANGED
@@ -459,6 +459,9 @@ class _DefaultSettings:
|
|
459
459
|
("btn-outline-link", "Link Outline"),
|
460
460
|
]
|
461
461
|
|
462
|
+
CJKCMS_VERSION_MONITOR_TOKEN = "" # blank token = disabled version monitor api
|
463
|
+
CJKCMS_VERSION_MONITOR_ALLOWED_DOMAINS = [] # disallow from any domain by default
|
464
|
+
|
462
465
|
def __getattribute__(self, attr: str):
|
463
466
|
# First load from Django settings.
|
464
467
|
# If it does not exist, load from _DefaultSettings.
|
cjkcms/urls.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
from django.urls import include, path
|
2
2
|
from wagtail.contrib.sitemaps.views import sitemap
|
3
3
|
from cjkcms import search_urls as cjkcms_search_urls
|
4
|
+
from .views import VersionView
|
4
5
|
|
5
6
|
# from .settings import cms_settings
|
6
7
|
from cjkcms.views import (
|
@@ -13,6 +14,8 @@ urlpatterns = [
|
|
13
14
|
path("favicon.ico", favicon, name="cjkcms_favicon"),
|
14
15
|
path("robots.txt", robots, name="cjkcms_robots"),
|
15
16
|
path("sitemap.xml", sitemap, name="cjkcms_sitemap"),
|
17
|
+
# version reporting
|
18
|
+
path("api/versions/<str:token>/", VersionView.as_view(), name="get_versions"),
|
16
19
|
# Search
|
17
20
|
path("search/", include(cjkcms_search_urls)),
|
18
21
|
]
|
cjkcms/views.py
CHANGED
@@ -13,6 +13,16 @@ from wagtail.models import Page, get_page_models
|
|
13
13
|
# from coderedcms.importexport import convert_csv_to_json, import_pages, ImportPagesFromCSVFileForm
|
14
14
|
from cjkcms.templatetags.cjkcms_tags import get_name_of_class
|
15
15
|
|
16
|
+
from rest_framework.views import APIView
|
17
|
+
from rest_framework.response import Response
|
18
|
+
from rest_framework import status
|
19
|
+
from django.conf import settings
|
20
|
+
from django.http import JsonResponse
|
21
|
+
import django
|
22
|
+
from wagtail import __version__ as wagtail_version
|
23
|
+
from cjkcms import __version__ as cjkcms_version
|
24
|
+
import sys
|
25
|
+
|
16
26
|
|
17
27
|
def search(request):
|
18
28
|
"""
|
@@ -84,46 +94,30 @@ def robots(request):
|
|
84
94
|
return render(request, "cjkcms/robots.txt", content_type="text/plain")
|
85
95
|
|
86
96
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
# messages.error(request, _(
|
115
|
-
# "Import failed: %(reason)s") % {'reason': e}
|
116
|
-
# )
|
117
|
-
# else:
|
118
|
-
# messages.success(request, ngettext(
|
119
|
-
# "%(count)s page imported.",
|
120
|
-
# "%(count)s pages imported.",
|
121
|
-
# page_count) % {'count': page_count}
|
122
|
-
# )
|
123
|
-
# return redirect('wagtailadmin_explore', parent_page.pk)
|
124
|
-
# else:
|
125
|
-
# form = ImportPagesFromCSVFileForm()
|
126
|
-
|
127
|
-
# return render(request, 'wagtailimportexport/import_from_csv.html', {
|
128
|
-
# 'form': form,
|
129
|
-
# })
|
97
|
+
class VersionView(APIView):
|
98
|
+
|
99
|
+
def get(self, request, token):
|
100
|
+
monitor_token = settings.CJKCMS_VERSION_MONITOR_TOKEN
|
101
|
+
allowed_domains = settings.CJKCMS_VERSION_MONITOR_ALLOWED_DOMAINS
|
102
|
+
|
103
|
+
host = request.META.get("HTTP_HOST")
|
104
|
+
|
105
|
+
token_ok = len(token) < 12 or token != monitor_token
|
106
|
+
domain_ok = allowed_domains = ["*"] or host in allowed_domains
|
107
|
+
|
108
|
+
# minimum required token length is 12 characters
|
109
|
+
# this also prevents sites from reporting when default
|
110
|
+
# empty token has not been replaced in local config with a proper one
|
111
|
+
|
112
|
+
if token_ok and domain_ok:
|
113
|
+
return JsonResponse(
|
114
|
+
{"error": "Forbidden."}, status=status.HTTP_403_FORBIDDEN
|
115
|
+
)
|
116
|
+
|
117
|
+
data = {
|
118
|
+
"python": sys.version,
|
119
|
+
"django": django.get_version(),
|
120
|
+
"wagtail": wagtail_version,
|
121
|
+
"cjkcms": cjkcms_version,
|
122
|
+
}
|
123
|
+
return Response(data)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
cjkcms/__init__.py,sha256=
|
1
|
+
cjkcms/__init__.py,sha256=uzDcEIDpp5lH6IeiWtbJf_4eZ4bGrRhIYQO0B5H7PV0,272
|
2
2
|
cjkcms/apps.py,sha256=VA5Z1YerImetvN8KsjPTMSn1fSo6O1JkBJdK5y5ubJY,173
|
3
3
|
cjkcms/fields.py,sha256=dE0DuNIjX7jhA-5GjSmR2l66EDH2kq3vuxL9WyRALCY,3191
|
4
4
|
cjkcms/forms.py,sha256=_uu_FR8odz40lD-Rmw0tlK7-xxxa8THHfV2-1ZJYsIM,361
|
5
5
|
cjkcms/image_formats.py,sha256=d4zRshuybwxSRL8UpBH31dFBr32o4HNexa0ks5PX3TI,1833
|
6
6
|
cjkcms/search_urls.py,sha256=92XkGTJRrQQyA061wWl1l5C0vq6INVJPXOrpcgp3aoU,125
|
7
|
-
cjkcms/settings.py,sha256=
|
8
|
-
cjkcms/urls.py,sha256=
|
7
|
+
cjkcms/settings.py,sha256=ACxaVRUhpdMbcnv_QAe0BfrcTx0Q5ZJdoIj0_PsSHbY,19568
|
8
|
+
cjkcms/urls.py,sha256=k5tEHWI4Umi2PWvGdNJ-FZ9OCy6AS3Y2S7k5jNOpgt0,644
|
9
9
|
cjkcms/utils.py,sha256=u4pkPxAwqH3SgyIcmvk7I5L3w-eIcz0Rphmv0Y1DRpA,2006
|
10
|
-
cjkcms/views.py,sha256=
|
10
|
+
cjkcms/views.py,sha256=Us1rsJ6-N0A_WNkH-jANHrWgUh7lbImDitaRBoPH8bE,4106
|
11
11
|
cjkcms/wagtail_hooks.py,sha256=utrTXxJzjumhbzHmB_p5xZsIOZHkDQUJKGQ5geKD-mY,6543
|
12
12
|
cjkcms/widgets.py,sha256=2B92WkaktZC1ge4GrAMTB7VVYKnKR8qoZLAtWS2z_00,1745
|
13
13
|
cjkcms/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -326,9 +326,9 @@ cjkcms/tests/testapp/models.py,sha256=Rkn9KHrGbLzrKjP4y_gwtXma1_fJOZNU7ekb689fJE
|
|
326
326
|
cjkcms/tests/testapp/migrations/0001_initial.py,sha256=hxr-r-42IQEGr_OsZkxXXCW7wbxAHuI_OLOkn-seJUU,4942
|
327
327
|
cjkcms/tests/testapp/migrations/0002_create_homepage.py,sha256=EfsxHh1oyqwahW9RVpTvaRDx_CHtFSJQahKEr7XC5Gg,1999
|
328
328
|
cjkcms/tests/testapp/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
329
|
-
wagtail_cjkcms-24.6.
|
330
|
-
wagtail_cjkcms-24.6.
|
331
|
-
wagtail_cjkcms-24.6.
|
332
|
-
wagtail_cjkcms-24.6.
|
333
|
-
wagtail_cjkcms-24.6.
|
334
|
-
wagtail_cjkcms-24.6.
|
329
|
+
wagtail_cjkcms-24.6.2.dist-info/LICENSE,sha256=KHsCh1fKOZzvcKe1a9h3FlDjTjK_UurO3wHK55TnHHo,1538
|
330
|
+
wagtail_cjkcms-24.6.2.dist-info/METADATA,sha256=KZ60vLD33NHKl5rgTMPeh_sAuruQ0dh4OVC8bDGtUpE,3108
|
331
|
+
wagtail_cjkcms-24.6.2.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
332
|
+
wagtail_cjkcms-24.6.2.dist-info/entry_points.txt,sha256=FzoiFENdZ1uebNztyz6GlswkumQspd5VjWbR9MUIH_8,50
|
333
|
+
wagtail_cjkcms-24.6.2.dist-info/top_level.txt,sha256=8wJGOGo1pG5nO5akfcMzA7i3ndj5868I8w35vTT0JJM,7
|
334
|
+
wagtail_cjkcms-24.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|