🚀 Auto-deploy: BrainKP atualizado em 25/07/2026 19:55:59

This commit is contained in:
2026-07-25 19:55:59 +00:00
parent 6ebb16634a
commit 2f371c23ec
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -549,6 +549,13 @@ def run_backup():
except Exception as e:
return jsonify({"error": str(e), "trace": traceback.format_exc()}), 500
@app.route("/api/download/<filename>")
def download_file(filename):
path = f"/tmp/restore-temp/{filename}"
if os.path.exists(path):
return send_file(path, as_attachment=True)
return "File not found locally", 404
# ──────────────────────────────────────────────
# STATIC & LOGS
# ──────────────────────────────────────────────
+8
View File
@@ -221,6 +221,7 @@ input,button,select{font-family:inherit}
</div>
<div class="modal-body" id="modal-body"></div>
<div class="modal-footer" id="modal-footer">
<a id="modal-download" class="btn" style="display:none; text-decoration:none;" target="_blank">📥 Baixar</a>
<button class="btn" onclick="closeModal()">Cancelar</button>
<button class="btn btn-primary" id="modal-confirm" onclick="doRestore()">Restaurar</button>
</div>
@@ -504,6 +505,7 @@ function openRestoreModal(type, filename, size) {
<div class="progress-bar" id="dl-progress"><div class="fill" style="width:0%"></div></div>
`;
document.getElementById('modal-confirm').style.display = 'inline-block';
document.getElementById('modal-download').style.display = 'none';
document.getElementById('restore-modal').classList.add('show');
// Start download
@@ -542,6 +544,8 @@ function openRestoreModal(type, filename, size) {
` cp -r ${d.extracted_to}/* /var/lib/docker/volumes/yccsckck4g004gosccwc4kg4_gitea-data/_data/`;
}
document.getElementById('restore-instructions').value = instructions || 'Pronto para uso.';
document.getElementById('modal-download').href = `/api/download/${filename}`;
document.getElementById('modal-download').style.display = 'inline-block';
} else {
document.getElementById('restore-instructions').value = `Erro: ${d.error}`;
}
@@ -569,6 +573,7 @@ function openRestoreRepo(owner, repoName, size) {
<textarea id="restore-instructions" disabled>Baixando e preparando...</textarea>
</div>
`;
document.getElementById('modal-download').style.display = 'none';
document.getElementById('restore-modal').classList.add('show');
fetch(`${API}/restore/repo`, {
@@ -588,6 +593,9 @@ function openRestoreRepo(owner, repoName, size) {
` cp -r ${d.extracted_to}/* /var/lib/docker/volumes/yccsckck4g004gosccwc4kg4_gitea-data/_data/git/repositories/${owner}/\n` +
` # Reinicie o Gitea\n` +
` docker start <gitea-container>`;
document.getElementById('modal-download').href = `/api/download/${repoName}`;
document.getElementById('modal-download').style.display = 'inline-block';
} else {
document.getElementById('restore-instructions').value = `Erro: ${d.error}`;
}