Add dashcam USB file browser
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -38,6 +38,29 @@ def dash_import():
|
||||
summary = app_dash.import_dashcam()
|
||||
return jsonify(summary)
|
||||
|
||||
@app.route('/api/dash/files')
|
||||
def dash_files():
|
||||
summary = app_dash.list_dashcam_files()
|
||||
return jsonify(summary)
|
||||
|
||||
@app.route('/api/dash/files', methods=['DELETE'])
|
||||
def dash_delete_all():
|
||||
summary = app_dash.delete_dashcam_files(delete_all=True)
|
||||
status_code = 200 if summary["status"] in {"ok", "partial"} else 409
|
||||
return jsonify(summary), status_code
|
||||
|
||||
@app.route('/api/dash/file', methods=['DELETE'])
|
||||
def dash_delete_file():
|
||||
body = request.get_json(silent=True) or {}
|
||||
summary = app_dash.delete_dashcam_files(relative_path=body.get("path"))
|
||||
status_codes = {
|
||||
"ok": 200,
|
||||
"partial": 409,
|
||||
"invalid_path": 400,
|
||||
"not_found": 404,
|
||||
}
|
||||
return jsonify(summary), status_codes.get(summary["status"], 409)
|
||||
|
||||
@app.route('/api/upload/status')
|
||||
def upload_status():
|
||||
return jsonify(app_upload.get_status())
|
||||
|
||||
Reference in New Issue
Block a user