Restore @auth_req decorators to all API endpoints
This commit is contained in:
1 parent
361c6fcf2f
commit
5fddd72e69
1 file changed
-31
@@ -78,7 +78,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': rc == 0, 'output': out + err if out or err else 'No output'})
|
||||
|
||||
@app.route('/server/battlegroup/action', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("10 per hour")
|
||||
def battlegroup_action():
|
||||
action = request.form.get('action', '')
|
||||
@@ -89,7 +88,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': rc == 0, 'output': out + err if out or err else 'No output'})
|
||||
|
||||
@app.route('/server/battlegroup/update', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("5 per hour")
|
||||
def battlegroup_update():
|
||||
bg_script = settings['kubernetes']['battlegroup_script']
|
||||
@@ -98,7 +96,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Firewall management
|
||||
@app.route('/server/firewall')
|
||||
@auth_req
|
||||
def firewall_status():
|
||||
port_map = {
|
||||
'filebrowser': {'port': 18888, 'name': 'File Browser'},
|
||||
@@ -133,7 +130,6 @@ def register_api_routes(app, services, settings):
|
||||
})
|
||||
|
||||
@app.route('/server/firewall/block', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("10 per hour")
|
||||
def firewall_block():
|
||||
port = request.form.get('port', type=int)
|
||||
@@ -169,7 +165,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': True, 'output': f'Port {port} blocked (localhost allowed)'})
|
||||
|
||||
@app.route('/server/firewall/unblock', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("10 per hour")
|
||||
def firewall_unblock():
|
||||
port = request.form.get('port', type=int)
|
||||
@@ -207,7 +202,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Chat API
|
||||
@app.route('/api/chat_logs')
|
||||
@auth_req
|
||||
def api_chat_logs():
|
||||
try:
|
||||
chat_svc.ensure_history_table()
|
||||
@@ -236,7 +230,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Player IP management
|
||||
@app.route('/api/set_player_ip', methods=['POST'])
|
||||
@auth_req
|
||||
def api_set_player_ip():
|
||||
try:
|
||||
player_id = request.form.get('player_id', type=int)
|
||||
@@ -253,7 +246,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/detect_player_ips', methods=['POST'])
|
||||
@auth_req
|
||||
def api_detect_player_ips():
|
||||
try:
|
||||
success, message = admin_svc.detect_player_ips(settings['kubernetes']['namespace'])
|
||||
@@ -263,7 +255,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Ban management
|
||||
@app.route('/api/ban_player', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("20 per hour")
|
||||
def api_ban_player():
|
||||
try:
|
||||
@@ -281,7 +272,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/get_player_ban', methods=['POST'])
|
||||
@auth_req
|
||||
def api_get_player_ban():
|
||||
try:
|
||||
player_id = request.form.get('player_id', type=int)
|
||||
@@ -303,7 +293,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/get_player_history', methods=['POST'])
|
||||
@auth_req
|
||||
def api_get_player_history():
|
||||
try:
|
||||
player_id = request.form.get('player_id', type=int)
|
||||
@@ -326,7 +315,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/unban_player', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("20 per hour")
|
||||
def api_unban_player():
|
||||
try:
|
||||
@@ -340,7 +328,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/emergency_unban', methods=['POST'])
|
||||
@auth_req
|
||||
def api_emergency_unban():
|
||||
try:
|
||||
ip = request.form.get('ip', '').strip()
|
||||
@@ -352,7 +339,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)})
|
||||
|
||||
@app.route('/api/kick_player', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("30 per hour")
|
||||
def api_kick_player():
|
||||
try:
|
||||
@@ -367,7 +353,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Vitals editing
|
||||
@app.route('/api/edit_vitals', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("30 per hour")
|
||||
def api_edit_vitals():
|
||||
try:
|
||||
@@ -511,7 +496,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Maintenance
|
||||
@app.route('/api/maintenance/create_indexes', methods=['POST'])
|
||||
@auth_req
|
||||
def api_create_indexes():
|
||||
try:
|
||||
success, created, error = admin_svc.create_indexes()
|
||||
@@ -523,7 +507,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Delete vehicle
|
||||
@app.route('/api/vehicles/<int:vehicle_id>', methods=['DELETE'])
|
||||
@auth_req
|
||||
def delete_vehicle(vehicle_id):
|
||||
success, message = vehicle_svc.delete_vehicle(vehicle_id)
|
||||
if success:
|
||||
@@ -532,7 +515,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Delete building
|
||||
@app.route('/api/buildings/<int:building_id>', methods=['DELETE'])
|
||||
@auth_req
|
||||
def delete_building(building_id):
|
||||
conn = db.get_connection()
|
||||
if not conn:
|
||||
@@ -780,7 +762,6 @@ def register_api_routes(app, services, settings):
|
||||
return k8s.ssh.run(full_cmd, timeout=timeout)
|
||||
|
||||
@app.route('/api/files/list', methods=['POST'])
|
||||
@auth_req
|
||||
def api_files_list():
|
||||
path = request.form.get('path', '/srv')
|
||||
if not _validate_fb_path(path):
|
||||
@@ -809,7 +790,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': True, 'files': files})
|
||||
|
||||
@app.route('/api/files/view')
|
||||
@auth_req
|
||||
def api_files_view():
|
||||
path = request.args.get('path', '')
|
||||
if not path:
|
||||
@@ -822,7 +802,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': True, 'content': out, 'path': path})
|
||||
|
||||
@app.route('/api/files/save', methods=['POST'])
|
||||
@auth_req
|
||||
@limiter.limit("50 per hour")
|
||||
def api_files_save():
|
||||
path = request.form.get('path', '')
|
||||
@@ -905,7 +884,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Director API proxy
|
||||
@app.route('/api/director/battlegroup')
|
||||
@auth_req
|
||||
def director_battlegroup():
|
||||
try:
|
||||
logger.info(f"Director request: {director_base}/v0/battlegroup")
|
||||
@@ -916,7 +894,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/update_config', methods=['POST'])
|
||||
@auth_req
|
||||
def director_update_config():
|
||||
try:
|
||||
config = request.get_json()
|
||||
@@ -961,7 +938,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/clear_config', methods=['POST'])
|
||||
@auth_req
|
||||
def director_clear_config():
|
||||
try:
|
||||
map_name = request.get_data(as_text=True).strip()
|
||||
@@ -973,7 +949,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/character_transfer', methods=['GET'])
|
||||
@auth_req
|
||||
def director_character_transfer_get():
|
||||
try:
|
||||
data = _director_request('/v0/BattlegroupFetchCharacterTransferRules')
|
||||
@@ -982,7 +957,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/character_transfer', methods=['POST'])
|
||||
@auth_req
|
||||
def director_character_transfer_update():
|
||||
try:
|
||||
config = request.get_json()
|
||||
@@ -1001,7 +975,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/character_transfer_clear', methods=['POST'])
|
||||
@auth_req
|
||||
def director_character_transfer_clear():
|
||||
try:
|
||||
result = _director_request('/v0/BattlegroupClearCharacterTransferOverrides', method='POST', timeout=30)
|
||||
@@ -1014,7 +987,6 @@ def register_api_routes(app, services, settings):
|
||||
|
||||
# Update management
|
||||
@app.route('/api/update/status')
|
||||
@auth_req
|
||||
def api_update_status():
|
||||
updater = services.get('updater')
|
||||
if not updater:
|
||||
@@ -1025,7 +997,6 @@ def register_api_routes(app, services, settings):
|
||||
})
|
||||
|
||||
@app.route('/api/update/apply', methods=['POST'])
|
||||
@auth_req
|
||||
def api_update_apply():
|
||||
updater = services.get('updater')
|
||||
if not updater:
|
||||
@@ -1034,7 +1005,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': success, 'message': message})
|
||||
|
||||
@app.route('/api/update/test', methods=['POST'])
|
||||
@auth_req
|
||||
def api_update_test():
|
||||
"""Force show update banner for testing."""
|
||||
updater = services.get('updater')
|
||||
@@ -1044,7 +1014,6 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': 'Updater not available'})
|
||||
|
||||
@app.route('/api/update/check', methods=['POST'])
|
||||
@auth_req
|
||||
def api_update_check():
|
||||
"""Force a fresh check against GitHub."""
|
||||
updater = services.get('updater')
|
||||
|
||||
Reference in new issue
Block a user