impl. Kroki, compile path, and code-editor feature
This commit is contained in:
1 parent
c1bc8f0c03
commit
94d56f9a8f
49 files changed
+40652
-389
No files matched your search
@@ -166,10 +166,9 @@ func (s *Server) handleConfig(
|
||||
s.getTheme()
|
||||
|
||||
if v := strings.TrimSpace(r.FormValue("theme")); v != "" {
|
||||
switch v {
|
||||
case "dark", "light", "monokai", "solarized-dark", "solarized-light", "terminal-green", "amber-crt", "lain-dark", "nanoha-dark":
|
||||
if isAllowedTheme(v) {
|
||||
theme = v
|
||||
default:
|
||||
} else {
|
||||
http.Error(w, "invalid theme", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -239,6 +238,51 @@ func (s *Server) handleConfig(
|
||||
return
|
||||
}
|
||||
|
||||
case "editor":
|
||||
|
||||
keymap :=
|
||||
strings.TrimSpace(
|
||||
r.FormValue("editor_keymap"),
|
||||
)
|
||||
|
||||
if keymap != "vim" {
|
||||
keymap = "default"
|
||||
}
|
||||
|
||||
err = s.store.SetConfig(
|
||||
"editor_keymap",
|
||||
keymap,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
err = s.store.SetConfig(
|
||||
"editor_syntax_highlight",
|
||||
boolFormValue(
|
||||
r.FormValue("editor_syntax_highlight"),
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
err = s.store.SetConfig(
|
||||
"editor_autocomplete",
|
||||
boolFormValue(
|
||||
r.FormValue("editor_autocomplete"),
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
case "zombie-purge":
|
||||
|
||||
_, err = s.store.PurgeZombieObjects(
|
||||
@@ -338,6 +382,10 @@ func (s *Server) handleConfig(
|
||||
"Locale": s.getLocale(),
|
||||
"Timezone": s.getTimezoneName(),
|
||||
"Theme": s.getTheme(),
|
||||
"ThemeOptions": themeOptions(),
|
||||
"EditorKeymap": s.getEditorKeymap(),
|
||||
"EditorSyntax": s.getEditorSyntaxHighlight(),
|
||||
"EditorAutocomplete": s.getEditorAutocomplete(),
|
||||
"ZombieGraceHours": zombieGraceHours,
|
||||
"Objects": recent,
|
||||
"ZombieObjects": zombies,
|
||||
@@ -346,3 +394,16 @@ func (s *Server) handleConfig(
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func boolFormValue(
|
||||
v string,
|
||||
) string {
|
||||
|
||||
if v == "on" ||
|
||||
v == "true" ||
|
||||
v == "1" {
|
||||
return "true"
|
||||
}
|
||||
|
||||
return "false"
|
||||
}
|
||||
Reference in new issue
Block a user