mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-26 20:50:30 +08:00
fix: add file existence checks before backup and fix CSS typo
This commit is contained in:
parent
d811f76bb4
commit
041a81cfd4
@ -59,15 +59,33 @@ export async function webdavBackup(): Promise<boolean> {
|
||||
const { client, webdavDir, webdavMaxBackups } = await getWebDAVClient()
|
||||
const zip = new AdmZip()
|
||||
|
||||
if (existsSync(appConfigPath())) {
|
||||
zip.addLocalFile(appConfigPath())
|
||||
}
|
||||
if (existsSync(controledMihomoConfigPath())) {
|
||||
zip.addLocalFile(controledMihomoConfigPath())
|
||||
}
|
||||
if (existsSync(profileConfigPath())) {
|
||||
zip.addLocalFile(profileConfigPath())
|
||||
}
|
||||
if (existsSync(overrideConfigPath())) {
|
||||
zip.addLocalFile(overrideConfigPath())
|
||||
}
|
||||
if (existsSync(themesDir())) {
|
||||
zip.addLocalFolder(themesDir(), 'themes')
|
||||
}
|
||||
if (existsSync(profilesDir())) {
|
||||
zip.addLocalFolder(profilesDir(), 'profiles')
|
||||
}
|
||||
if (existsSync(overrideDir())) {
|
||||
zip.addLocalFolder(overrideDir(), 'override')
|
||||
}
|
||||
if (existsSync(rulesDir())) {
|
||||
zip.addLocalFolder(rulesDir(), 'rules')
|
||||
}
|
||||
if (existsSync(subStoreDir())) {
|
||||
zip.addLocalFolder(subStoreDir(), 'substore')
|
||||
}
|
||||
const date = new Date()
|
||||
const zipFileName = `${process.platform}_${dayjs(date).format('YYYY-MM-DD_HH-mm-ss')}.zip`
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ const WebdavConfig: React.FC = () => {
|
||||
/>
|
||||
</div>
|
||||
</SettingItem>
|
||||
<div className="flex justify0between">
|
||||
<div className="flex justify-between">
|
||||
<Button isLoading={backuping} fullWidth size="sm" className="mr-1" onPress={handleBackup}>
|
||||
{t('webdav.backup')}
|
||||
</Button>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user