fix(user): allow re-login by removing existing session if user is already logged in
fix(main): conditionally initialize and connect to watchdog based on configuration fix(instance): remove unused userID variable and commented debug logs in ListInstancesHandler
This commit is contained in:
@@ -463,7 +463,7 @@ func getNumFromMap(m map[string]interface{}, key string) int {
|
||||
}
|
||||
|
||||
func ListInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
userID, err := utils.Auth(w, r, http.MethodGet, "visitor", "admin", "superuser")
|
||||
_, err := utils.Auth(w, r, http.MethodGet, "visitor", "admin", "superuser")
|
||||
if err != nil {
|
||||
utils.SendErrorResponse(w, http.StatusUnauthorized, "invalid token or timestamp")
|
||||
postLog.Warning(fmt.Sprintf("[ListInstancesHandler] Auth failed: %v", err))
|
||||
@@ -471,7 +471,7 @@ func ListInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
instances, err := database.DBListFrpcInstances()
|
||||
postLog.Debug(fmt.Sprintf("[ListInstancesHandler] Retrieved %d instances", len(instances)))
|
||||
// postLog.Debug(fmt.Sprintf("[ListInstancesHandler] Retrieved %d instances", len(instances)))
|
||||
if err != nil {
|
||||
postLog.Error(fmt.Sprintf("[ListInstancesHandler] Failed to get all instances: %v", err))
|
||||
utils.SendErrorResponse(w, http.StatusInternalServerError, "Failed to get instances")
|
||||
@@ -499,7 +499,7 @@ func ListInstancesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
utils.SendSuccessResponse(w, "Instances retrieved successfully", instanceList)
|
||||
postLog.Info(fmt.Sprintf("[ListInstancesHandler] Retrieved %d instances for user %d", len(instances), userID))
|
||||
// postLog.Info(fmt.Sprintf("[ListInstancesHandler] Retrieved %d instances for user %d", len(instances), userID))
|
||||
}
|
||||
|
||||
func StartInstanceHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user