Compare commits
No commits in common. "117b3bc3d06f3a64135813eb3639f1f2b8c1d56d" and "a408d1dbb0479cea14da076f37ed6f939ac1d121" have entirely different histories.
117b3bc3d0
...
a408d1dbb0
8 changed files with 22 additions and 20 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import click
|
import click
|
||||||
from flask import Flask, request, current_app
|
from flask import Flask, request, session, current_app
|
||||||
import tomllib
|
import tomllib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"""API endpoints supporting the 'ui'."""
|
"""API endpoints supporting the 'ui'."""
|
||||||
|
|
||||||
|
|
||||||
from flask import Blueprint
|
from flask import Blueprint, request, Request, redirect
|
||||||
|
|
||||||
BLUEPRINT = Blueprint("api", __name__, url_prefix="/api")
|
BLUEPRINT = Blueprint("api", __name__, url_prefix="/api")
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from click import group
|
||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint,
|
Blueprint,
|
||||||
|
current_app,
|
||||||
request,
|
request,
|
||||||
|
Request,
|
||||||
redirect,
|
redirect,
|
||||||
render_template,
|
render_template,
|
||||||
|
session,
|
||||||
|
url_for,
|
||||||
flash,
|
flash,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,16 @@ import re
|
||||||
|
|
||||||
from tentacles.globals import ctx
|
from tentacles.globals import ctx
|
||||||
|
|
||||||
|
from click import group
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint,
|
Blueprint,
|
||||||
current_app,
|
current_app,
|
||||||
request,
|
request,
|
||||||
|
Request,
|
||||||
redirect,
|
redirect,
|
||||||
render_template,
|
render_template,
|
||||||
|
session,
|
||||||
|
url_for,
|
||||||
flash,
|
flash,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,17 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from click import group
|
||||||
|
|
||||||
from flask import (
|
from flask import (
|
||||||
|
Blueprint,
|
||||||
current_app,
|
current_app,
|
||||||
|
request,
|
||||||
|
Request,
|
||||||
redirect,
|
redirect,
|
||||||
|
render_template,
|
||||||
|
session,
|
||||||
|
url_for,
|
||||||
flash,
|
flash,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -307,17 +307,3 @@ form {
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.keys ul li {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.key-key {
|
|
||||||
max-width: 20em;
|
|
||||||
overflow: clip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
No printers available. {% if ctx.is_admin %}<a href="/printers/add">Configure one!</a>{% else %}Ask the admin to configure one!{% endif %}
|
No printers available. {% if request.is_admin %}<a href="/printers/add">Configure one!</a>{% else %}Ask the admin to configure one!{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{% extends "base.html.j2" %}
|
{% extends "base.html.j2" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>User settings</h1>
|
<h1>User settings</h1>
|
||||||
<div class="keys">
|
<div class="">
|
||||||
<h2>API keys</h2>
|
<h2>API keys</h2>
|
||||||
{% with keys = ctx.db.list_keys(ctx.uid) %}
|
{% with keys = ctx.db.list_keys(ctx.uid) %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for id, name, exp in keys if name != 'web session' %}
|
{% for id, name, exp in keys if name != 'web session' %}
|
||||||
<li>
|
<li>
|
||||||
<span class="key-name">{{ name or 'anonymous' }}</span>
|
<span class="key-name">{{ name }}</span>
|
||||||
<span class="key-key">{{ id[:10] }}...</span>
|
<span class="key-key">{{ id }}</span>
|
||||||
<span class="key-expiration">{{ 'Expires in' if exp else ''}} {{ exp - datetime.now() if exp else 'Never' }}</span>
|
<span class="key-expiration">{{ 'Expires in' if exp else ''}} {{ exp - datetime.now() if exp else 'Never' }}</span>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="action" value="revoke">
|
<input type="hidden" name="action" value="revoke">
|
||||||
|
|
Loading…
Reference in a new issue