fix: change permission level for instance listing to visitor and making sure all instances could be listed for all users

This commit is contained in:
2026-05-07 21:38:52 +08:00
parent 9ffb4263cf
commit 6e705ce2f3
4 changed files with 22 additions and 22 deletions
+1 -7
View File
@@ -295,7 +295,7 @@ func DeleteProxyHandler(w http.ResponseWriter, r *http.Request) {
}
func ListProxiesHandler(w http.ResponseWriter, r *http.Request) {
userID, err := utils.Auth(w, r, http.MethodGet)
_, err := utils.Auth(w, r, http.MethodGet)
if err != nil {
utils.SendErrorResponse(w, http.StatusUnauthorized, err.Error())
postLog.Warning(fmt.Sprintf("[ListProxiesHandler] Auth failed: %v", err))
@@ -319,12 +319,6 @@ func ListProxiesHandler(w http.ResponseWriter, r *http.Request) {
return
}
if instance.UserID != userID {
postLog.Error(fmt.Sprintf("[ListProxiesHandler] Instance not found for user %d", userID))
utils.SendErrorResponse(w, http.StatusNotFound, "Instance not found")
return
}
configContent, err := os.ReadFile(instance.ConfigPath)
if err != nil {
postLog.Error(fmt.Sprintf("[ListProxiesHandler] Failed to read config file %s: %v", instance.ConfigPath, err))