j49_c commited on
Commit
182c4ef
·
1 Parent(s): 867199e

Fix duplicate users API route in admin panel

Browse files
Files changed (1) hide show
  1. app.py +0 -43
app.py CHANGED
@@ -1114,50 +1114,7 @@ def admin_server_ban():
1114
  return jsonify({"success": True})
1115
 
1116
 
1117
- @app.route("/api/admin/users")
1118
- @admin_required
1119
- def admin_users():
1120
- db = load_users()
1121
-
1122
- counts = {}
1123
- if os.path.isdir(USERS_ROOT):
1124
- for owner in os.listdir(USERS_ROOT):
1125
- root = get_user_servers_root(owner)
1126
- if os.path.isdir(root):
1127
- counts[owner] = len([d for d in os.listdir(root) if os.path.isdir(os.path.join(root, d))])
1128
-
1129
- users = []
1130
- for u in db.get("users", []):
1131
- users.append({
1132
- "username": u.get("username"),
1133
- "email": u.get("email"),
1134
- "active": bool(u.get("active", True)),
1135
- "premium": bool(u.get("premium", False)),
1136
- "servers": counts.get(u.get("username") or "", 0),
1137
- })
1138
- return jsonify({"success": True, "users": users})
1139
-
1140
 
1141
- @app.route("/api/admin/user/update", methods=["POST"])
1142
- @admin_required
1143
- def admin_user_update():
1144
- data = request.get_json(silent=True) or {}
1145
- username = (data.get("username") or "").strip()
1146
- if not username:
1147
- return jsonify({"success": False, "message": "Username required"}), 400
1148
-
1149
- db = load_users()
1150
- u = find_user(db, username)
1151
- if not u:
1152
- return jsonify({"success": False, "message": "User not found"}), 404
1153
-
1154
- if "active" in data:
1155
- u["active"] = bool(data["active"])
1156
- if "premium" in data:
1157
- u["premium"] = bool(data["premium"])
1158
-
1159
- save_users(db)
1160
- return jsonify({"success": True})
1161
 
1162
 
1163
  @app.route("/api/admin/quickstats")
 
1114
  return jsonify({"success": True})
1115
 
1116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1118
 
1119
 
1120
  @app.route("/api/admin/quickstats")