mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-10-28 15:47:50 +09:00
Comments, docstrings and a few strings cited plan numbers ("plan 29
#9", "plan 86 §B2") from a git-ignored folder, so they pointed at
nothing; one reached users in a bottleneck hint. Code and frontend
strings are unchanged apart from those citations (checked by AST and
token comparison). A vhost still carrying the old asset comment reads
as undrifted, and a guard test keeps new citations out.
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
"""Run envelope REST twin.
|
|
|
|
The polling counterpart of the `run_log` / `run_status` socket events: any
|
|
run kind's persisted lines, resumable via ?after_id, so a client that missed
|
|
socket frames (or has sockets disabled) can always catch up. The deploy kind
|
|
keeps its richer legacy endpoint (/api/v1/deployment-jobs/<id>/logs) — this
|
|
one serves every kind stored in run_log_entries.
|
|
"""
|
|
from flask import Blueprint, jsonify, request
|
|
|
|
from app.middleware.rbac import auth_required, get_current_user
|
|
from app.services.run_access import can_read_run
|
|
from app.services.run_log_service import list_run_logs
|
|
|
|
runs_bp = Blueprint('runs', __name__)
|
|
|
|
|
|
@runs_bp.route('/<run_kind>/<run_id>/logs', methods=['GET'])
|
|
@auth_required()
|
|
def get_run_logs(run_kind, run_id):
|
|
if not can_read_run(get_current_user(), run_kind, run_id):
|
|
return jsonify({'error': 'Run not found or access denied'}), 403
|
|
after_id = request.args.get('after_id', type=int)
|
|
return jsonify({'logs': list_run_logs(run_kind, run_id, after_id=after_id)}), 200
|