remove sing-box subscription support
notes: you can use sing-box-yaott or qjebbs[may not be stable yet]
This commit is contained in:
4
.github/workflows/debug.yml
vendored
4
.github/workflows/debug.yml
vendored
@@ -16,6 +16,8 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get tags
|
||||
id: get_tags
|
||||
@@ -52,6 +54,8 @@ jobs:
|
||||
needs: [build]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get tags
|
||||
id: get_tags
|
||||
|
||||
@@ -51,7 +51,7 @@ box_run_crontab() {
|
||||
echo "${interva_update} ${scripts_dir}/box.tool geosub" >> "${box_run}/root"
|
||||
log Debug "Interval crontab geox and subs: ${interva_update}."
|
||||
log Info "${bin_name} geox updates: ${update_geo}."
|
||||
if [[ "${bin_name}" == @(clash|sing-box) ]]; then
|
||||
if [ "${bin_name}" = "clash" ]; then
|
||||
log Info "${bin_name} subscription update: ${update_subscription}."
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -186,66 +186,7 @@ update_subs() {
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
"sing-box")
|
||||
if [ -n "${subscription_url_sing}" ]; then
|
||||
# subscription sing-box
|
||||
if [ "${update_subscription}" = "true" ]; then
|
||||
log Info "daily updates subs"
|
||||
log Debug "Downloading ${update_file_name}"
|
||||
if update_file "${update_file_name}" "${subscription_url_sing}"; then
|
||||
log Info "${update_file_name} saved"
|
||||
if [ "${enhanced}" = "true" ]; then
|
||||
if "${yq_cmd}" -e . "${update_file_name}" >/dev/null 2>&1; then
|
||||
cp "${update_file_name}" "${sing_provide_config}"
|
||||
if [ -f "${update_file_name}.bak" ]; then
|
||||
rm "${update_file_name}.bak"
|
||||
fi
|
||||
|
||||
# script to edit sing-box subscriptions
|
||||
# removed the structure: inbounds/experimental/route/log and dns
|
||||
"${yq_cmd}" 'del(.inbounds, .experimental, .route, .log, .dns)' -i --output-format=json "${sing_provide_config}"
|
||||
|
||||
# remove outbound with type: direct/block/dns/selector/urltest
|
||||
"${yq_cmd}" 'del(.outbounds[] | select(.type == "direct" or .type == "block" or .type == "dns" or .type == "selector" or .type == "urltest"))' -i --output-format=json "${sing_provide_config}"
|
||||
|
||||
# create new outbounds with type: selector, tag: singbox in ${sing_provide_config}
|
||||
"${yq_cmd}" '.outbounds += [{"tag": "b0x", "type": "selector", "outbounds": [.outbounds[].tag]}]' -i --output-format=json "${sing_provide_config}"
|
||||
|
||||
# create new outbounds with type: urltest, tag: b0x[urltest] in ${sing_provide_config}
|
||||
"${yq_cmd}" '.outbounds += [{"tag": "b0x[urltest]", "type": "urltest", "url": "https://www.gstatic.com/generate_204", "interval": "3m", "outbounds": [.outbounds[].tag]}]' -i --output-format=json "${sing_provide_config}"
|
||||
|
||||
# renew outbounds with tag: singbox in main ${sing_config} dan ${sing_provide_config}
|
||||
"${yq_cmd}" 'del(.outbounds[].outbounds[] | select(. == "b0x"))' -i --output-format=json "${sing_provide_config}"
|
||||
"${yq_cmd}" 'del(.outbounds[].outbounds[] | select(. == "b0x"))' -i --output-format=json "${sing_config}"
|
||||
"${yq_cmd}" '.outbounds[0].outbounds += ["b0x"]' -i --output-format=json "${sing_config}"
|
||||
|
||||
# renew outbounds with tag: b0x[urltest] in main ${sing_config} dan ${sing_provide_config}
|
||||
"${yq_cmd}" 'del(.outbounds[].outbounds[] | select(. == "b0x[urltest]"))' -i --output-format=json "${sing_provide_config}"
|
||||
"${yq_cmd}" 'del(.outbounds[].outbounds[] | select(. == "b0x[urltest]"))' -i --output-format=json "${sing_config}"
|
||||
"${yq_cmd}" '.outbounds[0].outbounds += ["b0x[urltest]"]' -i --output-format=json "${sing_config}"
|
||||
|
||||
log Info "subscription success"
|
||||
log Info "Update subscription $(date +"%F %R")"
|
||||
else
|
||||
log Error "update subscription failed"
|
||||
log Error "${update_file_name} error"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
log Error "update subscription failed"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log Warning "${bin_name} subscription url is empty..."
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
"xray" | "v2fly")
|
||||
"xray"|"v2fly"|"sing-box")
|
||||
log Warning "${bin_name} does not support subscriptions.."
|
||||
return 1
|
||||
;;
|
||||
|
||||
@@ -78,15 +78,13 @@ run_crontab="false"
|
||||
|
||||
# type "su -c /data/adb/box/scripts/box.tool geox" to update geox
|
||||
update_geo="true"
|
||||
|
||||
# if "true" it will update config. *.yaml not subscription configuration
|
||||
renew=false
|
||||
# type "su -c /data/adb/box/scripts/box.tool subs" to update subscription
|
||||
update_subscription="false"
|
||||
|
||||
renew=false # if "true" it will update config. *.yaml or *.json not subscription configuration
|
||||
|
||||
# ex: clash subscription url
|
||||
subscription_url_clash=""
|
||||
# ex: sing-box subscription url
|
||||
subscription_url_sing=""
|
||||
|
||||
# clash configuration
|
||||
name_clash_config="config.yaml"
|
||||
@@ -102,9 +100,6 @@ clash_provide_rules="${box_dir}/clash/provide/${name_provide_clash_rules}"
|
||||
# sing configuration
|
||||
name_sing_config="config.json"
|
||||
sing_config="${box_dir}/sing-box/${name_sing_config}"
|
||||
# sing subscription
|
||||
name_provide_sing_config="subscription.json"
|
||||
sing_provide_config="${box_dir}/sing-box/${name_provide_sing_config}"
|
||||
|
||||
normal="\033[0m"
|
||||
orange="\033[1;38;5;208m"
|
||||
|
||||
@@ -20,7 +20,7 @@ MSG_TEMPLATE = """
|
||||
|
||||
{version}
|
||||
|
||||
[Commit](https://github.com/shioeri/sing-box/commits/dev-next):
|
||||
[Commit](https://github.com/taamarin/box_for_magisk/commits/master):
|
||||
```
|
||||
{cg}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user