Skip to content

Commit

Permalink
update 2024-11-24 12:16:35
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed Nov 24, 2024
1 parent 1c914da commit ff8b12e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ return view.extend({

o = s.taboption('external_control', form.Value, 'ui_url', '*' + ' ' + _('UI Url'));
o.rmempty = false;
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip', 'MetaCubeXD');
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip', 'YACD');
o.value('https://mirror.ghproxy.com/https://github.com/MetaCubeX/Razord-meta/archive/refs/heads/gh-pages.zip', 'Razord');
o.value('https://mirror.ghproxy.com/https://github.com/Zephyruso/sing-box-dashboard/archive/refs/heads/gh-pages.zip', 'SD');
o.value('https://ghp.ci/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip', 'MetaCubeXD');
o.value('https://ghp.ci/https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip', 'YACD');
o.value('https://ghp.ci/https://github.com/MetaCubeX/Razord-meta/archive/refs/heads/gh-pages.zip', 'Razord');
o.value('https://ghp.ci/https://github.com/Zephyruso/zashboard/archive/refs/heads/gh-pages.zip', 'Zashboard');

o = s.taboption('external_control', form.Value, 'api_port', '*' + ' ' + _('API Port'));
o.datatype = 'port';
Expand Down
10 changes: 5 additions & 5 deletions mihomo/files/mihomo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ config mixin 'mixin'
option 'tcp_keep_alive_idle' '600'
option 'tcp_keep_alive_interval' '15'
option 'ui_name' 'metacubexd'
option 'ui_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip'
option 'ui_url' 'https://ghp.ci/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip'
option 'api_port' '9090'
option 'api_secret' ''
option 'selection_cache' '1'
Expand Down Expand Up @@ -90,10 +90,10 @@ config mixin 'mixin'
option 'dns_nameserver_policy' '0'
option 'geoip_format' 'dat'
option 'geodata_loader' 'memconservative'
option 'geosite_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat'
option 'geoip_mmdb_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.metadb'
option 'geoip_dat_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat'
option 'geoip_asn_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
option 'geosite_url' 'https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat'
option 'geoip_mmdb_url' 'https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.metadb'
option 'geoip_dat_url' 'https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat'
option 'geoip_asn_url' 'https://ghp.ci/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
option 'geox_auto_update' '0'
option 'geox_update_interval' '24'
option 'mixin_file_content' '0'
Expand Down
20 changes: 19 additions & 1 deletion mihomo/files/mihomo.init
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,23 @@ update_subscription() {
if [ -z "$subscription_section" ]; then
return
fi
# load config
config_load mihomo
# get subscription config
local subscription_name subscription_url subscription_user_agent
config_get subscription_name "$subscription_section" "name"
config_get subscription_url "$subscription_section" "url"
config_get subscription_user_agent "$subscription_section" "user_agent"
# reset subscription info
uci_remove "mihomo" "$subscription_section" "expire"
uci_remove "mihomo" "$subscription_section" "upload"
uci_remove "mihomo" "$subscription_section" "download"
uci_remove "mihomo" "$subscription_section" "total"
uci_remove "mihomo" "$subscription_section" "used"
uci_remove "mihomo" "$subscription_section" "avaliable"
uci_remove "mihomo" "$subscription_section" "update"
uci_remove "mihomo" "$subscription_section" "success"
# update subscription
log "Update Subscription: $subscription_name."
local subscription_header_tmpfile; subscription_header_tmpfile="/tmp/$subscription_section.header"
local subscription_tmpfile; subscription_tmpfile="/tmp/$subscription_section.yaml"
Expand All @@ -645,6 +657,7 @@ update_subscription() {
subscription_avaliable=$((subscription_total - subscription_upload - subscription_download))
fi
fi
# update subscription info
if [ -n "$subscription_expire" ]; then
uci_set "mihomo" "$subscription_section" "expire" "$(date "+%Y-%m-%d %H:%M:%S" -d @$subscription_expire)"
fi
Expand All @@ -664,12 +677,17 @@ update_subscription() {
uci_set "mihomo" "$subscription_section" "avaliable" "$(format_filesize $subscription_avaliable)"
fi
uci_set "mihomo" "$subscription_section" "update" "$(date "+%Y-%m-%d %H:%M:%S")"
uci_commit "mihomo"
uci_set "mihomo" "$subscription_section" "success" "1"
# update subscription file
rm -f "$subscription_header_tmpfile"
mv -f "$subscription_tmpfile" "$subscription_file"
else
log "Subscription update failed."
# update subscription info
uci_set "mihomo" "$subscription_section" "success" "0"
# remove tmpfile
rm -f "$subscription_header_tmpfile"
rm -f "$subscription_tmpfile"
fi
uci_commit "mihomo"
}

0 comments on commit ff8b12e

Please sign in to comment.