You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
604 B

package localchat
import (
"encoding/json"
"godo/libs"
"net/http"
"os"
)
func HandleCheck(w http.ResponseWriter, r *http.Request) {
hostname, err := os.Hostname()
if err != nil {
libs.ErrorMsg(w, "HandleMessage error")
return
}
libs.SuccessMsg(w, hostname, "")
}
func HandleAddr(w http.ResponseWriter, r *http.Request) {
var ipStr libs.UserChatIpSetting
err := json.NewDecoder(r.Body).Decode(&ipStr)
if err != nil {
libs.HTTPError(w, http.StatusBadRequest, "Failed to parse request body")
return
}
libs.SetConfigByName("ChatIpSetting", ipStr)
libs.SuccessMsg(w, nil, "success")
}