UX: lector publico, panel admin escondido, paginacion feed, auth activa
This commit is contained in:
+17
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user