gitea.py answered a 401 or 403 from the git server by raising
PermissionError("gitea-unauthorised"), with a comment saying the caller would
refresh and retry. That caller was tokens.py, deleted two phases ago when the
members area took over its own logins. Nothing has caught it since, so a
refused token arrived as a 500 on Contenido — Flask's own page, in English,
saying nothing — and, when approving a submission, as "no se encontró la imagen
en el disco", because PermissionError is a subclass of OSError and the approve
path caught OSError to mean a missing file. The page was displaying the
photograph two lines above the message.
Underneath both: a site-admin token cannot write to a repository. Gitea's
scopes are per category and `admin` does not contain `repository`, so the
editor has never been able to commit and nothing written in the members area
has ever reached the site. server-setup.md said the fallback to
GITEA_ADMIN_TOKEN "keeps an existing install working", which was the sentence
that hid it; it now says what that token can and cannot do.
Fixed: 401/403 raises a GiteaError naming the scope to check; approve reads the
picture before the try and catches only FileNotFoundError, so "the image is
missing" is said only when it is; and a 500 handler renders the site's own page
and logs the traceback with the request path.
Then the three wall pieces:
Every name — wall, thread, comment, private message, dashboard, directory —
renders through templates/_person.html, which links to vienalatina.com/<login>
only when that person has published a page. Both failure modes are silent, so
the rule lives in one macro instead of nine templates. A profile also has one
canonical address now: /<name>/ redirects to /<name>, which is what url_for had
been quietly preferring.
One 👍 per member per thread or comment, clicking again takes it back. The
table is shaped like attachments — two nullable parents, a CHECK that exactly
one is set — and uniqueness is two partial indexes, because UNIQUE across a
NULL column would make every comment reaction unique by accident. The `back`
field goes through auth.safe_next (renamed from _safe_next), since a redirect
somebody can type is an open redirect.
Miembros is a directory: a card per person with photo, username, role, the
first line of their bio, somewhere to write from and a link to their page.
Admin controls fold into a per-card Gestionar block. That is also the fix for
the misaligned row in the screenshot — four forms in a column two inches wide
was the cause, and the table is gone. Photos inside the members area are served
by a login-gated route even when the public page is unpublished, and the
profile form now says so.
404 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
63 lines
2.2 KiB
HTML
63 lines
2.2 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Mi perfil{% endblock %}
|
|
|
|
{% block main %}
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('profiles.edit') }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<h1>Mi perfil público</h1>
|
|
|
|
{% if not available %}
|
|
{# The routing gives the static site every collision, so this page would
|
|
simply never load. Better said here than discovered by a friend who
|
|
cannot open the link. #}
|
|
<p class="flash flash--error">
|
|
Tu usuario coincide con una dirección que ya usa el sitio, así que tu
|
|
página no se podría abrir. Pide a un administrador que te cambie el
|
|
nombre de usuario.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<label for="bio">Sobre ti</label>
|
|
<textarea id="bio" name="bio" rows="8"
|
|
placeholder="Se puede usar Markdown.">{{ g.member.bio or '' }}</textarea>
|
|
|
|
<label for="links">Enlaces</label>
|
|
<textarea id="links" name="links" rows="5"
|
|
placeholder="Instagram|https://instagram.com/tu-cuenta">{{ links_text }}</textarea>
|
|
<p class="muted small">
|
|
Uno por línea, con el formato <span class="mono">Nombre|dirección</span>.
|
|
Sólo direcciones que empiecen por http:// o https://.
|
|
</p>
|
|
|
|
<label for="photo">Foto</label>
|
|
<input id="photo" name="photo" type="file" accept="image/*">
|
|
{% if g.member.photo_name %}
|
|
<p class="muted small">Ya tienes una. Subir otra la reemplaza.</p>
|
|
{% endif %}
|
|
<p class="muted small">
|
|
Tu foto aparece en <a href="{{ url_for('members.index') }}">Miembros</a>,
|
|
que sólo ven las personas que han entrado. Fuera del sitio sólo se ve si
|
|
publicas tu página, abajo.
|
|
</p>
|
|
|
|
<label class="check">
|
|
<input type="checkbox" name="published" {{ 'checked' if g.member.profile_published }}>
|
|
Publicar mi página
|
|
</label>
|
|
<p class="muted small">
|
|
Mientras esté publicada, cualquiera puede verla en
|
|
<span class="mono">vienalatina.com{{ address }}</span> y los buscadores
|
|
pueden indexarla. Puedes dejar de publicarla cuando quieras: la página y
|
|
la foto desaparecen en el momento.
|
|
</p>
|
|
|
|
<div class="actions">
|
|
<button class="btn" type="submit">Guardar</button>
|
|
{% if g.member.profile_published %}
|
|
<a class="linkish" href="{{ address }}">Ver mi página</a>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|