A member fills in a bio, links and a photo, ticks a box, and has a page at vienalatina.com/su-nombre. Until they tick it there is no page, and an unpublished profile 404s exactly like a name that was never a member. The routing was the dangerous part and it is not solved by a list. The original plan reserved Hugo's paths in the Caddyfile, which is wrong the first time the site grows one, and the failure is a member's page silently shadowing part of vienalatina.com. Instead Caddy forwards a request only when the path is a single segment, is not /comunidad, and Hugo has built nothing there — `not file` with try_files. The static site wins every collision because the filesystem answers the question, so the rule cannot drift. A member called "de" shadows nothing; their profile is merely unreachable, which is why such names are refused at sign-up: to protect the member, not the site. An unknown name 404s from the app and handle_response turns that into the site's own 404.html, so the public site keeps its error page and the app never needs a public-facing one. Both directives verified against Caddy's documentation source, since caddyserver.com is unreachable here. Links are the injection surface on a public page: anything whose scheme is not http or https is dropped, which is asserted against javascript:, data: and vbscript:, including a leading-space variant. They render with rel="nofollow noopener". The photo is public, which the existing upload code deliberately is not, so it gets its own route that serves a file only while a published profile points at it. Unpublishing takes the picture down with the page, and a private board image cannot be fetched through it — both tested. The page does not extend base.html: that is the members-area chrome, and rendering a public page inside it would put "Área privada" and a Salir button on something anybody can read. It repeats the brand colours instead of sharing them, because Hugo fingerprints its stylesheet — a deliberate duplicate, named as one, with the source of truth in a comment. Migration 3 adds the columns. 231 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
58 lines
2.0 KiB
HTML
58 lines
2.0 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 %}
|
|
|
|
<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 %}
|