File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,20 +127,19 @@ pub(crate) fn subscribe_state(app: &mut AppSub) -> io::Result<IFEXIT> {
127127 utils:: create_json_file (
128128 utils:: Save :: V2ray ,
129129 format ! (
130- "{{
131- \" v2core\" :\" {}\"
132- }}" ,
130+ "{{\n \
131+ \" v2core\" :\" {}\" \n \
132+ }}",
133133 app. settings_input[ 0 ]
134134 ) ,
135135 )
136136 . unwrap_or_else ( |err| panic ! ( "{}" , err) ) ;
137- let mut subscribe_json: String = "[\n " . to_string ( ) ;
137+ let mut subscribe_json: String = "[\n \n " . to_string ( ) ;
138138 for asub in & app. subscription {
139139 subscribe_json. push_str ( & format ! (
140- "
141- {{
142- \" url\" : \" {}\"
143- }},\n " ,
140+ "{{ \n \
141+ \" url\" : \" {}\" \n \
142+ }},\n ",
144143 asub
145144 ) ) ;
146145 }
@@ -154,8 +153,8 @@ pub(crate) fn subscribe_state(app: &mut AppSub) -> io::Result<IFEXIT> {
154153 if let Ok ( list) = get_list {
155154 let mut storge: String = String :: new ( ) ;
156155 storge. push ( '[' ) ;
157- storge. push ( '\n' ) ;
158- if !list[ 0 ] . is_empty ( ) {
156+ storge. push_str ( " \n \n " ) ;
157+ if !list. is_empty ( ) && !list [ 0 ] . is_empty ( ) {
159158 //app.subs = list[0].clone();
160159 app. stateoflist = true ;
161160 app. state . select ( Some ( 0 ) ) ;
@@ -222,7 +221,8 @@ pub(crate) fn subscribe_state(app: &mut AppSub) -> io::Result<IFEXIT> {
222221 KeyCode :: Up => app. previous_sub ( ) ,
223222 KeyCode :: Down => app. next_sub ( ) ,
224223 KeyCode :: Char ( 'd' ) => {
225- app. subscription . remove ( app. index_subscription . selected ( ) . unwrap ( ) ) ;
224+ app. subscription
225+ . remove ( app. index_subscription . selected ( ) . unwrap ( ) ) ;
226226 if app. subscription . is_empty ( ) {
227227 app. unselect_sub ( ) ;
228228 app. input_mode = InputMode :: Popup ;
Original file line number Diff line number Diff line change 11use crate :: spider:: Information ;
2- use serde_json:: Value ;
2+ use serde_json:: { Value , json } ;
33use std:: {
44 env,
55 fs:: { self , File } ,
@@ -48,7 +48,9 @@ pub fn start_v2core() -> String {
4848 let message = match get_json ( Save :: V2ray ) {
4949 Ok ( output) => output,
5050 Err ( _) => {
51- let core = "{\n \" v2core\" :\" /usr/bin/v2ray\" \n }" . to_string ( ) ;
51+ let core = json ! ( {
52+ "v2core" : "/usr/bin/v2ray"
53+ } ) . to_string ( ) ;
5254 create_json_file ( Save :: V2ray , core. clone ( ) ) . unwrap_or_else ( |err| panic ! ( "{}" , err) ) ;
5355 core
5456 }
You can’t perform that action at this time.
0 commit comments