diff --git a/files/www/cgi-bin/owrt-full-backup b/files/www/cgi-bin/owrt-full-backup index 50e6ec1..a85a965 100644 --- a/files/www/cgi-bin/owrt-full-backup +++ b/files/www/cgi-bin/owrt-full-backup @@ -145,6 +145,49 @@ download_file() { exit 0 } +handle_delete_backup() { + local file confirm + file="$(param file)" + confirm="$(param confirm)" + RESULT_TITLE="Удаление бэкапа" + RESULT_FILE="${TMPDIR:-/tmp}/owrt-full-backup-result.$$" + + if [ "$confirm" != "DELETE" ]; then + RESULT_CODE=2 + printf 'Для удаления введи DELETE.\n' >"$RESULT_FILE" + return + fi + + valid_abs_path "$file" || { + RESULT_CODE=2 + printf 'Неверный путь к файлу.\n' >"$RESULT_FILE" + return + } + + case "$file" in + *.tar.gz|*.tar.gz.sha256) ;; + *) + RESULT_CODE=2 + printf 'Удалять можно только архивы бэкапа и checksum-файлы.\n' >"$RESULT_FILE" + return + ;; + esac + + if [ ! -f "$file" ]; then + RESULT_CODE=2 + printf 'Файл не найден: %s\n' "$file" >"$RESULT_FILE" + return + fi + + if rm -f "$file" "$file.sha256" 2>"$RESULT_FILE"; then + RESULT_CODE=0 + printf 'Удалено: %s\n' "$file" >"$RESULT_FILE" + else + RESULT_CODE=1 + printf 'Не удалось удалить: %s\n' "$file" >>"$RESULT_FILE" + fi +} + run_backend() { RESULT_TITLE="$1" shift @@ -264,6 +307,7 @@ handle_action() { inspect) handle_inspect ;; restore) handle_restore ;; save_defaults) handle_save_defaults ;; + delete_backup) handle_delete_backup ;; esac } @@ -305,8 +349,8 @@ backup_rows() { base="$(basename "$file")" size="$(ls -lh "$file" 2>/dev/null | awk '{print $5}')" mtime="$(ls -l "$file" 2>/dev/null | awk '{print $6" "$7" "$8}')" - printf '%s%s%sскачать' \ - "$(h "$base")" "$(h "$size")" "$(h "$mtime")" "$(self_url)" "$key" "$(h "$file")" + printf '%s%s%sСкачать
' \ + "$(h "$base")" "$(h "$size")" "$(h "$mtime")" "$(self_url)" "$key" "$(h "$file")" "$(self_url)" "$key" "$(h "$file")" done } @@ -351,12 +395,15 @@ label { display: block; margin: 9px 0 4px; font-weight: 600; } input[type=text], input[type=number] { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text); padding: 9px; } .checks label { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 8px 0; } button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; padding: 8px 12px; text-decoration: none; font-weight: 700; cursor: pointer; } +.small { min-height: 30px; padding: 6px 9px; font-size: 12px; } .danger { background: var(--bad); } .muted { color: var(--muted); } code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; } pre { overflow: auto; background: rgba(127,127,127,.12); border-radius: 6px; padding: 10px; } table { width: 100%; border-collapse: collapse; } td, th { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; } +.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } +.actions form { margin: 0; } .status { display: flex; flex-wrap: wrap; gap: 8px; } .pill { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--muted); } @media (max-width: 820px) { .span4, .span6, .span8, .span12 { grid-column: 1 / -1; } main { padding: 12px; } .hero { align-items: flex-start; flex-direction: column; } .hero-actions { justify-content: flex-start; min-width: 0; } } @@ -370,7 +417,7 @@ td, th { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: lef

Веб-панель для полного бэкапа OpenWrt без сборки IPK. Держи эту ссылку в секрете.

-LuCI: Службы +Вернуться в OpenWrt Backup / Restore OpenWrt 22-25
@@ -462,17 +509,6 @@ $(backup_rows) -
-

Установка / удаление через Git

-

Установка через clone:

-
git clone $(h "$PROJECT_URL").git
-cd luci-app-owrt-full-backup
-sh install.sh
-

Установка одной командой:

-
wget -O - $(h "$RAW_URL")/install.sh | sh
-

Удаление:

-
wget -O - $(h "$RAW_URL")/uninstall.sh | sh
-