mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:43:44 +08:00
feat: compatible profile config
This commit is contained in:
parent
4903c70686
commit
b04e22cd2c
@ -170,7 +170,21 @@ macro_rules! patch {
|
|||||||
impl Profiles {
|
impl Profiles {
|
||||||
/// read the config from the file
|
/// read the config from the file
|
||||||
pub fn read_file() -> Self {
|
pub fn read_file() -> Self {
|
||||||
config::read_yaml::<Self>(dirs::profiles_path())
|
let mut profiles = config::read_yaml::<Self>(dirs::profiles_path());
|
||||||
|
|
||||||
|
if profiles.items.is_none() {
|
||||||
|
profiles.items = Some(vec![]);
|
||||||
|
}
|
||||||
|
|
||||||
|
profiles.items.as_mut().map(|items| {
|
||||||
|
for mut item in items.iter_mut() {
|
||||||
|
if item.uid.is_none() {
|
||||||
|
item.uid = Some(help::get_uid("d"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
profiles
|
||||||
}
|
}
|
||||||
|
|
||||||
/// save the config to the file
|
/// save the config to the file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user