From 2312179e656367fe7768545aa4dee58b52ddbf5e Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Wed, 11 Dec 2024 14:17:01 +0800 Subject: [PATCH] update 2024-12-11 14:17:01 --- ddnsto/Makefile | 1 + istoreenhance/Makefile | 1 + linkease/Makefile | 1 + luci-app-nekobox/htdocs/nekobox/mihomo.php | 22 +++++++++++++++------- quickstart/Makefile | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ddnsto/Makefile b/ddnsto/Makefile index 5836224a4..4548564a4 100644 --- a/ddnsto/Makefile +++ b/ddnsto/Makefile @@ -45,6 +45,7 @@ define Package/$(PKG_NAME)/postinst #!/bin/sh if [ -z "$${IPKG_INSTROOT}" ]; then [ -f /etc/uci-defaults/ddnsto ] && /etc/uci-defaults/ddnsto && rm -f /etc/uci-defaults/ddnsto + exit 0 fi endef diff --git a/istoreenhance/Makefile b/istoreenhance/Makefile index 4d81145f4..45a8d6704 100644 --- a/istoreenhance/Makefile +++ b/istoreenhance/Makefile @@ -43,6 +43,7 @@ define Package/$(PKG_NAME)/postinst #!/bin/sh if [ -z "$${IPKG_INSTROOT}" ]; then [ -f /etc/uci-defaults/istoreenhance ] && /etc/uci-defaults/istoreenhance && rm -f /etc/uci-defaults/istoreenhance + exit 0 fi endef diff --git a/linkease/Makefile b/linkease/Makefile index 523f754f8..09959b6c7 100644 --- a/linkease/Makefile +++ b/linkease/Makefile @@ -45,6 +45,7 @@ define Package/$(PKG_NAME)/postinst #!/bin/sh if [ -z "$${IPKG_INSTROOT}" ]; then [ -f /etc/uci-defaults/linkease ] && /etc/uci-defaults/linkease && rm -f /etc/uci-defaults/linkease + exit 0 fi endef diff --git a/luci-app-nekobox/htdocs/nekobox/mihomo.php b/luci-app-nekobox/htdocs/nekobox/mihomo.php index 5813cc4a3..153e50c90 100644 --- a/luci-app-nekobox/htdocs/nekobox/mihomo.php +++ b/luci-app-nekobox/htdocs/nekobox/mihomo.php @@ -4,7 +4,7 @@ include './cfg.php'; ini_set('memory_limit', '256M'); $subscription_file = '/etc/neko/subscription.txt'; $download_path = '/etc/neko/config/'; -$sh_script_path = '/etc/neko/update_config.sh'; +$sh_script_path = '/etc/neko/core/update_config.sh'; $log_file = '/var/log/neko_update.log'; function logMessage($message) { @@ -156,6 +156,10 @@ dns: function saveSubscriptionContentToYaml($url, $filename) { global $download_path; + if (pathinfo($filename, PATHINFO_EXTENSION) !== 'yaml') { + $filename .= '.yaml'; + } + if (strpbrk($filename, "!@#$%^&*()+=[]\\\';,/{}|\":<>?") !== false) { $message = "文件名包含非法字符,请使用字母、数字、点、下划线或横杠。"; logMessage($message); @@ -381,12 +385,16 @@ function setupCronJob($cron_time) { global $sh_script_path; $cron_entry = "$cron_time $sh_script_path\n"; - $current_cron = shell_exec('crontab -l 2>/dev/null'); - if (strpos($current_cron, $sh_script_path) !== false) { - $updated_cron = preg_replace('/.*' . preg_quote($sh_script_path, '/') . '/', $cron_entry, $current_cron); + $current_cron = shell_exec('crontab -l 2>/dev/null'); + + if (empty($current_cron)) { + $updated_cron = $cron_entry; } else { - $updated_cron = $current_cron . $cron_entry; + $updated_cron = preg_replace('/.*' . preg_quote($sh_script_path, '/') . '/', $cron_entry, $current_cron); + if ($updated_cron == $current_cron) { + $updated_cron .= $cron_entry; + } } $success = file_put_contents('/tmp/cron.txt', $updated_cron) !== false; @@ -478,7 +486,7 @@ $current_subscription_url = getSubscriptionUrlFromFile($subscription_file); value="" required>
- + @@ -505,7 +513,7 @@ $current_subscription_url = getSubscriptionUrlFromFile($subscription_file);

欢迎使用 Mihomo 订阅程序!请按照以下步骤进行操作:

diff --git a/quickstart/Makefile b/quickstart/Makefile index 59403132b..b98dfb1ce 100644 --- a/quickstart/Makefile +++ b/quickstart/Makefile @@ -47,6 +47,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then chmod 755 /etc/uci-defaults/09-quickstart /etc/uci-defaults/09-quickstart && rm -f /etc/uci-defaults/09-quickstart fi + exit 0 fi endef