Authenticated Sysinfo

This commit is contained in:
w-e-w
2024-12-27 08:58:44 +09:00
parent 078d04ef23
commit fc54833505
5 changed files with 76 additions and 17 deletions

View File

@@ -213,3 +213,13 @@ def get_config():
return json.load(f)
except Exception as e:
return str(e)
def download_sysinfo(attachment=False):
from fastapi.responses import PlainTextResponse
from datetime import datetime
text = get()
filename = f"sysinfo-{datetime.utcnow().strftime('%Y-%m-%d-%H-%M')}.json"
return PlainTextResponse(text, headers={'Content-Disposition': f'{"attachment" if attachment else "inline"}; filename="{filename}"'})