Refactor proxy routing and installer flows
This commit is contained in:
@@ -75,13 +75,6 @@ impl JsonStorage {
|
||||
&self.paths
|
||||
}
|
||||
|
||||
pub fn ensure_dirs(&self) -> io::Result<()> {
|
||||
fs::create_dir_all(&self.paths.config_dir)?;
|
||||
fs::create_dir_all(&self.paths.state_dir)?;
|
||||
fs::create_dir_all(&self.paths.generated_dir)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn read_profiles(&self) -> io::Result<Vec<Profile>> {
|
||||
self.read_json_or_default(&self.paths.profiles_file)
|
||||
}
|
||||
@@ -102,10 +95,6 @@ impl JsonStorage {
|
||||
self.read_json_or_default(&self.paths.components_file)
|
||||
}
|
||||
|
||||
pub fn write_components(&self, components: &[ComponentStatus]) -> io::Result<()> {
|
||||
self.write_json(&self.paths.components_file, components)
|
||||
}
|
||||
|
||||
pub fn read_local_singbox_config(&self) -> io::Result<LocalSingBoxConfig> {
|
||||
self.read_json_or_default(&self.paths.local_singbox_file)
|
||||
}
|
||||
@@ -135,11 +124,6 @@ impl JsonStorage {
|
||||
Ok(cap_activity(entries, self.activity_limit))
|
||||
}
|
||||
|
||||
pub fn write_activity(&self, entries: &[ActivityEntry]) -> io::Result<()> {
|
||||
let entries = cap_activity(entries.to_vec(), self.activity_limit);
|
||||
self.write_json(&self.paths.activity_file, &entries)
|
||||
}
|
||||
|
||||
pub fn append_activity(&self, entry: ActivityEntry) -> io::Result<Vec<ActivityEntry>> {
|
||||
let entries = self.read_activity()?;
|
||||
let entries = append_activity(entries, entry, self.activity_limit);
|
||||
|
||||
Reference in New Issue
Block a user