mirror of
https://github.com/VirtualHotBar/NetMount.git
synced 2026-05-31 16:34:05 +08:00
fix:上传文件
This commit is contained in:
@@ -12,7 +12,7 @@ async function updateStorageInfoList() {
|
||||
...(await updateRcloneStorageInfoList()),)
|
||||
|
||||
//移除不需要的存储
|
||||
const unneededStorages:string[]=['Virtual','Crypt','Alias']
|
||||
const unneededStorages:string[]=['Virtual','Crypt','Alias','SMB','FTP','WebDAV']
|
||||
storageInfoList=storageInfoList.filter(item => !unneededStorages.includes(item.type));
|
||||
|
||||
//给存储排序
|
||||
@@ -22,7 +22,7 @@ async function updateStorageInfoList() {
|
||||
{ "text": "189", "weight": 4.5 },
|
||||
{ "text": "alist", "weight": 3.5 },
|
||||
{ "text": "aliyundrive", "weight": 5 },
|
||||
{ "text": "baidunetdisk", "weight": 6 },
|
||||
{ "text": "baidunetdisk", "weight": 5 },
|
||||
{ "text": "baiduphoto", "weight": 1 },
|
||||
{ "text": "cloudreve", "weight": 3 },
|
||||
{ "text": "feijipan", "weight": 2.5 },
|
||||
|
||||
@@ -13,12 +13,12 @@ import { nmConfig } from "../../services/config"
|
||||
|
||||
//列举存储信息
|
||||
async function reupStorage() {
|
||||
const storageListTemp:StorageList[]=[]
|
||||
const storageListTemp: StorageList[] = []
|
||||
//rclone
|
||||
const dump = await rclone_api_post(
|
||||
'/config/dump',
|
||||
)
|
||||
|
||||
|
||||
for (const storageName in dump) {
|
||||
storageListTemp.push({
|
||||
framework: 'rclone',
|
||||
@@ -40,12 +40,12 @@ async function reupStorage() {
|
||||
alist: {
|
||||
id: storage.id,
|
||||
driverPath: storage.mount_path,
|
||||
status:storage.status
|
||||
status: storage.status
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
rcloneInfo.storageList = storageListTemp
|
||||
|
||||
hooks.upStorage()
|
||||
@@ -80,7 +80,7 @@ async function delStorage(name: string) {
|
||||
|
||||
//删除挂载
|
||||
for (const mount of nmConfig.mount.lists) {
|
||||
if (mount.storageName === storage?.name ) {
|
||||
if (mount.storageName === storage?.name) {
|
||||
await delMountStorage(mount.mountPath)
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ async function delStorage(name: string) {
|
||||
})
|
||||
break;
|
||||
case 'alist':
|
||||
await alist_api_post('/api/admin/storage/delete',undefined, { id: storage.other?.alist?.id })
|
||||
await alist_api_post('/api/admin/storage/delete', undefined, { id: storage.other?.alist?.id })
|
||||
break;
|
||||
}
|
||||
reupStorage()
|
||||
@@ -310,8 +310,8 @@ const uploadFileRequest = (option: RequestOptions, storageName: string, path: st
|
||||
|
||||
xhr.onerror = () => onError(xhr);
|
||||
|
||||
xhr.open('POST', `${rcloneInfo.endpoint.url}/operations/uploadfile?fs=${convertStoragePath(storageName,undefined,undefined,undefined,true)}&remote=${convertStoragePath(storageName,path,true,true,undefined)}`, true);
|
||||
xhr.setRequestHeader('Authorization', `Bearer ${getRcloneApiHeaders().Authorization}`);
|
||||
xhr.open('POST', `${rcloneInfo.endpoint.url}/operations/uploadfile?fs=${convertStoragePath(storageName, undefined, undefined, undefined, true)}&remote=${convertStoragePath(storageName, path, true, true, undefined)}`, true);
|
||||
xhr.setRequestHeader('Authorization', getRcloneApiHeaders().Authorization);
|
||||
xhr.send(formData);
|
||||
};
|
||||
|
||||
|
||||
@@ -25,19 +25,28 @@ function Mount_page() {
|
||||
{
|
||||
title: t('storage_name'),
|
||||
dataIndex: 'storageName',
|
||||
width:'11rem',
|
||||
ellipsis: true,
|
||||
render: (text) => {
|
||||
return <Typography.Ellipsis>{text}</Typography.Ellipsis>
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('mount_path'),
|
||||
dataIndex: 'mountPath_',
|
||||
ellipsis: true,
|
||||
|
||||
},
|
||||
{
|
||||
title: t('mount_status'),
|
||||
dataIndex: 'mounted',
|
||||
width:'5.5rem',
|
||||
},
|
||||
{
|
||||
title: t('actions'),
|
||||
dataIndex: 'actions',
|
||||
align: 'right'
|
||||
align: 'right',
|
||||
width:'11rem'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -98,10 +107,10 @@ function Mount_page() {
|
||||
const mounted = isMounted(item.mountPath)
|
||||
return {
|
||||
...item,
|
||||
mountPath_: <>{item.mountPath}{rcloneInfo.endpoint.isLocal&&osInfo.osType==='Windows_NT' &&mounted&&
|
||||
mountPath_: <div style={{ display: 'flex', width:'100%',alignItems:'center' }}><Typography.Ellipsis className='singe-line' showTooltip>{item.mountPath}</Typography.Ellipsis>{rcloneInfo.endpoint.isLocal&&osInfo.osType==='Windows_NT' &&mounted&&
|
||||
<Button title={t('show_path_in_explorer')} onClick={async () => {
|
||||
await showPathInExplorer(item.mountPath,true)
|
||||
}} type='text' icon={<IconEye />}></Button>}</>,
|
||||
}} type='text' icon={<IconEye />}></Button>}</div>,
|
||||
mounted: mounted ? t('mounted') : t('unmounted'),
|
||||
actions: <Space>
|
||||
{
|
||||
|
||||
@@ -224,7 +224,7 @@ function InputForm_module({ data, style, showAdvanced, footer, onChange, overwri
|
||||
formItems.push(
|
||||
<FormItem
|
||||
requiredSymbol={false}
|
||||
label={<div className="singe-line">{dataItem.required && '*'}{t(dataItem.label)}</div>}
|
||||
label={<div className="singe-line" title={t(dataItem.label)}>{dataItem.required && '*'}{t(dataItem.label)}</div>}
|
||||
title={dataItem.description}
|
||||
field={dataItem.name}
|
||||
triggerPropName={dataItem.type === 'boolean' ? 'checked' : 'value'}
|
||||
|
||||
@@ -81,11 +81,11 @@ function Transmit_page() {
|
||||
{
|
||||
transmitList.map((item, index) => {
|
||||
return <List.Item key={index}>
|
||||
<Row >
|
||||
<Col flex={'3.5rem'}>
|
||||
<div style={{ width: '100%' ,display: 'flex' }}>
|
||||
<div style={{width:'5rem'}}>
|
||||
<Progress type={'circle'} percent={item.percentage} style={{ marginTop: '0.5rem' }} size='small' />
|
||||
</Col>
|
||||
<Col flex={'auto'}>
|
||||
</div>
|
||||
<div style={{width:'calc(100% - 5rem)',overflow:'auto'}}>
|
||||
<Typography.Ellipsis >{item.name}</Typography.Ellipsis>
|
||||
<Descriptions
|
||||
size='small'
|
||||
@@ -121,8 +121,8 @@ function Transmit_page() {
|
||||
}
|
||||
] : []),
|
||||
]} />
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
</List.Item>
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user