fix(updates): trigger immediate telegram push on component updates and fix cron cleanup regex
Backend CI / Backend Runtime Checks (push) Failing after 2m0s
Frontend CI / Frontend Quality Checks (push) Failing after 0s
Backend CI / OpenWrt Docker E2E (push) Skipped
Differential ShellCheck / Differential ShellCheck (push) Failing after 15s

This commit is contained in:
Dushnilin
2026-09-17 13:43:51 +03:00
parent 8d60bd36ef
commit 5bfe7103dc
7 changed files with 32 additions and 12 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-17 10:17+0300\n"
"PO-Revision-Date: 2026-09-17 10:17+0300\n"
"POT-Creation-Date: 2026-09-17 10:43+0300\n"
"PO-Revision-Date: 2026-09-17 10:43+0300\n"
"Last-Translator: Dushnilin <dushnilin@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
+2 -2
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-17 13:17+0300\n"
"PO-Revision-Date: 2026-09-17 13:17+0300\n"
"POT-Creation-Date: 2026-09-17 13:43+0300\n"
"PO-Revision-Date: 2026-09-17 13:43+0300\n"
"Last-Translator: Dushnilin\n"
"Language-Team: none\n"
"Language: ru\n"
+2 -2
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-17 13:17+0300\n"
"PO-Revision-Date: 2026-09-17 13:17+0300\n"
"POT-Creation-Date: 2026-09-17 13:43+0300\n"
"PO-Revision-Date: 2026-09-17 13:43+0300\n"
"Last-Translator: Dushnilin\n"
"Language-Team: none\n"
"Language: ru\n"
+2 -2
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: TACHYON\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-17 10:17+0300\n"
"PO-Revision-Date: 2026-09-17 10:17+0300\n"
"POT-Creation-Date: 2026-09-17 10:43+0300\n"
"PO-Revision-Date: 2026-09-17 10:43+0300\n"
"Last-Translator: Dushnilin <dushnilin@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
+4 -1
View File
@@ -822,7 +822,7 @@ function strip_unmarked_tachyon_cron_lines(data, bin, markers) {
return "";
let escaped_bin = replace(as_string(bin), /([^0-9A-Za-z_])/g, "\\$1");
let pattern = "^[^#\\n]*" + escaped_bin + "[ \\t]+(list_update|subscription_update|component_updates_if_due|component_auto_update_apply)([ \\t]|$)";
let pattern = regexp("^[^#\\n]*" + escaped_bin + "[ \\t]+(list_update(_if_due)?|subscription_update(_if_due)?|component_updates_if_due|component_auto_update_apply)([ \\t]|$)");
let lines = split(data, "\n");
let has_trailing_newline = substr(data, length(data) - 1) == "\n";
@@ -2173,6 +2173,9 @@ function component_updates_if_due() {
exit(1);
}
release_runtime_lock(COMPONENT_UPDATE_CHECK_LOCK_DIR);
// Prompt Telegram bot to deliver any update notifications immediately
system(common.background_command(BIN_PATH + " telegram notify-updates"));
}
function download_via_proxy_option_for_purpose(purpose) {
+19 -2
View File
@@ -14,6 +14,7 @@ const LIB_DIR = getenv("TACHYON_LIB") || "/usr/lib/tachyon";
const NFT_TABLE_NAME = getenv("NFT_TABLE_NAME") || "TachyonTable";
const PID_FILE = "/var/run/tachyon_telegram.pid";
const OFFSET_FILE = "/var/run/tachyon_telegram_offset";
const COMPONENT_UPDATE_CHECK_TIMESTAMP = "/var/run/tachyon/component-update-check.timestamp";
let as_string = common.as_string;
let option = common.option;
@@ -3435,6 +3436,7 @@ function worker() {
let last_report_day = -1;
let last_update_check = 0;
let last_update_check_mtime = 0;
let last_blocked_check = 0;
let consecutive_failures = 0;
let route_alert_sent = false;
@@ -3480,7 +3482,13 @@ function worker() {
send_daily_digest(cfg.bot_token, cfg.admin_ids);
}
if (now - last_update_check > 3600) {
let ts_stat = fs.stat(COMPONENT_UPDATE_CHECK_TIMESTAMP);
let ts_mtime = ts_stat ? int(ts_stat.mtime || 0) : 0;
if (ts_mtime > 0 && ts_mtime != last_update_check_mtime) {
last_update_check_mtime = ts_mtime;
check_notified_updates(cfg.bot_token, cfg.admin_ids);
last_update_check = now;
} else if (now - last_update_check > 3600) {
check_notified_updates(cfg.bot_token, cfg.admin_ids);
last_update_check = now;
}
@@ -3698,6 +3706,13 @@ function send_api(message) {
return 0;
}
function notify_updates_cli() {
let cfg = settings();
if (cfg.enabled != "1" || !cfg.bot_token || !cfg.admin_ids) return 0;
check_notified_updates(cfg.bot_token, cfg.admin_ids);
return 0;
}
let mode = (ARGV[0] == "") ? ARGV[1] : ARGV[0];
if (!mode) mode = "";
@@ -3711,6 +3726,8 @@ else if (mode == "status")
exit(get_status());
else if (mode == "diagnose")
exit(diagnose());
else if (mode == "notify-updates")
exit(notify_updates_cli());
else if (mode == "send") {
// Collect remaining args after "send" as the message text
let msg_parts = [];
@@ -3724,6 +3741,6 @@ else if (mode == "mask-token") {
exit(0);
}
else {
warn("Usage: service/telegram.uc <start-runtime|stop-runtime|worker|status|diagnose|send|mask-token ...> ...\n");
warn("Usage: service/telegram.uc <start-runtime|stop-runtime|worker|status|diagnose|notify-updates|send|mask-token ...> ...\n");
exit(1);
}
+1 -1
View File
@@ -40,7 +40,7 @@ grep -Fq 'function strip_unmarked_tachyon_cron_lines(' "$UPD" ||
grep -Fq 'strip_unmarked_tachyon_cron_lines(' "$UPD" || true
[ "$(grep -c 'strip_unmarked_tachyon_cron_lines(' "$UPD")" -ge 3 ] ||
fail "unmarked cron line stripping must be applied to remove and refresh paths"
grep -Fq '(list_update|subscription_update|component_updates_if_due|component_auto_update_apply)' "$UPD" ||
grep -Fq '(list_update(_if_due)?|subscription_update(_if_due)?|component_updates_if_due|component_auto_update_apply)' "$UPD" ||
fail "legacy cron pattern must cover all tachyon jobs"
# 4. Tunnel-style sections count as outbound configuration: a lone AWG/WARP