mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Adds warnings about misconfigurations
This commit is contained in:
parent
f6e2ec02aa
commit
be479fe4cb
2 changed files with 33 additions and 4 deletions
|
@ -23,6 +23,30 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if warnings.invalid_domain %}
|
||||
<div class="notification is-danger is-flex is-align-items-start">
|
||||
<span class="icon icon-warning is-size-4 pr-3" aria-hidden="true"></span>
|
||||
<span>
|
||||
{% blocktrans trimmed %}
|
||||
Your domain appears to be misconfigured.
|
||||
It should not include protocol or slashes.
|
||||
{% endblocktrans %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if warnings.protocol %}
|
||||
<div class="notification is-danger is-flex is-align-items-start">
|
||||
<span class="icon icon-warning is-size-4 pr-3" aria-hidden="true"></span>
|
||||
<span>
|
||||
{% blocktrans trimmed %}
|
||||
You are running BookWyrm in production mode without https.
|
||||
<strong>USE_HTTPS</strong> should be enabled in production.
|
||||
{% endblocktrans %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="columns">
|
||||
<div class="column is-half is-flex is-flex-direction-column">
|
||||
<h2 class="title is-4">{% trans "Settings" %}</h2>
|
||||
|
@ -82,14 +106,14 @@
|
|||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Enable preview images" %}
|
||||
{% trans "Enable preview images:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
{{ info.preview_images|yesno }}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Enable image thumbnails" %}
|
||||
{% trans "Enable image thumbnails:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
{{ info.thumbnails|yesno }}
|
||||
|
@ -104,7 +128,7 @@
|
|||
<h2 class="title is-4">{% trans "Does everything look right?" %}</h2>
|
||||
<p class="subtitle help">
|
||||
{% blocktrans trimmed %}
|
||||
This is your last change to set your domain and protocol.
|
||||
This is your last chance to set your domain and protocol.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
""" Installation wizard 🧙 """
|
||||
import re
|
||||
|
||||
from django.contrib.auth import login
|
||||
from django.contrib.auth.models import Group
|
||||
from django.core.exceptions import PermissionDenied
|
||||
|
@ -9,6 +11,7 @@ from django.views import View
|
|||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm import settings
|
||||
from bookwyrm.utils import regex
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
|
@ -25,8 +28,10 @@ class InstanceConfig(View):
|
|||
# check for possible problems with the instance configuration
|
||||
warnings = {}
|
||||
warnings["debug"] = settings.DEBUG
|
||||
warnings["protocol_in_domain"] = settings.DOMAIN.startswith("http")
|
||||
warnings["invalid_domain"] = not re.match(rf"^{regex.DOMAIN}$", settings.DOMAIN)
|
||||
warnings["protocol"] = not settings.DEBUG and not settings.USE_HTTPS
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
data = {
|
||||
"warnings": warnings,
|
||||
"info": {
|
||||
|
|
Loading…
Reference in a new issue