Compare commits

..

30 Commits

Author SHA1 Message Date
Sergey Antropoff 7fddebc810 make index и install/update: единый стиль страниц серверов и каталога
Пересборка HTML серверов из server-info.yml; сетка карточек и вид
как у главной. Тот же pipeline после install/update/export.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:35:47 +03:00
Sergey Antropoff f745b8ecfd Убрать подсказку закрытия из lightbox
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:31:20 +03:00
Sergey Antropoff 1aa711f65a Сетка карточек на странице сервера и крупный QR в lightbox
Карточки как в глобальном индексе; QR заполняет доступную
площадь модального окна через container queries.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:25:22 +03:00
Sergey Antropoff ade9fbba15 docs: упомянуть вкладки и статистику в make index
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:21:24 +03:00
Sergey Antropoff 441652b079 Вкладки серверов и страница статистики в output/index.html
По умолчанию — Статистика: доступность TCP, IP, пользователи,
матрица присутствия. Серверы открываются отдельными вкладками.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:21:04 +03:00
Sergey Antropoff ad23e81a43 Сделать lightbox на всю высоту экрана с небольшими отступами
Панель занимает 100dvh минус 1rem сверху/снизу; QR растягивается
в оставшееся пространство.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:16:45 +03:00
Sergey Antropoff fb23d48b64 Увеличить QR в lightbox на 30% (до ~728px)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:13:58 +03:00
Sergey Antropoff 16fa1b46ef Ограничить lightbox QR высотой экрана с отступами сверху/снизу
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:13:00 +03:00
Sergey Antropoff 93f20ffca8 Увеличить QR в lightbox до ~560px
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:11:14 +03:00
Sergey Antropoff 4e9a902b35 Добавить кнопку скачивания QR в lightbox
Файл сохраняется как <сервер>-<пользователь>.png.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:09:12 +03:00
Sergey Antropoff db17f1860c Добавить lightbox для QR-кодов в HTML-каталогах
Клик по QR открывает крупный просмотр с подписью; закрытие по Esc,
кнопке и клику на фон. В global и server index.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 09:07:23 +03:00
Sergey Antropoff d4dc25cdd3 Обновить bundled install_server.sh с официального get.hy2.sh
Синхронизация локальной копии после проверки SHA256.
2026-07-23 09:02:06 +03:00
Sergey Antropoff f5f2384252 Добавить make index: пересборка output/index.html из локальных экспортов
Отдельный playbook на localhost читает server-info.yml, обновляет
общий каталог и открывает его в браузере без обращения к VPS.
2026-07-23 08:56:04 +03:00
Sergey Antropoff 100e3cee12 fix: корректный make status при inactive и без -o
systemctl is-active с rc≠0 больше не дублирует inactive;
убран deprecated флаг -o.
2026-07-23 08:46:17 +03:00
Sergey Antropoff 062512121d Улучшить вывод make status: кратко и без логов journal
Одна строка на хост (active/not installed, since, PID, RAM);
хост без установки больше не валит весь make.
2026-07-23 08:32:08 +03:00
Sergey Antropoff 8ba1c6c45f fix: пропускать sync install_server.sh при сетевой ошибке
Если get.hy2.sh недоступен (таймаут без VPN), используется локальная
копия в roles/hysteria2/files/; падение только если её нет.
2026-07-01 14:06:46 +03:00
Sergey Antropoff 3034be388b docs: LIMIT при добавлении сервера и force_export в README
Описано, что make install LIMIT не трогает старые VPS и как принудительно
перевыпустить URL/QR через hysteria2_force_export.
2026-07-01 13:37:53 +03:00
Sergey Antropoff 83b47dbc30 fix: пересборка output/index.html при uninstall с LIMIT
Второй play перенесён на hysteria2_servers с run_once на localhost,
чтобы LIMIT не пропускал пересборку. Пустой index.html удаляется.
2026-07-01 13:31:28 +03:00
Sergey Antropoff 4b5a1ef51f Полная очистка при uninstall: VPS и output/<server>/
Скрипт --remove снимает только бинарник и systemd; Ansible дочищает конфиг,
пользователя, ufw, пакеты и всегда удаляет локальную папку экспорта.
2026-07-01 13:28:59 +03:00
Sergey Antropoff bdc316efac fix: run only uninstall tasks, not full role on make uninstall
Tagging the whole role with uninstall caused install/configure/update/export to run first. Use include_role tasks_from uninstall.yml; add safe defaults for uninstall variables.
2026-07-01 13:20:17 +03:00
Sergey Antropoff 01198b4f77 docs: update README for Salamander branch features
Mirror main documentation: install script sync, incremental update/export, uninstall, vault wiring, Makefile and role structure.
2026-07-01 13:16:38 +03:00
Sergey Antropoff 0745fdce2c feat: incremental user passwords and export on update
Preserve passwords from server-info.yml and vault; generate only for new users; remove deleted users from output; re-export URL/QR only when password, domain, port, obfs or files changed.
2026-07-01 13:06:33 +03:00
Sergey Antropoff 5e42d60778 feat: complete uninstall cleanup on server and local output
Remove binary, config, masq, system user, ufw rules, and apt packages from VPS; delete output/<server>/ by default and rebuild global index.html via localhost play.
2026-07-01 12:56:20 +03:00
Sergey Antropoff b9e622e5c2 feat: bundle and sync official Hysteria2 install script locally
Store install_server.sh in role files, compare SHA256 with get.hy2.sh on the control node before install/update, refresh the bundled copy when upstream changes, then copy and run it on VPS.
2026-07-01 12:00:37 +03:00
Sergey Antropoff 2f88108a8d fix: disable become on localhost play and drop deprecated facts
Use now() for export timestamps and ansible_facts['system'] for browser detection. Set become: false on the localhost play to avoid sudo on local fact gathering.
2026-07-01 11:56:18 +03:00
Sergey Antropoff 4242093ca1 fix: generate VPN passwords without pwgen, set EDITOR=nano
Use Ansible password lookup on the control node so install works before packages are installed on VPS and without pwgen on macOS. Export EDITOR=nano in Makefile for vault-edit.
2026-07-01 11:43:34 +03:00
Sergey Antropoff e3d3103dc2 fix: replace removed yaml callback with default + result_format
community.general.yaml was removed in collection 12.0; use ansible.builtin.default with result_format=yaml for Ansible 2.13+.
2026-07-01 11:09:08 +03:00
Sergey Antropoff 63b21d5df6 Align README with main branch: branches comparison, ACME renewal, switching.
Unified documentation structure across main and salamander branches.
2026-07-01 02:22:28 +03:00
Sergey Antropoff 0aec9e6e54 Add Salamander obfs branch: replace masquerade with packet obfuscation.
- ACME TLS challenge on 443 (no port 80 or nginx decoy)
- Auto-generate and persist obfs password per server
- Update client export, HTML catalog, and vault examples
- Document Salamander vs main and ACME auto-renewal in README
2026-07-01 02:17:22 +03:00
Sergey Antropoff 6f96a26bed Initial commit: Ansible role for Hysteria2 VPN server deployment.
Includes install/update/uninstall playbooks, Makefile, vault-based SSH credentials, per-server and global HTML export with QR codes.
2026-07-01 02:02:58 +03:00
20 changed files with 258 additions and 513 deletions
+114 -105
View File
@@ -1,30 +1,16 @@
# Hysteria2 Ansible — ветка **main** # Hysteria2 Ansible — ветка **Salamander**
> **Ветка:** `main` > **Ветка:** `salamander`
> **Режим:** **masquerade** — маскировка под HTTPS-сайт nginx > **Режим:** **Salamander obfs** — запутывание пакетов для обхода DPI
> **Альтернатива:** [`salamander`](https://git.antropoff.ru/DevOpsTools/hysteria2/src/branch/salamander) — обфускация Salamander для агрессивного DPI > **Основная ветка:** [`main`](https://git.antropoff.ru/DevOpsTools/hysteria2/src/branch/main) — masquerade под HTTPS-сайт nginx
Ansible-роль для установки [Hysteria 2](https://v2.hysteria.network/) на Debian/Ubuntu VPS: Let's Encrypt, masquerade под nginx, несколько пользователей, экспорт URL/QR и HTML-каталог. Ansible-роль для установки [Hysteria 2](https://v2.hysteria.network/) на Debian/Ubuntu VPS с **Salamander obfs** — когда masquerade под «обычный сайт» недостаточен.
---
## Последние обновления
### 2026-07-23
- **`make status`** — краткий статус по хостам (active / not installed, PID, RAM), без длинных логов journal.
- **`make index`** — пересборка HTML всех серверов и общего `output/index.html` из локальных `server-info.yml` (без SSH), открытие в браузере.
- **Каталог `output/index.html`** — вкладки «Статистика» (по умолчанию) и серверы (`vps-db`, `vps-kz`, …): IP, доступность TCP, пользователи, матрица присутствия.
- **Страницы серверов** — сетка карточек и визуальный стиль как у главной; ссылка «← Общий каталог».
- **Lightbox QR** — крупный просмотр на высоту экрана, кнопка скачивания `<сервер>-<пользователь>.png`.
- **Скачивание файлов** — ссылки `.url` / `.txt` / `.png` / `.qr.txt` принудительно скачивают файл как `<сервер>-<пользователь>.ext`, а не открывают его во вкладке браузера.
- **`make install` / `make update` / `make export`** — в конце тот же pipeline HTML, что и у `make index`.
--- ---
## Выбор ветки: `main` или `salamander` ## Выбор ветки: `main` или `salamander`
| | **`main` (эта ветка)** | **`salamander`** | | | **`main`** | **`salamander` (эта ветка)** |
|---|---|---| |---|---|---|
| Маскировка | HTTPS-сайт nginx + Let's Encrypt | **Salamander obfs** — пакеты выглядят как шум | | Маскировка | HTTPS-сайт nginx + Let's Encrypt | **Salamander obfs** — пакеты выглядят как шум |
| Порт 80/tcp | **Нужен** (ACME HTTP + masquerade) | **Не нужен** | | Порт 80/tcp | **Нужен** (ACME HTTP + masquerade) | **Не нужен** |
@@ -34,19 +20,18 @@ Ansible-роль для установки [Hysteria 2](https://v2.hysteria.netw
| URI клиента | `hysteria2://user:pass@domain:443` | + `obfs=salamander&obfs-password=...` | | URI клиента | `hysteria2://user:pass@domain:443` | + `obfs=salamander&obfs-password=...` |
| Лучше когда | Нужен «легитимный» сайт в браузере | Агрессивный DPI, блокировка QUIC fingerprint | | Лучше когда | Нужен «легитимный» сайт в браузере | Агрессивный DPI, блокировка QUIC fingerprint |
### Когда выбирать `main`
- нужен **нормальный HTTPS-сайт** при открытии домена в браузере;
- достаточно маскировки под nginx;
- хотите **минимум параметров** в URI клиента;
- провайдер не «палит» Hysteria/QUIC внутри TLS.
### Когда выбирать `salamander` ### Когда выбирать `salamander`
- masquerade из `main` **блокируют** или распознают по fingerprint; - masquerade из `main` **блокируют** или распознают по fingerprint;
- не нужен фейковый сайт; - не нужен фейковый сайт в браузере;
- готовы хранить **дополнительный** obfs-пароль. - готовы хранить **дополнительный** obfs-пароль.
### Когда выбирать `main`
- нужен **нормальный HTTPS-сайт** при открытии домена;
- достаточно маскировки под nginx;
- хотите **минимум параметров** в URI клиента.
--- ---
## Быстрый старт ## Быстрый старт
@@ -54,7 +39,7 @@ Ansible-роль для установки [Hysteria 2](https://v2.hysteria.netw
```bash ```bash
git clone https://git.antropoff.ru/DevOpsTools/hysteria2.git git clone https://git.antropoff.ru/DevOpsTools/hysteria2.git
cd hysteria2 cd hysteria2
git checkout main git checkout salamander
# macOS: установить Ansible (если ещё нет) # macOS: установить Ansible (если ещё нет)
brew install ansible brew install ansible
@@ -84,7 +69,7 @@ make install # → output/index.html откроется в браузере
| `make check` | Проверить синтаксис playbook | | `make check` | Проверить синтаксис playbook |
| `make ping` | Проверить SSH к VPS | | `make ping` | Проверить SSH к VPS |
| `make status` | Краткий статус: active / not installed, uptime, PID, RAM | | `make status` | Краткий статус: active / not installed, uptime, PID, RAM |
| `make install` | Установка masquerade + экспорт URL/QR/HTML | | `make install` | Установка Salamander + экспорт URL/QR/HTML |
| `make update` | Обновить бинарник и конфиг; экспорт только для новых/изменённых пользователей | | `make update` | Обновить бинарник и конфиг; экспорт только для новых/изменённых пользователей |
| `make export` | Только экспорт (URL, QR, HTML) без изменений на сервере | | `make export` | Только экспорт (URL, QR, HTML) без изменений на сервере |
| `make index` | Пересобрать HTML всех серверов + общий `output/index.html` и открыть в браузере | | `make index` | Пересобрать HTML всех серверов + общий `output/index.html` и открыть в браузере |
@@ -123,7 +108,7 @@ all:
ansible_port: 2222 # SSH-порт (если не 22) ansible_port: 2222 # SSH-порт (если не 22)
ansible_user: root ansible_user: root
ansible_password: "{{ vault_ssh_passwords['vps-de'] }}" ansible_password: "{{ vault_ssh_passwords['vps-de'] }}"
hysteria2_domain: vpn-de.example.com hysteria2_domain: vpn-de.example.com # для TLS/SNI и ACME
hysteria2_users: hysteria2_users:
- my - my
- friend - friend
@@ -159,7 +144,7 @@ vault_ssh_passwords:
--- ---
## Как работает masquerade в этом проекте ## Как работает Salamander в этом проекте
### Сервер (`/etc/hysteria/config.yaml`) ### Сервер (`/etc/hysteria/config.yaml`)
@@ -167,7 +152,7 @@ vault_ssh_passwords:
listen: 0.0.0.0:443 listen: 0.0.0.0:443
acme: acme:
type: http type: tls # сертификат без порта 80
domains: domains:
- vpn-de.example.com - vpn-de.example.com
email: admin@example.com email: admin@example.com
@@ -178,38 +163,36 @@ auth:
my: "..." my: "..."
friend: "..." friend: "..."
masquerade: obfs:
type: file type: salamander
file: salamander:
dir: /var/www/masq password: "общий_obfs_пароль_сервера"
listenHTTP: :80
listenHTTPS: :443
forceHTTPS: true
``` ```
### Сайт-заглушка
В `/var/www/masq/index.html` — официальная страница **Welcome to nginx!**
При открытии домена в браузере — валидный HTTPS-сайт с Let's Encrypt.
### Клиент (генерируется автоматически) ### Клиент (генерируется автоматически)
```yaml ```yaml
server: vpn-de.example.com:443 server: vpn-de.example.com:443
auth: my:password auth: my:password
obfs:
type: salamander
salamander:
password: общий_obfs_пароль_сервера
``` ```
### URI (пример) ### URI (пример)
``` ```
hysteria2://my:password@vpn-de.example.com:443#my hysteria2://my:password@vpn-de.example.com:443?obfs=salamander&obfs-password=OBFS_PASS#my
``` ```
Роль вызывает `hysteria share` — URI и QR формируются автоматически. Роль вызывает `hysteria share` — URI и QR уже содержат параметры Salamander.
--- ---
## Пароли VPN-пользователей ## Пароли
### VPN-пользователи (`userpass`)
1. **Vault (рекомендуется):** 1. **Vault (рекомендуется):**
@@ -235,11 +218,31 @@ hysteria2_user_passwords:
3. **Автогенерация** — Ansible `password` lookup, если пароль не задан ни в inventory/vault, ни в `output/<server>/server-info.yml`. 3. **Автогенерация** — Ansible `password` lookup, если пароль не задан ни в inventory/vault, ни в `output/<server>/server-info.yml`.
При `make update` / `make export`: При `make update` / `make export`:
- **существующие** пользователи сохраняют пароли из `server-info.yml` (и URL/QR, если домен/порт не менялись); - **существующие** пользователи сохраняют пароли из `server-info.yml` (и URL/QR, если домен/порт/obfs не менялись);
- **новые** получают автогенерацию и полный экспорт; - **новые** получают автогенерацию и полный экспорт;
- **удалённые** из inventory убираются из конфига Hysteria2 и из `output/<server>/`. - **удалённые** из inventory убираются из конфига Hysteria2 и из `output/<server>/`.
Принудительно перевыпустить URL/QR для всех: `hysteria2_force_export: true``group_vars/all.yml` или `EXTRA_VARS`). ### Salamander obfs (один на сервер)
1. **Vault (рекомендуется):**
```yaml
vault_hysteria2_obfs_passwords:
vps-de: "cry_me_a_r1ver_salamander_obfs"
```
Подключается через `group_vars/hysteria2_servers/vars.yml`:
```yaml
hysteria2_obfs_password: "{{ vault_hysteria2_obfs_passwords[inventory_hostname] | default('') }}"
```
2. **Авто:** Ansible `password` lookup (`hysteria2_obfs_password_length`) при первой установке
3. **При update/export:** загружается из `output/<server>/server-info.yml` (как VPN-пароли)
> **Важно:** obfs-пароль на сервере и клиенте должен **совпадать**. При `make update` без vault пароль сохраняется из предыдущего экспорта.
Принудительно перевыпустить URL/QR для всех VPN-пользователей: `hysteria2_force_export: true`.
```bash ```bash
make install EXTRA_VARS='hysteria2_force_export=true' make install EXTRA_VARS='hysteria2_force_export=true'
@@ -262,12 +265,12 @@ make install LIMIT=новый-сервер
### Добавить / удалить пользователя ### Добавить / удалить пользователя
1. Отредактируйте `hysteria2_users` в `inventory/hosts.yml` (добавьте имя или уберите). 1. Отредактируйте `hysteria2_users` в `inventory/hosts.yml`.
2. Запустите `make update LIMIT=<хост>`. 2. Запустите `make update LIMIT=<хост>`.
Пароли существующих клиентов **не меняются** (берутся из `output/<server>/server-info.yml`). Пароли и obfs существующих клиентов **не меняются** (из `server-info.yml`).
Новому пользователю генерируется пароль и создаются URL/QR. Новому пользователю генерируется пароль и создаются URL/QR с параметрами Salamander.
Удалённый пользователь пропадает из `/etc/hysteria/config.yaml` и из папки `output/<server>/`. Удалённый пользователь пропадает из конфига и из `output/<server>/`.
--- ---
@@ -275,12 +278,12 @@ make install LIMIT=новый-сервер
Официальный скрипт `install_server.sh` хранится в `roles/hysteria2/files/`. Официальный скрипт `install_server.sh` хранится в `roles/hysteria2/files/`.
Перед `make install` / `make update` на **control node** (ваш Mac): Перед `make install` / `make update` на **control node**:
1. Скачивается копия с https://get.hy2.sh/ 1. Скачивается копия с https://get.hy2.sh/
2. Сравнивается SHA256 с локальным файлом в роли 2. Сравнивается SHA256 с локальным файлом в роли
3. При отличии — локальная копия обновляется 3. При отличии — локальная копия обновляется
4. Скрипт копируется на VPS и запускается оттуда (без `curl | bash` на сервере) 4. Скрипт копируется на VPS и запускается оттуда
--- ---
@@ -289,11 +292,11 @@ make install LIMIT=новый-сервер
| Компонент | Поведение | | Компонент | Поведение |
|---|---| |---|---|
| Бинарник `hysteria` | Обновляется (`install_server.sh --force`) | | Бинарник `hysteria` | Обновляется (`install_server.sh --force`) |
| `/etc/hysteria/config.yaml` | Перекатывается под текущий inventory | | `/etc/hysteria/config.yaml` | Перекатывается (auth + obfs) |
| Пароли VPN | Сохраняются для существующих пользователей | | Пароли VPN / obfs | Сохраняются для существующей конфигурации |
| URL / QR | Только для новых, изменённых или при `hysteria2_force_export=true` | | URL / QR | Только для новых, изменённых или при `hysteria2_force_export=true` |
| `apt upgrade` | **Не** выполняется (отключено в Makefile) | | `apt upgrade` | **Не** выполняется |
| Ожидание ACME | **Не** выполняется (`hysteria2_wait_for_acme=false`) | | Ожидание ACME | **Не** выполняется |
--- ---
@@ -304,10 +307,9 @@ make install LIMIT=новый-сервер
- бинарник `/usr/local/bin/hysteria` и unit-файлы systemd; - бинарник `/usr/local/bin/hysteria` и unit-файлы systemd;
- `/etc/hysteria/` (конфиг и ACME); - `/etc/hysteria/` (конфиг и ACME);
- `/var/lib/hysteria` и пользователь `hysteria`; - `/var/lib/hysteria` и пользователь `hysteria`;
- `/var/www/masq` (сайт-заглушка, ветка **main**);
- symlink'и `multi-user.target.wants/hysteria-server*`; - symlink'и `multi-user.target.wants/hysteria-server*`;
- временные `/tmp/hysteria-client-*.yaml`; - временные `/tmp/hysteria-client-*.yaml`;
- правила ufw, добавленные при install; - правила ufw: `443/tcp`, `443/udp` (порт из `hysteria2_listen_port`);
- пакеты `curl`, `micro`, `qrencode`. - пакеты `curl`, `micro`, `qrencode`.
На **control node**: На **control node**:
@@ -324,11 +326,11 @@ make install LIMIT=новый-сервер
При блоке `acme:` в конфиге встроенный ACME-клиент Hysteria2 сам получает и **продлевает** сертификат Let's Encrypt (срок ~90 дней). Повторный `make install` или certbot для продления **не нужны** — процесс `hysteria-server` делает это сам. При блоке `acme:` в конфиге встроенный ACME-клиент Hysteria2 сам получает и **продлевает** сертификат Let's Encrypt (срок ~90 дней). Повторный `make install` или certbot для продления **не нужны** — процесс `hysteria-server` делает это сам.
**Условия для авто-продления (ветка `main`):** **Условия для авто-продления (ветка `salamander`):**
- сервер **запущен** и доступен из интернета; - сервер **запущен** и доступен из интернета;
- домен указывает на IP VPS; - домен указывает на IP VPS;
- порты **80/tcp** и **443/tcp** открыты (ACME HTTP challenge + masquerade); - порт **443/tcp** открыт (ACME TLS-ALPN challenge);
- конфиг `acme` не удалён. - конфиг `acme` не удалён.
Проверка логов: `journalctl -u hysteria-server -f` Проверка логов: `journalctl -u hysteria-server -f`
@@ -337,11 +339,12 @@ make install LIMIT=новый-сервер
## Firewall ## Firewall
По умолчанию открываются: По умолчанию открываются только порты Hysteria2:
- **80/tcp** — ACME HTTP + masquerade HTTP - **443/tcp**
- **443/tcp** — HTTPS masquerade - **443/udp**
- **443/udp** — Hysteria2
**Порт 80 не используется** — в отличие от ветки `main`.
--- ---
@@ -351,19 +354,20 @@ make install LIMIT=новый-сервер
output/ output/
├── index.html ← все серверы (открывается в браузере) ├── index.html ← все серверы (открывается в браузере)
├── vps-de/ ├── vps-de/
│ ├── index.html ← страница сервера │ ├── index.html ← страница сервера + obfs-пароль
│ ├── my.url │ ├── my.url ← URI с obfs=salamander
│ ├── my.png ← QR PNG │ ├── my.png ← QR PNG
│ ├── my.qr.txt ← QR ASCII │ ├── my.qr.txt ← QR ASCII
│ ├── my.txt │ ├── my.txt
│ └── server-info.yml │ └── server-info.yml ← mode, obfs_password, users
└── vps-nl/ └── vps-nl/
└── ... └── ...
``` ```
HTML-страницы показывают: HTML-страницы показывают:
- пароль и URL каждого пользователя с **кнопкой копирования**; - режим **Salamander** и **obfs-password** с кнопкой копирования;
- пароль и URL каждого пользователя;
- QR-коды; - QR-коды;
- ссылки на файлы и страницы серверов. - ссылки на файлы и страницы серверов.
@@ -391,33 +395,37 @@ ASCII QR — `hysteria share --qr` → `user.qr.txt`.
| Переменная | Где | Описание | | Переменная | Где | Описание |
|---|---|---| |---|---|---|
| `hysteria2_domain` | host | Домен с A-записью на IP | | `hysteria2_mode` | defaults | `salamander` (информативно) |
| `hysteria2_users` | host | Список имён VPN-пользователей | | `hysteria2_domain` | host | Домен для TLS/SNI/ACME |
| `hysteria2_acme_email` | group | Email для Let's Encrypt | | `hysteria2_users` | host | VPN-пользователи |
| `hysteria2_user_passwords` | host/vault | Фиксированные пароли VPN (`vars.yml` + vault) | | `hysteria2_acme_email` | group | Email Let's Encrypt |
| `hysteria2_password_length` | group | Длина автогенерируемого пароля (40) | | `hysteria2_user_passwords` | host/vault | Фиксированные пароли VPN |
| `hysteria2_force_export` | group | Перегенерировать URL/QR для всех (`false` по умолчанию) | | `hysteria2_password_length` | group | Длина автопароля VPN (40) |
| `hysteria2_force_export` | group | Перегенерировать URL/QR для всех (`false`) |
| `hysteria2_obfs_password` | host/vault | Пароль Salamander (или авто) |
| `hysteria2_obfs_password_length` | group | Длина автопароля obfs (32) |
| `hysteria2_output_dir` | group | Папка экспорта (`./output`) | | `hysteria2_output_dir` | group | Папка экспорта (`./output`) |
| `hysteria2_output_name` | host | Подпапка экспорта (`inventory_hostname`) | | `hysteria2_listen_port` | group | Порт (443) |
| `hysteria2_listen_port` | group | Порт Hysteria2 (443) | | `hysteria2_upgrade_system` | group | `apt upgrade` перед install |
| `hysteria2_upgrade_system` | group | `apt upgrade` перед install (`true`) | | `hysteria2_configure_firewall` | group | Открыть порты в ufw |
| `hysteria2_configure_firewall` | group | Открыть порты в ufw (`true`) |
| `hysteria2_generate_qr_png` | group | PNG QR через `qrencode` | | `hysteria2_generate_qr_png` | group | PNG QR через `qrencode` |
| `hysteria2_wait_for_acme` | group | Пауза при первом ACME (install) | | `hysteria2_wait_for_acme` | group | Пауза при первом ACME |
| `hysteria2_open_browser` | group | Открыть `output/index.html` после экспорта | | `hysteria2_open_browser` | group | Открыть `output/index.html` после экспорта |
| `hysteria2_uninstall_rebuild_global_index` | group | Пересобрать `output/index.html` после uninstall (`true`) | | `hysteria2_uninstall_rebuild_global_index` | group | Пересобрать `output/index.html` после uninstall (`true`) |
| `vault_ssh_passwords` | vault | SSH-пароли root по имени хоста | | `vault_ssh_passwords` | vault | SSH-пароли root |
| `vault_hysteria2_user_passwords` | vault | VPN-пароли по серверам | | `vault_hysteria2_user_passwords` | vault | VPN-пароли по серверам |
| `vault_hysteria2_obfs_passwords` | vault | obfs-пароли по серверам |
Полный список defaults: `roles/hysteria2/defaults/main.yml`, `defaults/uninstall.yml`. Полный список: `roles/hysteria2/defaults/main.yml`, `defaults/uninstall.yml`.
--- ---
## Безопасность ## Безопасность
- `output/` содержит пароли и URL — **не коммитить**`.gitignore`) - `output/` содержит пароли, obfs-ключи и URL — **не коммитить**`.gitignore`)
- `inventory/hosts.yml`, `vault.yml`, `.vault_pass` — не коммитить - `inventory/hosts.yml`, `vault.yml`, `.vault_pass` — не коммитить
- После `make init` выполните `make vault-encrypt` - После `make init` выполните `make vault-encrypt`
- Salamander **не делает** вас невидимым: IP VPS и UDP-поток всё ещё можно анализировать
--- ---
@@ -425,8 +433,9 @@ ASCII QR — `hysteria share --qr` → `user.qr.txt`.
- **Control node:** macOS или Linux с Ansible **2.14+** (`brew install ansible` на Mac) - **Control node:** macOS или Linux с Ansible **2.14+** (`brew install ansible` на Mac)
- **VPS:** Debian/Ubuntu с sudo - **VPS:** Debian/Ubuntu с sudo
- Домен с A-записью на IP сервера - Домен с A-записью на IP (для ACME TLS)
- Порты **80/tcp** и **443/tcp+udp** доступны с интернета (ветка `main`) - Порт **443/tcp+udp** доступен с интернета
- Клиент Hysteria2 с поддержкой Salamander (Shadowrocket, NekoBox, Hiddify и др.)
- Для авто-открытия браузера: macOS (`open`) или Linux (`xdg-open`) - Для авто-открытия браузера: macOS (`open`) или Linux (`xdg-open`)
--- ---
@@ -436,29 +445,29 @@ ASCII QR — `hysteria share --qr` → `user.qr.txt`.
``` ```
roles/hysteria2/ roles/hysteria2/
├── defaults/ ├── defaults/
│ ├── main.yml ← основные переменные │ ├── main.yml
│ └── uninstall.yml ← переменные удаления │ └── uninstall.yml
├── files/ ├── files/
│ └── install_server.sh ← официальный скрипт (синхронизация с get.hy2.sh) │ └── install_server.sh
├── tasks/ ├── tasks/
│ ├── main.yml ← порядок задач и теги │ ├── main.yml
│ ├── validate.yml │ ├── validate.yml
│ ├── users.yml ← пароли (inventory / vault / server-info.yml) │ ├── users.yml
│ ├── obfs.yml ← пароль Salamander obfs
│ ├── sync_install_script.yml │ ├── sync_install_script.yml
│ ├── install.yml ← пакеты, бинарник │ ├── install.yml
│ ├── configure.yml ← masquerade + ACME + ufw │ ├── configure.yml ← Salamander, без masquerade
│ ├── update.yml ← обновление бинарника │ ├── update.yml
│ ├── export_prepare.yml ← инкрементальный экспорт │ ├── export_prepare.yml
│ ├── export.yml ← URL, QR, HTML сервера │ ├── export.yml
│ ├── export_global.yml ← общий output/index.html │ ├── export_global.yml
│ ├── share_user.yml │ ├── share_user.yml
│ ├── reuse_export_user.yml │ ├── reuse_export_user.yml
│ └── uninstall.yml │ └── uninstall.yml
└── templates/ └── templates/
├── config.yaml.j2 ← acme http + masquerade file ├── config.yaml.j2 ← acme tls + obfs salamander
├── client.yaml.j2 ├── client.yaml.j2
── masq/index.html.j2 ── export/
└── export/ ← HTML-каталоги
``` ```
--- ---
@@ -467,15 +476,15 @@ roles/hysteria2/
```bash ```bash
git fetch origin git fetch origin
git checkout main # masquerade + nginx (эта ветка) git checkout main # masquerade + nginx
git checkout salamander # Salamander obfs git checkout salamander # Salamander obfs (эта ветка)
``` ```
Конфиги на **уже установленном** сервере **не меняются** при переключении ветки в git. Конфиги на **уже установленном** сервере **не меняются** при переключении ветки в git.
Чтобы применить другой режим на VPS: Чтобы применить другой режим на VPS:
```bash ```bash
git checkout salamander # или main git checkout main # или salamander
make install # перекатит конфиг сервера make install # перекатит конфиг сервера
# или # или
make update make update
+5 -2
View File
@@ -17,8 +17,11 @@ hysteria2_output_dir: "{{ playbook_dir }}/output"
# Открывать output/index.html в браузере после install/update/export # Открывать output/index.html в браузере после install/update/export
# hysteria2_open_browser: true # hysteria2_open_browser: true
# Порт Hysteria2 # Порт Hysteria2 (Salamander — достаточно открыть только его, 80/tcp не нужен)
hysteria2_listen_port: 443 hysteria2_listen_port: 443
# Открывать порты в ufw (80/tcp, 443/tcp, 443/udp) # Открывать порты в ufw ({{ hysteria2_listen_port }}/tcp и /udp)
hysteria2_configure_firewall: true hysteria2_configure_firewall: true
# Длина пароля Salamander obfs
# hysteria2_obfs_password_length: 32
@@ -4,3 +4,6 @@
# Проброс VPN-паролей из vault в переменные роли (опционально) # Проброс VPN-паролей из vault в переменные роли (опционально)
hysteria2_user_passwords: "{{ vault_hysteria2_user_passwords[inventory_hostname] | default({}) }}" hysteria2_user_passwords: "{{ vault_hysteria2_user_passwords[inventory_hostname] | default({}) }}"
# Опционально: фиксированный пароль Salamander obfs для сервера
# hysteria2_obfs_password: "{{ vault_hysteria2_obfs_passwords[inventory_hostname] | default('') }}"
@@ -14,5 +14,8 @@ vault_ssh_passwords:
# vault_hysteria2_user_passwords: # vault_hysteria2_user_passwords:
# vps-de: # vps-de:
# friend: "Aingae0Okit1eek4eeZahFohVei4akee" # friend: "Aingae0Okit1eek4eeZahFohVei4akee"
# vps-nl:
# alice: "CustomAlicePassword40chars................" # Опционально: пароль Salamander obfs (один на сервер)
# vault_hysteria2_obfs_passwords:
# vps-de: "cry_me_a_r1ver_salamander_obfs_pass"
# vps-nl: "another_obfs_password_32chars!!"
+12 -12
View File
@@ -1,5 +1,8 @@
--- ---
# Домен сервера (A-запись → IP VPS). Задаётся per-host в inventory. # Режим развёртывания (ветка salamander)
hysteria2_mode: salamander
# Домен сервера (A-запись → IP VPS). Используется для TLS/SNI и ACME.
hysteria2_domain: "" hysteria2_domain: ""
# Email для ACME / Let's Encrypt # Email для ACME / Let's Encrypt
@@ -9,14 +12,17 @@ hysteria2_acme_email: ""
hysteria2_users: [] hysteria2_users: []
# Опционально: фиксированные пароли { username: password } # Опционально: фиксированные пароли { username: password }
# Пустое значение или отсутствие ключа — автогенерация на control node (Ansible password lookup)
# Пароль обфускации Salamander (общий для сервера).
# Пусто — автогенерация на control node (Ansible password lookup) или загрузка из output/<server>/server-info.yml
hysteria2_obfs_password: ""
hysteria2_password_length: 40 hysteria2_password_length: 40
hysteria2_obfs_password_length: 32
hysteria2_listen_port: 443 hysteria2_listen_port: 443
hysteria2_upgrade_system: true hysteria2_upgrade_system: true
hysteria2_configure_firewall: true hysteria2_configure_firewall: true
hysteria2_masq_dir: /var/www/masq
hysteria2_config_path: /etc/hysteria/config.yaml hysteria2_config_path: /etc/hysteria/config.yaml
hysteria2_service_name: hysteria-server hysteria2_service_name: hysteria-server
@@ -26,20 +32,15 @@ hysteria2_install_script_name: install_server.sh
hysteria2_install_script_staging_dir: "{{ playbook_dir }}/.cache/hysteria2" hysteria2_install_script_staging_dir: "{{ playbook_dir }}/.cache/hysteria2"
hysteria2_install_script_remote_path: /tmp/hysteria2-install_server.sh hysteria2_install_script_remote_path: /tmp/hysteria2-install_server.sh
# Локальный каталог для экспорта URL и QR (на control node)
hysteria2_output_dir: "{{ playbook_dir }}/output" hysteria2_output_dir: "{{ playbook_dir }}/output"
hysteria2_output_name: "{{ inventory_hostname }}" hysteria2_output_name: "{{ inventory_hostname }}"
# Генерировать PNG QR-коды через qrencode (apt на VPS, fetch на control node)
hysteria2_generate_qr_png: true hysteria2_generate_qr_png: true
hysteria2_qr_png_size: 6 hysteria2_qr_png_size: 6
hysteria2_qr_png_margin: 2 hysteria2_qr_png_margin: 2
hysteria2_qr_png_error_correction: M hysteria2_qr_png_error_correction: M
# Ждать ACME при первом запуске (отключите при update: make update)
hysteria2_wait_for_acme: true hysteria2_wait_for_acme: true
# Открыть output/index.html в браузере после install/update/export
hysteria2_open_browser: true hysteria2_open_browser: true
# Перегенерировать URL/QR для всех пользователей (иначе — только новые/изменённые) # Перегенерировать URL/QR для всех пользователей (иначе — только новые/изменённые)
@@ -47,9 +48,8 @@ hysteria2_force_export: false
# --- uninstall (см. также defaults/uninstall.yml) --- # --- uninstall (см. также defaults/uninstall.yml) ---
hysteria2_system_user: hysteria hysteria2_system_user: hysteria
hysteria2_uninstall_remove_masq: true hysteria2_uninstall_remove_masq: false
hysteria2_uninstall_rebuild_global_index: true hysteria2_uninstall_rebuild_global_index: true
hysteria2_uninstall_ufw_rules: hysteria2_uninstall_ufw_rules:
- 80/tcp - "{{ hysteria2_listen_port }}/tcp"
- 443/tcp - "{{ hysteria2_listen_port }}/udp"
- 443/udp
+4 -5
View File
@@ -2,11 +2,10 @@
# Системный пользователь Hysteria (создаётся install_server.sh) # Системный пользователь Hysteria (создаётся install_server.sh)
hysteria2_system_user: hysteria hysteria2_system_user: hysteria
# --- uninstall --- # --- uninstall (Salamander: без masq, порты listen_port/tcp+udp) ---
# install_server.sh --remove: бинарник + systemd; остальное — задачи uninstall.yml # install_server.sh --remove: бинарник + systemd; остальное — задачи uninstall.yml
hysteria2_uninstall_remove_masq: true hysteria2_uninstall_remove_masq: false
hysteria2_uninstall_rebuild_global_index: true hysteria2_uninstall_rebuild_global_index: true
hysteria2_uninstall_ufw_rules: hysteria2_uninstall_ufw_rules:
- 80/tcp - "{{ hysteria2_listen_port }}/tcp"
- 443/tcp - "{{ hysteria2_listen_port }}/udp"
- 443/udp
+1 -1
View File
@@ -2,7 +2,7 @@
galaxy_info: galaxy_info:
role_name: hysteria2 role_name: hysteria2
author: inecs author: inecs
description: Install Hysteria2 VPN server with masquerade site and export client URLs with QR codes description: Install Hysteria2 VPN server with Salamander obfs and export client URLs with QR codes
license: MIT license: MIT
min_ansible_version: "2.14" min_ansible_version: "2.14"
platforms: platforms:
+6 -20
View File
@@ -1,24 +1,11 @@
--- ---
- name: Create masquerade web directory
ansible.builtin.file:
path: "{{ hysteria2_masq_dir }}"
state: directory
mode: "0755"
- name: Deploy masquerade index.html
ansible.builtin.template:
src: masq/index.html.j2
dest: "{{ hysteria2_masq_dir }}/index.html"
mode: "0644"
notify: Restart hysteria-server
- name: Remove default Hysteria config if present - name: Remove default Hysteria config if present
ansible.builtin.file: ansible.builtin.file:
path: "{{ hysteria2_config_path }}" path: "{{ hysteria2_config_path }}"
state: absent state: absent
when: not ansible_check_mode when: not ansible_check_mode
- name: Deploy Hysteria2 server config - name: Deploy Hysteria2 Salamander server config
ansible.builtin.template: ansible.builtin.template:
src: config.yaml.j2 src: config.yaml.j2
dest: "{{ hysteria2_config_path }}" dest: "{{ hysteria2_config_path }}"
@@ -42,12 +29,11 @@
failed_when: false failed_when: false
when: hysteria2_configure_firewall | bool when: hysteria2_configure_firewall | bool
- name: Allow HTTP and HTTPS in ufw - name: Allow Hysteria2 port in ufw (Salamander — только {{ hysteria2_listen_port }})
ansible.builtin.command: "ufw allow {{ item }}" ansible.builtin.command: "ufw allow {{ item }}"
loop: loop:
- 80/tcp - "{{ hysteria2_listen_port }}/tcp"
- 443/tcp - "{{ hysteria2_listen_port }}/udp"
- 443/udp
register: _hysteria2_ufw_allow register: _hysteria2_ufw_allow
changed_when: "'Skipping' not in (_hysteria2_ufw_allow.stdout | default(''))" changed_when: "'Skipping' not in (_hysteria2_ufw_allow.stdout | default(''))"
failed_when: false failed_when: false
@@ -55,10 +41,10 @@
- hysteria2_configure_firewall | bool - hysteria2_configure_firewall | bool
- "'active' in (_hysteria2_ufw_status.stdout | default(''))" - "'active' in (_hysteria2_ufw_status.stdout | default(''))"
- name: Wait for ACME certificate (first start may take several minutes) - name: Wait for ACME TLS certificate (first start may take several minutes)
ansible.builtin.pause: ansible.builtin.pause:
seconds: 30 seconds: 30
prompt: "Ожидание получения ACME-сертификата для {{ hysteria2_domain }}..." prompt: "Ожидание получения ACME TLS-сертификата для {{ hysteria2_domain }}..."
when: hysteria2_wait_for_acme | default(true) | bool when: hysteria2_wait_for_acme | default(true) | bool
- name: Verify hysteria-server is running - name: Verify hysteria-server is running
+3 -1
View File
@@ -43,10 +43,11 @@
mode: "0600" mode: "0600"
content: | content: |
server: {{ hysteria2_output_name }} server: {{ hysteria2_output_name }}
mode: salamander
domain: {{ hysteria2_domain }} domain: {{ hysteria2_domain }}
port: {{ hysteria2_listen_port }} port: {{ hysteria2_listen_port }}
host_ip: "{{ ansible_host | default('') }}" host_ip: "{{ ansible_host | default('') }}"
mode: masquerade obfs_password: "{{ hysteria2_obfs_password }}"
users: users:
{% for user in hysteria2_export_users %} {% for user in hysteria2_export_users %}
- name: {{ user.name }} - name: {{ user.name }}
@@ -67,6 +68,7 @@
mode: "0644" mode: "0644"
vars: vars:
generated_at: "{{ now(utc=false, fmt='%Y-%m-%d %H:%M:%S') }}" generated_at: "{{ now(utc=false, fmt='%Y-%m-%d %H:%M:%S') }}"
hysteria2_obfs_password: "{{ hysteria2_obfs_password }}"
delegate_to: localhost delegate_to: localhost
become: false become: false
+2 -1
View File
@@ -34,12 +34,13 @@
name: "{{ _server_name }}" name: "{{ _server_name }}"
domain: "{{ _info.domain }}" domain: "{{ _info.domain }}"
port: "{{ _info.port }}" port: "{{ _info.port }}"
mode: "{{ _info.mode | default('masquerade') }}" mode: "{{ _info.mode | default('salamander') }}"
host_ip: >- host_ip: >-
{{ {{
_info.host_ip _info.host_ip
| default(hostvars[_server_name].ansible_host | default(''), true) | default(hostvars[_server_name].ansible_host | default(''), true)
}} }}
obfs_password: "{{ _info.obfs_password | default('') }}"
dir: "{{ item.item.path | dirname | basename }}" dir: "{{ item.item.path | dirname | basename }}"
users: "{{ _info.users }}" users: "{{ _info.users }}"
become: false become: false
+4
View File
@@ -7,6 +7,10 @@
ansible.builtin.import_tasks: users.yml ansible.builtin.import_tasks: users.yml
tags: [install, update, export] tags: [install, update, export]
- name: Resolve Salamander obfs password
ansible.builtin.import_tasks: obfs.yml
tags: [install, update, export]
- name: Install packages and Hysteria2 binary - name: Install packages and Hysteria2 binary
ansible.builtin.import_tasks: install.yml ansible.builtin.import_tasks: install.yml
tags: [install] tags: [install]
+58
View File
@@ -0,0 +1,58 @@
---
- name: Check for saved Salamander password from previous install
ansible.builtin.stat:
path: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/server-info.yml"
register: _hysteria2_saved_info
delegate_to: localhost
become: false
tags:
- install
- update
- export
- name: Load saved Salamander obfs password
when: _hysteria2_saved_info.stat.exists
block:
- name: Read server-info.yml for obfs password
ansible.builtin.slurp:
path: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/server-info.yml"
register: _hysteria2_saved_info_raw
delegate_to: localhost
become: false
- name: Parse saved obfs password
ansible.builtin.set_fact:
_hysteria2_saved_obfs_password: "{{ (_hysteria2_saved_info_raw.content | b64decode | from_yaml).obfs_password | default('') }}"
delegate_to: localhost
become: false
tags:
- install
- update
- export
- name: Resolve Salamander obfs password
ansible.builtin.set_fact:
hysteria2_obfs_password: >-
{{
hysteria2_obfs_password
| default(_hysteria2_saved_obfs_password | default(''), true)
}}
tags:
- install
- update
- export
- name: Generate Salamander obfs password
ansible.builtin.set_fact:
hysteria2_obfs_password: >-
{{
lookup(
'password',
'/dev/null chars=ascii_letters,digits length=' ~ (hysteria2_obfs_password_length | string)
)
}}
when: hysteria2_obfs_password | length == 0
tags:
- install
- update
- export
+2
View File
@@ -34,6 +34,8 @@
Domain: {{ hysteria2_domain }}:{{ hysteria2_listen_port }} Domain: {{ hysteria2_domain }}:{{ hysteria2_listen_port }}
User: {{ hysteria2_current_user.name }} User: {{ hysteria2_current_user.name }}
Password: {{ hysteria2_current_user.password }} Password: {{ hysteria2_current_user.password }}
Mode: salamander
Obfs password: {{ hysteria2_obfs_password }}
URL: URL:
{{ _hysteria2_client_url }} {{ _hysteria2_client_url }}
+1 -7
View File
@@ -32,12 +32,6 @@
- "{{ hysteria2_config_path | dirname }}" - "{{ hysteria2_config_path | dirname }}"
- "/var/lib/{{ hysteria2_system_user | default('hysteria') }}" - "/var/lib/{{ hysteria2_system_user | default('hysteria') }}"
- name: Remove masquerade web directory
ansible.builtin.file:
path: "{{ hysteria2_masq_dir }}"
state: absent
when: hysteria2_uninstall_remove_masq | default(true) | bool
- name: Remove enabled hysteria-server systemd symlink - name: Remove enabled hysteria-server systemd symlink
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/system/multi-user.target.wants/hysteria-server.service path: /etc/systemd/system/multi-user.target.wants/hysteria-server.service
@@ -130,7 +124,7 @@
- name: Show uninstall result - name: Show uninstall result
ansible.builtin.debug: ansible.builtin.debug:
msg: >- msg: >-
Hysteria2 полностью удалён с {{ inventory_hostname }}. Hysteria2 (Salamander) полностью удалён с {{ inventory_hostname }}.
Локальная папка {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/ удалена. Локальная папка {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/ удалена.
{% if hysteria2_uninstall_rebuild_global_index | default(true) | bool %} {% if hysteria2_uninstall_rebuild_global_index | default(true) | bool %}
{{ hysteria2_output_dir }}/index.html будет пересобран без этого сервера. {{ hysteria2_output_dir }}/index.html будет пересобран без этого сервера.
+1 -1
View File
@@ -7,7 +7,7 @@
- hysteria2_users | length > 0 - hysteria2_users | length > 0
fail_msg: | fail_msg: |
Задайте для каждого хоста: Задайте для каждого хоста:
hysteria2_domain — домен с A-записью на IP сервера hysteria2_domain — домен с A-записью на IP сервера (используется для TLS/SNI)
hysteria2_users — список имён пользователей, например [my, friend] hysteria2_users — список имён пользователей, например [my, friend]
И в group_vars/all.yml: И в group_vars/all.yml:
hysteria2_acme_email — email для Let's Encrypt hysteria2_acme_email — email для Let's Encrypt
+5
View File
@@ -1,3 +1,8 @@
server: {{ hysteria2_domain }}:{{ hysteria2_listen_port }} server: {{ hysteria2_domain }}:{{ hysteria2_listen_port }}
auth: {{ hysteria2_current_user.name }}:{{ hysteria2_current_user.password }} auth: {{ hysteria2_current_user.name }}:{{ hysteria2_current_user.password }}
obfs:
type: salamander
salamander:
password: {{ hysteria2_obfs_password }}
+5 -8
View File
@@ -1,7 +1,7 @@
listen: 0.0.0.0:{{ hysteria2_listen_port }} listen: 0.0.0.0:{{ hysteria2_listen_port }}
acme: acme:
type: http type: tls
domains: domains:
- {{ hysteria2_domain }} - {{ hysteria2_domain }}
email: {{ hysteria2_acme_email }} email: {{ hysteria2_acme_email }}
@@ -13,10 +13,7 @@ auth:
{{ user.name }}: "{{ user.password }}" {{ user.name }}: "{{ user.password }}"
{% endfor %} {% endfor %}
masquerade: obfs:
type: file type: salamander
file: salamander:
dir: {{ hysteria2_masq_dir }} password: "{{ hysteria2_obfs_password }}"
listenHTTP: :80
listenHTTPS: :{{ hysteria2_listen_port }}
forceHTTPS: true
@@ -516,10 +516,8 @@
background: var(--bg-input); background: var(--bg-input);
color: var(--accent); color: var(--accent);
text-decoration: none; text-decoration: none;
font: inherit;
font-size: 0.85rem; font-size: 0.85rem;
font-weight: 650; font-weight: 650;
cursor: pointer;
transition: color 0.15s, border-color 0.15s, background 0.15s; transition: color 0.15s, border-color 0.15s, background 0.15s;
} }
.lightbox-download:hover { .lightbox-download:hover {
@@ -627,7 +625,7 @@
</div> </div>
<div class="meta-item"> <div class="meta-item">
<label>Режим</label> <label>Режим</label>
<span>{{ server.mode | default('masquerade') | e }}</span> <span>{{ server.mode | default('salamander') | e }}</span>
</div> </div>
<div class="meta-item"> <div class="meta-item">
<label>Пользователи</label> <label>Пользователи</label>
@@ -718,19 +716,16 @@
</div> </div>
</div> </div>
{% set _png = namespace(b64='', data='') %}
{% if user.has_png | default(false) %} {% if user.has_png | default(false) %}
{% set _png.b64 = lookup('pipe', 'base64 < ' ~ ((hysteria2_output_dir ~ '/' ~ server.dir ~ '/' ~ user.name ~ '.png') | quote)) | regex_replace('\\s+', '') %}
{% set _png.data = 'data:image/png;base64,' ~ _png.b64 %}
<div class="qr-block"> <div class="qr-block">
<img <img
src="{{ _png.data }}" src="{{ server.dir | e }}/{{ user.name | e }}.png"
alt="QR {{ user.name | e }}" alt="QR {{ user.name | e }}"
width="160" width="160"
height="160" height="160"
role="button" role="button"
tabindex="0" tabindex="0"
data-lightbox-src="{{ _png.data }}" data-lightbox-src="{{ server.dir | e }}/{{ user.name | e }}.png"
data-lightbox-caption="{{ server.name | e }} · {{ user.name | e }}" data-lightbox-caption="{{ server.name | e }} · {{ user.name | e }}"
data-lightbox-download="{{ server.name | e }}-{{ user.name | e }}.png" data-lightbox-download="{{ server.name | e }}-{{ user.name | e }}.png"
aria-label="Открыть QR-код {{ user.name | e }}" aria-label="Открыть QR-код {{ user.name | e }}"
@@ -739,12 +734,12 @@
{% endif %} {% endif %}
<nav class="files" aria-label="Файлы"> <nav class="files" aria-label="Файлы">
<a class="file-download" href="{{ server.dir | e }}/{{ user.name | e }}.url" download="{{ server.name | e }}-{{ user.name | e }}.url" data-filename="{{ server.name | e }}-{{ user.name | e }}.url" data-text="{{ (user.url ~ '\n') | e }}">.url</a> <a href="{{ server.dir | e }}/{{ user.name | e }}.url" download>.url</a>
<a class="file-download" href="{{ server.dir | e }}/{{ user.name | e }}.txt" download="{{ server.name | e }}-{{ user.name | e }}.txt" data-filename="{{ server.name | e }}-{{ user.name | e }}.txt" data-text="{{ ('Server: ' ~ server.name ~ '\nDomain: ' ~ server.domain ~ ':' ~ server.port ~ '\nUser: ' ~ user.name ~ '\nPassword: ' ~ user.password ~ '\n\nURL:\n' ~ user.url ~ '\n') | e }}">.txt</a> <a href="{{ server.dir | e }}/{{ user.name | e }}.txt" download>.txt</a>
{% if user.has_png | default(false) and _png.b64 %} {% if user.has_png | default(false) %}
<a class="file-download" href="{{ server.dir | e }}/{{ user.name | e }}.png" download="{{ server.name | e }}-{{ user.name | e }}.png" data-filename="{{ server.name | e }}-{{ user.name | e }}.png" data-png-b64="{{ _png.b64 }}">.png</a> <a href="{{ server.dir | e }}/{{ user.name | e }}.png" download>.png</a>
{% endif %} {% endif %}
<a class="file-download" href="{{ server.dir | e }}/{{ user.name | e }}.qr.txt" download="{{ server.name | e }}-{{ user.name | e }}.qr.txt" data-filename="{{ server.name | e }}-{{ user.name | e }}.qr.txt" data-text="{{ lookup('file', hysteria2_output_dir ~ '/' ~ server.dir ~ '/' ~ user.name ~ '.qr.txt', errors='ignore') | default('URL: ' ~ user.url ~ '\n', true) | e }}">.qr.txt</a> <a href="{{ server.dir | e }}/{{ user.name | e }}.qr.txt" download>.qr.txt</a>
</nav> </nav>
</article> </article>
{% endfor %} {% endfor %}
@@ -764,10 +759,10 @@
</div> </div>
<p class="lightbox-caption" id="lightbox-caption"></p> <p class="lightbox-caption" id="lightbox-caption"></p>
<div class="lightbox-actions"> <div class="lightbox-actions">
<button type="button" class="lightbox-download" id="lightbox-download"> <a class="lightbox-download" id="lightbox-download" href="#" download>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
Скачать QR Скачать QR
</button> </a>
</div> </div>
</div> </div>
</div> </div>
@@ -830,76 +825,14 @@
var caption = document.getElementById('lightbox-caption'); var caption = document.getElementById('lightbox-caption');
var closeBtn = document.getElementById('lightbox-close'); var closeBtn = document.getElementById('lightbox-close');
var downloadBtn = document.getElementById('lightbox-download'); var downloadBtn = document.getElementById('lightbox-download');
var downloadSrc = '';
function triggerDataUrlDownload(dataUrl, filename) {
var a = document.createElement('a');
a.href = dataUrl;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
}
function triggerFileDownload(blob, filename) {
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1500);
}
function downloadQrFromCanvas(filename) {
if (!img.complete || !img.naturalWidth) return false;
try {
var canvas = document.createElement('canvas');
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
canvas.getContext('2d').drawImage(img, 0, 0);
// toDataURL sync — download stays in the user-gesture (Safari/Chrome)
triggerDataUrlDownload(canvas.toDataURL('image/png'), filename);
return true;
} catch (err) {
return false;
}
}
function downloadQrImage(e) {
e.preventDefault();
e.stopPropagation();
var filename = downloadBtn.getAttribute('data-filename') || 'qr.png';
var src = downloadSrc || img.currentSrc || img.src;
// Embedded data: URLs work on file:// (no CORS / tainted canvas)
if (src && src.indexOf('data:') === 0) {
triggerDataUrlDownload(src, filename);
return;
}
if (downloadQrFromCanvas(filename)) return;
if (!src || location.protocol === 'file:') return;
fetch(src)
.then(function (res) {
if (!res.ok) throw new Error('fetch failed');
return res.blob();
})
.then(function (blob) { triggerFileDownload(blob, filename); })
.catch(function () { /* avoid navigating to the image URL */ });
}
function openLightbox(src, text, alt, filename) { function openLightbox(src, text, alt, filename) {
var safeName = filename || 'qr.png';
img.src = src; img.src = src;
img.alt = alt || text || 'QR'; img.alt = alt || text || 'QR';
caption.textContent = text || ''; caption.textContent = text || '';
downloadSrc = src; downloadBtn.href = src;
downloadBtn.setAttribute('data-filename', safeName); downloadBtn.setAttribute('download', filename || 'qr.png');
downloadBtn.setAttribute('aria-label', 'Скачать ' + safeName); downloadBtn.setAttribute('aria-label', 'Скачать ' + (filename || 'qr.png'));
box.classList.add('open'); box.classList.add('open');
box.setAttribute('aria-hidden', 'false'); box.setAttribute('aria-hidden', 'false');
document.body.classList.add('lightbox-open'); document.body.classList.add('lightbox-open');
@@ -911,8 +844,7 @@
box.setAttribute('aria-hidden', 'true'); box.setAttribute('aria-hidden', 'true');
document.body.classList.remove('lightbox-open'); document.body.classList.remove('lightbox-open');
img.removeAttribute('src'); img.removeAttribute('src');
downloadSrc = ''; downloadBtn.removeAttribute('href');
downloadBtn.removeAttribute('data-filename');
} }
document.querySelectorAll('[data-lightbox-src]').forEach(function (el) { document.querySelectorAll('[data-lightbox-src]').forEach(function (el) {
@@ -933,7 +865,6 @@
}); });
}); });
downloadBtn.addEventListener('click', downloadQrImage);
closeBtn.addEventListener('click', closeLightbox); closeBtn.addEventListener('click', closeLightbox);
box.addEventListener('click', function (e) { box.addEventListener('click', function (e) {
if (e.target === box) closeLightbox(); if (e.target === box) closeLightbox();
@@ -942,84 +873,6 @@
if (e.key === 'Escape' && box.classList.contains('open')) closeLightbox(); if (e.key === 'Escape' && box.classList.contains('open')) closeLightbox();
}); });
})(); })();
(function () {
function triggerDataUrlDownload(dataUrl, filename) {
var a = document.createElement('a');
a.href = dataUrl;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
}
function triggerFileDownload(blob, filename) {
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1500);
}
function pngFromCard(link, filename) {
var card = link.closest('.user-card');
var qrImg = card && card.querySelector('img[data-lightbox-src], .qr-block img');
if (!qrImg) return false;
var src = qrImg.currentSrc || qrImg.src || '';
if (src.indexOf('data:image/') === 0) {
triggerDataUrlDownload(src, filename);
return true;
}
if (!qrImg.complete || !qrImg.naturalWidth) return false;
try {
var canvas = document.createElement('canvas');
canvas.width = qrImg.naturalWidth;
canvas.height = qrImg.naturalHeight;
canvas.getContext('2d').drawImage(qrImg, 0, 0);
triggerDataUrlDownload(canvas.toDataURL('image/png'), filename);
return true;
} catch (err) {
return false;
}
}
document.querySelectorAll('a.file-download').forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var filename = link.getAttribute('data-filename') || link.getAttribute('download') || 'download';
var href = link.getAttribute('href');
var fallbackText = link.getAttribute('data-text');
var pngB64 = link.getAttribute('data-png-b64');
var isPng = /\.png$/i.test(filename);
// Sync paths first — file:// blocks fetch (CORS) and taints canvas
if (pngB64) {
triggerDataUrlDownload('data:image/png;base64,' + pngB64, filename);
return;
}
if (isPng && pngFromCard(link, filename)) return;
if (fallbackText !== null) {
triggerFileDownload(new Blob([fallbackText], { type: 'text/plain;charset=utf-8' }), filename);
return;
}
if (!href || location.protocol === 'file:') return;
fetch(href)
.then(function (res) {
if (!res.ok) throw new Error('fetch failed');
return res.blob();
})
.then(function (blob) { triggerFileDownload(blob, filename); })
.catch(function () { /* do not navigate to the file URL */ });
});
});
})();
</script> </script>
</body> </body>
</html> </html>
+13 -160
View File
@@ -333,10 +333,8 @@
background: var(--bg-input); background: var(--bg-input);
color: var(--accent); color: var(--accent);
text-decoration: none; text-decoration: none;
font: inherit;
font-size: 0.85rem; font-size: 0.85rem;
font-weight: 650; font-weight: 650;
cursor: pointer;
} }
.lightbox-download:hover { .lightbox-download:hover {
border-color: var(--accent); border-color: var(--accent);
@@ -424,19 +422,16 @@
</div> </div>
</div> </div>
{% set _png = namespace(b64='', data='') %}
{% if user.has_png | default(false) %} {% if user.has_png | default(false) %}
{% set _png.b64 = lookup('pipe', 'base64 < ' ~ ((hysteria2_output_dir ~ '/' ~ hysteria2_output_name ~ '/' ~ user.name ~ '.png') | quote)) | regex_replace('\\s+', '') %}
{% set _png.data = 'data:image/png;base64,' ~ _png.b64 %}
<div class="qr-block"> <div class="qr-block">
<img <img
src="{{ _png.data }}" src="{{ user.name | e }}.png"
alt="QR {{ user.name | e }}" alt="QR {{ user.name | e }}"
width="160" width="160"
height="160" height="160"
role="button" role="button"
tabindex="0" tabindex="0"
data-lightbox-src="{{ _png.data }}" data-lightbox-src="{{ user.name | e }}.png"
data-lightbox-caption="{{ hysteria2_output_name | e }} · {{ user.name | e }}" data-lightbox-caption="{{ hysteria2_output_name | e }} · {{ user.name | e }}"
data-lightbox-download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.png" data-lightbox-download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.png"
aria-label="Открыть QR-код {{ user.name | e }}" aria-label="Открыть QR-код {{ user.name | e }}"
@@ -445,12 +440,12 @@
{% endif %} {% endif %}
<nav class="files" aria-label="Файлы"> <nav class="files" aria-label="Файлы">
<a class="file-download" href="{{ user.name | e }}.url" download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.url" data-filename="{{ hysteria2_output_name | e }}-{{ user.name | e }}.url" data-text="{{ (user.url ~ '\n') | e }}">.url</a> <a href="{{ user.name | e }}.url" download>.url</a>
<a class="file-download" href="{{ user.name | e }}.txt" download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.txt" data-filename="{{ hysteria2_output_name | e }}-{{ user.name | e }}.txt" data-text="{{ ('Server: ' ~ hysteria2_output_name ~ '\nDomain: ' ~ hysteria2_domain ~ ':' ~ hysteria2_listen_port ~ '\nUser: ' ~ user.name ~ '\nPassword: ' ~ user.password ~ '\n\nURL:\n' ~ user.url ~ '\n') | e }}">.txt</a> <a href="{{ user.name | e }}.txt" download>.txt</a>
{% if user.has_png | default(false) and _png.b64 %} {% if user.has_png | default(false) %}
<a class="file-download" href="{{ user.name | e }}.png" download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.png" data-filename="{{ hysteria2_output_name | e }}-{{ user.name | e }}.png" data-png-b64="{{ _png.b64 }}">.png</a> <a href="{{ user.name | e }}.png" download>.png</a>
{% endif %} {% endif %}
<a class="file-download" href="{{ user.name | e }}.qr.txt" download="{{ hysteria2_output_name | e }}-{{ user.name | e }}.qr.txt" data-filename="{{ hysteria2_output_name | e }}-{{ user.name | e }}.qr.txt" data-text="{{ lookup('file', hysteria2_output_dir ~ '/' ~ hysteria2_output_name ~ '/' ~ user.name ~ '.qr.txt', errors='ignore') | default('URL: ' ~ user.url ~ '\n', true) | e }}">.qr.txt</a> <a href="{{ user.name | e }}.qr.txt" download>.qr.txt</a>
</nav> </nav>
</article> </article>
{% endfor %} {% endfor %}
@@ -468,10 +463,10 @@
</div> </div>
<p class="lightbox-caption" id="lightbox-caption"></p> <p class="lightbox-caption" id="lightbox-caption"></p>
<div class="lightbox-actions"> <div class="lightbox-actions">
<button type="button" class="lightbox-download" id="lightbox-download"> <a class="lightbox-download" id="lightbox-download" href="#" download>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
Скачать QR Скачать QR
</button> </a>
</div> </div>
</div> </div>
</div> </div>
@@ -507,76 +502,14 @@
var caption = document.getElementById('lightbox-caption'); var caption = document.getElementById('lightbox-caption');
var closeBtn = document.getElementById('lightbox-close'); var closeBtn = document.getElementById('lightbox-close');
var downloadBtn = document.getElementById('lightbox-download'); var downloadBtn = document.getElementById('lightbox-download');
var downloadSrc = '';
function triggerDataUrlDownload(dataUrl, filename) {
var a = document.createElement('a');
a.href = dataUrl;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
}
function triggerFileDownload(blob, filename) {
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1500);
}
function downloadQrFromCanvas(filename) {
if (!img.complete || !img.naturalWidth) return false;
try {
var canvas = document.createElement('canvas');
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
canvas.getContext('2d').drawImage(img, 0, 0);
// toDataURL sync — download stays in the user-gesture (Safari/Chrome)
triggerDataUrlDownload(canvas.toDataURL('image/png'), filename);
return true;
} catch (err) {
return false;
}
}
function downloadQrImage(e) {
e.preventDefault();
e.stopPropagation();
var filename = downloadBtn.getAttribute('data-filename') || 'qr.png';
var src = downloadSrc || img.currentSrc || img.src;
// Embedded data: URLs work on file:// (no CORS / tainted canvas)
if (src && src.indexOf('data:') === 0) {
triggerDataUrlDownload(src, filename);
return;
}
if (downloadQrFromCanvas(filename)) return;
if (!src || location.protocol === 'file:') return;
fetch(src)
.then(function (res) {
if (!res.ok) throw new Error('fetch failed');
return res.blob();
})
.then(function (blob) { triggerFileDownload(blob, filename); })
.catch(function () { /* avoid navigating to the image URL */ });
}
function openLightbox(src, text, alt, filename) { function openLightbox(src, text, alt, filename) {
var safeName = filename || 'qr.png';
img.src = src; img.src = src;
img.alt = alt || text || 'QR'; img.alt = alt || text || 'QR';
caption.textContent = text || ''; caption.textContent = text || '';
downloadSrc = src; downloadBtn.href = src;
downloadBtn.setAttribute('data-filename', safeName); downloadBtn.setAttribute('download', filename || 'qr.png');
downloadBtn.setAttribute('aria-label', 'Скачать ' + safeName); downloadBtn.setAttribute('aria-label', 'Скачать ' + (filename || 'qr.png'));
box.classList.add('open'); box.classList.add('open');
box.setAttribute('aria-hidden', 'false'); box.setAttribute('aria-hidden', 'false');
document.body.classList.add('lightbox-open'); document.body.classList.add('lightbox-open');
@@ -588,8 +521,7 @@
box.setAttribute('aria-hidden', 'true'); box.setAttribute('aria-hidden', 'true');
document.body.classList.remove('lightbox-open'); document.body.classList.remove('lightbox-open');
img.removeAttribute('src'); img.removeAttribute('src');
downloadSrc = ''; downloadBtn.removeAttribute('href');
downloadBtn.removeAttribute('data-filename');
} }
document.querySelectorAll('[data-lightbox-src]').forEach(function (el) { document.querySelectorAll('[data-lightbox-src]').forEach(function (el) {
@@ -610,7 +542,6 @@
}); });
}); });
downloadBtn.addEventListener('click', downloadQrImage);
closeBtn.addEventListener('click', closeLightbox); closeBtn.addEventListener('click', closeLightbox);
box.addEventListener('click', function (e) { box.addEventListener('click', function (e) {
if (e.target === box) closeLightbox(); if (e.target === box) closeLightbox();
@@ -619,84 +550,6 @@
if (e.key === 'Escape' && box.classList.contains('open')) closeLightbox(); if (e.key === 'Escape' && box.classList.contains('open')) closeLightbox();
}); });
})(); })();
(function () {
function triggerDataUrlDownload(dataUrl, filename) {
var a = document.createElement('a');
a.href = dataUrl;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
}
function triggerFileDownload(blob, filename) {
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
a.rel = 'noopener';
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1500);
}
function pngFromCard(link, filename) {
var card = link.closest('.user-card');
var qrImg = card && card.querySelector('img[data-lightbox-src], .qr-block img');
if (!qrImg) return false;
var src = qrImg.currentSrc || qrImg.src || '';
if (src.indexOf('data:image/') === 0) {
triggerDataUrlDownload(src, filename);
return true;
}
if (!qrImg.complete || !qrImg.naturalWidth) return false;
try {
var canvas = document.createElement('canvas');
canvas.width = qrImg.naturalWidth;
canvas.height = qrImg.naturalHeight;
canvas.getContext('2d').drawImage(qrImg, 0, 0);
triggerDataUrlDownload(canvas.toDataURL('image/png'), filename);
return true;
} catch (err) {
return false;
}
}
document.querySelectorAll('a.file-download').forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var filename = link.getAttribute('data-filename') || link.getAttribute('download') || 'download';
var href = link.getAttribute('href');
var fallbackText = link.getAttribute('data-text');
var pngB64 = link.getAttribute('data-png-b64');
var isPng = /\.png$/i.test(filename);
// Sync paths first — file:// blocks fetch (CORS) and taints canvas
if (pngB64) {
triggerDataUrlDownload('data:image/png;base64,' + pngB64, filename);
return;
}
if (isPng && pngFromCard(link, filename)) return;
if (fallbackText !== null) {
triggerFileDownload(new Blob([fallbackText], { type: 'text/plain;charset=utf-8' }), filename);
return;
}
if (!href || location.protocol === 'file:') return;
fetch(href)
.then(function (res) {
if (!res.ok) throw new Error('fetch failed');
return res.blob();
})
.then(function (blob) { triggerFileDownload(blob, filename); })
.catch(function () { /* do not navigate to the file URL */ });
});
});
})();
</script> </script>
</body> </body>
</html> </html>
@@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, nginx is successfully installed and working.
Further configuration is required for the web server, reverse proxy,
API gateway, load balancer, content cache, or other features.</p>
<p>For online documentation and support please refer to
<a href="https://nginx.org/">nginx.org</a>.<br/>
To engage with the community please visit
<a href="https://community.nginx.org/">community.nginx.org</a>.<br/>
For enterprise grade support, professional services, additional
security features and capabilities please refer to
<a href="https://f5.com/nginx">f5.com/nginx</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>