mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
feat(backup): add dns_config into backup (#5166)
This commit is contained in:
@@ -288,6 +288,12 @@ pub fn create_backup() -> Result<(String, PathBuf), Error> {
|
|||||||
zip.start_file(dirs::VERGE_CONFIG, options)?;
|
zip.start_file(dirs::VERGE_CONFIG, options)?;
|
||||||
zip.write_all(serde_yaml_ng::to_string(&verge_config)?.as_bytes())?;
|
zip.write_all(serde_yaml_ng::to_string(&verge_config)?.as_bytes())?;
|
||||||
|
|
||||||
|
let dns_config_path = dirs::app_home_dir()?.join(dirs::DNS_CONFIG);
|
||||||
|
if dns_config_path.exists() {
|
||||||
|
zip.start_file(dirs::DNS_CONFIG, options)?;
|
||||||
|
zip.write_all(fs::read(&dns_config_path)?.as_slice())?;
|
||||||
|
}
|
||||||
|
|
||||||
zip.start_file(dirs::PROFILE_YAML, options)?;
|
zip.start_file(dirs::PROFILE_YAML, options)?;
|
||||||
zip.write_all(fs::read(dirs::profiles_path()?)?.as_slice())?;
|
zip.write_all(fs::read(dirs::profiles_path()?)?.as_slice())?;
|
||||||
zip.finish()?;
|
zip.finish()?;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ pub static PORTABLE_FLAG: OnceCell<bool> = OnceCell::new();
|
|||||||
pub static CLASH_CONFIG: &str = "config.yaml";
|
pub static CLASH_CONFIG: &str = "config.yaml";
|
||||||
pub static VERGE_CONFIG: &str = "verge.yaml";
|
pub static VERGE_CONFIG: &str = "verge.yaml";
|
||||||
pub static PROFILE_YAML: &str = "profiles.yaml";
|
pub static PROFILE_YAML: &str = "profiles.yaml";
|
||||||
|
pub static DNS_CONFIG: &str = "dns_config.yaml";
|
||||||
|
|
||||||
/// init portable flag
|
/// init portable flag
|
||||||
pub fn init_portable_flag() -> Result<()> {
|
pub fn init_portable_flag() -> Result<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user