This commit is contained in:
pavel 2026-05-10 21:06:23 +02:00
commit 8fa8d04427
10 changed files with 231 additions and 71 deletions

View file

@ -23,6 +23,7 @@ type App struct {
auth *Auth
templates *template.Template
storageDir string
devMode bool
}
type Skill struct {
@ -83,11 +84,15 @@ func main() {
auth: auth,
templates: tmpl,
storageDir: cfg.StorageDir,
devMode: cfg.DevMode,
}
app.auth.WithDB(db)
mux := http.NewServeMux()
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
mux.HandleFunc("/auth/login", app.auth.HandleLogin)
mux.HandleFunc("/auth/callback", app.auth.HandleCallback)
mux.HandleFunc("/auth/logout", app.auth.HandleLogout)
mux.Handle("/uploads/", app.auth.RequireAuth(http.HandlerFunc(app.handleDownload)))
mux.HandleFunc("/", app.handleHome)
mux.Handle("/dashboard", app.auth.RequireAuth(http.HandlerFunc(app.handleDashboard)))
@ -133,7 +138,8 @@ func (a *App) handleHome(w http.ResponseWriter, r *http.Request) {
return
}
a.render(w, "home.html", map[string]any{
"Title": "LLM Skill Marketplace",
"Title": "LLM Skill Marketplace",
"DevMode": a.devMode,
})
}