From 9e98a67832d7f0437fee55847c53f392a4406a8e Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Wed, 4 Dec 2024 09:43:01 +0800 Subject: [PATCH] update 2024-12-04 09:43:01 --- .../luci-static/resources/fileassistant/fb.js | 18 +-- .../luasrc/controller/fileassistant.lua | 19 +-- luci-app-nekobox/htdocs/nekobox/puernya.php | 28 +--- luci-app-nekobox/htdocs/nekobox/settings.php | 152 +++++++++++------- .../htdocs/nekobox/update_metacubexd.php | 8 + .../htdocs/nekobox/update_zashboard.php | 49 ++++-- luci-app-nekobox/root/etc/neko/core/neko | 1 - 7 files changed, 162 insertions(+), 113 deletions(-) diff --git a/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js b/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js index ac3b7cf12..616919d24 100644 --- a/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js +++ b/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js @@ -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); diff --git a/luci-app-fileassistant/luasrc/controller/fileassistant.lua b/luci-app-fileassistant/luasrc/controller/fileassistant.lua index bb86c8048..9364710c6 100644 --- a/luci-app-fileassistant/luasrc/controller/fileassistant.lua +++ b/luci-app-fileassistant/luasrc/controller/fileassistant.lua @@ -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 diff --git a/luci-app-nekobox/htdocs/nekobox/puernya.php b/luci-app-nekobox/htdocs/nekobox/puernya.php index 05aa71d01..d261463a6 100644 --- a/luci-app-nekobox/htdocs/nekobox/puernya.php +++ b/luci-app-nekobox/htdocs/nekobox/puernya.php @@ -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' 不存在。"); } diff --git a/luci-app-nekobox/htdocs/nekobox/settings.php b/luci-app-nekobox/htdocs/nekobox/settings.php index a1c303ad1..105277ecc 100644 --- a/luci-app-nekobox/htdocs/nekobox/settings.php +++ b/luci-app-nekobox/htdocs/nekobox/settings.php @@ -45,7 +45,7 @@ $singBoxVersion = getSingboxVersion(); 🏠 首页 📊 面板 ⚙️ 配置 - 📦 订阅 + 📦 订阅 🛠️ 设定

主题设定

@@ -309,8 +309,8 @@ $uiVersion = getUiVersion();
@@ -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(); }); }); - @@ -669,7 +710,6 @@ document.getElementById('checkUiButton').addEventListener('click', function() { NekoBox -