feat(handlers): add duplicate login check and improve request handling

refactor: move postLog package to root directory and enhance logging
fix(frpc): improve request parsing and type handling for instance creation
chore: update config paths and enable debug mode
This commit is contained in:
2026-02-27 21:04:08 +08:00
parent 7e163b5216
commit 962a36d74f
7 changed files with 112 additions and 27 deletions
+7 -1
View File
@@ -7,7 +7,7 @@ import (
"io"
"net/http"
"strconv"
"super-frpc/modules"
"super-frpc/postLog"
"time"
)
@@ -150,6 +150,12 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
return
}
existingTokenInfo, err := GetTokenInfo(user.UserID)
if err == nil && existingTokenInfo != nil {
SendErrorResponse(w, http.StatusConflict, "user is already logged in")
return
}
token, err := GenerateToken(user.UserID)
if err != nil {
SendErrorResponse(w, http.StatusInternalServerError, "failed to generate token")