🎨 加入只读模式配置

This commit is contained in:
Liang Ding 2022-08-09 10:11:53 +08:00
parent 24d4654030
commit f6a72ff464
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,11 @@ var logger = gulu.Log.NewLogger(os.Stdout)
// AutocompleteHandler handles request of code autocompletion.
func AutocompleteHandler(w http.ResponseWriter, r *http.Request) {
if conf.Wide.ReadOnly {
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)