fix: RegisterPublicRoute pour pages HTML modules + masquer installés dans store

- RouteEntry.Public bool : routes sans auth (pages HTML navigables par Swup)
- RegisterPublicRoute() ajouté à Registry interface + coreRegistry
- main.go : switch public/auth/admin pour les routes modules
- modules.html : masque les modules déjà installés dans le store

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-22 18:44:10 +01:00
parent 3c8a1a6b58
commit 365165c13b
4 changed files with 16 additions and 5 deletions

View file

@ -80,6 +80,7 @@ type RouteEntry struct {
Path string
Handler http.HandlerFunc
RequireAdmin bool
Public bool // true = pas d'authentification requise (ex: pages HTML)
}
type migrationEntry struct {
@ -118,7 +119,12 @@ func newCoreRegistry(sqlDB *sql.DB, pool *sshpool.Pool, enc *crypto.Encryptor) *
}
func (r *coreRegistry) RegisterRoute(method, path string, handler http.HandlerFunc, requireAdmin bool) {
r.routes = append(r.routes, RouteEntry{method, path, handler, requireAdmin})
r.routes = append(r.routes, RouteEntry{Method: method, Path: path, Handler: handler, RequireAdmin: requireAdmin})
}
// RegisterPublicRoute enregistre une route sans authentification (ex: page HTML d'un module).
func (r *coreRegistry) RegisterPublicRoute(method, path string, handler http.HandlerFunc) {
r.routes = append(r.routes, RouteEntry{Method: method, Path: path, Handler: handler, Public: true})
}
func (r *coreRegistry) RegisterWSChannel(channel string, handler WSHandler) {