mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
Add files via upload
This commit is contained in:
@@ -80,6 +80,27 @@ func main() {
|
||||
time.Sleep(2 * time.Second)
|
||||
http.Redirect(w, r, "http://webportal:8080/", http.StatusFound)
|
||||
}))
|
||||
// Authentication routes
|
||||
http.HandleFunc("/login", enableCORS(handleLogin))
|
||||
http.HandleFunc("/logout", enableCORS(handleLogout))
|
||||
|
||||
// Admin routes (protected)
|
||||
http.HandleFunc("/admin", enableCORS(requireAdminAuth(handleAdmin)))
|
||||
http.HandleFunc("/admin/cards", enableCORS(requireAdminAuth(handleAdminCards)))
|
||||
|
||||
http.HandleFunc("/admin/cards/", enableCORS(requireAdminAuth(func(w http.ResponseWriter, r *http.Request) {
|
||||
path := r.URL.Path
|
||||
if strings.HasSuffix(path, "/toggle") {
|
||||
handleAdminCardToggle(w, r)
|
||||
} else if r.Method == "DELETE" {
|
||||
handleAdminCardDelete(w, r)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
})))
|
||||
|
||||
// Public API to get cards for homepage
|
||||
http.HandleFunc("/api/cards", enableCORS(handleGetCards))
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
|
||||
Reference in New Issue
Block a user