Commit d3fcdd18 authored by Lars Kruse's avatar Lars Kruse
Browse files

feat(url): provide URL paths for retrieving the configured logo images

This will allow external applications (e.g. a matrix chat web interface)
to re-use configured logo locations without parsing the grouprise
parent 7e2a4a7b
Pipeline #3099 passed with stages
in 5 minutes and 33 seconds
from django.contrib import admin
from django.conf.urls import url
from django.urls import path
from grouprise.core.views import Markdown
from grouprise.core.views import LogoRedirects, Markdown
urlpatterns = [
path('stadt/markdown/', Markdown.as_view(), name='markdown'),
url(r'stadt/logos/(?P<name>\w+)', LogoRedirects.as_view(), name='logos'),
import json
import django
from django.http import Http404
from django.views.generic.base import RedirectView
from django_filters.views import FilterMixin
from rules.contrib.views import PermissionRequiredMixin
import grouprise.core.settings as grouprise_settings
class PermissionMixin(PermissionRequiredMixin):
......@@ -52,3 +56,19 @@ app_config = AppConfig()
class Markdown(django.views.generic.TemplateView):
template_name = 'core/markdown.html'
class LogoRedirects(RedirectView):
"backdrop": grouprise_settings.LOGO_BACKDROP,
"favicon": grouprise_settings.LOGO_FAVICON,
"square": grouprise_settings.LOGO_SQUARE,
"text": grouprise_settings.LOGO_TEXT,
def get_redirect_url(self, name):
return self.LOGO_NAME_URL_MAP[name]
except KeyError:
raise Http404("Unknown logo")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment