Bypass cache for web panel updates
This commit is contained in:
1 parent
c61a6e5786
commit
104bf8f390
3 files changed
+18
-5
No files matched your search
@@ -28,6 +28,14 @@ sh install.sh
|
|||||||
wget -O - https://raw.githubusercontent.com/kzolotarev95/luci-app-owrt-full-backup/main/install.sh | 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
|
```text
|
||||||
|
|||||||
@@ -96,7 +96,10 @@ authorized() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http_html() {
|
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() {
|
http_unauthorized() {
|
||||||
|
|||||||
+6
-4
@@ -33,7 +33,7 @@ fetch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_file() {
|
install_file() {
|
||||||
local rel mode src dst
|
local rel mode src dst bust
|
||||||
rel="$1"
|
rel="$1"
|
||||||
mode="$2"
|
mode="$2"
|
||||||
src="$SCRIPT_DIR/files/$rel"
|
src="$SCRIPT_DIR/files/$rel"
|
||||||
@@ -42,13 +42,14 @@ install_file() {
|
|||||||
if [ -f "$src" ]; then
|
if [ -f "$src" ]; then
|
||||||
cp "$src" "$dst"
|
cp "$src" "$dst"
|
||||||
else
|
else
|
||||||
fetch "$RAW_URL/files/$rel" "$dst"
|
bust="$(date +%s 2>/dev/null || echo $$)"
|
||||||
|
fetch "$RAW_URL/files/$rel?v=$bust" "$dst"
|
||||||
fi
|
fi
|
||||||
chmod "$mode" "$dst"
|
chmod "$mode" "$dst"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_config() {
|
install_config() {
|
||||||
local rel src dst
|
local rel src dst bust
|
||||||
rel="etc/config/fullbackup"
|
rel="etc/config/fullbackup"
|
||||||
src="$SCRIPT_DIR/files/$rel"
|
src="$SCRIPT_DIR/files/$rel"
|
||||||
dst="$(target_path "$rel")"
|
dst="$(target_path "$rel")"
|
||||||
@@ -60,7 +61,8 @@ install_config() {
|
|||||||
if [ -f "$src" ]; then
|
if [ -f "$src" ]; then
|
||||||
cp "$src" "$dst"
|
cp "$src" "$dst"
|
||||||
else
|
else
|
||||||
fetch "$RAW_URL/files/$rel" "$dst"
|
bust="$(date +%s 2>/dev/null || echo $$)"
|
||||||
|
fetch "$RAW_URL/files/$rel?v=$bust" "$dst"
|
||||||
fi
|
fi
|
||||||
chmod 0644 "$dst"
|
chmod 0644 "$dst"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user