Added food api endpoints prep for mcp

This commit is contained in:
Joren de Graaf
2026-10-07 14:56:24 +02:00
parent 98f76918dc
commit 4f8c3272aa
22 changed files with 1093 additions and 115 deletions
+34
View File
@@ -0,0 +1,34 @@
{% extends 'planner/base.html' %}
{% block title %}API tokens · Tasknest{% endblock %}
{% block content %}
<section class="settings-page">
<p class="eyebrow">Personal preferences</p>
<h1>API tokens</h1>
<p>Give an app access to your food log and kitchen inventory. Keep tokens private.</p>
{% if new_token %}
<section class="settings-card" role="status">
<h2>New token</h2>
<p><strong>Copy this token now. For security reasons it cannot be shown again.</strong></p>
<div class="form-field"><label for="new-api-token">Token</label><input id="new-api-token" type="text" value="{{ new_token }}" readonly autocomplete="off" spellcheck="false"></div>
</section>
{% endif %}
<section class="settings-card">
<h2>Create token</h2>
<form method="post">{% csrf_token %}
{% for field in form %}{% if field.name == 'scopes' %}<fieldset class="token-scope-field"><legend>Permissions</legend>{{ field }}{{ field.errors }}</fieldset>{% else %}<div class="form-field">{{ field.label_tag }}{{ field }}{{ field.errors }}</div>{% endif %}{% endfor %}
<button class="button" type="submit">Create token</button>
</form>
</section>
<section class="settings-card">
<h2>Your tokens</h2>
{% for token in tokens %}
<div>
<h3>{{ token.name }}</h3>
<p>Permissions: {{ token.scopes|join:", " }} · Created: {{ token.created_at|date:"SHORT_DATETIME_FORMAT" }} · Last used: {{ token.last_used_at|date:"SHORT_DATETIME_FORMAT"|default:"Never" }}</p>
<p>Status: {% if token.revoked_at %}Revoked{% elif token.expires_at and token.expires_at <= now %}Expired{% else %}Active{% endif %}{% if token.expires_at %} · Expires: {{ token.expires_at|date:"SHORT_DATETIME_FORMAT" }}{% endif %}</p>
{% if not token.revoked_at %}<form method="post" action="{% url 'food:token-revoke' token.pk %}">{% csrf_token %}<button class="button button--secondary" type="submit">Revoke {{ token.name }}</button></form>{% endif %}
</div>
{% empty %}<p>No API tokens yet.</p>{% endfor %}
</section>
</section>
{% endblock %}