mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: handle remote clash config fields
This commit is contained in:
@@ -316,6 +316,9 @@ pub struct Profiles {
|
||||
/// same as PrfConfig.chain
|
||||
chain: Option<Vec<String>>,
|
||||
|
||||
/// record valid fields for clash
|
||||
valid: Option<Vec<String>>,
|
||||
|
||||
/// profile list
|
||||
items: Option<Vec<PrfItem>>,
|
||||
}
|
||||
@@ -399,6 +402,11 @@ impl Profiles {
|
||||
self.chain = chain;
|
||||
}
|
||||
|
||||
/// just change the `field`
|
||||
pub fn put_valid(&mut self, valid: Option<Vec<String>>) {
|
||||
self.valid = valid;
|
||||
}
|
||||
|
||||
/// find the item by the uid
|
||||
pub fn get_item(&self, uid: &String) -> Result<&PrfItem> {
|
||||
if self.items.is_some() {
|
||||
@@ -599,9 +607,12 @@ impl Profiles {
|
||||
None => vec![],
|
||||
};
|
||||
|
||||
let valid = self.valid.clone().unwrap_or(vec![]);
|
||||
|
||||
Ok(PrfEnhanced {
|
||||
current,
|
||||
chain,
|
||||
valid,
|
||||
callback,
|
||||
})
|
||||
}
|
||||
@@ -613,6 +624,8 @@ pub struct PrfEnhanced {
|
||||
|
||||
pub chain: Vec<PrfData>,
|
||||
|
||||
pub valid: Vec<String>,
|
||||
|
||||
pub callback: String,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user