Added download link for backup archives.

pull/1930/head v1.1.1-beta.17
morpheus65535 2 years ago
parent 8387a57148
commit a36b3ce2ba

@ -131,6 +131,12 @@ def movies_images(url):
return Response(stream_with_context(req.iter_content(2048)), content_type=req.headers['content-type']) return Response(stream_with_context(req.iter_content(2048)), content_type=req.headers['content-type'])
@check_login
@ui_bp.route('/system/backup/download/<path:filename>', methods=['GET'])
def backup_download(filename):
return send_file(os.path.join(settings.backup.folder, filename), cache_timeout=0, as_attachment=True)
def configured(): def configured():
System.update({System.configured: '1'}).execute() System.update({System.configured: '1'}).execute()

@ -2,9 +2,10 @@ import { useDeleteBackups, useRestoreBackups } from "@/apis/hooks";
import { Action, PageTable } from "@/components"; import { Action, PageTable } from "@/components";
import { useModals } from "@/modules/modals"; import { useModals } from "@/modules/modals";
import { useTableStyles } from "@/styles"; import { useTableStyles } from "@/styles";
import { Environment } from "@/utilities";
import { faClock, faHistory, faTrash } from "@fortawesome/free-solid-svg-icons"; import { faClock, faHistory, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Group, Text } from "@mantine/core"; import { Anchor, Group, Text } from "@mantine/core";
import { FunctionComponent, useMemo } from "react"; import { FunctionComponent, useMemo } from "react";
import { Column } from "react-table"; import { Column } from "react-table";
@ -23,8 +24,13 @@ const Table: FunctionComponent<Props> = ({ backups }) => {
Header: "Name", Header: "Name",
accessor: "filename", accessor: "filename",
Cell: ({ value }) => { Cell: ({ value }) => {
const { classes } = useTableStyles(); return (
return <Text className={classes.primary}>{value}</Text>; <Anchor
href={`${Environment.baseUrl}/system/backup/download/${value}`}
>
{value}
</Anchor>
);
}, },
}, },
{ {

Loading…
Cancel
Save