Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hansegucker/AlekSIS-Core
  • pinguin/AlekSIS-Core
  • AlekSIS/official/AlekSIS-Core
  • sunweaver/AlekSIS-Core
  • sggua/AlekSIS-Core
  • edward/AlekSIS-Core
  • magicfelix/AlekSIS-Core
7 results
Show changes
Commits on Source (8)
......@@ -5,7 +5,7 @@
>
<h1 class="text-h2">{{ $t(shortErrorMessageKey) }}</h1>
<div>{{ $t(longErrorMessageKey) }}</div>
<v-btn color="secondary" :to="{ name: redirectRouteName }">
<v-btn color="secondary" :to="{ name: redirectRouteName }" v-if="!hideButton">
<v-icon left>{{ redirectButtonIcon }}</v-icon>
{{ $t(redirectButtonTextKey) }}
</v-btn>
......@@ -36,6 +36,11 @@ export default {
type: String,
required: true,
},
hideButton: {
type: Boolean,
default: false,
required: false,
},
},
};
</script>
......
......@@ -199,6 +199,7 @@ TEMPLATES = [
"maintenance_mode.context_processors.maintenance_mode",
"dynamic_preferences.processors.global_preferences",
"aleksis.core.util.core_helpers.custom_information_processor",
"aleksis.core.util.context_processors.need_maintenance_response_context_processor",
],
},
},
......@@ -697,7 +698,7 @@ MAINTENANCE_MODE = _settings.get("maintenance.enabled", None)
MAINTENANCE_MODE_IGNORE_IP_ADDRESSES = _settings.get(
"maintenance.ignore_ips", _settings.get("maintenance.internal_ips", [])
)
MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS = "ipware.ip.get_ip"
MAINTENANCE_MODE_GET_CLIENT_IP_ADDRESS = "aleksis.core.util.core_helpers.get_ip"
MAINTENANCE_MODE_IGNORE_SUPERUSER = True
MAINTENANCE_MODE_STATE_FILE_NAME = _settings.get(
"maintenance.statefile", "maintenance_mode_state.txt"
......
{% extends "core/base.html" %}
{% load i18n %}
{% extends "core/vue_index.html" %}
{% block content %}
<div class="container">
<div class="card red">
<div class="card-content white-text">
<i class="material-icons iconify small left" data-icon="mdi:alert-octagon-outline"></i>
<span class="card-title">{% blocktrans %}The maintenance mode is currently enabled. Please try again
later.{% endblocktrans %}</span>
<p>
{% blocktrans %}
This page is currently unavailable. If this error persists, contact your site administrators:
{% endblocktrans %}
</p>
{% include "core/partials/admins_list.html" %}
</div>
</div>
</div>
{% block no_frontend %}
{% endblock %}
......@@ -12,13 +12,23 @@
This webbrowser doesn't support JavaScript, or its execution is blocked. Please use another browser to continue.
{% endblocktrans %}
</noscript>
{% if need_maintenance_response %}
<p>
{% blocktrans %}
The maintenance mode is currently enabled. Please try again later.
{% endblocktrans %}
</p>
{% endif %}
</div>
{% if not need_maintenance_response %}
<div class="lds-ellipsis">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
{% endif %}
<style>
#logo {
......@@ -36,7 +46,7 @@
max-height: calc(100vh - 10vh - calc(2 * min(85px, 15vh)));
}
noscript {
noscript, p {
font-family: Roboto, sans-serif;
font-weight: 400;
}
......
......@@ -29,6 +29,10 @@
<app ref="aleksisApp"></app>
</main>
{% vite_asset 'aleksis/core/frontend/index.js' %}
{% block no_frontend %}
{% if not need_maintenance_response %}
{% vite_asset 'aleksis/core/frontend/index.js' %}
{% endif %}
{% endblock no_frontend %}
</body>
</html>
......@@ -11,6 +11,7 @@ import calendarweek.django
from ckeditor_uploader import views as ckeditor_uploader_views
from graphene_django.views import GraphQLView
from health_check.urls import urlpatterns as health_urls
from maintenance_mode.decorators import force_maintenance_mode_off
from oauth2_provider.views import ConnectDiscoveryInfoView
from rules.contrib.views import permission_required
from two_factor.urls import urlpatterns as tf_urls
......@@ -24,7 +25,7 @@ urlpatterns = [
path(settings.MEDIA_URL.removeprefix("/"), include("titofisto.urls")),
path("__icons__/", include("dj_iconify.urls")),
path("graphql/", csrf_exempt(GraphQLView.as_view(graphiql=True)), name="graphql"),
path("logo", views.LogoView.as_view(), name="logo"),
path("logo", force_maintenance_mode_off(views.LogoView.as_view()), name="logo"),
path(
".well-known/openid-configuration/",
ConnectDiscoveryInfoView.as_view(),
......
from maintenance_mode.http import need_maintenance_response
def need_maintenance_response_context_processor(request):
return {"need_maintenance_response": need_maintenance_response(request)}
......@@ -482,3 +482,10 @@ class OOTRouter:
post_invalidation.connect(OOTRouter._invalidate_cachalot)
def get_ip(*args, **kwargs):
"""Recreate ipware.ip.get_ip as it was replaced by get_client_ip."""
from ipware.ip import get_client_ip # noqa
return get_client_ip(*args, **kwargs)[0]
......@@ -236,6 +236,16 @@ export default defineConfig({
"PWA-Is-Cacheable": "true",
},
},
plugins: [
{
fetchDidSucceed: async ({ request, response }) => {
if (response.ok) {
return response;
}
throw new Error(`${response.status} ${response.statusText}`);
},
}
],
},
},
{
......