invites page, menu, links, hackity hack
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c752dac624
commit
953821b381
@ -6,11 +6,7 @@ from uuid import uuid4
|
|||||||
from fastapi import APIRouter, Depends, Request
|
from fastapi import APIRouter, Depends, Request
|
||||||
from fastapi.responses import RedirectResponse
|
from fastapi.responses import RedirectResponse
|
||||||
|
|
||||||
from members_lumbung_space.dependencies import (
|
from members_lumbung_space.dependencies import get_invites, get_user, logged_in
|
||||||
get_invites,
|
|
||||||
get_user,
|
|
||||||
logged_in,
|
|
||||||
)
|
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@ -32,7 +28,7 @@ async def invite_keycloak_create(
|
|||||||
|
|
||||||
await request.app.state.redis.set(username, invites)
|
await request.app.state.redis.set(username, invites)
|
||||||
|
|
||||||
return RedirectResponse(request.url_for("home"))
|
return RedirectResponse(request.url_for("invites"))
|
||||||
|
|
||||||
|
|
||||||
@router.get("/invite/keycloak/delete", dependencies=[Depends(logged_in)])
|
@router.get("/invite/keycloak/delete", dependencies=[Depends(logged_in)])
|
||||||
@ -50,4 +46,4 @@ async def invite_keycloak_delete(
|
|||||||
|
|
||||||
await request.app.state.redis.set(user["preferred_username"], purged)
|
await request.app.state.redis.set(user["preferred_username"], purged)
|
||||||
|
|
||||||
return RedirectResponse(request.url_for("home"))
|
return RedirectResponse(request.url_for("invites"))
|
||||||
|
@ -29,3 +29,19 @@ async def home(
|
|||||||
return request.app.state.templates.TemplateResponse(
|
return request.app.state.templates.TemplateResponse(
|
||||||
"admin.html", context=context
|
"admin.html", context=context
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@router.get("/invites", dependencies=[Depends(logged_in)])
|
||||||
|
async def invites(
|
||||||
|
request: Request,
|
||||||
|
user=Depends(get_user),
|
||||||
|
invites=Depends(get_invites),
|
||||||
|
):
|
||||||
|
context = {
|
||||||
|
"request": request,
|
||||||
|
"user": user,
|
||||||
|
"invites": invites,
|
||||||
|
}
|
||||||
|
|
||||||
|
return request.app.state.templates.TemplateResponse(
|
||||||
|
"invites.html", context=context
|
||||||
|
)
|
||||||
|
@ -40,10 +40,6 @@ th, td {
|
|||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table, th, td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
border: 2px solid currentcolor;
|
border: 2px solid currentcolor;
|
||||||
}
|
}
|
||||||
@ -142,4 +138,4 @@ footer .content span {
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
padding-bottom: 2rem !important;
|
padding-bottom: 2rem !important;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
<div id="navbar" class="navbar-menu">
|
<div id="navbar" class="navbar-menu">
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<div class="navbar-item">
|
<div class="navbar-item">
|
||||||
<strong>logout</strong>
|
<a href="/"><strong>services</strong></a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-item">
|
||||||
|
<a href="/invites"><strong>invites</strong></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -18,63 +21,16 @@
|
|||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="{{ url_for('static', path='svg/lumbung_space_logo.svg') }}" alt="lumbung.space logo">
|
<img src="{{ url_for('static', path='svg/lumbung_space_logo.svg') }}" alt="lumbung.space logo">
|
||||||
</div>
|
</div>
|
||||||
<p>
|
{% set site_list = ("tv","social","cloud","pen", "books") %}
|
||||||
Hello, {{ user.preferred_username }} 👋
|
|
||||||
</p>
|
|
||||||
<h2>Services</h2>
|
|
||||||
{% set site_list = ("tv","social","shouts","sounds","cloud","kios","pen","gallery","pixel","books") %}
|
|
||||||
<div class="columns is-multiline is-gapless is-mobile">
|
<div class="columns is-multiline is-gapless is-mobile">
|
||||||
{% for i in site_list %}
|
{% for i in site_list %}
|
||||||
<div class="column site is-one-fifth-tablet is-one-third-mobile">
|
<div class="column site is-one-fifth-tablet is-one-third-mobile">
|
||||||
<a href="https://{{i}}.lumbung.space">
|
<a href="https://{{i}}.lumbung.space">
|
||||||
<img src="{{ url_for('static', path='svg/' ~ i ~'_lumbung.svg') }}" alt="lumbung.{{i}}">
|
<img src="{{ url_for('static', path='svg/' ~ i ~'_lumbung.svg') }}" alt="lumbung.{{i}}">
|
||||||
<p>lumbung.{{i}}</p>
|
<p>{{i}}.lumbung.space</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<h2>Invites</h2>
|
|
||||||
{% if user.preferred_username in invites and invites[user.preferred_username]|length > 0 %}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Link</th>
|
|
||||||
<th>Validity</th>
|
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
|
||||||
{% for invite in invites[user.preferred_username] %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a class="invite" href="{{ url_for('register_invite', invite=invite.link) }}">
|
|
||||||
{{ url_for('register_invite', invite=invite.link) }}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td> {{ invite.validity }} </td>
|
|
||||||
<td> <button class="button is-ghost"><a href="{{ url_for('invite_keycloak_delete') }}?invite={{ invite.link }}">delete</a></button></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<button class="button is-ghost"><a href="{{ url_for('invite_keycloak_create') }}">Generate</a></button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<footer class="footer">
|
|
||||||
<div class="content footer-links">
|
|
||||||
<span>
|
|
||||||
Imprint
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
Privacy Policy
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
FAQ
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
Community Agreement
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -16,5 +16,21 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">{% block content %}{% endblock %}</div>
|
<div id="content">{% block content %}{% endblock %}</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="content footer-links">
|
||||||
|
<span>
|
||||||
|
<a href="https://panduan.lumbung.space/share/684ea8a2-bc47-4111-acf2-f88a200b640f">Imprint</a>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<a href="https://panduan.lumbung.space/share/8a742222-2561-4d67-a9f1-6c7c4fe8bead">Privacy Policy</a>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<a href="https://panduan.lumbung.space/share/272026ff-57fd-4894-8d68-58606c77044c">FAQ</a>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<a href="https://panduan.lumbung.space/share/ece8e392-7b21-4379-bd82-a11e06ebf1fb">Community Guidelines</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
50
members_lumbung_space/templates/invites.html
Normal file
50
members_lumbung_space/templates/invites.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||||
|
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
<div id="navbar" class="navbar-menu">
|
||||||
|
<div class="navbar-end">
|
||||||
|
<div class="navbar-item">
|
||||||
|
<a href="/"><strong>services</strong></a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-item">
|
||||||
|
<a href="/invites"><strong>invites</strong></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="logo">
|
||||||
|
<img src="{{ url_for('static', path='svg/lumbung_space_logo.svg') }}" alt="lumbung.space logo">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{% if user.preferred_username in invites and invites[user.preferred_username]|length > 0 %}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Link</th>
|
||||||
|
<th>Validity</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
{% for invite in invites[user.preferred_username] %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a class="invite" href="{{ url_for('register_invite', invite=invite.link) }}">
|
||||||
|
{{ url_for('register_invite', invite=invite.link) }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td> {{ invite.validity }} </td>
|
||||||
|
<td> <button class="button is-ghost"><a href="{{ url_for('invite_keycloak_delete') }}?invite={{ invite.link }}">delete</a></button></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<button class="button is-ghost"><a href="{{ url_for('invite_keycloak_create') }}">Generate</a></button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user