From 104bf8f39072d0e1fe83b230c45390354803f784 Mon Sep 17 00:00:00 2001 From: kzolotarev95 Date: Sun, 28 Jun 2026 17:19:31 +0400 Subject: [PATCH] Bypass cache for web panel updates --- README.md | 8 ++++++++ files/www/cgi-bin/owrt-full-backup | 5 ++++- install.sh | 10 ++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a53c689..a4c5a6f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,14 @@ sh install.sh wget -O - https://raw.githubusercontent.com/kzolotarev95/luci-app-owrt-full-backup/main/install.sh | sh ``` +Если GitHub или браузер отдал старую версию, принудительно обнови с cache-bust: + +```sh +wget -O - "https://raw.githubusercontent.com/kzolotarev95/luci-app-owrt-full-backup/main/install.sh?v=$(date +%s)" | sh +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +/etc/init.d/uhttpd restart +``` + После установки скрипт покажет приватную ссылку: ```text diff --git a/files/www/cgi-bin/owrt-full-backup b/files/www/cgi-bin/owrt-full-backup index 065fbef..50e6ec1 100644 --- a/files/www/cgi-bin/owrt-full-backup +++ b/files/www/cgi-bin/owrt-full-backup @@ -96,7 +96,10 @@ authorized() { } http_html() { - printf 'Content-Type: text/html; charset=utf-8\r\n\r\n' + printf 'Content-Type: text/html; charset=utf-8\r\n' + printf 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0\r\n' + printf 'Pragma: no-cache\r\n' + printf 'Expires: 0\r\n\r\n' } http_unauthorized() { diff --git a/install.sh b/install.sh index a85fb47..b8d6454 100644 --- a/install.sh +++ b/install.sh @@ -33,7 +33,7 @@ fetch() { } install_file() { - local rel mode src dst + local rel mode src dst bust rel="$1" mode="$2" src="$SCRIPT_DIR/files/$rel" @@ -42,13 +42,14 @@ install_file() { if [ -f "$src" ]; then cp "$src" "$dst" else - fetch "$RAW_URL/files/$rel" "$dst" + bust="$(date +%s 2>/dev/null || echo $$)" + fetch "$RAW_URL/files/$rel?v=$bust" "$dst" fi chmod "$mode" "$dst" } install_config() { - local rel src dst + local rel src dst bust rel="etc/config/fullbackup" src="$SCRIPT_DIR/files/$rel" dst="$(target_path "$rel")" @@ -60,7 +61,8 @@ install_config() { if [ -f "$src" ]; then cp "$src" "$dst" else - fetch "$RAW_URL/files/$rel" "$dst" + bust="$(date +%s 2>/dev/null || echo $$)" + fetch "$RAW_URL/files/$rel?v=$bust" "$dst" fi chmod 0644 "$dst" }