Spaces:
Sleeping
Sleeping
deploy 2026-05-11_1146
Browse files- app.py +12 -0
- templates/index.html +1 -0
app.py
CHANGED
|
@@ -115,6 +115,18 @@ def index():
|
|
| 115 |
return render_template("index.html")
|
| 116 |
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
@app.route("/api/data")
|
| 119 |
def api_data():
|
| 120 |
collect_only = request.args.get("collect_only", "1") == "1"
|
|
|
|
| 115 |
return render_template("index.html")
|
| 116 |
|
| 117 |
|
| 118 |
+
@app.route("/api/download-csv")
|
| 119 |
+
def download_csv():
|
| 120 |
+
"""Send the full raw CSV file as a download."""
|
| 121 |
+
if not os.path.exists(CSV_PATH):
|
| 122 |
+
return Response("No data file found", status=404)
|
| 123 |
+
return Response(
|
| 124 |
+
open(CSV_PATH, "r", encoding="utf-8").read(),
|
| 125 |
+
mimetype="text/csv",
|
| 126 |
+
headers={"Content-Disposition": f"attachment; filename={os.path.basename(CSV_PATH)}"},
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
@app.route("/api/data")
|
| 131 |
def api_data():
|
| 132 |
collect_only = request.args.get("collect_only", "1") == "1"
|
templates/index.html
CHANGED
|
@@ -235,6 +235,7 @@
|
|
| 235 |
<input type="text" id="globalSearch" placeholder="Search all columns...">
|
| 236 |
<label><input type="checkbox" id="showAllCols"> All columns</label>
|
| 237 |
<label><input type="checkbox" id="hideBots"> Hide bots</label>
|
|
|
|
| 238 |
<button class="btn" id="refreshBtn">Reload</button>
|
| 239 |
<span class="badge" id="rowCount">-</span>
|
| 240 |
</div>
|
|
|
|
| 235 |
<input type="text" id="globalSearch" placeholder="Search all columns...">
|
| 236 |
<label><input type="checkbox" id="showAllCols"> All columns</label>
|
| 237 |
<label><input type="checkbox" id="hideBots"> Hide bots</label>
|
| 238 |
+
<a class="btn" href="/api/download-csv" download style="text-decoration:none">Download CSV</a>
|
| 239 |
<button class="btn" id="refreshBtn">Reload</button>
|
| 240 |
<span class="badge" id="rowCount">-</span>
|
| 241 |
</div>
|