Skip to content

Commit

Permalink
update 2024-12-05 00:27:49
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed Dec 4, 2024
1 parent f062e96 commit 6c0bf77
Show file tree
Hide file tree
Showing 57 changed files with 88 additions and 709 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var formData = {

return view.extend({
render: function() {
var m, s, o;
let m, s, o;

m = new form.JSONMap(formData, _('File Browser'), '');

Expand Down
22 changes: 18 additions & 4 deletions luci-app-nekobox/htdocs/nekobox/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ function getUiVersion() {
<select id="panelSelect" class="form-select">
<option value="zashboard">Zashboard 面板</option>
<option value="metacubexd">Metacubexd 面板</option>
<option value="yacd-meat">Yacd-Meat 面板</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -516,13 +517,25 @@ function selectOperation(type) {
'panel': {
url: selectedPanel === 'zashboard'
? 'update_zashboard.php'
: 'update_metacubexd.php',
: selectedPanel === 'yacd-meat'
? 'update_meta.php'
: selectedPanel === 'metacubexd'
? 'update_metacubexd.php'
: 'unknown_panel.php',
message: selectedPanel === 'zashboard'
? '开始下载 Zashboard 面板更新...'
: '开始下载 Metacubexd 面板更新...',
: selectedPanel === 'yacd-meat'
? '开始下载 Yacd-Meat 面板更新...'
: selectedPanel === 'metacubexd'
? '开始下载 Metacubexd 面板更新...'
: '未知面板更新类型...',
description: selectedPanel === 'zashboard'
? '正在更新 Zashboard 面板到最新版本'
: '正在更新 Metacubexd 面板到最新版本'
: selectedPanel === 'yacd-meat'
? '正在更新 Yacd-Meat 面板到最新版本'
: selectedPanel === 'metacubexd'
? '正在更新 Metacubexd 面板到最新版本'
: '无法识别的面板类型,无法更新。'
}
};
const operation = operations[type];
Expand Down Expand Up @@ -667,7 +680,8 @@ function checkVersion(outputId, updateFiles) {
document.getElementById('checkUiButton').addEventListener('click', function () {
const updateFiles = [
{ name: 'MetaCube', url: 'update_metacubexd.php' },
{ name: 'Zashboard', url: 'update_zashboard.php' }
{ name: 'Zashboard', url: 'update_zashboard.php' },
{ name: 'yacd-meat', url: 'update_meta.php' }
];
checkVersion('NewUi', updateFiles);
});
Expand Down
67 changes: 67 additions & 0 deletions luci-app-nekobox/htdocs/nekobox/update_meta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

ini_set('memory_limit', '128M');

$fixed_version = "0.3.8";

function getUiVersion() {
$versionFile = '/etc/neko/ui/meta/version.txt';

if (file_exists($versionFile)) {
return trim(file_get_contents($versionFile));
} else {
return $fixed_version;
}
}

function writeVersionToFile($version) {
$versionFile = '/etc/neko/ui/meta/version.txt';
file_put_contents($versionFile, $version);
}

$download_url = "https://github.com/Thaolga/neko/releases/download/$fixed_version/meta.tar";
$install_path = '/etc/neko/ui/meta';
$temp_file = '/tmp/meta-dist.tar';

if (!is_dir($install_path)) {
mkdir($install_path, 0755, true);
}

$current_version = $fixed_version;

if (isset($_GET['check_version'])) {
echo "当前版本: $current_version\n";
echo "最新版本: $fixed_version\n";
exit;
}

exec("wget -O '$temp_file' '$download_url'", $output, $return_var);
if ($return_var !== 0) {
die("下载失败!");
}

if (!file_exists($temp_file)) {
die("下载的文件不存在!");
}

echo "开始解压文件...\n";
exec("tar -xf '$temp_file' -C '$install_path'", $output, $return_var);
if ($return_var !== 0) {
echo "解压失败,错误信息: " . implode("\n", $output);
die("解压失败!");
}
echo "解压成功!\n";

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($fixed_version);
echo "更新完成!当前版本: $fixed_version\n";

unlink($temp_file);

?>
1 change: 0 additions & 1 deletion luci-app-nekobox/root/etc/neko/ui/meta/CNAME

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions luci-app-nekobox/root/etc/neko/ui/meta/_headers

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6c0bf77

Please sign in to comment.