mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 11:17:34 +08:00
update 2024-11-24 12:24:44
This commit is contained in:
parent
f98dc4762e
commit
424cecc154
@ -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';
|
||||
|
@ -127,7 +127,7 @@ $uiVersion = getUiVersion();
|
||||
</div>
|
||||
<div class="text-center mt-2">
|
||||
<button class="btn btn-pink" id="checkCliverButton">🔍 检测版本</button>
|
||||
<button class="btn btn-info" id="updateButton" title="更新到最新版本">🔄 更新版本</button>
|
||||
<button class="btn btn-info" id="updateButton" title="更新到最新版本" onclick="showUpdateVersionModal()">🔄 更新版本</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -174,6 +174,32 @@ $uiVersion = getUiVersion();
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal fade" id="updateVersionModal" tabindex="-1" aria-labelledby="updateVersionModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="updateVersionModalLabel">选择更新版本语言</h5>
|
||||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="languageSelect">选择语言</label>
|
||||
<select id="languageSelect" class="form-select">
|
||||
<option value="cn">中文版</option>
|
||||
<option value="en">英文版</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" onclick="confirmUpdateVersion()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="mihomoVersionSelectionModal" tabindex="-1" aria-labelledby="mihomoVersionSelectionModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
@ -310,8 +336,18 @@ $uiVersion = getUiVersion();
|
||||
|
||||
<script>
|
||||
let selectedSingboxVersion = 'v1.11.0-alpha.6';
|
||||
|
||||
let selectedMihomoVersion = 'stable';
|
||||
let selectedLanguage = 'cn';
|
||||
|
||||
function showUpdateVersionModal() {
|
||||
$('#updateVersionModal').modal('show');
|
||||
}
|
||||
|
||||
function confirmUpdateVersion() {
|
||||
selectedLanguage = document.getElementById('languageSelect').value;
|
||||
$('#updateVersionModal').modal('hide');
|
||||
selectOperation('client');
|
||||
}
|
||||
|
||||
function showSingboxVersionSelector() {
|
||||
$('#optionsModal').modal('hide');
|
||||
@ -374,6 +410,11 @@ function selectOperation(type) {
|
||||
: 'update_mihomo_preview.php',
|
||||
message: '开始下载 Mihomo 内核更新...',
|
||||
description: '正在更新 Mihomo 内核到最新版本 (' + selectedMihomoVersion + ')'
|
||||
},
|
||||
'client': {
|
||||
url: 'update_script.php?lang=' + selectedLanguage,
|
||||
message: '开始下载客户端更新...',
|
||||
description: '正在更新客户端到最新版本'
|
||||
}
|
||||
};
|
||||
|
||||
@ -419,10 +460,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
$('#optionsModal').modal('show');
|
||||
});
|
||||
|
||||
document.getElementById('updateButton').addEventListener('click', function() {
|
||||
initiateUpdate('update_script.php', '开始下载客户端更新...', '正在更新客户端到最新版本');
|
||||
});
|
||||
|
||||
document.getElementById('updateUiButton').addEventListener('click', function() {
|
||||
initiateUpdate('ui.php', '开始下载 UI 面板更新...', '正在更新 Metacubexd 面板到最新版本');
|
||||
});
|
||||
|
@ -23,20 +23,17 @@ if (empty($new_version)) {
|
||||
die("未找到最新版本或版本信息为空。");
|
||||
}
|
||||
|
||||
$installed_lang = isset($_GET['lang']) ? $_GET['lang'] : 'cn';
|
||||
|
||||
if ($installed_lang !== 'cn' && $installed_lang !== 'en') {
|
||||
die("无效的语言选择。请选择 'cn' 或 'en'。");
|
||||
}
|
||||
|
||||
if (isset($_GET['check_version'])) {
|
||||
echo "最新版本: V" . $new_version;
|
||||
exit;
|
||||
}
|
||||
|
||||
$installed_package_info = shell_exec("opkg status " . escapeshellarg($package_name));
|
||||
$installed_lang = 'cn';
|
||||
|
||||
if (strpos($installed_package_info, '-cn') !== false) {
|
||||
$installed_lang = 'cn';
|
||||
} elseif (strpos($installed_package_info, '-en') !== false) {
|
||||
$installed_lang = 'en';
|
||||
}
|
||||
|
||||
$download_url = "https://github.com/$repo_owner/$repo_name/releases/download/$new_version/{$package_name}_{$new_version}-{$installed_lang}_all.ipk";
|
||||
|
||||
echo "<pre>最新版本: $new_version</pre>";
|
||||
|
@ -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'
|
||||
@ -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'
|
||||
|
@ -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"
|
||||
@ -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
|
||||
@ -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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user