bot
commited on
Commit
·
aa547c1
1
Parent(s):
34e36ef
前台添加分享功能
Browse files- main.py +3 -3
- pikpakapi/__init__.py +1 -1
- templates/index.html +431 -222
main.py
CHANGED
|
@@ -199,10 +199,10 @@ async def file_batch_share(
|
|
| 199 |
|
| 200 |
|
| 201 |
@api_router.post(
|
| 202 |
-
"/
|
| 203 |
)
|
| 204 |
-
async def
|
| 205 |
-
return await THUNDERX_CLIENT.
|
| 206 |
|
| 207 |
|
| 208 |
@api_router.post(
|
|
|
|
| 199 |
|
| 200 |
|
| 201 |
@api_router.post(
|
| 202 |
+
"/share_batch_delete", summary="取消分享", description="取消分享", tags=["分享"]
|
| 203 |
)
|
| 204 |
+
async def share_batch_delete(ids: List[str]):
|
| 205 |
+
return await THUNDERX_CLIENT.share_batch_delete(ids)
|
| 206 |
|
| 207 |
|
| 208 |
@api_router.post(
|
pikpakapi/__init__.py
CHANGED
|
@@ -998,7 +998,7 @@ class PikPakApi:
|
|
| 998 |
)
|
| 999 |
return result
|
| 1000 |
|
| 1001 |
-
async def
|
| 1002 |
self,
|
| 1003 |
ids: List[str],
|
| 1004 |
) -> Dict[str, Any]:
|
|
|
|
| 998 |
)
|
| 999 |
return result
|
| 1000 |
|
| 1001 |
+
async def share_batch_delete(
|
| 1002 |
self,
|
| 1003 |
ids: List[str],
|
| 1004 |
) -> Dict[str, Any]:
|
templates/index.html
CHANGED
|
@@ -217,7 +217,7 @@
|
|
| 217 |
const randomString = Math.random()
|
| 218 |
.toString(36)
|
| 219 |
.substring(2, 10); // 生成一个随机字符串确保event每次的值不一样,如果一样会不触发事件
|
| 220 |
-
const identity = `${Date.now()}-${randomString}`;
|
| 221 |
// 存储到 localStorage,以便其他页面能够接收到
|
| 222 |
localStorage.setItem(
|
| 223 |
"event",
|
|
@@ -402,24 +402,24 @@
|
|
| 402 |
<Table responsive bordered>
|
| 403 |
<thead>
|
| 404 |
<tr className="text-center">
|
| 405 |
-
{columns.map((column, index) => (
|
| 406 |
-
<th key={index}>{column.title}</th>
|
| 407 |
-
))}
|
| 408 |
</tr>
|
| 409 |
</thead>
|
| 410 |
<tbody>
|
| 411 |
-
{data.map((row, rowIndex) => (
|
| 412 |
-
<tr key={rowIndex} className="text-center">
|
| 413 |
-
{columns.map((column, colIndex) => (
|
| 414 |
-
<td key={colIndex}>
|
| 415 |
-
{/* 调用渲染方法,如果没有定义,则直接显示数据 */}
|
| 416 |
-
{column.render
|
| 417 |
? column.render(row)
|
| 418 |
-
: row[column.dataIndex]}
|
| 419 |
</td>
|
| 420 |
-
))}
|
| 421 |
</tr>
|
| 422 |
-
))}
|
| 423 |
</tbody>
|
| 424 |
</Table>
|
| 425 |
);
|
|
@@ -439,23 +439,23 @@
|
|
| 439 |
return (
|
| 440 |
<select
|
| 441 |
className="page-link border-0 h-100 py-0"
|
| 442 |
-
style={{ width: "auto" }}
|
| 443 |
-
onChange={(e) => {
|
| 444 |
props.onClick(parseInt(e.target.value));
|
| 445 |
-
}}
|
| 446 |
>
|
| 447 |
-
{pageNumbers.map((number) => {
|
| 448 |
const selected = number === page ? true : false;
|
| 449 |
return (
|
| 450 |
<option
|
| 451 |
-
key={number}
|
| 452 |
-
value={number}
|
| 453 |
-
selected={selected}
|
| 454 |
>
|
| 455 |
-
{number}
|
| 456 |
</option>
|
| 457 |
);
|
| 458 |
-
})}
|
| 459 |
</select>
|
| 460 |
);
|
| 461 |
};
|
|
@@ -463,42 +463,42 @@
|
|
| 463 |
<div className="d-flex justify-content-center align-items-baseline">
|
| 464 |
|
| 465 |
<Pagination>
|
| 466 |
-
{pageCount > 1 && page > 1 && (
|
| 467 |
<Pagination.First
|
| 468 |
-
onClick={() => {
|
| 469 |
props.onClick(1);
|
| 470 |
-
}}
|
| 471 |
/>
|
| 472 |
-
)}
|
| 473 |
-
{pageCount > 1 && page > 1 && (
|
| 474 |
<Pagination.Prev
|
| 475 |
-
onClick={() => {
|
| 476 |
props.onClick(page - 1);
|
| 477 |
-
}}
|
| 478 |
/>
|
| 479 |
-
)}
|
| 480 |
<Pagination.Item linkClassName="p-0 h-100 d-inline-block">
|
| 481 |
<SelectItems />
|
| 482 |
</Pagination.Item>
|
| 483 |
<Pagination.Item>
|
| 484 |
<span className="text-info">
|
| 485 |
-
{page}/{pageCount}
|
| 486 |
</span>
|
| 487 |
</Pagination.Item>
|
| 488 |
-
{pageCount > 1 && page < pageCount && (
|
| 489 |
<Pagination.Next
|
| 490 |
-
onClick={() => {
|
| 491 |
props.onClick(page + 1);
|
| 492 |
-
}}
|
| 493 |
/>
|
| 494 |
-
)}
|
| 495 |
-
{pageCount > 1 && page < pageCount && (
|
| 496 |
<Pagination.Last
|
| 497 |
-
onClick={() => {
|
| 498 |
props.onClick(pageCount);
|
| 499 |
-
}}
|
| 500 |
/>
|
| 501 |
-
)}
|
| 502 |
</Pagination>
|
| 503 |
</div>
|
| 504 |
);
|
|
@@ -507,8 +507,8 @@
|
|
| 507 |
const Icon = (props) => {
|
| 508 |
return (
|
| 509 |
<span
|
| 510 |
-
onClick={props.onClick}
|
| 511 |
-
className={`mdi mdi-${props.icon} fs-${props.size} ${props.className}`}
|
| 512 |
></span>
|
| 513 |
);
|
| 514 |
};
|
|
@@ -517,13 +517,13 @@
|
|
| 517 |
return (
|
| 518 |
<Button
|
| 519 |
variant="success"
|
| 520 |
-
onClick={props.onClick}
|
| 521 |
-
className={props.className}
|
| 522 |
>
|
| 523 |
<span
|
| 524 |
-
className={`mdi mdi-${props.icon} fs-${props.iconSize} ${props.iconClassName}`}
|
| 525 |
></span>
|
| 526 |
-
{props.text}
|
| 527 |
</Button>
|
| 528 |
);
|
| 529 |
};
|
|
@@ -556,16 +556,16 @@
|
|
| 556 |
}, [props.src]);
|
| 557 |
if (loadedSrc === props.src) {
|
| 558 |
return (
|
| 559 |
-
<img {...props} />
|
| 560 |
);
|
| 561 |
}
|
| 562 |
-
return <img {...props} src="https://placehold.co/600x400?text=Loading" />;
|
| 563 |
};
|
| 564 |
|
| 565 |
//设置框
|
| 566 |
const SettingModal = (props) => {
|
| 567 |
const settings = [
|
| 568 |
-
{ "thunderx": [{ "label": "登陆令牌", "key": "secret_token", "show": false },{ "label": "代理地址", "key": "cf_proxy", "show": true }] },
|
| 569 |
{ "github": [{ "label": "Actions地址", "key": "github_host", "show": true }, { "label": "Github令牌", "key": "github_token", "show": false }] },
|
| 570 |
{ "directus": [{ "label": "Directus地址", "key": "directus_host", "show": true }, { "label": "Directus令牌", "key": "directus_token", "show": false }] }
|
| 571 |
]
|
|
@@ -590,50 +590,50 @@
|
|
| 590 |
//localStorage.setItem('settings', JSON.stringify(setting));
|
| 591 |
}
|
| 592 |
return (
|
| 593 |
-
<Modal show={props.show} onHide={props.onHide} onShow={loadSetting}>
|
| 594 |
-
<Modal.Header closeButton onHide={props.onHide}>
|
| 595 |
<Modal.Title>设置</Modal.Title>
|
| 596 |
</Modal.Header>
|
| 597 |
<Modal.Body>
|
| 598 |
<Form>
|
| 599 |
<ListGroup>
|
| 600 |
-
{settings.map((value, index) => {
|
| 601 |
const key = Object.keys(value)[0];
|
| 602 |
const items = value[key];
|
| 603 |
return (<ListGroup.Item>
|
| 604 |
-
{items.map((setting_item) => {
|
| 605 |
return (
|
| 606 |
-
<Form.Group as={Row} className="mb-3">
|
| 607 |
<Form.Label column sm="3">
|
| 608 |
-
{setting_item.label}
|
| 609 |
</Form.Label>
|
| 610 |
<Col sm="9">
|
| 611 |
-
<Form.Control type={setting_item.show ? "input" : "password"} value={setting[setting_item.key]} name={setting_item.key} placeholder={setting_item.label} onChange={(e) => { setSetting({ ...setting, [setting_item.key]: e.target.value }) }} />
|
| 612 |
</Col>
|
| 613 |
</Form.Group>
|
| 614 |
)
|
| 615 |
-
})}
|
| 616 |
</ListGroup.Item>)
|
| 617 |
-
})}
|
| 618 |
</ListGroup>
|
| 619 |
</Form>
|
| 620 |
</Modal.Body>
|
| 621 |
<Modal.Footer className="justify-content-between">
|
| 622 |
<Button
|
| 623 |
variant="secondary"
|
| 624 |
-
onClick={() => {
|
| 625 |
props.onHide();
|
| 626 |
-
}}
|
| 627 |
>
|
| 628 |
关闭
|
| 629 |
</Button>
|
| 630 |
<Button
|
| 631 |
variant="primary"
|
| 632 |
-
onClick={() => {
|
| 633 |
saveSetting();
|
| 634 |
props.onHide();
|
| 635 |
//props.onSave();
|
| 636 |
-
}}
|
| 637 |
>
|
| 638 |
保存
|
| 639 |
</Button>
|
|
@@ -766,7 +766,7 @@
|
|
| 766 |
const url = `/files`;
|
| 767 |
|
| 768 |
const { data } = await axios.post(url,
|
| 769 |
-
|
| 770 |
"size": 100,
|
| 771 |
"parent_id": "",
|
| 772 |
"next_page_token": page_token,
|
|
@@ -774,30 +774,30 @@
|
|
| 774 |
"additionalProp1": {}
|
| 775 |
},
|
| 776 |
{
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
| 782 |
return data
|
| 783 |
}
|
| 784 |
|
| 785 |
const paginateFavoritesGet = async (limit, page, keyword) => {
|
| 786 |
-
const url = `/favorites?size=${limit}&page=${page}&kw=${keyword}`;
|
| 787 |
const { data } = await axios.get(url)
|
| 788 |
return data
|
| 789 |
}
|
| 790 |
|
| 791 |
|
| 792 |
const paginateTagLinksGet = async (limit, page, tag) => {
|
| 793 |
-
const url = `/tags?size=${limit}&page=${page}&tag=${tag}`;
|
| 794 |
const { data } = await axios.get(url)
|
| 795 |
return data
|
| 796 |
}
|
| 797 |
|
| 798 |
const paginateTasksGet = async (limit, skip) => {
|
| 799 |
const setting = STORE.getState().settings;
|
| 800 |
-
const url = setting.directus_host + `items/task?limit=${limit}&offset=${skip}&meta[]=filter_count&sort[]=-id`;
|
| 801 |
const { data } = await axios.get(url, { headers: { Authorization: "Bearer " + setting.directus_token } })
|
| 802 |
return data
|
| 803 |
}
|
|
@@ -827,7 +827,7 @@
|
|
| 827 |
<div>
|
| 828 |
<Navbar.Toggle
|
| 829 |
className="shadow-none border-0"
|
| 830 |
-
onClick={handleSidebarShow}
|
| 831 |
children={
|
| 832 |
<Icon
|
| 833 |
icon="menu"
|
|
@@ -837,7 +837,7 @@
|
|
| 837 |
}
|
| 838 |
/>
|
| 839 |
<Navbar.Brand
|
| 840 |
-
as={Link}
|
| 841 |
to="/"
|
| 842 |
className="text-white"
|
| 843 |
>
|
|
@@ -848,13 +848,13 @@
|
|
| 848 |
<Tasks />
|
| 849 |
<LocalTasks />
|
| 850 |
<Button
|
| 851 |
-
style={{
|
| 852 |
backgroundColor: "transparent",
|
| 853 |
-
}}
|
| 854 |
className="nav-link btn"
|
| 855 |
-
onClick={() => {
|
| 856 |
setSetting(true)
|
| 857 |
-
}}
|
| 858 |
children={
|
| 859 |
<Icon
|
| 860 |
icon="dots-vertical"
|
|
@@ -864,17 +864,17 @@
|
|
| 864 |
}
|
| 865 |
></Button>
|
| 866 |
<SettingModal
|
| 867 |
-
show={setting}
|
| 868 |
-
onHide={() => {
|
| 869 |
setSetting(false);
|
| 870 |
-
}}
|
| 871 |
/>
|
| 872 |
</div>
|
| 873 |
</Container>
|
| 874 |
</Navbar>
|
| 875 |
</header>
|
| 876 |
<Container fluid>
|
| 877 |
-
<Row style={{ minHeight: "100vh" }}>
|
| 878 |
<Col
|
| 879 |
md="2"
|
| 880 |
lg="2"
|
|
@@ -883,8 +883,8 @@
|
|
| 883 |
>
|
| 884 |
<Offcanvas
|
| 885 |
className="leftsidebar h-100 bg-light"
|
| 886 |
-
show={showSideBar}
|
| 887 |
-
onHide={handleSidebarClose}
|
| 888 |
placement="start"
|
| 889 |
responsive="md"
|
| 890 |
>
|
|
@@ -903,7 +903,7 @@
|
|
| 903 |
className="flex-column"
|
| 904 |
>
|
| 905 |
<Nav.Link
|
| 906 |
-
as={Link}
|
| 907 |
className="nav-link text-dark"
|
| 908 |
to="/"
|
| 909 |
onClick={
|
|
@@ -917,6 +917,21 @@
|
|
| 917 |
/>
|
| 918 |
文件列表
|
| 919 |
</Nav.Link>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 920 |
</Nav>
|
| 921 |
</Container>
|
| 922 |
</Offcanvas.Body>
|
|
@@ -926,7 +941,7 @@
|
|
| 926 |
<Col xs="12" sm="12" md="10" lg="10" xl="10">
|
| 927 |
<main>
|
| 928 |
<Container fluid className="pt-2 px-0 pb-5">
|
| 929 |
-
{children}
|
| 930 |
</Container>
|
| 931 |
</main>
|
| 932 |
</Col>
|
|
@@ -948,9 +963,9 @@
|
|
| 948 |
>
|
| 949 |
<ButtonGroup className="bg-teal">
|
| 950 |
<IconButton
|
| 951 |
-
onClick={() => {
|
| 952 |
alert("test")
|
| 953 |
-
}}
|
| 954 |
text="刷新"
|
| 955 |
className="bg-teal border-0"
|
| 956 |
icon="reload"
|
|
@@ -958,9 +973,9 @@
|
|
| 958 |
iconSize="6"
|
| 959 |
/>
|
| 960 |
<IconButton
|
| 961 |
-
onClick={() => {
|
| 962 |
alert("hello");
|
| 963 |
-
}}
|
| 964 |
text="删除"
|
| 965 |
className="bg-teal border-0"
|
| 966 |
icon="delete-outline"
|
|
@@ -977,66 +992,101 @@
|
|
| 977 |
|
| 978 |
const Videos = () => {
|
| 979 |
const [reload, setReload] = useState(false);
|
| 980 |
-
const [pageToken,setPageToken] = useState('');
|
| 981 |
const [keyword, setKeyword] = useState("")
|
| 982 |
const [search, setSearch] = useState("")
|
| 983 |
const [videos, setVideos] = useState([])
|
| 984 |
const setting = STORE.getState().settings;
|
| 985 |
const { id } = useParams();
|
| 986 |
const columns = [
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
|
| 1016 |
-
|
| 1017 |
-
|
| 1018 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1019 |
const { data: fileData, mutateAsync: downloadMutation } = useMutation({
|
| 1020 |
-
|
| 1021 |
-
|
| 1022 |
-
|
| 1023 |
-
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
|
| 1038 |
-
const { data:
|
| 1039 |
-
mutationKey: ["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1040 |
mutationFn: async (query) => {
|
| 1041 |
showLoading();
|
| 1042 |
var url = '/files';
|
|
@@ -1059,9 +1109,9 @@
|
|
| 1059 |
}, [pageToken, reload, search]);
|
| 1060 |
useEffect(() => {
|
| 1061 |
if (!setting.secret_token || setting.secret_token.length < 5) {
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
|
| 1066 |
let data = {
|
| 1067 |
"size": 100,
|
|
@@ -1070,7 +1120,7 @@
|
|
| 1070 |
"additional_filters": {},
|
| 1071 |
"additionalProp1": {}
|
| 1072 |
}
|
| 1073 |
-
|
| 1074 |
filesMutation(data);
|
| 1075 |
}, []);
|
| 1076 |
useEffect(() => {
|
|
@@ -1082,10 +1132,18 @@
|
|
| 1082 |
|
| 1083 |
|
| 1084 |
useEffect(() => {
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1089 |
|
| 1090 |
const handleSearchClick = () => {
|
| 1091 |
setSearch(keyword)
|
|
@@ -1106,9 +1164,9 @@
|
|
| 1106 |
>
|
| 1107 |
<ButtonGroup className="bg-teal">
|
| 1108 |
<IconButton
|
| 1109 |
-
onClick={() => {
|
| 1110 |
forceUpdate();
|
| 1111 |
-
}}
|
| 1112 |
text="刷新"
|
| 1113 |
className="bg-teal border-0"
|
| 1114 |
icon="reload"
|
|
@@ -1118,11 +1176,11 @@
|
|
| 1118 |
</ButtonGroup>
|
| 1119 |
</ButtonToolbar>
|
| 1120 |
</div>
|
| 1121 |
-
{linksError && (
|
| 1122 |
<div className="text-center text-danger">
|
| 1123 |
发生错误,请稍后重试!!!
|
| 1124 |
</div>
|
| 1125 |
-
)}
|
| 1126 |
|
| 1127 |
<Container fluid className="p-2">
|
| 1128 |
<InputGroup className="mb-3">
|
|
@@ -1130,27 +1188,178 @@
|
|
| 1130 |
placeholder="关键词"
|
| 1131 |
aria-label="关键词"
|
| 1132 |
aria-describedby="关键词"
|
| 1133 |
-
onChange={e => setKeyword(e.target.value)}
|
| 1134 |
/>
|
| 1135 |
-
<Button variant="outline-secondary" id="button-addon2" onClick={() => { handleSearchClick() }}>
|
| 1136 |
搜索
|
| 1137 |
</Button>
|
| 1138 |
</InputGroup>
|
| 1139 |
|
| 1140 |
-
{(linksLoading) && (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1141 |
<Row>
|
| 1142 |
-
<Col xs={12} className="py-2">
|
| 1143 |
<div className="text-center text-success">
|
| 1144 |
正在努力加载中......
|
| 1145 |
</div>
|
| 1146 |
</Col>
|
| 1147 |
</Row>
|
| 1148 |
-
)}
|
| 1149 |
-
{linksData && (
|
| 1150 |
<Row>
|
| 1151 |
-
<DataTable data={videos ? videos : []} columns={columns} />
|
| 1152 |
</Row>
|
| 1153 |
-
)}
|
| 1154 |
|
| 1155 |
</Container>
|
| 1156 |
</div>
|
|
@@ -1158,7 +1367,6 @@
|
|
| 1158 |
};
|
| 1159 |
|
| 1160 |
|
| 1161 |
-
|
| 1162 |
const Tasks = () => {
|
| 1163 |
const [show, setShow] = useState(false);
|
| 1164 |
const handleClose = () => setShow(false);
|
|
@@ -1192,11 +1400,11 @@
|
|
| 1192 |
return (
|
| 1193 |
<div>
|
| 1194 |
<Button
|
| 1195 |
-
style={{
|
| 1196 |
backgroundColor: "transparent",
|
| 1197 |
-
}}
|
| 1198 |
className="nav-link btn"
|
| 1199 |
-
onClick={handleShow}
|
| 1200 |
children={
|
| 1201 |
<span>
|
| 1202 |
<Icon
|
|
@@ -1209,30 +1417,30 @@
|
|
| 1209 |
></Button>
|
| 1210 |
|
| 1211 |
|
| 1212 |
-
<Modal show={show} onHide={handleClose}>
|
| 1213 |
<Modal.Header closeButton>
|
| 1214 |
<Modal.Title>远程下载任务</Modal.Title>
|
| 1215 |
</Modal.Header>
|
| 1216 |
<Modal.Body className="py-0">
|
| 1217 |
-
{tasksError && (
|
| 1218 |
<div className="text-center text-danger">
|
| 1219 |
发生错误,请稍后重试!!!
|
| 1220 |
</div>
|
| 1221 |
-
)}
|
| 1222 |
-
{(tasksLoading) && (
|
| 1223 |
<div className="text-center text-success">
|
| 1224 |
正在努力加载中......
|
| 1225 |
</div>
|
| 1226 |
-
)}
|
| 1227 |
<Container fluid className="p-2">
|
| 1228 |
<Row>
|
| 1229 |
-
<Col xs={12}>
|
| 1230 |
-
<Paginate page={pagination.pageIndex} onClick={(i) => { onPaginationChange({ pageSize: 36, pageIndex: i }) }} itemsPerPage="36" totalCount={meta.filter_count} />
|
| 1231 |
</Col>
|
| 1232 |
</Row>
|
| 1233 |
|
| 1234 |
<Row>
|
| 1235 |
-
<Col xs={12}>
|
| 1236 |
<Table bordered hover>
|
| 1237 |
<thead>
|
| 1238 |
<tr>
|
|
@@ -1241,17 +1449,17 @@
|
|
| 1241 |
<th>状态</th>
|
| 1242 |
</tr>
|
| 1243 |
</thead>
|
| 1244 |
-
{tasksData && (
|
| 1245 |
<tbody>
|
| 1246 |
-
{tasks.map((task, index) => (
|
| 1247 |
<tr>
|
| 1248 |
-
<td>{task.id}</td>
|
| 1249 |
-
<td>{task.url.substr(task.url.indexOf('##') + 2)}</td>
|
| 1250 |
-
<td>{task.status == 'draft' ? <span className="text-warning">待下载</span> : <span class="text-success">正在下载中</span>}</td>
|
| 1251 |
</tr>
|
| 1252 |
-
))}
|
| 1253 |
</tbody>
|
| 1254 |
-
)}
|
| 1255 |
|
| 1256 |
</Table>
|
| 1257 |
|
|
@@ -1259,17 +1467,17 @@
|
|
| 1259 |
</Row>
|
| 1260 |
|
| 1261 |
<Row>
|
| 1262 |
-
<Col xs={12} className="py-2">
|
| 1263 |
-
<Paginate page={pagination.pageIndex} onClick={(i) => { onPaginationChange({ pageSize: 36, pageIndex: i }) }} itemsPerPage="36" totalCount={meta.filter_count} />
|
| 1264 |
</Col>
|
| 1265 |
</Row>
|
| 1266 |
</Container>
|
| 1267 |
</Modal.Body>
|
| 1268 |
<Modal.Footer className="justify-content-between">
|
| 1269 |
-
<Button variant="primary" onClick={() => { forceUpdate(); }}>
|
| 1270 |
刷新
|
| 1271 |
</Button>
|
| 1272 |
-
<Button variant="primary" onClick={() => {
|
| 1273 |
const setting = STORE.getState().settings;
|
| 1274 |
showLoading();
|
| 1275 |
axios.post(setting.github_host, { "ref": "main", "inputs": {} }, {
|
|
@@ -1287,10 +1495,10 @@
|
|
| 1287 |
}).finally(() => {
|
| 1288 |
hideLoading();
|
| 1289 |
});
|
| 1290 |
-
}}>
|
| 1291 |
开始下载
|
| 1292 |
</Button>
|
| 1293 |
-
<Button variant="primary" onClick={handleClose}>
|
| 1294 |
关闭
|
| 1295 |
</Button>
|
| 1296 |
</Modal.Footer>
|
|
@@ -1326,7 +1534,7 @@
|
|
| 1326 |
icon="delete-outline"
|
| 1327 |
size="6"
|
| 1328 |
className="me-2"
|
| 1329 |
-
onClick={() => {
|
| 1330 |
layer.confirm('确定删除?该操作无法撤销!!!', { icon: 3 }, function (index) {
|
| 1331 |
setDownloads(
|
| 1332 |
downloads.filter(a =>
|
|
@@ -1337,13 +1545,13 @@
|
|
| 1337 |
}, function () {
|
| 1338 |
|
| 1339 |
});
|
| 1340 |
-
}}
|
| 1341 |
/>
|
| 1342 |
<Icon
|
| 1343 |
icon="pencil-outline"
|
| 1344 |
size="6"
|
| 1345 |
className="me-2"
|
| 1346 |
-
onClick={() => {
|
| 1347 |
layer.prompt({
|
| 1348 |
title: '输入文件名称,并确认',
|
| 1349 |
formType: 0,
|
|
@@ -1368,7 +1576,7 @@
|
|
| 1368 |
setDownloads(newDownloads);
|
| 1369 |
layer.close(index);
|
| 1370 |
});
|
| 1371 |
-
}}
|
| 1372 |
/>
|
| 1373 |
</div>
|
| 1374 |
),
|
|
@@ -1408,12 +1616,12 @@
|
|
| 1408 |
const file = fileinfo.data;
|
| 1409 |
var url = file.web_content_link;
|
| 1410 |
for (const obj of file.medias) {
|
| 1411 |
-
if (obj.link.url.trim().length>10) {
|
| 1412 |
url = obj.link.url;
|
| 1413 |
-
break;
|
| 1414 |
}
|
| 1415 |
}
|
| 1416 |
-
const download = { name: file.name, size: Number(file.size),url:url, created: file.created_time }
|
| 1417 |
setAddDownloadObject(download)
|
| 1418 |
}
|
| 1419 |
useEffect(() => {
|
|
@@ -1441,11 +1649,11 @@
|
|
| 1441 |
return (
|
| 1442 |
<div>
|
| 1443 |
<Button
|
| 1444 |
-
style={{
|
| 1445 |
backgroundColor: "transparent",
|
| 1446 |
-
}}
|
| 1447 |
className="nav-link btn"
|
| 1448 |
-
onClick={handleShow}
|
| 1449 |
children={
|
| 1450 |
<span>
|
| 1451 |
<Icon
|
|
@@ -1453,41 +1661,41 @@
|
|
| 1453 |
size="3"
|
| 1454 |
className="text-white"
|
| 1455 |
/>
|
| 1456 |
-
<Badge bg="danger" style={{ top: '-15px', left: '-10px' }}>{downloads.length}</Badge>
|
| 1457 |
</span>
|
| 1458 |
}
|
| 1459 |
></Button>
|
| 1460 |
|
| 1461 |
|
| 1462 |
-
<Modal show={show} onHide={handleClose}>
|
| 1463 |
<Modal.Header closeButton>
|
| 1464 |
<Modal.Title>本地下载任务</Modal.Title>
|
| 1465 |
</Modal.Header>
|
| 1466 |
<Modal.Body>
|
| 1467 |
-
{downloads && (
|
| 1468 |
-
<DataTable data={downloads ? downloads : []} columns={columns} />
|
| 1469 |
-
)}
|
| 1470 |
</Modal.Body>
|
| 1471 |
<Modal.Footer className="justify-content-between">
|
| 1472 |
|
| 1473 |
<ButtonGroup>
|
| 1474 |
-
<Button variant="primary" onClick={async () => { await localTaskdMutation() }}>
|
| 1475 |
添加转存
|
| 1476 |
</Button>
|
| 1477 |
</ButtonGroup>
|
| 1478 |
|
| 1479 |
<ButtonGroup>
|
| 1480 |
-
<Button variant="danger" onClick={() => {
|
| 1481 |
layer.confirm('确定删除?该操作无法撤销!!!', { icon: 3 }, function (index) {
|
| 1482 |
setDownloads([]);
|
| 1483 |
layer.close(index);
|
| 1484 |
}, function () {
|
| 1485 |
|
| 1486 |
});
|
| 1487 |
-
}}>
|
| 1488 |
清空
|
| 1489 |
</Button>
|
| 1490 |
-
<Button variant="primary" onClick={handleClose}>
|
| 1491 |
关闭
|
| 1492 |
</Button>
|
| 1493 |
</ButtonGroup>
|
|
@@ -1560,9 +1768,9 @@
|
|
| 1560 |
dataIndex: "name",
|
| 1561 |
render: (row) => (
|
| 1562 |
row.is_dir ? <Nav.Link
|
| 1563 |
-
as={Link}
|
| 1564 |
className="nav-link text-dark"
|
| 1565 |
-
to={decodeURI(path + row.name + '/')}
|
| 1566 |
target="_blank"
|
| 1567 |
>
|
| 1568 |
<Icon
|
|
@@ -1575,10 +1783,10 @@
|
|
| 1575 |
icon="download-outline"
|
| 1576 |
size="6"
|
| 1577 |
className="me-2"
|
| 1578 |
-
onClick={async () => {
|
| 1579 |
let data = { "path": path + row.name, "password": "" }
|
| 1580 |
await downloadMutation(data);
|
| 1581 |
-
}}
|
| 1582 |
/>
|
| 1583 |
),
|
| 1584 |
},
|
|
@@ -1607,9 +1815,9 @@
|
|
| 1607 |
>
|
| 1608 |
<ButtonGroup className="bg-teal">
|
| 1609 |
<IconButton
|
| 1610 |
-
onClick={() => {
|
| 1611 |
emitEvent("test", { a: 'b' })
|
| 1612 |
-
}}
|
| 1613 |
text="刷新"
|
| 1614 |
className="bg-teal border-0"
|
| 1615 |
icon="reload"
|
|
@@ -1620,19 +1828,19 @@
|
|
| 1620 |
</ButtonToolbar>
|
| 1621 |
</div>
|
| 1622 |
<Container fluid className="p-2">
|
| 1623 |
-
{error && (
|
| 1624 |
<div className="text-center text-danger">
|
| 1625 |
-
{error}
|
| 1626 |
</div>
|
| 1627 |
-
)}
|
| 1628 |
-
{(loading) && (
|
| 1629 |
<div className="text-center text-success">
|
| 1630 |
正在努力加载中......
|
| 1631 |
</div>
|
| 1632 |
-
)}
|
| 1633 |
-
{response && (
|
| 1634 |
-
<DataTable data={response.data.content ? response.data.content : []} columns={columns} />
|
| 1635 |
-
)}
|
| 1636 |
</Container>
|
| 1637 |
</div>
|
| 1638 |
);
|
|
@@ -1641,13 +1849,14 @@
|
|
| 1641 |
const container = document.getElementById("root");
|
| 1642 |
const root = ReactDOM.createRoot(container);
|
| 1643 |
root.render(
|
| 1644 |
-
<QueryClientProvider client={queryClient}>
|
| 1645 |
<HashRouter>
|
| 1646 |
<Route path="/:path?">
|
| 1647 |
<Layout>
|
| 1648 |
<Switch>
|
| 1649 |
-
<Route path="/" exact component={Videos} />
|
| 1650 |
-
<Route path="/
|
|
|
|
| 1651 |
</Switch>
|
| 1652 |
</Layout>
|
| 1653 |
</Route>
|
|
|
|
| 217 |
const randomString = Math.random()
|
| 218 |
.toString(36)
|
| 219 |
.substring(2, 10); // 生成一个随机字符串确保event每次的值不一样,如果一样会不触发事件
|
| 220 |
+
const identity = `${ Date.now() }-${ randomString }`;
|
| 221 |
// 存储到 localStorage,以便其他页面能够接收到
|
| 222 |
localStorage.setItem(
|
| 223 |
"event",
|
|
|
|
| 402 |
<Table responsive bordered>
|
| 403 |
<thead>
|
| 404 |
<tr className="text-center">
|
| 405 |
+
{ columns.map((column, index) => (
|
| 406 |
+
<th key={ index }>{ column.title }</th>
|
| 407 |
+
)) }
|
| 408 |
</tr>
|
| 409 |
</thead>
|
| 410 |
<tbody>
|
| 411 |
+
{ data.map((row, rowIndex) => (
|
| 412 |
+
<tr key={ rowIndex } className="text-center">
|
| 413 |
+
{ columns.map((column, colIndex) => (
|
| 414 |
+
<td key={ colIndex }>
|
| 415 |
+
{/* 调用渲染方法,如果没有定义,则直接显示数据 */ }
|
| 416 |
+
{ column.render
|
| 417 |
? column.render(row)
|
| 418 |
+
: row[column.dataIndex] }
|
| 419 |
</td>
|
| 420 |
+
)) }
|
| 421 |
</tr>
|
| 422 |
+
)) }
|
| 423 |
</tbody>
|
| 424 |
</Table>
|
| 425 |
);
|
|
|
|
| 439 |
return (
|
| 440 |
<select
|
| 441 |
className="page-link border-0 h-100 py-0"
|
| 442 |
+
style={ { width: "auto" } }
|
| 443 |
+
onChange={ (e) => {
|
| 444 |
props.onClick(parseInt(e.target.value));
|
| 445 |
+
} }
|
| 446 |
>
|
| 447 |
+
{ pageNumbers.map((number) => {
|
| 448 |
const selected = number === page ? true : false;
|
| 449 |
return (
|
| 450 |
<option
|
| 451 |
+
key={ number }
|
| 452 |
+
value={ number }
|
| 453 |
+
selected={ selected }
|
| 454 |
>
|
| 455 |
+
{ number }
|
| 456 |
</option>
|
| 457 |
);
|
| 458 |
+
}) }
|
| 459 |
</select>
|
| 460 |
);
|
| 461 |
};
|
|
|
|
| 463 |
<div className="d-flex justify-content-center align-items-baseline">
|
| 464 |
|
| 465 |
<Pagination>
|
| 466 |
+
{ pageCount > 1 && page > 1 && (
|
| 467 |
<Pagination.First
|
| 468 |
+
onClick={ () => {
|
| 469 |
props.onClick(1);
|
| 470 |
+
} }
|
| 471 |
/>
|
| 472 |
+
) }
|
| 473 |
+
{ pageCount > 1 && page > 1 && (
|
| 474 |
<Pagination.Prev
|
| 475 |
+
onClick={ () => {
|
| 476 |
props.onClick(page - 1);
|
| 477 |
+
} }
|
| 478 |
/>
|
| 479 |
+
) }
|
| 480 |
<Pagination.Item linkClassName="p-0 h-100 d-inline-block">
|
| 481 |
<SelectItems />
|
| 482 |
</Pagination.Item>
|
| 483 |
<Pagination.Item>
|
| 484 |
<span className="text-info">
|
| 485 |
+
{ page }/{ pageCount }
|
| 486 |
</span>
|
| 487 |
</Pagination.Item>
|
| 488 |
+
{ pageCount > 1 && page < pageCount && (
|
| 489 |
<Pagination.Next
|
| 490 |
+
onClick={ () => {
|
| 491 |
props.onClick(page + 1);
|
| 492 |
+
} }
|
| 493 |
/>
|
| 494 |
+
) }
|
| 495 |
+
{ pageCount > 1 && page < pageCount && (
|
| 496 |
<Pagination.Last
|
| 497 |
+
onClick={ () => {
|
| 498 |
props.onClick(pageCount);
|
| 499 |
+
} }
|
| 500 |
/>
|
| 501 |
+
) }
|
| 502 |
</Pagination>
|
| 503 |
</div>
|
| 504 |
);
|
|
|
|
| 507 |
const Icon = (props) => {
|
| 508 |
return (
|
| 509 |
<span
|
| 510 |
+
onClick={ props.onClick }
|
| 511 |
+
className={ `mdi mdi-${ props.icon } fs-${ props.size } ${ props.className }` }
|
| 512 |
></span>
|
| 513 |
);
|
| 514 |
};
|
|
|
|
| 517 |
return (
|
| 518 |
<Button
|
| 519 |
variant="success"
|
| 520 |
+
onClick={ props.onClick }
|
| 521 |
+
className={ props.className }
|
| 522 |
>
|
| 523 |
<span
|
| 524 |
+
className={ `mdi mdi-${ props.icon } fs-${ props.iconSize } ${ props.iconClassName }` }
|
| 525 |
></span>
|
| 526 |
+
{ props.text }
|
| 527 |
</Button>
|
| 528 |
);
|
| 529 |
};
|
|
|
|
| 556 |
}, [props.src]);
|
| 557 |
if (loadedSrc === props.src) {
|
| 558 |
return (
|
| 559 |
+
<img { ...props } />
|
| 560 |
);
|
| 561 |
}
|
| 562 |
+
return <img { ...props } src="https://placehold.co/600x400?text=Loading" />;
|
| 563 |
};
|
| 564 |
|
| 565 |
//设置框
|
| 566 |
const SettingModal = (props) => {
|
| 567 |
const settings = [
|
| 568 |
+
{ "thunderx": [{ "label": "登陆令牌", "key": "secret_token", "show": false }, { "label": "代理地址", "key": "cf_proxy", "show": true }] },
|
| 569 |
{ "github": [{ "label": "Actions地址", "key": "github_host", "show": true }, { "label": "Github令牌", "key": "github_token", "show": false }] },
|
| 570 |
{ "directus": [{ "label": "Directus地址", "key": "directus_host", "show": true }, { "label": "Directus令牌", "key": "directus_token", "show": false }] }
|
| 571 |
]
|
|
|
|
| 590 |
//localStorage.setItem('settings', JSON.stringify(setting));
|
| 591 |
}
|
| 592 |
return (
|
| 593 |
+
<Modal show={ props.show } onHide={ props.onHide } onShow={ loadSetting }>
|
| 594 |
+
<Modal.Header closeButton onHide={ props.onHide }>
|
| 595 |
<Modal.Title>设置</Modal.Title>
|
| 596 |
</Modal.Header>
|
| 597 |
<Modal.Body>
|
| 598 |
<Form>
|
| 599 |
<ListGroup>
|
| 600 |
+
{ settings.map((value, index) => {
|
| 601 |
const key = Object.keys(value)[0];
|
| 602 |
const items = value[key];
|
| 603 |
return (<ListGroup.Item>
|
| 604 |
+
{ items.map((setting_item) => {
|
| 605 |
return (
|
| 606 |
+
<Form.Group as={ Row } className="mb-3">
|
| 607 |
<Form.Label column sm="3">
|
| 608 |
+
{ setting_item.label }
|
| 609 |
</Form.Label>
|
| 610 |
<Col sm="9">
|
| 611 |
+
<Form.Control type={ setting_item.show ? "input" : "password" } value={ setting[setting_item.key] } name={ setting_item.key } placeholder={ setting_item.label } onChange={ (e) => { setSetting({ ...setting, [setting_item.key]: e.target.value }) } } />
|
| 612 |
</Col>
|
| 613 |
</Form.Group>
|
| 614 |
)
|
| 615 |
+
}) }
|
| 616 |
</ListGroup.Item>)
|
| 617 |
+
}) }
|
| 618 |
</ListGroup>
|
| 619 |
</Form>
|
| 620 |
</Modal.Body>
|
| 621 |
<Modal.Footer className="justify-content-between">
|
| 622 |
<Button
|
| 623 |
variant="secondary"
|
| 624 |
+
onClick={ () => {
|
| 625 |
props.onHide();
|
| 626 |
+
} }
|
| 627 |
>
|
| 628 |
关闭
|
| 629 |
</Button>
|
| 630 |
<Button
|
| 631 |
variant="primary"
|
| 632 |
+
onClick={ () => {
|
| 633 |
saveSetting();
|
| 634 |
props.onHide();
|
| 635 |
//props.onSave();
|
| 636 |
+
} }
|
| 637 |
>
|
| 638 |
保存
|
| 639 |
</Button>
|
|
|
|
| 766 |
const url = `/files`;
|
| 767 |
|
| 768 |
const { data } = await axios.post(url,
|
| 769 |
+
{
|
| 770 |
"size": 100,
|
| 771 |
"parent_id": "",
|
| 772 |
"next_page_token": page_token,
|
|
|
|
| 774 |
"additionalProp1": {}
|
| 775 |
},
|
| 776 |
{
|
| 777 |
+
headers: {
|
| 778 |
+
'Authorization': setting.secret_token,
|
| 779 |
+
'Content-Type': 'application/json'
|
| 780 |
+
},
|
| 781 |
+
})
|
| 782 |
return data
|
| 783 |
}
|
| 784 |
|
| 785 |
const paginateFavoritesGet = async (limit, page, keyword) => {
|
| 786 |
+
const url = `/favorites?size=${ limit }&page=${ page }&kw=${ keyword }`;
|
| 787 |
const { data } = await axios.get(url)
|
| 788 |
return data
|
| 789 |
}
|
| 790 |
|
| 791 |
|
| 792 |
const paginateTagLinksGet = async (limit, page, tag) => {
|
| 793 |
+
const url = `/tags?size=${ limit }&page=${ page }&tag=${ tag }`;
|
| 794 |
const { data } = await axios.get(url)
|
| 795 |
return data
|
| 796 |
}
|
| 797 |
|
| 798 |
const paginateTasksGet = async (limit, skip) => {
|
| 799 |
const setting = STORE.getState().settings;
|
| 800 |
+
const url = setting.directus_host + `items/task?limit=${ limit }&offset=${ skip }&meta[]=filter_count&sort[]=-id`;
|
| 801 |
const { data } = await axios.get(url, { headers: { Authorization: "Bearer " + setting.directus_token } })
|
| 802 |
return data
|
| 803 |
}
|
|
|
|
| 827 |
<div>
|
| 828 |
<Navbar.Toggle
|
| 829 |
className="shadow-none border-0"
|
| 830 |
+
onClick={ handleSidebarShow }
|
| 831 |
children={
|
| 832 |
<Icon
|
| 833 |
icon="menu"
|
|
|
|
| 837 |
}
|
| 838 |
/>
|
| 839 |
<Navbar.Brand
|
| 840 |
+
as={ Link }
|
| 841 |
to="/"
|
| 842 |
className="text-white"
|
| 843 |
>
|
|
|
|
| 848 |
<Tasks />
|
| 849 |
<LocalTasks />
|
| 850 |
<Button
|
| 851 |
+
style={ {
|
| 852 |
backgroundColor: "transparent",
|
| 853 |
+
} }
|
| 854 |
className="nav-link btn"
|
| 855 |
+
onClick={ () => {
|
| 856 |
setSetting(true)
|
| 857 |
+
} }
|
| 858 |
children={
|
| 859 |
<Icon
|
| 860 |
icon="dots-vertical"
|
|
|
|
| 864 |
}
|
| 865 |
></Button>
|
| 866 |
<SettingModal
|
| 867 |
+
show={ setting }
|
| 868 |
+
onHide={ () => {
|
| 869 |
setSetting(false);
|
| 870 |
+
} }
|
| 871 |
/>
|
| 872 |
</div>
|
| 873 |
</Container>
|
| 874 |
</Navbar>
|
| 875 |
</header>
|
| 876 |
<Container fluid>
|
| 877 |
+
<Row style={ { minHeight: "100vh" } }>
|
| 878 |
<Col
|
| 879 |
md="2"
|
| 880 |
lg="2"
|
|
|
|
| 883 |
>
|
| 884 |
<Offcanvas
|
| 885 |
className="leftsidebar h-100 bg-light"
|
| 886 |
+
show={ showSideBar }
|
| 887 |
+
onHide={ handleSidebarClose }
|
| 888 |
placement="start"
|
| 889 |
responsive="md"
|
| 890 |
>
|
|
|
|
| 903 |
className="flex-column"
|
| 904 |
>
|
| 905 |
<Nav.Link
|
| 906 |
+
as={ Link }
|
| 907 |
className="nav-link text-dark"
|
| 908 |
to="/"
|
| 909 |
onClick={
|
|
|
|
| 917 |
/>
|
| 918 |
文件列表
|
| 919 |
</Nav.Link>
|
| 920 |
+
<Nav.Link
|
| 921 |
+
as={ Link }
|
| 922 |
+
className="nav-link text-dark"
|
| 923 |
+
to="/shares"
|
| 924 |
+
onClick={
|
| 925 |
+
handleSidebarClose
|
| 926 |
+
}
|
| 927 |
+
>
|
| 928 |
+
<Icon
|
| 929 |
+
icon="share-variant"
|
| 930 |
+
size="6"
|
| 931 |
+
className="me-2"
|
| 932 |
+
/>
|
| 933 |
+
分享列表
|
| 934 |
+
</Nav.Link>
|
| 935 |
</Nav>
|
| 936 |
</Container>
|
| 937 |
</Offcanvas.Body>
|
|
|
|
| 941 |
<Col xs="12" sm="12" md="10" lg="10" xl="10">
|
| 942 |
<main>
|
| 943 |
<Container fluid className="pt-2 px-0 pb-5">
|
| 944 |
+
{ children }
|
| 945 |
</Container>
|
| 946 |
</main>
|
| 947 |
</Col>
|
|
|
|
| 963 |
>
|
| 964 |
<ButtonGroup className="bg-teal">
|
| 965 |
<IconButton
|
| 966 |
+
onClick={ () => {
|
| 967 |
alert("test")
|
| 968 |
+
} }
|
| 969 |
text="刷新"
|
| 970 |
className="bg-teal border-0"
|
| 971 |
icon="reload"
|
|
|
|
| 973 |
iconSize="6"
|
| 974 |
/>
|
| 975 |
<IconButton
|
| 976 |
+
onClick={ () => {
|
| 977 |
alert("hello");
|
| 978 |
+
} }
|
| 979 |
text="删除"
|
| 980 |
className="bg-teal border-0"
|
| 981 |
icon="delete-outline"
|
|
|
|
| 992 |
|
| 993 |
const Videos = () => {
|
| 994 |
const [reload, setReload] = useState(false);
|
| 995 |
+
const [pageToken, setPageToken] = useState('');
|
| 996 |
const [keyword, setKeyword] = useState("")
|
| 997 |
const [search, setSearch] = useState("")
|
| 998 |
const [videos, setVideos] = useState([])
|
| 999 |
const setting = STORE.getState().settings;
|
| 1000 |
const { id } = useParams();
|
| 1001 |
const columns = [
|
| 1002 |
+
{ title: "文件名称", dataIndex: "name" },
|
| 1003 |
+
{ title: "大小", dataIndex: "size", render: (row) => (bytesToSize(Number(row.size))) },
|
| 1004 |
+
{ title: "日期", dataIndex: "created_time", render: (row) => (formatDate(row.created_time)) },
|
| 1005 |
+
{
|
| 1006 |
+
title: "操作",
|
| 1007 |
+
dataIndex: "name",
|
| 1008 |
+
render: (row) => (
|
| 1009 |
+
<div className="d-flex justify-content-center">
|
| 1010 |
+
{
|
| 1011 |
+
row.kind == "drive#folder" ? (<Nav.Link
|
| 1012 |
+
as={ Link }
|
| 1013 |
+
className="nav-link text-dark"
|
| 1014 |
+
to={ `/videos/${ row.id }` }
|
| 1015 |
+
target="_blank"
|
| 1016 |
+
>
|
| 1017 |
+
<Icon
|
| 1018 |
+
icon="open-in-new"
|
| 1019 |
+
size="6"
|
| 1020 |
+
className="me-2"
|
| 1021 |
+
/>
|
| 1022 |
+
</Nav.Link>) :
|
| 1023 |
+
(<Icon
|
| 1024 |
+
icon="download-outline"
|
| 1025 |
+
size="6"
|
| 1026 |
+
className="me-2"
|
| 1027 |
+
onClick={ async () => {
|
| 1028 |
+
let data = { "id": row.id }
|
| 1029 |
+
await downloadMutation(data);
|
| 1030 |
+
} }
|
| 1031 |
+
/>)
|
| 1032 |
+
}
|
| 1033 |
+
|
| 1034 |
+
|
| 1035 |
+
<Icon
|
| 1036 |
+
icon="share-variant"
|
| 1037 |
+
size="6"
|
| 1038 |
+
className="me-2"
|
| 1039 |
+
onClick={ async () => {
|
| 1040 |
+
let data = { "id": row.id }
|
| 1041 |
+
await sharedMutation(data);
|
| 1042 |
+
} }
|
| 1043 |
+
/>
|
| 1044 |
+
</div>
|
| 1045 |
+
),
|
| 1046 |
+
},
|
| 1047 |
+
];
|
| 1048 |
+
const authorization = 'Bearer ' + setting.secret_token;
|
| 1049 |
const { data: fileData, mutateAsync: downloadMutation } = useMutation({
|
| 1050 |
+
mutationKey: ["get-download"],
|
| 1051 |
+
mutationFn: async (fileinfo) => {
|
| 1052 |
+
showLoading();
|
| 1053 |
+
var url = '/files/' + fileinfo.id;
|
| 1054 |
+
return await axios.get(url, {
|
| 1055 |
+
headers: {
|
| 1056 |
+
'Authorization': authorization,
|
| 1057 |
+
'Content-Type': 'application/json'
|
| 1058 |
+
},
|
| 1059 |
+
})
|
| 1060 |
+
},
|
| 1061 |
+
onSuccess: async (data, variables, context) => {
|
| 1062 |
+
hideLoading();
|
| 1063 |
+
},
|
| 1064 |
+
onError: () => {
|
| 1065 |
+
hideLoading();
|
| 1066 |
+
}
|
| 1067 |
+
})
|
| 1068 |
+
const { data: shareData, mutateAsync: sharedMutation } = useMutation({
|
| 1069 |
+
mutationKey: ["create_share"],
|
| 1070 |
+
mutationFn: async (fileinfo) => {
|
| 1071 |
+
showLoading();
|
| 1072 |
+
var url = 'file_batch_share?need_password=false&expiration_days=-1';
|
| 1073 |
+
return await axios.post(url, [fileinfo.id], {
|
| 1074 |
+
headers: {
|
| 1075 |
+
'Authorization': authorization,
|
| 1076 |
+
'Content-Type': 'application/json'
|
| 1077 |
+
},
|
| 1078 |
+
})
|
| 1079 |
+
},
|
| 1080 |
+
onSuccess: async (data, variables, context) => {
|
| 1081 |
+
hideLoading();
|
| 1082 |
+
},
|
| 1083 |
+
onError: () => {
|
| 1084 |
+
hideLoading();
|
| 1085 |
+
}
|
| 1086 |
+
})
|
| 1087 |
+
|
| 1088 |
+
const { data: linksData, mutateAsync: filesMutation, error: linksError, isPending: linksLoading } = useMutation({
|
| 1089 |
+
mutationKey: ["get-files", pageToken],
|
| 1090 |
mutationFn: async (query) => {
|
| 1091 |
showLoading();
|
| 1092 |
var url = '/files';
|
|
|
|
| 1109 |
}, [pageToken, reload, search]);
|
| 1110 |
useEffect(() => {
|
| 1111 |
if (!setting.secret_token || setting.secret_token.length < 5) {
|
| 1112 |
+
layer.alert("请先正确配置登陆令牌,最少5位", { icon: 5 });
|
| 1113 |
+
return
|
| 1114 |
+
}
|
| 1115 |
|
| 1116 |
let data = {
|
| 1117 |
"size": 100,
|
|
|
|
| 1120 |
"additional_filters": {},
|
| 1121 |
"additionalProp1": {}
|
| 1122 |
}
|
| 1123 |
+
|
| 1124 |
filesMutation(data);
|
| 1125 |
}, []);
|
| 1126 |
useEffect(() => {
|
|
|
|
| 1132 |
|
| 1133 |
|
| 1134 |
useEffect(() => {
|
| 1135 |
+
if (fileData) {
|
| 1136 |
+
emitEvent("addDownload", fileData)
|
| 1137 |
+
}
|
| 1138 |
+
}, [fileData]);
|
| 1139 |
+
|
| 1140 |
+
useEffect(() => {
|
| 1141 |
+
if (shareData) {
|
| 1142 |
+
layer.alert(shareData.data.share_url);
|
| 1143 |
+
}
|
| 1144 |
+
}, [shareData]);
|
| 1145 |
+
|
| 1146 |
+
|
| 1147 |
|
| 1148 |
const handleSearchClick = () => {
|
| 1149 |
setSearch(keyword)
|
|
|
|
| 1164 |
>
|
| 1165 |
<ButtonGroup className="bg-teal">
|
| 1166 |
<IconButton
|
| 1167 |
+
onClick={ () => {
|
| 1168 |
forceUpdate();
|
| 1169 |
+
} }
|
| 1170 |
text="刷新"
|
| 1171 |
className="bg-teal border-0"
|
| 1172 |
icon="reload"
|
|
|
|
| 1176 |
</ButtonGroup>
|
| 1177 |
</ButtonToolbar>
|
| 1178 |
</div>
|
| 1179 |
+
{ linksError && (
|
| 1180 |
<div className="text-center text-danger">
|
| 1181 |
发生错误,请稍后重试!!!
|
| 1182 |
</div>
|
| 1183 |
+
) }
|
| 1184 |
|
| 1185 |
<Container fluid className="p-2">
|
| 1186 |
<InputGroup className="mb-3">
|
|
|
|
| 1188 |
placeholder="关键词"
|
| 1189 |
aria-label="关键词"
|
| 1190 |
aria-describedby="关键词"
|
| 1191 |
+
onChange={ e => setKeyword(e.target.value) }
|
| 1192 |
/>
|
| 1193 |
+
<Button variant="outline-secondary" id="button-addon2" onClick={ () => { handleSearchClick() } }>
|
| 1194 |
搜索
|
| 1195 |
</Button>
|
| 1196 |
</InputGroup>
|
| 1197 |
|
| 1198 |
+
{ (linksLoading) && (
|
| 1199 |
+
<Row>
|
| 1200 |
+
<Col xs={ 12 } className="py-2">
|
| 1201 |
+
<div className="text-center text-success">
|
| 1202 |
+
正在努力加载中......
|
| 1203 |
+
</div>
|
| 1204 |
+
</Col>
|
| 1205 |
+
</Row>
|
| 1206 |
+
) }
|
| 1207 |
+
{ linksData && (
|
| 1208 |
+
<Row>
|
| 1209 |
+
<DataTable data={ videos ? videos : [] } columns={ columns } />
|
| 1210 |
+
</Row>
|
| 1211 |
+
) }
|
| 1212 |
+
|
| 1213 |
+
</Container>
|
| 1214 |
+
</div>
|
| 1215 |
+
);
|
| 1216 |
+
};
|
| 1217 |
+
|
| 1218 |
+
const Shares = () => {
|
| 1219 |
+
const [reload, setReload] = useState(false);
|
| 1220 |
+
const [pageToken, setPageToken] = useState('');
|
| 1221 |
+
const [keyword, setKeyword] = useState("")
|
| 1222 |
+
const [search, setSearch] = useState("")
|
| 1223 |
+
const [videos, setVideos] = useState([])
|
| 1224 |
+
const setting = STORE.getState().settings;
|
| 1225 |
+
const { id } = useParams();
|
| 1226 |
+
const columns = [
|
| 1227 |
+
{ title: "文件名称", dataIndex: "title" },
|
| 1228 |
+
{ title: "分享ID", dataIndex: "share_id" },
|
| 1229 |
+
{ title: "日期", dataIndex: "create_time", render: (row) => (formatDate(row.create_time)) },
|
| 1230 |
+
{
|
| 1231 |
+
title: "操作",
|
| 1232 |
+
dataIndex: "name",
|
| 1233 |
+
render: (row) => (
|
| 1234 |
+
<Icon
|
| 1235 |
+
icon="cancel"
|
| 1236 |
+
size="6"
|
| 1237 |
+
className="me-2"
|
| 1238 |
+
onClick={ async () => {
|
| 1239 |
+
let data = { "id": row.share_id }
|
| 1240 |
+
await deleteMutation(data);
|
| 1241 |
+
} }
|
| 1242 |
+
/>
|
| 1243 |
+
),
|
| 1244 |
+
},
|
| 1245 |
+
];
|
| 1246 |
+
const authorization = 'Bearer ' + setting.secret_token;
|
| 1247 |
+
const { data: fileData, mutateAsync: deleteMutation } = useMutation({
|
| 1248 |
+
mutationKey: ["share_batch_delete"],
|
| 1249 |
+
mutationFn: async (fileinfo) => {
|
| 1250 |
+
showLoading();
|
| 1251 |
+
var url = '/share_batch_delete';
|
| 1252 |
+
return await axios.post(url, [fileinfo.id], {
|
| 1253 |
+
headers: {
|
| 1254 |
+
'Authorization': authorization,
|
| 1255 |
+
'Content-Type': 'application/json'
|
| 1256 |
+
},
|
| 1257 |
+
})
|
| 1258 |
+
},
|
| 1259 |
+
onSuccess: async (data, variables, context) => {
|
| 1260 |
+
hideLoading();
|
| 1261 |
+
forceUpdate();
|
| 1262 |
+
},
|
| 1263 |
+
onError: () => {
|
| 1264 |
+
hideLoading();
|
| 1265 |
+
}
|
| 1266 |
+
})
|
| 1267 |
+
const { data: linksData, mutateAsync: filesMutation, error: linksError, isPending: linksLoading } = useMutation({
|
| 1268 |
+
mutationKey: ["get_share_list", pageToken],
|
| 1269 |
+
mutationFn: async (query) => {
|
| 1270 |
+
showLoading();
|
| 1271 |
+
var url = '/get_share_list';
|
| 1272 |
+
return await axios.post(url, query, {
|
| 1273 |
+
headers: {
|
| 1274 |
+
'Authorization': authorization,
|
| 1275 |
+
'Content-Type': 'application/json'
|
| 1276 |
+
},
|
| 1277 |
+
})
|
| 1278 |
+
},
|
| 1279 |
+
onSuccess: async (data, variables, context) => {
|
| 1280 |
+
hideLoading();
|
| 1281 |
+
},
|
| 1282 |
+
onError: () => {
|
| 1283 |
+
hideLoading();
|
| 1284 |
+
}
|
| 1285 |
+
})
|
| 1286 |
+
|
| 1287 |
+
// useEffect(() => {
|
| 1288 |
+
|
| 1289 |
+
// }, [pageToken, reload]);
|
| 1290 |
+
useEffect(() => {
|
| 1291 |
+
if (!setting.secret_token || setting.secret_token.length < 5) {
|
| 1292 |
+
layer.alert("请先正确配置登陆令牌,最少5位", { icon: 5 });
|
| 1293 |
+
return
|
| 1294 |
+
}
|
| 1295 |
+
|
| 1296 |
+
let data = {
|
| 1297 |
+
"size": 100,
|
| 1298 |
+
"parent_id": id,
|
| 1299 |
+
"next_page_token": pageToken,
|
| 1300 |
+
"additional_filters": {},
|
| 1301 |
+
"additionalProp1": {}
|
| 1302 |
+
}
|
| 1303 |
+
|
| 1304 |
+
filesMutation(data);
|
| 1305 |
+
}, [pageToken, reload]);
|
| 1306 |
+
useEffect(() => {
|
| 1307 |
+
if (linksData) {
|
| 1308 |
+
setPageToken(linksData.data.next_page_token)
|
| 1309 |
+
setVideos([...linksData.data.data])
|
| 1310 |
+
}
|
| 1311 |
+
}, [linksData]);
|
| 1312 |
+
|
| 1313 |
+
|
| 1314 |
+
|
| 1315 |
+
|
| 1316 |
+
const forceUpdate = () => {
|
| 1317 |
+
setReload((pre) => !pre);
|
| 1318 |
+
};
|
| 1319 |
+
|
| 1320 |
+
return (
|
| 1321 |
+
<div>
|
| 1322 |
+
<div className="d-flex justify-content-between align-items-center p-2 border-bottom bg-light">
|
| 1323 |
+
<label className="fs-3">分享列表</label>
|
| 1324 |
+
<ButtonToolbar
|
| 1325 |
+
aria-label="分享列表"
|
| 1326 |
+
className="bg-teal rounded"
|
| 1327 |
+
>
|
| 1328 |
+
<ButtonGroup className="bg-teal">
|
| 1329 |
+
<IconButton
|
| 1330 |
+
onClick={ () => {
|
| 1331 |
+
forceUpdate();
|
| 1332 |
+
} }
|
| 1333 |
+
text="刷新"
|
| 1334 |
+
className="bg-teal border-0"
|
| 1335 |
+
icon="reload"
|
| 1336 |
+
iconClassName="me-1 text-white"
|
| 1337 |
+
iconSize="6"
|
| 1338 |
+
/>
|
| 1339 |
+
</ButtonGroup>
|
| 1340 |
+
</ButtonToolbar>
|
| 1341 |
+
</div>
|
| 1342 |
+
{ linksError && (
|
| 1343 |
+
<div className="text-center text-danger">
|
| 1344 |
+
发生错误,请稍后重试!!!
|
| 1345 |
+
</div>
|
| 1346 |
+
) }
|
| 1347 |
+
|
| 1348 |
+
<Container fluid className="p-2">
|
| 1349 |
+
{ (linksLoading) && (
|
| 1350 |
<Row>
|
| 1351 |
+
<Col xs={ 12 } className="py-2">
|
| 1352 |
<div className="text-center text-success">
|
| 1353 |
正在努力加载中......
|
| 1354 |
</div>
|
| 1355 |
</Col>
|
| 1356 |
</Row>
|
| 1357 |
+
) }
|
| 1358 |
+
{ linksData && (
|
| 1359 |
<Row>
|
| 1360 |
+
<DataTable data={ videos ? videos : [] } columns={ columns } />
|
| 1361 |
</Row>
|
| 1362 |
+
) }
|
| 1363 |
|
| 1364 |
</Container>
|
| 1365 |
</div>
|
|
|
|
| 1367 |
};
|
| 1368 |
|
| 1369 |
|
|
|
|
| 1370 |
const Tasks = () => {
|
| 1371 |
const [show, setShow] = useState(false);
|
| 1372 |
const handleClose = () => setShow(false);
|
|
|
|
| 1400 |
return (
|
| 1401 |
<div>
|
| 1402 |
<Button
|
| 1403 |
+
style={ {
|
| 1404 |
backgroundColor: "transparent",
|
| 1405 |
+
} }
|
| 1406 |
className="nav-link btn"
|
| 1407 |
+
onClick={ handleShow }
|
| 1408 |
children={
|
| 1409 |
<span>
|
| 1410 |
<Icon
|
|
|
|
| 1417 |
></Button>
|
| 1418 |
|
| 1419 |
|
| 1420 |
+
<Modal show={ show } onHide={ handleClose }>
|
| 1421 |
<Modal.Header closeButton>
|
| 1422 |
<Modal.Title>远程下载任务</Modal.Title>
|
| 1423 |
</Modal.Header>
|
| 1424 |
<Modal.Body className="py-0">
|
| 1425 |
+
{ tasksError && (
|
| 1426 |
<div className="text-center text-danger">
|
| 1427 |
发生错误,请稍后重试!!!
|
| 1428 |
</div>
|
| 1429 |
+
) }
|
| 1430 |
+
{ (tasksLoading) && (
|
| 1431 |
<div className="text-center text-success">
|
| 1432 |
正在努力加载中......
|
| 1433 |
</div>
|
| 1434 |
+
) }
|
| 1435 |
<Container fluid className="p-2">
|
| 1436 |
<Row>
|
| 1437 |
+
<Col xs={ 12 }>
|
| 1438 |
+
<Paginate page={ pagination.pageIndex } onClick={ (i) => { onPaginationChange({ pageSize: 36, pageIndex: i }) } } itemsPerPage="36" totalCount={ meta.filter_count } />
|
| 1439 |
</Col>
|
| 1440 |
</Row>
|
| 1441 |
|
| 1442 |
<Row>
|
| 1443 |
+
<Col xs={ 12 }>
|
| 1444 |
<Table bordered hover>
|
| 1445 |
<thead>
|
| 1446 |
<tr>
|
|
|
|
| 1449 |
<th>状态</th>
|
| 1450 |
</tr>
|
| 1451 |
</thead>
|
| 1452 |
+
{ tasksData && (
|
| 1453 |
<tbody>
|
| 1454 |
+
{ tasks.map((task, index) => (
|
| 1455 |
<tr>
|
| 1456 |
+
<td>{ task.id }</td>
|
| 1457 |
+
<td>{ task.url.substr(task.url.indexOf('##') + 2) }</td>
|
| 1458 |
+
<td>{ task.status == 'draft' ? <span className="text-warning">待下载</span> : <span class="text-success">正在下载中</span> }</td>
|
| 1459 |
</tr>
|
| 1460 |
+
)) }
|
| 1461 |
</tbody>
|
| 1462 |
+
) }
|
| 1463 |
|
| 1464 |
</Table>
|
| 1465 |
|
|
|
|
| 1467 |
</Row>
|
| 1468 |
|
| 1469 |
<Row>
|
| 1470 |
+
<Col xs={ 12 } className="py-2">
|
| 1471 |
+
<Paginate page={ pagination.pageIndex } onClick={ (i) => { onPaginationChange({ pageSize: 36, pageIndex: i }) } } itemsPerPage="36" totalCount={ meta.filter_count } />
|
| 1472 |
</Col>
|
| 1473 |
</Row>
|
| 1474 |
</Container>
|
| 1475 |
</Modal.Body>
|
| 1476 |
<Modal.Footer className="justify-content-between">
|
| 1477 |
+
<Button variant="primary" onClick={ () => { forceUpdate(); } }>
|
| 1478 |
刷新
|
| 1479 |
</Button>
|
| 1480 |
+
<Button variant="primary" onClick={ () => {
|
| 1481 |
const setting = STORE.getState().settings;
|
| 1482 |
showLoading();
|
| 1483 |
axios.post(setting.github_host, { "ref": "main", "inputs": {} }, {
|
|
|
|
| 1495 |
}).finally(() => {
|
| 1496 |
hideLoading();
|
| 1497 |
});
|
| 1498 |
+
} }>
|
| 1499 |
开始下载
|
| 1500 |
</Button>
|
| 1501 |
+
<Button variant="primary" onClick={ handleClose }>
|
| 1502 |
关闭
|
| 1503 |
</Button>
|
| 1504 |
</Modal.Footer>
|
|
|
|
| 1534 |
icon="delete-outline"
|
| 1535 |
size="6"
|
| 1536 |
className="me-2"
|
| 1537 |
+
onClick={ () => {
|
| 1538 |
layer.confirm('确定删除?该操作无法撤销!!!', { icon: 3 }, function (index) {
|
| 1539 |
setDownloads(
|
| 1540 |
downloads.filter(a =>
|
|
|
|
| 1545 |
}, function () {
|
| 1546 |
|
| 1547 |
});
|
| 1548 |
+
} }
|
| 1549 |
/>
|
| 1550 |
<Icon
|
| 1551 |
icon="pencil-outline"
|
| 1552 |
size="6"
|
| 1553 |
className="me-2"
|
| 1554 |
+
onClick={ () => {
|
| 1555 |
layer.prompt({
|
| 1556 |
title: '输入文件名称,并确认',
|
| 1557 |
formType: 0,
|
|
|
|
| 1576 |
setDownloads(newDownloads);
|
| 1577 |
layer.close(index);
|
| 1578 |
});
|
| 1579 |
+
} }
|
| 1580 |
/>
|
| 1581 |
</div>
|
| 1582 |
),
|
|
|
|
| 1616 |
const file = fileinfo.data;
|
| 1617 |
var url = file.web_content_link;
|
| 1618 |
for (const obj of file.medias) {
|
| 1619 |
+
if (obj.link.url.trim().length > 10) {
|
| 1620 |
url = obj.link.url;
|
| 1621 |
+
break;
|
| 1622 |
}
|
| 1623 |
}
|
| 1624 |
+
const download = { name: file.name, size: Number(file.size), url: url, created: file.created_time }
|
| 1625 |
setAddDownloadObject(download)
|
| 1626 |
}
|
| 1627 |
useEffect(() => {
|
|
|
|
| 1649 |
return (
|
| 1650 |
<div>
|
| 1651 |
<Button
|
| 1652 |
+
style={ {
|
| 1653 |
backgroundColor: "transparent",
|
| 1654 |
+
} }
|
| 1655 |
className="nav-link btn"
|
| 1656 |
+
onClick={ handleShow }
|
| 1657 |
children={
|
| 1658 |
<span>
|
| 1659 |
<Icon
|
|
|
|
| 1661 |
size="3"
|
| 1662 |
className="text-white"
|
| 1663 |
/>
|
| 1664 |
+
<Badge bg="danger" style={ { top: '-15px', left: '-10px' } }>{ downloads.length }</Badge>
|
| 1665 |
</span>
|
| 1666 |
}
|
| 1667 |
></Button>
|
| 1668 |
|
| 1669 |
|
| 1670 |
+
<Modal show={ show } onHide={ handleClose }>
|
| 1671 |
<Modal.Header closeButton>
|
| 1672 |
<Modal.Title>本地下载任务</Modal.Title>
|
| 1673 |
</Modal.Header>
|
| 1674 |
<Modal.Body>
|
| 1675 |
+
{ downloads && (
|
| 1676 |
+
<DataTable data={ downloads ? downloads : [] } columns={ columns } />
|
| 1677 |
+
) }
|
| 1678 |
</Modal.Body>
|
| 1679 |
<Modal.Footer className="justify-content-between">
|
| 1680 |
|
| 1681 |
<ButtonGroup>
|
| 1682 |
+
<Button variant="primary" onClick={ async () => { await localTaskdMutation() } }>
|
| 1683 |
添加转存
|
| 1684 |
</Button>
|
| 1685 |
</ButtonGroup>
|
| 1686 |
|
| 1687 |
<ButtonGroup>
|
| 1688 |
+
<Button variant="danger" onClick={ () => {
|
| 1689 |
layer.confirm('确定删除?该操作无法撤销!!!', { icon: 3 }, function (index) {
|
| 1690 |
setDownloads([]);
|
| 1691 |
layer.close(index);
|
| 1692 |
}, function () {
|
| 1693 |
|
| 1694 |
});
|
| 1695 |
+
} }>
|
| 1696 |
清空
|
| 1697 |
</Button>
|
| 1698 |
+
<Button variant="primary" onClick={ handleClose }>
|
| 1699 |
关闭
|
| 1700 |
</Button>
|
| 1701 |
</ButtonGroup>
|
|
|
|
| 1768 |
dataIndex: "name",
|
| 1769 |
render: (row) => (
|
| 1770 |
row.is_dir ? <Nav.Link
|
| 1771 |
+
as={ Link }
|
| 1772 |
className="nav-link text-dark"
|
| 1773 |
+
to={ decodeURI(path + row.name + '/') }
|
| 1774 |
target="_blank"
|
| 1775 |
>
|
| 1776 |
<Icon
|
|
|
|
| 1783 |
icon="download-outline"
|
| 1784 |
size="6"
|
| 1785 |
className="me-2"
|
| 1786 |
+
onClick={ async () => {
|
| 1787 |
let data = { "path": path + row.name, "password": "" }
|
| 1788 |
await downloadMutation(data);
|
| 1789 |
+
} }
|
| 1790 |
/>
|
| 1791 |
),
|
| 1792 |
},
|
|
|
|
| 1815 |
>
|
| 1816 |
<ButtonGroup className="bg-teal">
|
| 1817 |
<IconButton
|
| 1818 |
+
onClick={ () => {
|
| 1819 |
emitEvent("test", { a: 'b' })
|
| 1820 |
+
} }
|
| 1821 |
text="刷新"
|
| 1822 |
className="bg-teal border-0"
|
| 1823 |
icon="reload"
|
|
|
|
| 1828 |
</ButtonToolbar>
|
| 1829 |
</div>
|
| 1830 |
<Container fluid className="p-2">
|
| 1831 |
+
{ error && (
|
| 1832 |
<div className="text-center text-danger">
|
| 1833 |
+
{ error }
|
| 1834 |
</div>
|
| 1835 |
+
) }
|
| 1836 |
+
{ (loading) && (
|
| 1837 |
<div className="text-center text-success">
|
| 1838 |
正在努力加载中......
|
| 1839 |
</div>
|
| 1840 |
+
) }
|
| 1841 |
+
{ response && (
|
| 1842 |
+
<DataTable data={ response.data.content ? response.data.content : [] } columns={ columns } />
|
| 1843 |
+
) }
|
| 1844 |
</Container>
|
| 1845 |
</div>
|
| 1846 |
);
|
|
|
|
| 1849 |
const container = document.getElementById("root");
|
| 1850 |
const root = ReactDOM.createRoot(container);
|
| 1851 |
root.render(
|
| 1852 |
+
<QueryClientProvider client={ queryClient }>
|
| 1853 |
<HashRouter>
|
| 1854 |
<Route path="/:path?">
|
| 1855 |
<Layout>
|
| 1856 |
<Switch>
|
| 1857 |
+
<Route path="/" exact component={ Videos } />
|
| 1858 |
+
<Route path="/shares" exact component={ Shares } />
|
| 1859 |
+
<Route path="/videos/:id?" exact component={ Videos } />
|
| 1860 |
</Switch>
|
| 1861 |
</Layout>
|
| 1862 |
</Route>
|