mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-04-24 03:04:10 +00:00
Merge 3f8cf2e134
into 4c764cd543
This commit is contained in:
commit
e838640f73
3 changed files with 21 additions and 0 deletions
bookwyrm
|
@ -89,6 +89,9 @@
|
|||
{% url 'settings-schedules' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Scheduled tasks" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/flower/"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Flower" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
{% url 'settings-email-config' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Email Configuration" %}</a>
|
||||
|
|
|
@ -29,6 +29,7 @@ BOOK_PATH = r"^book/(?P<book_id>\d+)"
|
|||
STREAMS = "|".join(s["key"] for s in settings.STREAMS)
|
||||
|
||||
urlpatterns = [
|
||||
views.FlowerProxyView.as_url(),
|
||||
path("admin/", admin.site.urls),
|
||||
path(
|
||||
"robots.txt",
|
||||
|
|
17
bookwyrm/views/admin/flower.py
Normal file
17
bookwyrm/views/admin/flower.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.urls import path, re_path
|
||||
from revproxy.views import ProxyView
|
||||
|
||||
class FlowerProxyView(UserPassesTestMixin, ProxyView):
|
||||
upstream = 'http://{}:{}'.format('localhost', 8888)
|
||||
url_prefix = 'flower'
|
||||
rewrite = (
|
||||
(r'^/{}$'.format(url_prefix), r'/{}/'.format(url_prefix)),
|
||||
)
|
||||
|
||||
def test_func(self):
|
||||
return self.request.user.is_superuser
|
||||
|
||||
@classmethod
|
||||
def as_url(cls):
|
||||
return re_path(r'^(?P<path>{}.*)$'.format(cls.url_prefix), cls.as_view(), name='flower')
|
Loading…
Reference in a new issue