fix: add file existence checks before backup and fix CSS typo

This commit is contained in:
xmk23333 2025-12-14 22:15:38 +08:00
parent d811f76bb4
commit 041a81cfd4
2 changed files with 28 additions and 10 deletions

View File

@ -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`

View File

@ -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>