mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
refactor: done
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::utils::{config, dirs};
|
||||
use crate::utils::{dirs, help};
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_yaml::{Mapping, Value};
|
||||
@@ -8,7 +8,7 @@ pub struct IClashTemp(pub Mapping);
|
||||
|
||||
impl IClashTemp {
|
||||
pub fn new() -> Self {
|
||||
match dirs::clash_path().and_then(|path| config::read_merge_mapping(&path)) {
|
||||
match dirs::clash_path().and_then(|path| help::read_merge_mapping(&path)) {
|
||||
Ok(map) => Self(map),
|
||||
Err(err) => {
|
||||
log::error!(target: "app", "{err}");
|
||||
@@ -20,7 +20,7 @@ impl IClashTemp {
|
||||
pub fn template() -> Self {
|
||||
let mut map = Mapping::new();
|
||||
|
||||
map.insert("mixed-port".into(), 7892.into());
|
||||
map.insert("mixed-port".into(), 7890.into());
|
||||
map.insert("log-level".into(), "info".into());
|
||||
map.insert("allow-lan".into(), false.into());
|
||||
map.insert("mode".into(), "rule".into());
|
||||
@@ -37,10 +37,10 @@ impl IClashTemp {
|
||||
}
|
||||
|
||||
pub fn save_config(&self) -> Result<()> {
|
||||
config::save_yaml(
|
||||
dirs::clash_path()?,
|
||||
help::save_yaml(
|
||||
&dirs::clash_path()?,
|
||||
&self.0,
|
||||
Some("# Default Config For ClashN Core\n\n"),
|
||||
Some("# Generated by Clash Verge"),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user