File tree 3 files changed +24
-2
lines changed
luasrc/model/cbi/openclash
3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,12 @@ o:value("true", translate("Enable"))
177
177
o .default = " false"
178
178
o :depends (" sub_convert" , " 1" )
179
179
180
+ ---- custom params
181
+ o = s :option (DynamicList , " custom_params" , translate (" Custom Params" ))
182
+ o .description = font_red .. bold_on .. translate (" eg: \" rename=\\ s+([2-9])[xX]@ (HIGH:$1)\" " ).. bold_off .. font_off
183
+ o .rmempty = false
184
+ o :depends (" sub_convert" , " 1" )
185
+
180
186
---- key
181
187
o = s :option (DynamicList , " keyword" , font_red .. bold_on .. translate (" Keyword Match" ).. bold_off .. font_off )
182
188
o .description = font_red .. bold_on .. translate (" eg: hk or tw&bgp" ).. bold_off .. font_off
Original file line number Diff line number Diff line change @@ -2874,6 +2874,12 @@ msgstr "Fake-IP 持久化缓存清理"
2874
2874
msgid "No Specify Upload File"
2875
2875
msgstr "未选择上传文件"
2876
2876
2877
+ msgid "Custom Params"
2878
+ msgstr "自定义参数"
2879
+
2880
+ msgid "eg: \" rename=\\ s+([2-9])[xX]@ (HIGH:$1)\" "
2881
+ msgstr "格式示例:\" rename=\\ s+([2-9])[xX]@ (高倍率:$1)\" "
2882
+
2877
2883
msgid "Use Rule Provider"
2878
2884
msgstr "使用规则集"
2879
2885
Original file line number Diff line number Diff line change @@ -367,9 +367,18 @@ server_key_match()
367
367
fi
368
368
}
369
369
370
+ convert_custom_param ()
371
+ {
372
+ if ! (echo " $1 " | grep -qE " ^\w+=.+$" ) then
373
+ return
374
+ fi
375
+ local p_name=" ${1%% =* } " p_value=" ${1#* =} "
376
+ append_custom_params=" ${append_custom_params} &${p_name} =$( urlencode " $p_value " ) "
377
+ }
378
+
370
379
sub_info_get ()
371
380
{
372
- local section=" $1 " subscribe_url template_path subscribe_url_param template_path_encode key_match_param key_ex_match_param c_address de_ex_keyword sub_ua
381
+ local section=" $1 " subscribe_url template_path subscribe_url_param template_path_encode key_match_param key_ex_match_param c_address de_ex_keyword sub_ua append_custom_params
373
382
config_get_bool " enabled" " $section " " enabled" " 1"
374
383
config_get " name" " $section " " name" " "
375
384
config_get " sub_convert" " $section " " sub_convert" " "
@@ -454,10 +463,11 @@ sub_info_get()
454
463
template_path=$custom_template_url
455
464
fi
456
465
if [ -n " $template_path " ]; then
466
+ config_list_foreach " $section " " custom_params" convert_custom_param
457
467
template_path_encode=$( urlencode " $template_path " )
458
468
[ -n " $key_match_param " ] && key_match_param=" $( urlencode " (?i)$key_match_param " ) "
459
469
[ -n " $key_ex_match_param " ] && key_ex_match_param=" $( urlencode " (?i)$key_ex_match_param " ) "
460
- subscribe_url_param=" ?target=clash&new_name=true&url=$subscribe_url &config=$template_path_encode &include=$key_match_param &exclude=$key_ex_match_param &emoji=$emoji &list=false&sort=$sort$udp &scv=$skip_cert_verify &append_type=$node_type &fdn=true$rule_provider "
470
+ subscribe_url_param=" ?target=clash&new_name=true&url=$subscribe_url &config=$template_path_encode &include=$key_match_param &exclude=$key_ex_match_param &emoji=$emoji &list=false&sort=$sort$udp &scv=$skip_cert_verify &append_type=$node_type &fdn=true$rule_provider$append_custom_params "
461
471
c_address=" $convert_address "
462
472
else
463
473
subscribe_url=$address
You can’t perform that action at this time.
0 commit comments