UX: lector publico, panel admin escondido, paginacion feed, auth activa

This commit is contained in:
Renato
2026-08-04 12:33:57 +08:00
parent fcff8b0a7b
commit 3fded1eae6
6 changed files with 108 additions and 21 deletions
+17 -1
View File
@@ -21,12 +21,28 @@ const publicPrefixes = [
]
// Páginas públicas del sitio (server-side, sin login).
const publicPages = ["/", "/p/", "/tag/"]
// "/" es MATCH EXACTO (startsWith("/") matchearía TODO).
// "/gallery/" incluye el lector: cualquiera puede LEER (GET); las acciones
// del panel (eliminar, etc.) quedan protegidas por el middleware vía método.
const publicPages = ["/p/", "/tag/", "/gallery/"]
// GET de lectura del proxy hacia el pipeline: públicos para que el lector
// funcione sin login. POST/DELETE/PATCH (mutaciones) siempre requieren sesión.
function isPublicProxyRead(pathname: string, method: string): boolean {
if (method !== "GET" && method !== "HEAD") return false
return (
pathname.startsWith("/api/proxy/galleries/") ||
pathname === "/api/proxy/status" ||
pathname === "/api/proxy/queue"
)
}
function isPublicPath(pathname: string, method: string): boolean {
if (pathname === "/") return true
if (publicExact.has(pathname)) return true
if (publicPrefixes.some((p) => pathname.startsWith(p))) return true
if (publicPages.some((p) => pathname.startsWith(p))) return true
if (isPublicProxyRead(pathname, method)) return true
// /api/posts: GET de listado público; mutaciones requieren sesión.
if (pathname === "/api/posts" && method === "GET") return true