mirror of
https://github.com/kenzok8/small-package
synced 2025-01-05 11:36:47 +08:00
update 2024-12-11 14:17:01
This commit is contained in:
parent
297b694a79
commit
2312179e65
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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="<?php echo htmlspecialchars($current_subscription_url); ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="filename" class="form-label">输入保存文件名 (默认: config.yaml):</label>
|
||||
<label for="filename" class="form-label">自定义文件名 (默认: config.yaml):</label>
|
||||
<input type="text" class="form-control" id="filename" name="filename"
|
||||
value="<?php echo htmlspecialchars(isset($_POST['filename']) ? $_POST['filename'] : ''); ?>"
|
||||
placeholder="config.yaml">
|
||||
@ -505,7 +513,7 @@ $current_subscription_url = getSubscriptionUrlFromFile($subscription_file);
|
||||
<p>欢迎使用 Mihomo 订阅程序!请按照以下步骤进行操作:</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><strong>输入订阅链接:</strong> 在文本框中输入您的 Clash 订阅链接。</li>
|
||||
<li class="list-group-item"><strong>输入保存文件名:</strong> 指定保存配置文件的文件名,默认为 "config.yaml"。</li>
|
||||
<li class="list-group-item"><strong>输入保存文件名:</strong> 指定保存配置文件的文件名,默认为 "config.yaml",无需添加后缀。</li>
|
||||
<li class="list-group-item">点击 "更新订阅" 按钮,系统将下载订阅内容,并进行转换和保存。</li>
|
||||
<li class="list-group-item"><strong>只支持Clash格式的订阅。</li>
|
||||
</ul>
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user