update 2024-12-24 14:16:36

This commit is contained in:
kenzok8 2024-12-24 14:16:36 +08:00
parent a77df09805
commit 52b12161e4
6 changed files with 185 additions and 213 deletions

View File

@ -24,7 +24,7 @@ return view.extend({
var log_textarea = E('div', { 'id': 'log_textarea' },
E('img', {
'src': L.resource(['icons/loading.gif']),
'src': L.resource('icons/loading.gif'),
'alt': _('Loading...'),
'style': 'vertical-align:middle'
}, _('Collecting data…'))

View File

@ -16,7 +16,7 @@ define Package/$(PKG_NAME)
SUBMENU:=3. Applications
TITLE:=LuCI support for mihomo & sing-box
PKGARCH:=all
DEPENDS:=+kmod-tun +bash +curl +jq +php8 +php8-cgi +php8-mod-curl +php8-mod-intl +zoneinfo-asia +coreutils-base64
DEPENDS:=+kmod-tun +bash +curl +jq +php8 +php8-cgi +php8-mod-curl +php8-mod-intl +zoneinfo-asia
endef
define Package/$(PKG_NAME)/description

View File

@ -55,7 +55,7 @@ include './cfg.php';
<a href="./singbox.php" class="col btn btn-lg"></i>📦 订阅</a>
<a href="./settings.php" class="col btn btn-lg">🛠️ 设定</a>
<form action="configs.php" method="post">
<div class="container text-center justify-content-md-center">
<div class="container text-center justify-content-md-center" style="padding-left: 4ch; padding-right: 4ch;">
<div class="row justify-content-md-center">
<div class="col mb-3 justify-content-md-center">
<h2 for="clashconfig" class="form-label p-4 m-2">选择 Mihomo 配置文件</h2>
@ -73,14 +73,8 @@ include './cfg.php';
</div>
</div>
</form>
<div class="container mt-4">
<?php if ($logMessage): ?>
<div class="alert alert-info" role="alert">
<?php echo htmlspecialchars($logMessage); ?>
</div>
<?php endif; ?>
</div>
<div class="container rounded-4 col-12 mb-4">
<div class="container rounded-4 col-12 mb-4" style="padding-left: 5ch; padding-right: 5ch;">
<ul class="nav d-flex justify-content-between w-100 text-center">
<li class="nav-item flex-grow-1">
<a class="btn btn-lg w-100 active" data-bs-toggle="tab" href="#info">配置</a>
@ -100,7 +94,7 @@ include './cfg.php';
</ul>
</div>
<div class="container rounded-4 col-12 mb-4">
<div class="container rounded-4 col-12 mb-4" style="padding-left: 5ch; padding-right: 5ch;">
<div class="tab-content">
<div id="info" class="tab-pane fade show active">
<h2 class="text-center p-2">配置资讯</h2>

View File

@ -428,78 +428,15 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
color: rgba(255, 255, 255, 0.9);
}
@media (max-width: 767px) {
.table th,
.table td {
padding: 6px 8px;
font-size: 14px;
}
.table th:nth-child(1), .table td:nth-child(1) {
width: 25%;
}
.table th:nth-child(2), .table td:nth-child(2) {
width: 20%;
}
.table th:nth-child(3), .table td:nth-child(3) {
width: 25%;
}
.table th:nth-child(4), .table td:nth-child(4) {
width: 100%;
}
.btn-group, .d-flex {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 5px;
html {
font-size: 16px;
}
.btn-group .btn {
flex: 1 1 auto;
font-size: 12px;
padding: 6px 8px;
.container {
padding-left: 2.4em;
padding-right: 2.4em;
}
.btn-group .btn:last-child {
margin-right: 0;
}
}
@media (max-width: 767px) {
.btn-rename {
width: 70px !important;
font-size: 0.6rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
text-align: center;
}
.btn-group {
display: flex;
gap: 10px;
justify-content: center;
}
.btn {
margin: 0;
}
td {
vertical-align: middle;
}
.action-btn {
padding: 6px 12px;
font-size: 0.85rem;
display: inline-block;
}
.btn-group.d-flex {
flex-wrap: wrap;
}
</style>
<script>
@ -578,41 +515,41 @@ function showUpdateAlert() {
<td class="align-middle">
<?php echo htmlspecialchars($fileType); ?>
</td>
<td>
<div class="d-flex justify-content-center">
<td class="align-middle">
<div class="action-buttons">
<?php if ($fileType == '代理文件'): ?>
<form action="" method="post" class="d-inline">
<form action="" method="post" class="d-inline mb-1">
<input type="hidden" name="deleteFile" value="<?php echo htmlspecialchars($file); ?>">
<button type="submit" class="btn btn-danger btn-sm mx-1" onclick="return confirm('确定要删除这个文件吗?');"><i>🗑️</i> 删除</button>
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除这个文件吗?');"><i>🗑️</i> 删除</button>
</form>
<form action="" method="post" class="d-inline">
<form action="" method="post" class="d-inline mb-1">
<input type="hidden" name="oldFileName" value="<?php echo htmlspecialchars($file); ?>">
<input type="hidden" name="fileType" value="proxy">
<button type="button" class="btn btn-success btn-sm mx-1 btn-rename" data-toggle="modal" data-target="#renameModal" data-filename="<?php echo htmlspecialchars($file); ?>" data-filetype="proxy"><i>✏️</i> 重命名</button>
<button type="button" class="btn btn-success btn-sm btn-rename" data-toggle="modal" data-target="#renameModal" data-filename="<?php echo htmlspecialchars($file); ?>" data-filetype="proxy"><i>✏️</i> 重命名</button>
</form>
<form action="" method="post" class="d-inline">
<button type="button" class="btn btn-warning btn-sm mx-1" onclick="openEditModal('<?php echo htmlspecialchars($file); ?>', 'proxy')"><i>📝</i> 编辑</button>
<form action="" method="post" class="d-inline mb-1">
<button type="button" class="btn btn-warning btn-sm" onclick="openEditModal('<?php echo htmlspecialchars($file); ?>', 'proxy')"><i>📝</i> 编辑</button>
</form>
<form action="" method="post" enctype="multipart/form-data" class="d-inline upload-btn">
<form action="" method="post" enctype="multipart/form-data" class="d-inline upload-btn mb-1">
<input type="file" name="fileInput" class="form-control-file" required id="fileInput-<?php echo htmlspecialchars($file); ?>" style="display: none;" onchange="this.form.submit()">
<button type="button" class="btn btn-info btn-sm mx-1" onclick="document.getElementById('fileInput-<?php echo htmlspecialchars($file); ?>').click();"><i>📤</i> 上传</button>
<button type="button" class="btn btn-info btn-sm" onclick="document.getElementById('fileInput-<?php echo htmlspecialchars($file); ?>').click();"><i>📤</i> 上传</button>
</form>
<?php else: ?>
<form action="" method="post" class="d-inline">
<form action="" method="post" class="d-inline mb-1">
<input type="hidden" name="deleteConfigFile" value="<?php echo htmlspecialchars($file); ?>">
<button type="submit" class="btn btn-danger btn-sm mx-1" onclick="return confirm('确定要删除这个文件吗?');"><i>🗑️</i> 删除</button>
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除这个文件吗?');"><i>🗑️</i> 删除</button>
</form>
<form action="" method="post" class="d-inline">
<form action="" method="post" class="d-inline mb-1">
<input type="hidden" name="oldFileName" value="<?php echo htmlspecialchars($file); ?>">
<input type="hidden" name="fileType" value="config">
<button type="button" class="btn btn-success btn-sm mx-1 btn-rename" data-toggle="modal" data-target="#renameModal" data-filename="<?php echo htmlspecialchars($file); ?>" data-filetype="config"><i>✏️</i> 重命名</button>
<button type="button" class="btn btn-success btn-sm btn-rename" data-toggle="modal" data-target="#renameModal" data-filename="<?php echo htmlspecialchars($file); ?>" data-filetype="config"><i>✏️</i> 重命名</button>
</form>
<form action="" method="post" class="d-inline">
<button type="button" class="btn btn-warning btn-sm mx-1" onclick="openEditModal('<?php echo htmlspecialchars($file); ?>', 'config')"><i>📝</i> 编辑</button>
<form action="" method="post" class="d-inline mb-1">
<button type="button" class="btn btn-warning btn-sm" onclick="openEditModal('<?php echo htmlspecialchars($file); ?>', 'config')"><i>📝</i> 编辑</button>
</form>
<form action="" method="post" enctype="multipart/form-data" class="d-inline upload-btn">
<form action="" method="post" enctype="multipart/form-data" class="d-inline upload-btn mb-1">
<input type="file" name="configFileInput" class="form-control-file" required id="fileInput-<?php echo htmlspecialchars($file); ?>" style="display: none;" onchange="this.form.submit()">
<button type="button" class="btn btn-info btn-sm mx-1" onclick="document.getElementById('fileInput-<?php echo htmlspecialchars($file); ?>').click();"><i>📤</i> 上传</button>
<button type="button" class="btn btn-info btn-sm" onclick="document.getElementById('fileInput-<?php echo htmlspecialchars($file); ?>').click();"><i>📤</i> 上传</button>
</form>
<?php endif; ?>
</div>
@ -990,38 +927,40 @@ function initializeAceEditor() {
<?php endif; ?>
<?php if (isset($subscriptions) && is_array($subscriptions)): ?>
<div class="row">
<?php
$maxSubscriptions = 6;
for ($i = 0; $i < $maxSubscriptions; $i++):
$displayIndex = $i + 1;
$url = $subscriptions[$i]['url'] ?? '';
$fileName = $subscriptions[$i]['file_name'] ?? "subscription_" . ($displayIndex) . ".yaml";
?>
<div class="col-md-4 mb-3 px-4">
<form method="post" class="card">
<div class="card-body">
<div class="form-group">
<h5 for="subscription_url_<?php echo $displayIndex; ?>" class="mb-2">订阅链接 <?php echo $displayIndex; ?></h5>
<input type="text" name="subscription_url" id="subscription_url_<?php echo $displayIndex; ?>" value="<?php echo htmlspecialchars($url); ?>" class="form-control" placeholder="请输入订阅链接">
<div class="container" style="padding-left: 2.4rem; padding-right: 2.4rem;">
<div class="row">
<?php
$maxSubscriptions = 6;
for ($i = 0; $i < $maxSubscriptions; $i++):
$displayIndex = $i + 1;
$url = $subscriptions[$i]['url'] ?? '';
$fileName = $subscriptions[$i]['file_name'] ?? "subscription_" . ($displayIndex) . ".yaml";
?>
<div class="col-md-4 mb-3">
<form method="post" class="card shadow-sm">
<div class="card-body">
<div class="form-group">
<h5 for="subscription_url_<?php echo $displayIndex; ?>" class="mb-2">订阅链接 <?php echo $displayIndex; ?></h5>
<input type="text" name="subscription_url" id="subscription_url_<?php echo $displayIndex; ?>" value="<?php echo htmlspecialchars($url); ?>" class="form-control" placeholder="请输入订阅链接">
</div>
<div class="form-group">
<label for="custom_file_name_<?php echo $displayIndex; ?>">自定义文件名</label>
<input type="text" name="custom_file_name" id="custom_file_name_<?php echo $displayIndex; ?>" value="<?php echo htmlspecialchars($fileName); ?>" class="form-control">
</div>
<input type="hidden" name="index" value="<?php echo $i; ?>">
<div class="text-center mt-3">
<button type="submit" name="update" class="btn btn-info btn-block">🔄 更新订阅 <?php echo $displayIndex; ?></button>
</div>
</div>
<div class="form-group">
<label for="custom_file_name_<?php echo $displayIndex; ?>">自定义文件名</label>
<input type="text" name="custom_file_name" id="custom_file_name_<?php echo $displayIndex; ?>" value="<?php echo htmlspecialchars($fileName); ?>" class="form-control">
</div>
<input type="hidden" name="index" value="<?php echo $i; ?>">
<div class="text-center mt-3">
<button type="submit" name="update" class="btn btn-info">🔄 更新订阅 <?php echo $displayIndex; ?></button>
</div>
</div>
</form>
</div>
</form>
</div>
<?php if (($displayIndex) % 3 == 0 && $displayIndex < $maxSubscriptions): ?>
</div><div class="row">
<?php endif; ?>
<?php if (($displayIndex) % 3 == 0 && $displayIndex < $maxSubscriptions): ?>
</div><div class="row">
<?php endif; ?>
<?php endfor; ?>
<?php endfor; ?>
</div>
</div>
<?php else: ?>
<p>未找到订阅信息。</p>

View File

@ -182,23 +182,23 @@ $razordVersion = getRazordVersion();
<a href="./configs.php" class="col btn btn-lg">⚙️ 配置</a>
<a href="./singbox.php" class="col btn btn-lg"></i>📦 订阅</a>
<a href="./settings.php" class="col btn btn-lg">🛠️ 设定</a>
<div class="container px-4">
<h2 class="text-center p-2 mb-3">主题设定</h2>
<form action="settings.php" method="post">
<div class="row justify-content-center">
<div class="col-12 col-md-6 mb-3">
<select class="form-select" name="themechange" aria-label="themex">
<option selected>Change Theme (<?php echo $neko_theme ?>)</option>
<?php foreach ($arrFiles as $file) echo "<option value=\"".$file.'">'.$file."</option>" ?>
</select>
</div>
<div class="col-12 col-md-6 mb-3">
<div class="text-center">
<input class="btn btn-info" type="submit" value="🖫 更改主题">
</div>
<div class="container px-4">
<h2 class="text-center p-2 mb-4">主题设定</h2>
<form action="settings.php" method="post">
<div class="row justify-content-center">
<div class="col-12 col-md-6 mb-3">
<select class="form-select" name="themechange" aria-label="themex">
<option selected>Change Theme (<?php echo $neko_theme ?>)</option>
<?php foreach ($arrFiles as $file) echo "<option value=\"".$file.'">'.$file."</option>" ?>
</select>
</div>
<div class="col-12 col-md-6 mb-3" style="padding-right: 1.3rem;" >
<div class="d-grid">
<input class="btn btn-info" type="submit" value="🖫 更改主题">
</div>
</div>
</form>
</div>
</form>
<table class="table table-borderless mb-3">
<tbody>
<tr>
@ -206,71 +206,109 @@ $razordVersion = getRazordVersion();
<h2 class="text-center mb-3">自动重载防火墙</h2>
<form action="settings.php" method="post">
<div class="btn-group d-flex justify-content-center">
<button type="submit" name="fw" value="enable" class="btn btn<?php if($fwstatus==1) echo "-outline" ?>-success <?php if($fwstatus==1) echo "disabled" ?>">启用</button>
<button type="submit" name="fw" value="enable" class="btn btn<?php if($fwstatus==1) echo "-outline" ?>-success <?php if($fwstatus==1) echo "disabled" ?>" style="margin-right: 20px;">启用</button>
<button type="submit" name="fw" value="disable" class="btn btn<?php if($fwstatus==0) echo "-outline" ?>-danger <?php if($fwstatus==0) echo "disabled" ?>">停用</button>
</div>
</form>
</td>
</tr>
<tr>
<tr>
<td>
<table class="table">
<thead>
<tr>
<th>客户端版本</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center" style="font-family: monospace;">
<span id="cliver"></span><span id="NewCliver"> </span>
</td>
</tr>
<tr>
<td class="text-center">
<button class="btn btn-pink" id="checkCliverButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateButton" title="更新到最新版本" onclick="showVersionTypeModal()">🔄 更新版本</button>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table class="table">
<thead>
<tr>
<th>UI 控制面板</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">
<?php echo htmlspecialchars($uiVersion); ?><span id="NewUi"> </span>
</td>
</tr>
<tr>
<td class="text-center">
<button class="btn btn-pink" id="checkUiButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateUiButton" title="更新面板" onclick="showPanelSelector()">🔄 更新版本</button>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table class="table">
<thead>
<tr>
<th>Sing-box 核心版本</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">
<div id="singBoxCorever">
<?php echo htmlspecialchars($singBoxVersion); ?><span id="NewSingbox"></span>
</div>
</form>
</td>
</tr>
<tr>
<td colspan="2">
<div class="row g-4">
<div class="col-md-6 mb-3">
<div class="text-center">
<h3>客户端版本</h3>
<div class="form-control text-center" style="font-family: monospace; text-align: center;">
<span id="cliver"></span><span id="NewCliver"> </span>
</div>
<div class="text-center mt-2">
<button class="btn btn-pink" id="checkCliverButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateButton" title="更新到最新版本" onclick="showVersionTypeModal()">🔄 更新版本</button>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="text-center">
<h3>Ui 控制面板</h3>
<div class="form-control text-center">
<?php echo htmlspecialchars($uiVersion); ?><span id="NewUi"> </span>
</div>
<div class="text-center mt-2">
<button class="btn btn-pink" id="checkUiButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateUiButton" title="更新面板" onclick="showPanelSelector()">🔄 更新版本</button>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="text-center">
<h3>Sing-box 核心版本</h3>
<div class="form-control text-center">
<div id="singBoxCorever">
<?php echo htmlspecialchars($singBoxVersion); ?><span id="NewSingbox"></span>
</div>
</div>
<div class="text-center mt-2">
<button class="btn btn-pink" id="checkSingboxButton">🔍 检测版本</button>
<button class="btn btn-info" id="singboxOptionsButton" title="Singbox 相关操作">🔄 更新版本</button>
</div>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="text-center">
<h3>Mihomo 核心版本</h3>
<div class="form-control text-center">
<span id="corever"></span><span id="NewMihomo"> </span>
</div>
<div class="text-center mt-2">
<button class="btn btn-pink" id="checkMihomoButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateCoreButton" title="更新 Mihomo 内核" onclick="showMihomoVersionSelector()">🔄 更新版本</button>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="text-center">
<button class="btn btn-pink" id="checkSingboxButton">🔍 检测版本</button>
<button class="btn btn-info" id="singboxOptionsButton" title="Singbox 相关操作">🔄 更新版本</button>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table class="table">
<thead>
<tr>
<th>Mihomo 核心版本</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">
<span id="corever"></span><span id="NewMihomo"> </span>
</td>
</tr>
<tr>
<td class="text-center">
<button class="btn btn-pink" id="checkMihomoButton">🔍 检测版本</button>
<button class="btn btn-info" id="updateCoreButton" title="更新 Mihomo 内核" onclick="showMihomoVersionSelector()">🔄 更新版本</button>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="modal fade" id="updateVersionTypeModal" tabindex="-1" aria-labelledby="updateVersionTypeModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
@ -370,14 +408,14 @@ $razordVersion = getRazordVersion();
</div>
<div class="modal-body">
<p class="text-warning">
<strong>说明:</strong> 请优先选择通道一版本进行更新,以确保兼容性。系统会先检测并动态生成最新版本号供选择下载。 如果通道一更新不可用,可以尝试通道二版本。
<strong>说明:</strong> 请优先选择通道一编译版本进行更新,以确保兼容性。系统会先检测并动态生成最新版本号供选择下载。 如果通道一更新不可用,可以尝试通道二版本。
</p>
<div class="d-grid gap-2">
<button class="btn btn-info" onclick="showSingboxVersionSelector()">更新 Singbox 内核(通道一)</button>
<button class="btn btn-success" onclick="showSingboxVersionSelectorForChannelTwo()">更新 Singbox 内核(通道二)</button>
<button class="btn btn-success" onclick="selectOperation('puernya')">切换 Puernya 内核</button>
<button class="btn btn-primary" onclick="selectOperation('rule')">更新 Singbox 规则集</button>
<button class="btn btn-primary" onclick="selectOperation('config')">更新 Mihomo 配置文件</button>
<button class="btn btn-primary" onclick="selectOperation('rule')">更新 P核 规则集</button>
<button class="btn btn-primary" onclick="selectOperation('config')">更新配置文件(备用)</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
@ -389,7 +427,7 @@ $razordVersion = getRazordVersion();
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="versionSelectionModalLabel">选择 Singbox 内核版本 通道一)</h5>
<h5 class="modal-title" id="versionSelectionModalLabel">选择 Singbox 内核版本 编译通道一)</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@ -422,7 +460,7 @@ $razordVersion = getRazordVersion();
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="singboxVersionModalLabel">选择 Singbox 核心版本(通道二)</h5>
<h5 class="modal-title" id="singboxVersionModalLabel">选择 Singbox 核心版本(官方通道二)</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@ -140,6 +140,7 @@ EOL;
.table-responsive {
width: 100%;
}
</style>
<div class="container-sm container-bg callout border border-3 rounded-4 col-11">
<div class="row">
@ -149,7 +150,7 @@ EOL;
<a href="./subscription.php" class="col btn btn-lg">🏦 模板 </a>
<a href="./mihomo.php" class="col btn btn-lg">🏣 模板 </a>
<div class="outer-container">
<div class="container">
<div class="container" style="padding-left: 2.4em; padding-right: 2.4em;">
<h1 class="title text-center" style="margin-top: 3rem; margin-bottom: 2rem;">Sing-box 订阅转换模板 </h1>
<div class="alert alert-info">
<h4 class="alert-heading">帮助信息</h4>
@ -163,7 +164,7 @@ EOL;
<li><strong>模板 4</strong>:香港 新加坡 日本 美国 分组 带分流规则。</li>
<li><strong>模板 5</strong>:新加坡 日本 美国 韩国 分组 带分流规则。</li>
<li><strong>模板 6</strong>:香港 台湾 新加坡 日本 美国 韩国 分组 带分流规则。</li>
<li><strong>模板 7</strong>:同上多规则</li>
<li><strong>模板 7</strong>:同上多规则</li>
</ul>
</div>
<form method="post" action="">
@ -217,7 +218,7 @@ EOL;
<input type="text" class="form-control" id="customTemplateUrl" name="customTemplateUrl" placeholder="输入自定义模板URL">
</div>
</fieldset>
<div class="row mb-4">
<div class="d-flex flex-wrap gap-2 mb-4">
<div class="col-auto">
<form method="post" action="">
<button type="submit" name="generateConfig" class="btn btn-info">