코드 정리

This commit is contained in:
2023-09-19 18:50:45 +09:00
parent e3ad826826
commit 81689f7512
2 changed files with 35 additions and 39 deletions

View File

@ -565,12 +565,12 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
// !success일 때 빈 body를 보내면 클라이언트는 로그아웃 된다.
if success {
output := map[string]any{
json.NewEncoder(w).Encode(map[string]any{
"sk": sk,
"expirein": sh.sessionTTL.Seconds(),
}
bt, _ := json.Marshal(output)
w.Write(bt)
})
} else {
logger.Println("sh.sessionProvider.Touch failed :", sk)
}
return
}
@ -598,6 +598,7 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
if err != nil {
logger.Error("getProviderInfo failed :", err)
w.WriteHeader(http.StatusBadRequest)
return
}
if authtype != newType || uid != newId {
@ -682,8 +683,8 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
if *noauth {
output["noauth"] = true
}
bt, _ := json.Marshal(output)
w.Write(bt)
json.NewEncoder(w).Encode(output)
}
func (sh *serviceDescription) findVersionSplit(version string) []byte {