diff --git a/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js b/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js
index 05ee8a795..abf24af68 100644
--- a/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js
+++ b/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js
@@ -10,14 +10,14 @@
var conf = 'dnsproxy';
var instance = 'dnsproxy';
-var callServiceList = rpc.declare({
+const callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
-var callHostHints = rpc.declare({
+const callHostHints = rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
@@ -60,7 +60,7 @@ return view.extend({
var isRunning = res[0],
hosts = res[1];
- var m, s, o, ss, so;
+ let m, s, o, ss, so;
m = new form.Map('dnsproxy', _('DNS Proxy'));
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/fchomo.js b/luci-app-fchomo/htdocs/luci-static/resources/fchomo.js
index 1425ab894..6c9f4f6ba 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/fchomo.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/fchomo.js
@@ -352,7 +352,7 @@ return baseclass.extend({
},
getFeatures: function() {
- var callGetFeatures = rpc.declare({
+ const callGetFeatures = rpc.declare({
object: 'luci.fchomo',
method: 'get_features',
expect: { '': {} }
@@ -363,7 +363,7 @@ return baseclass.extend({
getServiceStatus: function(instance) {
var conf = 'fchomo';
- var callServiceList = rpc.declare({
+ const callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
@@ -381,7 +381,7 @@ return baseclass.extend({
},
getClashAPI: function(instance) {
- var callGetClashAPI = rpc.declare({
+ const callGetClashAPI = rpc.declare({
object: 'luci.fchomo',
method: 'get_clash_api',
params: ['instance'],
@@ -798,7 +798,7 @@ return baseclass.extend({
},
lsDir: function(type) {
- var callLsDir = rpc.declare({
+ const callLsDir = rpc.declare({
object: 'luci.fchomo',
method: 'dir_ls',
params: ['type'],
@@ -814,7 +814,7 @@ return baseclass.extend({
},
readFile: function(type, filename) {
- var callReadFile = rpc.declare({
+ const callReadFile = rpc.declare({
object: 'luci.fchomo',
method: 'file_read',
params: ['type', 'filename'],
@@ -830,7 +830,7 @@ return baseclass.extend({
},
writeFile: function(type, filename, content) {
- var callWriteFile = rpc.declare({
+ const callWriteFile = rpc.declare({
object: 'luci.fchomo',
method: 'file_write',
params: ['type', 'filename', 'content'],
@@ -846,7 +846,7 @@ return baseclass.extend({
},
downloadFile: function(type, filename, url, header) {
- var callDownloadFile = rpc.declare({
+ const callDownloadFile = rpc.declare({
object: 'luci.fchomo',
method: 'file_download',
params: ['type', 'filename', 'url', 'header'],
@@ -862,7 +862,7 @@ return baseclass.extend({
},
removeFile: function(type, filename) {
- var callRemoveFile = rpc.declare({
+ const callRemoveFile = rpc.declare({
object: 'luci.fchomo',
method: 'file_remove',
params: ['type', 'filename'],
@@ -879,7 +879,7 @@ return baseclass.extend({
// thanks to homeproxy
uploadCertificate: function(type, filename, ev) {
- var callWriteCertificate = rpc.declare({
+ const callWriteCertificate = rpc.declare({
object: 'luci.fchomo',
method: 'certificate_write',
params: ['filename'],
@@ -898,7 +898,7 @@ return baseclass.extend({
.catch((e) => { ui.addNotification(null, E('p', e.message)) });
},
uploadInitialPack: function(ev, section_id) {
- var callWriteInitialPack = rpc.declare({
+ const callWriteInitialPack = rpc.declare({
object: 'luci.fchomo',
method: 'initialpack_write',
expect: { '': {} }
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js
index 521f44e8a..6d75341bc 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js
@@ -421,7 +421,7 @@ return view.extend({
render: function(data) {
var dashboard_repo = uci.get(data[0], 'api', 'dashboard_repo');
- var m, s, o, ss, so;
+ let m, s, o, ss, so;
m = new form.Map('fchomo', _('Mihomo client'));
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/global.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/global.js
index 800294364..832cab733 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/global.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/global.js
@@ -11,14 +11,14 @@
'require tools.firewall as fwtool';
'require tools.widgets as widgets';
-var callResVersion = rpc.declare({
+const callResVersion = rpc.declare({
object: 'luci.fchomo',
method: 'resources_get_version',
params: ['type', 'repo'],
expect: { '': {} }
});
-var callCrondSet = rpc.declare({
+const callCrondSet = rpc.declare({
object: 'luci.fchomo',
method: 'crond_set',
params: ['type', 'expr'],
@@ -26,7 +26,7 @@ var callCrondSet = rpc.declare({
});
function handleResUpdate(type, repo) {
- var callResUpdate = rpc.declare({
+ const callResUpdate = rpc.declare({
object: 'luci.fchomo',
method: 'resources_update',
params: ['type', 'repo'],
@@ -122,7 +122,7 @@ return view.extend({
var dashboard_repo = uci.get(data[0], 'api', 'dashboard_repo');
- var m, s, o, ss, so;
+ let m, s, o, ss, so;
m = new form.Map('fchomo', _('FullCombo Mihomo'),
'');
@@ -169,7 +169,7 @@ return view.extend({
so = ss.option(form.DummyValue, '_conn_check', _('Connection check'));
so.cfgvalue = function() {
- var callConnStat = rpc.declare({
+ const callConnStat = rpc.declare({
object: 'luci.fchomo',
method: 'connection_check',
params: ['url'],
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js
index c0d18bb90..fdfa43cd2 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js
@@ -26,7 +26,7 @@ var css = ' \
var hm_dir = '/var/run/fchomo';
function getRuntimeLog(name, filename) {
- var callLogClean = rpc.declare({
+ const callLogClean = rpc.declare({
object: 'luci.fchomo',
method: 'log_clean',
params: ['type'],
@@ -87,7 +87,7 @@ function getRuntimeLog(name, filename) {
return view.extend({
render: function(data) {
- var m, s, o;
+ let m, s, o;
m = new form.Map('fchomo');
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js
index 4d3dc24e6..4db4c5d4d 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js
@@ -15,7 +15,7 @@ return view.extend({
},
render: function(data) {
- var m, s, o, ss, so;
+ let m, s, o, ss, so;
m = new form.Map('fchomo', _('Edit node'));
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js
index 912169fb2..e50688153 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js
@@ -81,7 +81,7 @@ return view.extend({
},
render: function(data) {
- var m, s, o;
+ let m, s, o;
m = new form.Map('fchomo', _('Edit ruleset'));
diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js
index af539fab5..a15e49ebf 100644
--- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js
+++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js
@@ -53,7 +53,7 @@ return view.extend({
var dashboard_repo = uci.get(data[0], 'api', 'dashboard_repo'),
features = data[1];
- var m, s, o;
+ let m, s, o;
m = new form.Map('fchomo', _('Mihomo server'),
_('When used as a server, HomeProxy is a better choice.'));
diff --git a/luci-app-nekobox/htdocs/nekobox/box.php b/luci-app-nekobox/htdocs/nekobox/box.php
index e0b2bb305..a22ab2e5e 100644
--- a/luci-app-nekobox/htdocs/nekobox/box.php
+++ b/luci-app-nekobox/htdocs/nekobox/box.php
@@ -3,7 +3,7 @@ ob_start();
include './cfg.php';
date_default_timezone_set('Asia/Shanghai');
-$dataFilePath = '/tmp/subscription_data.txt';
+$dataFilePath = '/etc/neko/subscription_data.txt';
$lastSubscribeUrl = '';
if (file_exists($dataFilePath)) {
@@ -53,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['setCron'])) {
'',
- 'file_name' => "subscription_{$i}.yaml",
+ 'file_name' => "subscription_" . ($i + 1) . ".yaml",
];
}
}
@@ -184,13 +181,14 @@ if (!$subscriptions) {
if (isset($_POST['update'])) {
$index = intval($_POST['index']);
$url = $_POST['subscription_url'] ?? '';
- $customFileName = $_POST['custom_file_name'] ?? "subscription_{$index}.yaml";
+ $customFileName = $_POST['custom_file_name'] ?? "subscription_" . ($index + 1) . ".yaml";
$subscriptions[$index]['url'] = $url;
$subscriptions[$index]['file_name'] = $customFileName;
if (!empty($url)) {
$finalPath = $subscriptionPath . $customFileName;
+
$command = "wget -q --show-progress -O {$finalPath} {$url}";
exec($command . ' 2>&1', $output, $return_var);
@@ -209,16 +207,25 @@ if (isset($_POST['update'])) {
文件内容已更新:' . htmlspecialchars(basename($fileToSave)) . '
'; + $fileToSave = ($_POST['fileType'] === 'proxy') ? $uploadDir . basename($_POST['fileName']) : $configDir . basename($_POST['fileName']); + $contentToSave = $_POST['saveContent']; + file_put_contents($fileToSave, $contentToSave); + echo '文件内容已更新:' . htmlspecialchars(basename($fileToSave)) . '
'; + } } -} function formatFileModificationTime($filePath) { if (file_exists($filePath)) { @@ -108,7 +108,7 @@ function formatFileModificationTime($filePath) { } } -$proxyFiles = scandir($proxyDir); +$proxyFiles = scandir($uploadDir); $configFiles = scandir($configDir); if ($proxyFiles !== false) { @@ -134,7 +134,7 @@ function formatSize($size) { } if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['editFile'], $_GET['fileType'])) { - $filePath = ($_GET['fileType'] === 'proxy') ? $proxyDir . basename($_GET['editFile']) : $configDir . basename($_GET['editFile']); + $filePath = ($_GET['fileType'] === 'proxy') ? $uploadDir. basename($_GET['editFile']) : $configDir . basename($_GET['editFile']); if (file_exists($filePath)) { header('Content-Type: text/plain'); echo file_get_contents($filePath); @@ -146,89 +146,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['editFile'], $_GET['file } ?> - 0) { - ob_end_flush(); -} - -function outputMessage($message) { - if (!isset($_SESSION['notification_messages'])) { - $_SESSION['notification_messages'] = []; - } - $_SESSION['notification_messages'][] = $message; -} - -if (!isset($_SESSION['help_message'])) { - $_SESSION['help_message'] = '