mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:43:44 +08:00
chore: Auto Update config.yml
This commit is contained in:
parent
7551b45da2
commit
9f43a73c36
@ -12,11 +12,19 @@ pub struct IClashTemp(pub Mapping);
|
|||||||
|
|
||||||
impl IClashTemp {
|
impl IClashTemp {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
let template = Self::template();
|
||||||
match dirs::clash_path().and_then(|path| help::read_merge_mapping(&path)) {
|
match dirs::clash_path().and_then(|path| help::read_merge_mapping(&path)) {
|
||||||
Ok(map) => Self(Self::guard(map)),
|
Ok(mut map) => {
|
||||||
|
template.0.keys().for_each(|key| {
|
||||||
|
if !map.contains_key(key) {
|
||||||
|
map.insert(key.clone(), template.0.get(key).unwrap().clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Self(Self::guard(map))
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!(target: "app", "{err}");
|
log::error!(target: "app", "{err}");
|
||||||
Self::template()
|
template
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user