update 2024-10-27 12:23:17
This commit is contained in:
parent
a0db0b14dc
commit
6f18ad0c25
|
@ -78,6 +78,7 @@ $extracted_file = glob("$temp_dir/CrashCore")[0] ?? '';
|
||||||
if ($extracted_file && file_exists($extracted_file)) {
|
if ($extracted_file && file_exists($extracted_file)) {
|
||||||
exec("cp -f '$extracted_file' '$install_path'");
|
exec("cp -f '$extracted_file' '$install_path'");
|
||||||
exec("chmod 0755 '$install_path'");
|
exec("chmod 0755 '$install_path'");
|
||||||
|
$latest_version = "1.10.0-alpha.29-067c81a7";
|
||||||
writeVersionToFile($latest_version);
|
writeVersionToFile($latest_version);
|
||||||
echo "更新完成!当前版本: $latest_version";
|
echo "更新完成!当前版本: $latest_version";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -151,6 +151,7 @@ $uiVersion = getUiVersion();
|
||||||
<div class="text-center mt-2">
|
<div class="text-center mt-2">
|
||||||
<button class="btn btn-pink" id="checkSingboxButton">🔍 检测版本</button>
|
<button class="btn btn-pink" id="checkSingboxButton">🔍 检测版本</button>
|
||||||
<button class="btn btn-success" id="updatePuernyaButton" title="切换 Puernya 内核">🔄 切换内核</button>
|
<button class="btn btn-success" id="updatePuernyaButton" title="切换 Puernya 内核">🔄 切换内核</button>
|
||||||
|
<button class="btn btn-primary" id="updateRuleButton" title="更新 Singbox 规则集<配合 Puernya 内核可以使用 Singbox 的配置文件和本地规则集>">🔄 更新规则</button>
|
||||||
<button class="btn btn-info" id="updateSingboxButton" title="更新 Singbox 内核">🔄 更新版本</button>
|
<button class="btn btn-info" id="updateSingboxButton" title="更新 Singbox 内核">🔄 更新版本</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -174,11 +175,11 @@ $uiVersion = getUiVersion();
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
|
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="updateModalLabel">更新状态</h5>
|
<h5 class="modal-title" id="updateModalLabel">更新状态</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -245,6 +246,13 @@ $uiVersion = getUiVersion();
|
||||||
#updatePuernyaButton:hover {
|
#updatePuernyaButton:hover {
|
||||||
background-color: #87CEFA;
|
background-color: #87CEFA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#updateModal #logOutput {
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -302,6 +310,10 @@ $uiVersion = getUiVersion();
|
||||||
document.getElementById('updateConfigButton').addEventListener('click', function() {
|
document.getElementById('updateConfigButton').addEventListener('click', function() {
|
||||||
initiateUpdate('update_config.php', '开始下载 Mihomo 配置文件更新...');
|
initiateUpdate('update_config.php', '开始下载 Mihomo 配置文件更新...');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('updateRuleButton').addEventListener('click', function() {
|
||||||
|
initiateUpdate('update_rule.php', '开始下载 Singbox 规则集更新...');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -369,72 +369,6 @@ if (isset($_POST['update_index'])) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$url = "https://github.com/Thaolga/neko/releases/download/1.2.0/nekoclash.zip";
|
|
||||||
$zipFile = "/tmp/nekoclash.zip";
|
|
||||||
$extractPath = "/www/nekobox";
|
|
||||||
$logFile = "/tmp/update_log.txt";
|
|
||||||
|
|
||||||
function logMessage($message) {
|
|
||||||
global $logFile;
|
|
||||||
$timestamp = date("Y-m-d H:i:s");
|
|
||||||
file_put_contents($logFile, "[$timestamp] $message\n", FILE_APPEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadFile($url, $path) {
|
|
||||||
$fp = fopen($path, 'w+');
|
|
||||||
$ch = curl_init($url);
|
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
|
|
||||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
|
||||||
curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
fclose($fp);
|
|
||||||
logMessage("文件下载成功,保存到: $path");
|
|
||||||
}
|
|
||||||
|
|
||||||
function unzipFile($zipFile, $extractPath) {
|
|
||||||
$zip = new ZipArchive;
|
|
||||||
if ($zip->open($zipFile) === TRUE) {
|
|
||||||
if (!is_dir($extractPath)) {
|
|
||||||
mkdir($extractPath, 0755, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
|
||||||
$filename = $zip->getNameIndex($i);
|
|
||||||
$filePath = $extractPath . '/' . preg_replace('/^nekoclash\//', '', $filename);
|
|
||||||
|
|
||||||
if (substr($filename, -1) == '/') {
|
|
||||||
if (!is_dir($filePath)) {
|
|
||||||
mkdir($filePath, 0755, true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
copy("zip://".$zipFile."#".$filename, $filePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$zip->close();
|
|
||||||
logMessage("文件解压成功");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['update'])) {
|
|
||||||
downloadFile($url, $zipFile);
|
|
||||||
|
|
||||||
if (unzipFile($zipFile, $extractPath)) {
|
|
||||||
echo "规则集更新成功!";
|
|
||||||
logMessage("规则集更新成功");
|
|
||||||
} else {
|
|
||||||
echo "解压失败!";
|
|
||||||
logMessage("规则集更新失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-bs-theme="<?php echo substr($neko_theme, 0, -4) ?>">
|
<html lang="en" data-bs-theme="<?php echo substr($neko_theme, 0, -4) ?>">
|
||||||
<head>
|
<head>
|
||||||
|
@ -774,19 +708,6 @@ function showUpdateAlertSub(message) {
|
||||||
<h1 style="margin-top: 20px; margin-bottom: 20px;" title="只支持Sing-box格式的订阅">Sing-box 订阅</h1>
|
<h1 style="margin-top: 20px; margin-bottom: 20px;" title="只支持Sing-box格式的订阅">Sing-box 订阅</h1>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
button, .button {
|
|
||||||
background-color: #4CAF50;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover, .button:hover {
|
|
||||||
background-color: #45a049;
|
|
||||||
}
|
|
||||||
|
|
||||||
#updateAlert .close,
|
#updateAlert .close,
|
||||||
#updateAlertSub .close {
|
#updateAlertSub .close {
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -823,13 +744,6 @@ function showUpdateAlertSub(message) {
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form method="post" style="display: inline;">
|
|
||||||
<button type="submit" name="update" title="更新需要安装php8-mod-zip">🔄 更新规则集</button>
|
|
||||||
</form>
|
|
||||||
<a href="https://github.com/Thaolga/neko/releases/download/1.2.0/nekobox.zip" class="button" style="text-decoration: none; padding: 1.2px 12px; display: inline-block; color: white;" title="下载文件解压通过文件助手上传到/www/nekobox/对应目录,包含Sing-box和P核的所有规则">📥 下载规则集</a>
|
|
||||||
</body>
|
|
||||||
</br>
|
|
||||||
</br>
|
|
||||||
<?php if ($message): ?>
|
<?php if ($message): ?>
|
||||||
<p><?php echo nl2br(htmlspecialchars($message)); ?></p>
|
<p><?php echo nl2br(htmlspecialchars($message)); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
|
|
||||||
ini_set('memory_limit', '128M');
|
ini_set('memory_limit', '128M');
|
||||||
|
|
||||||
|
$logMessages = [];
|
||||||
|
|
||||||
function logMessage($message) {
|
function logMessage($message) {
|
||||||
$logFile = '/var/log/config_update.log';
|
global $logMessages;
|
||||||
$timestamp = date('Y-m-d H:i:s');
|
$timestamp = date('H:i:s');
|
||||||
file_put_contents($logFile, "[$timestamp] $message\n", FILE_APPEND);
|
$logMessages[] = "[$timestamp] $message";
|
||||||
}
|
}
|
||||||
|
|
||||||
$urls = [
|
$urls = [
|
||||||
"https://raw.githubusercontent.com/Thaolga/openwrt-nekobox/nekobox/luci-app-nekobox/root/etc/neko/config/mihomo.yaml" => "/etc/neko/config/mihomo.yaml",
|
"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Thaolga/openwrt-nekobox/nekobox/luci-app-nekobox/root/etc/neko/config/mihomo.yaml" => "/etc/neko/config/mihomo.yaml",
|
||||||
"https://raw.githubusercontent.com/Thaolga/openwrt-nekobox/nekobox/luci-app-nekobox/root/etc/neko/config/Puernya.json" => "/etc/neko/config/Puernya.json"
|
"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Thaolga/openwrt-nekobox/nekobox/luci-app-nekobox/root/etc/neko/config/Puernya.json" => "/etc/neko/config/Puernya.json"
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($urls as $download_url => $destination_path) {
|
foreach ($urls as $download_url => $destination_path) {
|
||||||
|
@ -27,6 +29,6 @@ foreach ($urls as $download_url => $destination_path) {
|
||||||
logMessage(basename($destination_path) . " 文件已成功更新!");
|
logMessage(basename($destination_path) . " 文件已成功更新!");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "文件已成功更新!";
|
echo implode("\n", $logMessages);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
ini_set('memory_limit', '128M');
|
||||||
|
|
||||||
|
$logMessages = [];
|
||||||
|
|
||||||
|
function logMessage($message) {
|
||||||
|
global $logMessages;
|
||||||
|
$timestamp = date('H:i:s');
|
||||||
|
$logMessages[] = "[$timestamp] $message";
|
||||||
|
}
|
||||||
|
|
||||||
|
$urls = [
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/ads.srs" => "/www/nekobox/rules/ads.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/ai.srs" => "/www/nekobox/rules/ai.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/apple-cn.srs" => "/www/nekobox/rules/apple-cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/applications.srs" => "/www/nekobox/rules/applications.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/cn.srs" => "/www/nekobox/rules/cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/disney.srs" => "/www/nekobox/rules/disney.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/fakeip-filter.srs" => "/www/nekobox/rules/fakeip-filter.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/games-cn.srs" => "/www/nekobox/rules/games-cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/microsoft-cn.srs" => "/www/nekobox/rules/microsoft-cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/netflix.srs" => "/www/nekobox/rules/netflix.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/networktest.srs" => "/www/nekobox/rules/networktest.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/private.srs" => "/www/nekobox/rules/private.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/privateip.srs" => "/www/nekobox/rules/privateip.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/proxy.srs" => "/www/nekobox/rules/proxy.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/telegramip.srs" => "/www/nekobox/rules/telegramip.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/tiktok.srs" => "/www/nekobox/rules/tiktok.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/youtube.srs" => "/www/nekobox/rules/youtube.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/geosite/tiktok.srs" => "/www/nekobox/rules/geosite/tiktok.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/rules/geosite/netflix.srs" => "/www/nekobox/rules/geosite/netflix.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-apple.srs" => "/www/nekobox/geoip-apple.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-cn.srs" => "/www/nekobox/geoip-cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-google.srs" => "/www/nekobox/geoip-google.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-netflix.srs" => "/www/nekobox/geoip-netflix.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-telegram.srs" => "/www/nekobox/geoip-telegram.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geoip-tiktok.srs" => "/www/nekobox/geoip-tiktok.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-apple.srs" => "/www/nekobox/geosite-apple.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-bilibili.srs" => "/www/nekobox/geosite-bilibili.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-cn.srs" => "/www/nekobox/geosite/geosite-cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-disney.srs" => "/www/nekobox/geosite-disney.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-geolocation-!cn.srs" => "/www/nekobox/geosite-geolocation-!cn.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-github.srs" => "/www/nekobox/geosite-github.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-google.srs" => "/www/nekobox/geosite-google.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-microsoft.srs" => "/www/nekobox/geosite-microsoft.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-netflix.srs" => "/www/nekobox/geosite-netflix.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-openai.srs" => "/www/nekobox/geosite-openai.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-telegram.srs" => "/www/nekobox/geosite-telegram.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-tiktok.srs" => "/www/nekobox/geosite-tiktok.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite-youtube.srs" => "/www/nekobox/geosite-youtube.srs",
|
||||||
|
"https://raw.githubusercontent.com/Thaolga/neko/main/nekobox/geosite.db" => "/www/nekobox/geosite.db"
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($urls as $download_url => $destination_path) {
|
||||||
|
if (!is_dir(dirname($destination_path))) {
|
||||||
|
mkdir(dirname($destination_path), 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
exec("wget -O '$destination_path' '$download_url'", $output, $return_var);
|
||||||
|
if ($return_var !== 0) {
|
||||||
|
logMessage("下载失败:$destination_path");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
logMessage(basename($destination_path) . " 文件已成功更新!");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo implode("\n", $logMessages);
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue