Add real Web Push notifications

This commit is contained in:
kzolotarev95 committed 2026-07-03 00:17:24 +04:00
1 parent c08feeda1e
commit d485446f52
4 files changed
+416 -18

No files matched your search

+19 -3
View File
@@ -2,7 +2,7 @@
set -u
APP_NAME="OpenWrt Remote Hub"
INSTALLER_VERSION="2026-07-02-login-clean-v8"
INSTALLER_VERSION="2026-07-03-web-push-v1"
RAW_BASE="${RAW_URL:-https://raw.githubusercontent.com/kzolotarev95/luci-app-owrt-remote/main}"
STATE_DIR="${OWRT_REMOTE_STATE_DIR:-/var/lib/owrt-remote}"
HUB_LOGIN="${HUB_LOGIN:-admin}"
@@ -79,7 +79,7 @@ detect_vps_host() {
install_packages() {
if command -v apt-get >/dev/null 2>&1; then
$SUDO apt-get update
$SUDO apt-get install -y curl wget unzip python3 openssh-client ca-certificates ufw
$SUDO apt-get install -y curl wget unzip python3 python3-venv openssh-client ca-certificates ufw
return
fi
die "поддерживается Ubuntu/Debian с apt-get"
@@ -99,9 +99,24 @@ install_files() {
cache_bust="$(date +%s)"
$SUDO mkdir -p /opt/owrt-remote "$STATE_DIR" /etc/xray
$SUDO wget -O /opt/owrt-remote/owrt-remote-hub.py "$RAW_BASE/vps/owrt-remote-hub.py?v=$cache_bust"
$SUDO wget -O /opt/owrt-remote/owrt-remote-run.sh "$RAW_BASE/vps/owrt-remote-run.sh?v=$cache_bust"
$SUDO wget -O /etc/systemd/system/owrt-remote.service "$RAW_BASE/vps/owrt-remote.service?v=$cache_bust"
$SUDO wget -O /opt/owrt-remote/enable-https.sh "$RAW_BASE/vps/enable-https.sh?v=$cache_bust"
$SUDO chmod +x /opt/owrt-remote/owrt-remote-hub.py /opt/owrt-remote/enable-https.sh
$SUDO chmod +x /opt/owrt-remote/owrt-remote-hub.py /opt/owrt-remote/owrt-remote-run.sh /opt/owrt-remote/enable-https.sh
}
install_python_deps() {
info "Ставлю Web Push для реальных push-уведомлений..."
if ! $SUDO python3 -m venv /opt/owrt-remote/venv; then
warn "Не смог создать Python venv. Hub запустится, но Web Push нужно доставить позже."
return 0
fi
if ! $SUDO /opt/owrt-remote/venv/bin/python -m pip install --upgrade pip wheel >/dev/null; then
warn "Не смог обновить pip в venv."
fi
if ! $SUDO /opt/owrt-remote/venv/bin/python -m pip install --upgrade pywebpush >/dev/null; then
warn "Не смог поставить pywebpush. Проверь internet/DNS на VPS."
fi
}
install_xray_service() {
@@ -242,6 +257,7 @@ main() {
info "IP/домен VPS: $host"
install_xray_binary
install_files
install_python_deps
install_xray_service
open_firewall
start_hub