feat: inline config file template

This commit is contained in:
GyDi
2022-02-18 23:57:13 +08:00
parent 4f2d3cc250
commit 46183d4d43
8 changed files with 59 additions and 75 deletions

View File

@@ -1,5 +1,5 @@
use super::{Clash, ClashInfo};
use crate::utils::{config, dirs};
use crate::utils::{config, dirs, tmpl};
use reqwest::header::HeaderMap;
use serde::{Deserialize, Serialize};
use serde_yaml::{Mapping, Value};
@@ -155,16 +155,7 @@ impl Profiles {
let file = format!("{}.yaml", now);
let path = dirs::app_home_dir().join("profiles").join(&file);
let file_data = b"# Profile Template for clash verge\n
# proxies defination (optional, the same as clash)
proxies:\n
# proxy-groups (optional, the same as clash)
proxy-groups:\n
# rules (optional, the same as clash)
rules:\n\n
";
match File::create(&path).unwrap().write(file_data) {
match File::create(&path).unwrap().write(tmpl::ITEM_CONFIG) {
Ok(_) => {
items.push(ProfileItem {
name: Some(name),