mirror of
https://github.com/kenzok8/small-package
synced 2025-01-05 11:36:47 +08:00
update 2024-12-04 09:43:01
This commit is contained in:
parent
00aaa20c7a
commit
9e98a67832
@ -19,7 +19,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
function removePath(filename, isdir) {
|
||||
var c = confirm('你确定要删除 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/delete',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/delete',
|
||||
{
|
||||
path: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
@ -44,7 +44,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
}
|
||||
var c = confirm('你确定要安装 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/install',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/install',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
@ -76,7 +76,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
newname = newname.trim();
|
||||
if (newname != filename) {
|
||||
var newpath = concatPath(currentPath, newname);
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/rename',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/rename',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newpath: newpath
|
||||
@ -94,7 +94,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
function chmodPath(filename, isdir) {
|
||||
var newmod = prompt('请输入新的权限位(支持八进制权限位或者a+x格式):', isdir === "1" ? "0755" : "0644");
|
||||
if (newmod) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/chmod',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chmod',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newmod: newmod
|
||||
@ -111,7 +111,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
function chownPath(filename) {
|
||||
var newown = prompt('请输入新的用户名(支持用户名或用户名:群组格式):', "root");
|
||||
if (newown) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/chown',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chown',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newown: newown
|
||||
@ -127,7 +127,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
|
||||
function openpath(filename, dirname) {
|
||||
dirname = dirname || currentPath;
|
||||
window.open('/cgi-bin/luci/admin/system/fileassistant/open?path='
|
||||
window.open('/cgi-bin/luci/admin/nas/fileassistant/open?path='
|
||||
+ encodeURIComponent(dirname) + '&filename='
|
||||
+ encodeURIComponent(filename));
|
||||
}
|
||||
@ -260,7 +260,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
opt = opt || {};
|
||||
path = concatPath(path, '');
|
||||
if (currentPath != path) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/list',
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/list',
|
||||
{path: path},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
@ -305,7 +305,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
formData.append('upload-dir', concatPath(currentPath, ''));
|
||||
formData.append('upload-file', uploadinput.files[0]);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/system/fileassistant/upload", true);
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/nas/fileassistant/upload", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
@ -327,7 +327,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
formData.append('path', currentPath);
|
||||
formData.append('dirname', dirname);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/system/fileassistant/mkdir", true);
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/nas/fileassistant/mkdir", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
|
@ -1,37 +1,38 @@
|
||||
module("luci.controller.fileassistant", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false
|
||||
|
||||
local page
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 50)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "mkdir"}, call("fileassistant_mkdir"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "mkdir"}, call("fileassistant_mkdir"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "chmod"}, call("fileassistant_chmod"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "chmod"}, call("fileassistant_chmod"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "chown"}, call("fileassistant_chown"), nil)
|
||||
page = entry({"admin", "nas", "fileassistant", "chown"}, call("fileassistant_chown"), nil)
|
||||
page.leaf = true
|
||||
end
|
||||
|
||||
|
@ -15,24 +15,7 @@ function writeVersionToFile($version) {
|
||||
|
||||
$repo_owner = "Thaolga";
|
||||
$repo_name = "luci-app-nekoclash";
|
||||
$api_url = "https://api.github.com/repos/$repo_owner/$repo_name/releases/latest";
|
||||
|
||||
$curl_command = "curl -s -H 'User-Agent: PHP' --connect-timeout 10 " . escapeshellarg($api_url);
|
||||
$response = shell_exec($curl_command);
|
||||
|
||||
if ($response === false || empty($response)) {
|
||||
logMessage("GitHub API 请求失败,可能是网络问题或 GitHub API 限制。");
|
||||
die("GitHub API 请求失败。请检查网络连接或稍后重试。");
|
||||
}
|
||||
|
||||
$data = json_decode($response, true);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
logMessage("解析 GitHub API 响应时出错: " . json_last_error_msg());
|
||||
die("解析 GitHub API 响应时出错: " . json_last_error_msg());
|
||||
}
|
||||
|
||||
$latest_version = $data['tag_name'] ?? '';
|
||||
$latest_version = "1.10.0-alpha.29-067c81a7";
|
||||
$current_version = '';
|
||||
$install_path = '/usr/bin/sing-box';
|
||||
$temp_file = '/tmp/sing-box.tar.gz';
|
||||
@ -42,6 +25,12 @@ if (file_exists($install_path)) {
|
||||
$current_version = trim(shell_exec("{$install_path} --version"));
|
||||
}
|
||||
|
||||
if (isset($_GET['check_version'])) {
|
||||
echo "当前版本: $current_version\n";
|
||||
echo "最新版本: $latest_version\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$current_arch = trim(shell_exec("uname -m"));
|
||||
$download_url = '';
|
||||
|
||||
@ -78,9 +67,8 @@ $extracted_file = glob("$temp_dir/CrashCore")[0] ?? '';
|
||||
if ($extracted_file && file_exists($extracted_file)) {
|
||||
exec("cp -f '$extracted_file' '$install_path'");
|
||||
exec("chmod 0755 '$install_path'");
|
||||
$latest_version = "1.10.0-alpha.29-067c81a7";
|
||||
writeVersionToFile($latest_version);
|
||||
echo "更新完成!当前版本: $latest_version";
|
||||
echo "更新完成!最新版本: $latest_version\n";
|
||||
} else {
|
||||
die("解压后的文件 'CrashCore' 不存在。");
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ $singBoxVersion = getSingboxVersion();
|
||||
<?php
|
||||
|
||||
function getUiVersion() {
|
||||
$versionFile = '/etc/neko/ui/metacubexd/version.txt';
|
||||
$versionFile = '/etc/neko/ui/zashboard/version.txt';
|
||||
|
||||
if (file_exists($versionFile)) {
|
||||
return trim(file_get_contents($versionFile));
|
||||
@ -80,7 +80,7 @@ $uiVersion = getUiVersion();
|
||||
<a href="./" class="col btn btn-lg">🏠 首页</a>
|
||||
<a href="./dashboard.php" class="col btn btn-lg">📊 面板</a>
|
||||
<a href="./configs.php" class="col btn btn-lg">⚙️ 配置</a>
|
||||
<a href="/nekobox/mon.php" class="col btn btn-lg d-flex align-items-center justify-content-center"></i>📦 订阅</a>
|
||||
<a href="/nekobox/mon.php" class="col btn btn-lg"></i>📦 订阅</a>
|
||||
<a href="#" class="col btn btn-lg">🛠️ 设定</a>
|
||||
<div class="container px-4">
|
||||
<h2 class="text-center p-2 mb-3">主题设定</h2>
|
||||
@ -309,8 +309,8 @@ $uiVersion = getUiVersion();
|
||||
<div class="form-group">
|
||||
<label for="panelSelect">选择一个面板</label>
|
||||
<select id="panelSelect" class="form-select">
|
||||
<option value="metacubexd">Metacubexd 面板</option>
|
||||
<option value="zashboard">Zashboard 面板</option>
|
||||
<option value="metacubexd">Metacubexd 面板</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -391,7 +391,7 @@ let selectedSingboxVersion = 'v1.11.0-alpha.6';
|
||||
let selectedMihomoVersion = 'stable';
|
||||
let selectedLanguage = 'cn';
|
||||
let selectedSingboxVersionForChannelTwo = 'preview';
|
||||
let selectedPanel = 'metacubexd';
|
||||
let selectedPanel = 'zashboard';
|
||||
|
||||
function showPanelSelector() {
|
||||
$('#panelSelectionModal').modal('show');
|
||||
@ -493,17 +493,16 @@ function selectOperation(type) {
|
||||
message: '开始下载客户端更新...',
|
||||
description: '正在更新客户端到最新版本'
|
||||
},
|
||||
|
||||
'panel': {
|
||||
url: selectedPanel === 'metacubexd'
|
||||
? 'update_metacubexd.php'
|
||||
: 'update_zashboard.php',
|
||||
message: selectedPanel === 'metacubexd'
|
||||
? '开始下载 Metacubexd 面板更新...'
|
||||
: '开始下载 Zashboard 面板更新...',
|
||||
description: selectedPanel === 'metacubexd'
|
||||
? '正在更新 Metacubexd 面板到最新版本'
|
||||
: '正在更新 Zashboard 面板到最新版本'
|
||||
url: selectedPanel === 'zashboard'
|
||||
? 'update_zashboard.php'
|
||||
: 'update_metacubexd.php',
|
||||
message: selectedPanel === 'zashboard'
|
||||
? '开始下载 Zashboard 面板更新...'
|
||||
: '开始下载 Metacubexd 面板更新...',
|
||||
description: selectedPanel === 'zashboard'
|
||||
? '正在更新 Zashboard 面板到最新版本'
|
||||
: '正在更新 Metacubexd 面板到最新版本'
|
||||
}
|
||||
};
|
||||
const operation = operations[type];
|
||||
@ -552,62 +551,104 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
showPanelSelector();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function checkVersion(buttonId, outputId, url) {
|
||||
function checkVersion(outputId, updateFiles, buttonId = null) {
|
||||
document.getElementById(outputId).innerHTML = '正在检查新版本...';
|
||||
let results = [];
|
||||
updateFiles.forEach(file => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', file.url + '?check_version=true', true);
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
let responseText = xhr.responseText.trim();
|
||||
const versionMatch = responseText.match(/最新版本:\s*([^\s]+)/);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url + '?check_version=true', true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200) {
|
||||
let responseText = xhr.responseText.trim();
|
||||
const versionMatch = responseText.match(/最新版本:\s*([^\s]+)/);
|
||||
if (versionMatch && versionMatch[1]) {
|
||||
const newVersion = versionMatch[1];
|
||||
results.push(`<tr><td>${file.name}</td><td>${newVersion}</td></tr>`);
|
||||
|
||||
if (versionMatch && versionMatch[1]) {
|
||||
const newVersion = versionMatch[1];
|
||||
document.getElementById(outputId).innerHTML = `最新版本: ${newVersion}`;
|
||||
if (file.url === 'update_singbox_preview.php') {
|
||||
const select = document.getElementById('singboxVersionSelect');
|
||||
let versionExists = Array.from(select.options).some(option => option.value === newVersion);
|
||||
|
||||
if (buttonId === 'checkSingboxButton') {
|
||||
const select = document.getElementById('singboxVersionSelect');
|
||||
let versionExists = Array.from(select.options).some(option => option.value === newVersion);
|
||||
|
||||
if (!versionExists) {
|
||||
const newOption = document.createElement('option');
|
||||
newOption.value = newVersion;
|
||||
newOption.textContent = newVersion;
|
||||
select.appendChild(newOption);
|
||||
if (!versionExists) {
|
||||
const newOption = document.createElement('option');
|
||||
newOption.value = newVersion;
|
||||
newOption.textContent = newVersion;
|
||||
select.appendChild(newOption);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
results.push(`<tr><td>${file.name}</td><td>无法解析版本信息</td></tr>`);
|
||||
}
|
||||
} else {
|
||||
document.getElementById(outputId).innerHTML = '无法解析版本信息,请稍后重试。';
|
||||
results.push(`<tr><td>${file.name}</td><td>版本检测失败</td></tr>`);
|
||||
}
|
||||
} else {
|
||||
document.getElementById(outputId).innerHTML = '版本检测失败,请稍后重试。';
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
document.getElementById(outputId).innerHTML = '网络错误,请稍后重试';
|
||||
};
|
||||
xhr.send();
|
||||
document.getElementById(outputId).innerHTML = `
|
||||
<table style="border-collapse: collapse; width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left; padding: 8px;">组件名称</th>
|
||||
<th style="text-align: left; padding: 8px;">最新版本</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${results.join('')}
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
results.push(`<tr><td>${file.name}</td><td>网络错误</td></tr>`);
|
||||
document.getElementById(outputId).innerHTML = `
|
||||
<table style="border-collapse: collapse; width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align: left; padding: 8px;">组件名称</th>
|
||||
<th style="text-align: left; padding: 8px;">最新版本</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${results.join('')}
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('checkSingboxButton').addEventListener('click', function() {
|
||||
checkVersion('checkSingboxButton', 'NewSingbox', 'update_singbox_preview.php');
|
||||
document.getElementById('checkSingboxButton').addEventListener('click', function () {
|
||||
const updateFiles = [
|
||||
{ name: 'Singbox 正式版', url: 'update_singbox_stable.php' },
|
||||
{ name: 'Singbox 预览版', url: 'update_singbox_preview.php' },
|
||||
{ name: 'Puernya 预览版', url: 'puernya.php' }
|
||||
];
|
||||
checkVersion('NewSingbox', updateFiles);
|
||||
});
|
||||
|
||||
document.getElementById('checkMihomoButton').addEventListener('click', function () {
|
||||
const updateFiles = [
|
||||
{ name: 'Mihomo 正式版', url: 'update_mihomo_stable.php' },
|
||||
{ name: 'Mihomo 预览版', url: 'update_mihomo_preview.php' }
|
||||
];
|
||||
checkVersion('NewMihomo', updateFiles);
|
||||
});
|
||||
|
||||
document.getElementById('checkUiButton').addEventListener('click', function () {
|
||||
const updateFiles = [
|
||||
{ name: 'MetaCube', url: 'update_metacubexd.php' },
|
||||
{ name: 'Zashboard', url: 'update_zashboard.php' }
|
||||
];
|
||||
checkVersion('NewUi', updateFiles);
|
||||
});
|
||||
|
||||
document.getElementById('checkCliverButton').addEventListener('click', function() {
|
||||
checkVersion('checkCliverButton', 'NewCliver', 'update_script.php');
|
||||
});
|
||||
|
||||
document.getElementById('checkMihomoButton').addEventListener('click', function() {
|
||||
checkVersion('checkMihomoButton', 'NewMihomo', 'update_mihomo_stable.php');
|
||||
});
|
||||
|
||||
document.getElementById('checkUiButton').addEventListener('click', function() {
|
||||
checkVersion('checkUiButton', 'NewUi', 'update_metacubexd.php');
|
||||
checkVersion('NewCliver', [
|
||||
{ name: 'Cliver', url: 'update_script.php' }
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -669,7 +710,6 @@ document.getElementById('checkUiButton').addEventListener('click', function() {
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NekoBox</title>
|
||||
<link rel="stylesheet" href="/www/nekobox/assets/css/bootstrap.min.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
@ -840,7 +880,5 @@ document.getElementById('checkUiButton').addEventListener('click', function() {
|
||||
<p><?php echo $footer ?></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="/www/nekobox/assets/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -62,11 +62,19 @@ if ($return_var !== 0) {
|
||||
|
||||
exec("tar -xzf '$temp_file' -C '$install_path'", $output, $return_var);
|
||||
if ($return_var !== 0) {
|
||||
echo "解压失败,错误信息: " . implode("\n", $output);
|
||||
die("解压失败!");
|
||||
}
|
||||
|
||||
exec("chown -R root:root '$install_path' 2>&1", $output, $return_var);
|
||||
if ($return_var !== 0) {
|
||||
echo "更改文件所有者失败,错误信息: " . implode("\n", $output);
|
||||
die();
|
||||
}
|
||||
|
||||
writeVersionToFile($latest_version);
|
||||
echo "更新完成!当前版本: $latest_version";
|
||||
|
||||
unlink($temp_file);
|
||||
|
||||
?>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
ini_set('memory_limit', '128M');
|
||||
ini_set('memory_limit', '128M');
|
||||
|
||||
function getUiVersion() {
|
||||
$versionFile = '/etc/neko/ui/zashboard/version.txt';
|
||||
|
||||
$versionFile = '/etc/neko/ui/zashboard/version.txt';
|
||||
|
||||
if (file_exists($versionFile)) {
|
||||
return trim(file_get_contents($versionFile));
|
||||
} else {
|
||||
@ -13,16 +13,14 @@ function getUiVersion() {
|
||||
}
|
||||
|
||||
function writeVersionToFile($version) {
|
||||
$versionFile = '/etc/neko/ui/zashboard/version.txt';
|
||||
$versionFile = '/etc/neko/ui/zashboard/version.txt';
|
||||
file_put_contents($versionFile, $version);
|
||||
}
|
||||
|
||||
$repo_owner = "Thaolga";
|
||||
$repo_name = "neko";
|
||||
$api_url = "https://api.github.com/repos/$repo_owner/$repo_name/releases/latest";
|
||||
|
||||
$curl_command = "curl -s -H 'User-Agent: PHP' --connect-timeout 10 " . escapeshellarg($api_url);
|
||||
$response = shell_exec($curl_command);
|
||||
$response = shell_exec("curl -s -H 'User-Agent: PHP' --connect-timeout 10 " . escapeshellarg($api_url));
|
||||
|
||||
if ($response === false || empty($response)) {
|
||||
die("GitHub API 请求失败。请检查网络连接或稍后重试。");
|
||||
@ -35,7 +33,21 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
}
|
||||
|
||||
$latest_version = $data['tag_name'] ?? '';
|
||||
$install_path = '/etc/neko/ui/zashboard';
|
||||
$assets = $data['assets'] ?? [];
|
||||
$download_url = '';
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
if (isset($asset['browser_download_url'])) {
|
||||
$download_url = $asset['browser_download_url'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($download_url)) {
|
||||
die("未找到下载链接,请检查发布版本的资源。");
|
||||
}
|
||||
|
||||
$install_path = '/etc/neko/ui/zashboard';
|
||||
$temp_file = '/tmp/compressed-dist.tgz';
|
||||
|
||||
if (!is_dir($install_path)) {
|
||||
@ -45,16 +57,11 @@ if (!is_dir($install_path)) {
|
||||
$current_version = getUiVersion();
|
||||
|
||||
if (isset($_GET['check_version'])) {
|
||||
echo "最新版本: $latest_version";
|
||||
echo "当前版本: $current_version\n";
|
||||
echo "最新版本: $latest_version\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$download_url = 'https://github.com/Thaolga/neko/releases/download/v1.10.0/artifact.tar';
|
||||
|
||||
if (empty($download_url)) {
|
||||
die("未找到下载链接,请检查发布版本的资源。");
|
||||
}
|
||||
|
||||
exec("wget -O '$temp_file' '$download_url'", $output, $return_var);
|
||||
if ($return_var !== 0) {
|
||||
die("下载失败!");
|
||||
@ -72,8 +79,16 @@ if ($return_var !== 0) {
|
||||
}
|
||||
echo "解压成功!\n";
|
||||
|
||||
writeVersionToFile($latest_version);
|
||||
echo "更新完成!当前版本: $latest_version";
|
||||
exec("chown -R root:root '$install_path' 2>&1", $output, $return_var);
|
||||
if ($return_var !== 0) {
|
||||
echo "更改文件拥有者失败,错误信息: " . implode("\n", $output) . "\n";
|
||||
die();
|
||||
}
|
||||
echo "文件拥有者已更改为 root。\n";
|
||||
|
||||
writeVersionToFile($latest_version);
|
||||
echo "更新完成!当前版本: $latest_version\n";
|
||||
|
||||
unlink($temp_file);
|
||||
|
||||
?>
|
||||
|
@ -269,7 +269,6 @@ while getopts ":skrpcvh" signal ; do
|
||||
;;
|
||||
v)
|
||||
neko_ver
|
||||
neko_checknewver
|
||||
echo "v.$neko_version"
|
||||
;;
|
||||
h)
|
||||
|
Loading…
Reference in New Issue
Block a user