Skip to content

Commit 9d7913f

Browse files
author
cht
committed
somepart use json!
1 parent d161b06 commit 9d7913f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/subscribe/state.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use super::{Page, IFEXIT};
55
use crossterm::event::{self, Event, KeyCode};
66
use std::{env, io, process::Command};
77
use tui::widgets::ListState;
8+
use serde_json::json;
89
pub(super) async fn subscribe_state(app: &mut AppSub) -> io::Result<IFEXIT> {
910
if app.receiver.is_some() {
1011
if let Ok(get_list) = app.receiver.as_mut().unwrap().try_recv() {
@@ -144,12 +145,9 @@ pub(super) async fn subscribe_state(app: &mut AppSub) -> io::Result<IFEXIT> {
144145
KeyCode::Char('s') => {
145146
utils::create_json_file(
146147
utils::Save::V2ray,
147-
format!(
148-
"{{\n \
149-
\"v2core\":\"{}\"\n\
150-
}}",
151-
app.settings_input[0]
152-
),
148+
json!({
149+
"v2core" : app.settings_input[0]
150+
}).to_string()
153151
)
154152
.unwrap_or_else(|err| panic!("{}", err));
155153
let mut subscribe_json: String = "[\n\n".to_string();

0 commit comments

Comments
 (0)