feat: add read-only mode to API and UI, disable write actions

This commit is contained in:
Sergey Krashevich
2026-02-01 04:13:43 +03:00
parent 6085c8aabe
commit cc453dd9ed
24 changed files with 438 additions and 8 deletions
+14
View File
@@ -12,6 +12,13 @@ import (
func apiStreams(w http.ResponseWriter, r *http.Request) {
w = creds.SecretResponse(w)
if api.IsReadOnly() {
switch r.Method {
case "PUT", "PATCH", "POST", "DELETE":
api.ReadOnlyError(w)
return
}
}
query := r.URL.Query()
src := query.Get("src")
@@ -130,6 +137,13 @@ func apiStreamsDOT(w http.ResponseWriter, r *http.Request) {
}
func apiPreload(w http.ResponseWriter, r *http.Request) {
if api.IsReadOnly() {
switch r.Method {
case "PUT", "DELETE":
api.ReadOnlyError(w)
return
}
}
// GET - return all preloads
if r.Method == "GET" {
api.ResponseJSON(w, GetPreloads())