Added export to web interface

This commit is contained in:
krateng 2022-04-04 18:31:04 +02:00
parent b7781d27c3
commit e1ce80131a
2 changed files with 16 additions and 2 deletions

View File

@ -380,6 +380,17 @@ def get_backup(**keys):
return static_file(os.path.basename(archivefile),root=tmpfolder)
@api.get("export")
@authenticated_api
def get_export(**keys):
from ..proccontrol.tasks.export import export
import tempfile
tmpfolder = tempfile.gettempdir()
resultfile = export(tmpfolder)
return static_file(os.path.basename(resultfile),root=tmpfolder)
@api.post("delete_scrobble")
@authenticated_api

View File

@ -77,10 +77,13 @@
<h2>Download Data</h2>
Download your data to have a backup.<br/><br/>
Backup your data.<br/><br/>
<a href="/apis/mlj_1/backup" download="maloja_backup.tar.gz">
<button type="button">Download</button>
<button type="button">Backup</button>
</a>
<a href="/apis/mlj_1/export" download="maloja_export.json">
<button type="button">Export</button>
</a>