Compare commits

3 Commits
Author SHA1 Message Date
Aemeath b0d9982796 Dawnline 0.16.3
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- Move Dawnline to Services in LuCI and update links and documentation.
- Make activity messages clearer, including device renames and person-specific history.
- Prune redundant frontend tests.
2026-10-31 12:21:53 +03:00
Aemeath f2b5ba101b Dawnline 0.16.2
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- The personal page switches to a renewed HTTPS certificate on its own:
  after ACME issues or renews one, the page restarts with it instead of
  serving the old certificate until Dawnline restarts
2026-10-26 07:39:32 +03:00
Aemeath 0fd22b917a Dawnline 0.16.1
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- Checking one component for updates in Components no longer fails
  with "XHR request timed out": the check starts at once instead of
  keeping the page waiting twenty seconds
- On a router without curl, updates and the installer download release
  files through GitHub's API: GitHub's own download links can make
  OpenWrt's built-in downloader hang
- Adding a device in the admin offers the same four types as the
  personal page: PC, Mobile, Router and Other (phones and tablets are
  one choice)
2026-10-26 06:41:54 +03:00
51 changed files with 631 additions and 312 deletions

No files matched your search

+1 -1
View File
@@ -64,7 +64,7 @@ follows a modern design.
sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)" sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)"
``` ```
2. **Set up** in LuCI: <kbd>Network</kbd> › <kbd>Dawnline</kbd>, and follow the 2. **Set up** in LuCI: <kbd>Services</kbd> › <kbd>Dawnline</kbd>, and follow the
wizard. It suggests the port, the public address and the networks. wizard. It suggests the port, the public address and the networks.
3. **Invite** someone: <kbd>Add person</kbd>, then send them the link or the 3. **Invite** someone: <kbd>Add person</kbd>, then send them the link or the
invite card with its QR code. They do the rest. invite card with its QR code. They do the rest.
+1 -1
View File
@@ -65,7 +65,7 @@ Dawnline запускает сервер [AmneziaWG] на вашем роуте
sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)" sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)"
``` ```
2. **Настройте** в LuCI: <kbd>Network</kbd> › <kbd>Dawnline</kbd>, дальше по 2. **Настройте** в LuCI: <kbd>Services</kbd> › <kbd>Dawnline</kbd>, дальше по
мастеру. Он предложит порт, публичный адрес и сети. мастеру. Он предложит порт, публичный адрес и сети.
3. **Пригласите** человека: <kbd>Добавить человека</kbd>, затем отправьте ему 3. **Пригласите** человека: <kbd>Добавить человека</kbd>, затем отправьте ему
ссылку или карточку приглашения с QR-кодом. Остальное он сделает сам. ссылку или карточку приглашения с QR-кодом. Остальное он сделает сам.
+33 -15
View File
@@ -487,18 +487,19 @@ check_tools() {
# ---------- downloads ---------- # ---------- downloads ----------
# fetch_once URL FILE [SECONDS] # fetch_once URL FILE [SECONDS] [ACCEPT]
fetch_once() { fetch_once() {
_fu="$1" _fu="$1"
_fd="$2" _fd="$2"
_ft="${3:-$DOWNLOAD_TIMEOUT}" _ft="${3:-$DOWNLOAD_TIMEOUT}"
_fa="${4:-}"
rm -f "$_fd" rm -f "$_fd"
case "$FETCHER" in case "$FETCHER" in
curl) curl)
run_logged download curl -fsSL --connect-timeout "$CONNECT_TIMEOUT" --max-time "$_ft" \ run_logged download curl -fsSL --connect-timeout "$CONNECT_TIMEOUT" --max-time "$_ft" \
--speed-limit 1024 --speed-time 30 -o "$_fd" "$_fu" --speed-limit 1024 --speed-time 30 ${_fa:+-H "Accept: $_fa"} -o "$_fd" "$_fu"
;; ;;
*) run_logged download "$FETCHER" -q -T "$CONNECT_TIMEOUT" -O "$_fd" "$_fu" ;; *) run_logged download "$FETCHER" -q -T "$CONNECT_TIMEOUT" ${_fa:+--header="Accept: $_fa"} -O "$_fd" "$_fu" ;;
esac esac
_frc=$? _frc=$?
[ "$_frc" -eq 0 ] && [ -s "$_fd" ] && return 0 [ "$_frc" -eq 0 ] && [ -s "$_fd" ] && return 0
@@ -531,16 +532,29 @@ asset_digest() {
jsonfilter -i "$1" -e "@.assets[@.name='$2'].digest" 2>/dev/null | head -n 1 | sed -n 's/^sha256:\([0-9a-f]\{64\}\)$/\1/p' jsonfilter -i "$1" -e "@.assets[@.name='$2'].digest" 2>/dev/null | head -n 1 | sed -n 's/^sha256:\([0-9a-f]\{64\}\)$/\1/p'
} }
# download URL FILE LABEL [SHA256]: direct, then (only when the sha256 is # A release file's URL in the GitHub API, from release JSON (empty if unknown).
# known) two mirrors, then direct again. A file whose sha256 doesn't match is # Asked for application/octet-stream, it answers with the file itself.
# thrown away and the next source is tried; without a sha256 only GitHub asset_api_url() {
# itself is used. [ -s "$1" ] || return 0
jsonfilter -i "$1" -e "@.assets[@.name='$2'].url" 2>/dev/null | head -n 1 |
sed -n 's#^\(https://api\.github\.com/repos/[^/]*/[^/]*/releases/assets/[0-9][0-9]*\)$#\1#p'
}
# download URL FILE LABEL [SHA256] [API_URL]: without curl the API's URL
# first (github.com's redirect carries a Content-Security-Policy header that
# can outgrow uclient-fetch's 4 KB line buffer, and it stalls there), then
# direct, then (only when the sha256 is known) two mirrors, then direct again.
# A file whose sha256 doesn't match is thrown away and the next source is
# tried; without a sha256 only GitHub itself is used.
download() { download() {
_du="$1" _du="$1"
_dd="$2" _dd="$2"
_dl="$3" _dl="$3"
_dw="${4:-}" _dw="${4:-}"
_da="${5:-}"
[ "$FETCHER" != curl ] || _da=""
set -- "$_du" set -- "$_du"
[ -z "$_da" ] || set -- "$_da" "$_du"
if [ -n "$_dw" ]; then if [ -n "$_dw" ]; then
for _m in $MIRRORS; do set -- "$@" "$_m$_du"; done for _m in $MIRRORS; do set -- "$@" "$_m$_du"; done
fi fi
@@ -555,7 +569,9 @@ download() {
sleep 2 sleep 2
msg "Downloading $_dl via $(host_of "$_try") (attempt $_n/$_total)" msg "Downloading $_dl via $(host_of "$_try") (attempt $_n/$_total)"
fi fi
if fetch_once "$_try" "$_dd"; then _acc=""
[ "$_try" != "$_da" ] || _acc="application/octet-stream"
if fetch_once "$_try" "$_dd" "" "$_acc"; then
if [ -n "$_dw" ] && [ "$(sha256sum "$_dd" 2>/dev/null | awk '{ print $1 }')" != "$_dw" ]; then if [ -n "$_dw" ] && [ "$(sha256sum "$_dd" 2>/dev/null | awk '{ print $1 }')" != "$_dw" ]; then
warn "$(host_of "$_try") sent a file that doesn't match GitHub's sha256: discarded" warn "$(host_of "$_try") sent a file that doesn't match GitHub's sha256: discarded"
rm -f "$_dd" rm -f "$_dd"
@@ -1118,10 +1134,11 @@ confirm() {
download_release_file() { download_release_file() {
_name="$1" _name="$1"
_sums="$TMP_DIR/sha256sums.txt" _sums="$TMP_DIR/sha256sums.txt"
# The checksum: GitHub's own (API), else the release's sha256sums.txt straight from github.com. # The checksum: GitHub's own (API), else the release's sha256sums.txt straight from GitHub.
_want="$(asset_digest "$TMP_DIR/release.json" "$_name")" _want="$(asset_digest "$TMP_DIR/release.json" "$_name")"
if [ -z "$_want" ]; then if [ -z "$_want" ]; then
[ -s "$_sums" ] || download "$ASSET_BASE/sha256sums.txt" "$_sums" sha256sums.txt || { [ -s "$_sums" ] || download "$ASSET_BASE/sha256sums.txt" "$_sums" sha256sums.txt "" \
"$(asset_api_url "$TMP_DIR/release.json" sha256sums.txt)" || {
err "Download failed: sha256sums.txt (does release $VERSION exist?)" err "Download failed: sha256sums.txt (does release $VERSION exist?)"
return 1 return 1
} }
@@ -1131,7 +1148,7 @@ download_release_file() {
return 1 return 1
} }
fi fi
download "$ASSET_BASE/$_name" "$TMP_DIR/$_name" "$_name" "$_want" || { download "$ASSET_BASE/$_name" "$TMP_DIR/$_name" "$_name" "$_want" "$(asset_api_url "$TMP_DIR/release.json" "$_name")" || {
err "Download failed: $_name" err "Download failed: $_name"
return 1 return 1
} }
@@ -1158,7 +1175,8 @@ download_awg() {
_f="$TMP_DIR/$_p$_pf" _f="$TMP_DIR/$_p$_pf"
# Verified when GitHub publishes the file's sha256 (then mirrors may serve it). # Verified when GitHub publishes the file's sha256 (then mirrors may serve it).
_want="$(asset_digest "$TMP_DIR/awg-$_s.json" "$_p$_pf")" _want="$(asset_digest "$TMP_DIR/awg-$_s.json" "$_p$_pf")"
if download "https://github.com/$_repo/releases/download/v$OWRT_RELEASE/$_p$_pf" "$_f" "$_p ($_repo)" "$_want" && if download "https://github.com/$_repo/releases/download/v$OWRT_RELEASE/$_p$_pf" "$_f" "$_p ($_repo)" "$_want" \
"$(asset_api_url "$TMP_DIR/awg-$_s.json" "$_p$_pf")" &&
verify_archive "$_f"; then verify_archive "$_f"; then
_files="$_files $_f" _files="$_files $_f"
else else
@@ -1425,7 +1443,7 @@ on_pipe() {
lan_url() { lan_url() {
_ip="$(uci -q get network.lan.ipaddr 2>/dev/null | cut -d/ -f1 | awk '{ print $1 }')" _ip="$(uci -q get network.lan.ipaddr 2>/dev/null | cut -d/ -f1 | awk '{ print $1 }')"
[ -n "$_ip" ] || _ip="192.168.1.1" [ -n "$_ip" ] || _ip="192.168.1.1"
printf 'http://%s/cgi-bin/luci/admin/network/dawnline/server' "$_ip" printf 'http://%s/cgi-bin/luci/admin/services/dawnline/server' "$_ip"
} }
main() { main() {
@@ -1495,9 +1513,9 @@ main() {
msg "Log: $LOG_FILE" msg "Log: $LOG_FILE"
msg "Recovery snapshot: $SNAPSHOT_DIR" msg "Recovery snapshot: $SNAPSHOT_DIR"
if [ "$MODE" = install ]; then if [ "$MODE" = install ]; then
msg "Open LuCI → Network → Dawnline and run the setup wizard:" msg "Open LuCI → Services → Dawnline and run the setup wizard:"
else else
msg "Open LuCI → Network → Dawnline:" msg "Open LuCI → Services → Dawnline:"
fi fi
msg " $(lan_url)" msg " $(lan_url)"
awg_netifd_restart awg_netifd_restart
+1 -1
View File
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dawnline PKG_NAME:=luci-app-dawnline
PKG_VERSION:=0.16.0 PKG_VERSION:=0.16.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
# po/<lang>/dawnline.po becomes luci-i18n-dawnline-<lang> (luci.mk), released # po/<lang>/dawnline.po becomes luci-i18n-dawnline-<lang> (luci.mk), released
+135
View File
@@ -1239,6 +1239,13 @@ msgstr "Срок доступа"
msgid "Access ends %s" msgid "Access ends %s"
msgstr "Окончание доступа: %s" msgstr "Окончание доступа: %s"
#: web/src/admin/events/render.ts
msgid "Access ends in %s day"
msgid_plural "Access ends in %s days"
msgstr[0] "Доступ закончится через %s день"
msgstr[1] "Доступ закончится через %s дня"
msgstr[2] "Доступ закончится через %s дней"
#: web/src/admin/netcheck.ts #: web/src/admin/netcheck.ts
msgid "Access ends in %s day (%s)." msgid "Access ends in %s day (%s)."
msgid_plural "Access ends in %s days (%s)." msgid_plural "Access ends in %s days (%s)."
@@ -1246,6 +1253,10 @@ msgstr[0] "Доступ закончится через %s день (%s)."
msgstr[1] "Доступ закончится через %s дня (%s)." msgstr[1] "Доступ закончится через %s дня (%s)."
msgstr[2] "Доступ закончится через %s дней (%s)." msgstr[2] "Доступ закончится через %s дней (%s)."
#: web/src/admin/events/render.ts
msgid "Access ends in a few days"
msgstr "Доступ закончится через несколько дней"
#: web/src/admin/netcheck.ts #: web/src/admin/netcheck.ts
msgid "Access ends today (%s)." msgid "Access ends today (%s)."
msgstr "Доступ закончится сегодня (%s)." msgstr "Доступ закончится сегодня (%s)."
@@ -1254,6 +1265,22 @@ msgstr "Доступ закончится сегодня (%s)."
msgid "Access must be lan, internet or both." msgid "Access must be lan, internet or both."
msgstr "Доступ должен быть lan, internet или both." msgstr "Доступ должен быть lan, internet или both."
#: web/src/admin/events/render.ts
msgid "Access paused"
msgstr "Доступ на паузе"
#: web/src/admin/events/render.ts
msgid "Access paused - %s"
msgstr "Доступ на паузе: %s"
#: web/src/admin/events/render.ts
msgid "Access resumed"
msgstr "Доступ возобновлён"
#: web/src/admin/events/render.ts
msgid "Access resumed - %s"
msgstr "Доступ возобновлён: %s"
#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent #: package/luci-app-dawnline/root/usr/libexec/dawnline/agent
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc
@@ -1441,6 +1468,10 @@ msgstr "Все проверки пройдены."
msgid "All components" msgid "All components"
msgstr "Все компоненты" msgstr "Все компоненты"
#: web/src/admin/events/render.ts
msgid "All devices removed, end date reached"
msgstr "Все устройства удалены: срок доступа закончился"
#: web/src/admin/pages/overview.ts #: web/src/admin/pages/overview.ts
msgid "All good. Nothing needs you right now." msgid "All good. Nothing needs you right now."
msgstr "Всё в порядке. Сейчас ничего не требует вашего внимания." msgstr "Всё в порядке. Сейчас ничего не требует вашего внимания."
@@ -2579,6 +2610,18 @@ msgstr "Сведения"
msgid "Device" msgid "Device"
msgstr "Устройство" msgstr "Устройство"
#: web/src/admin/events/render.ts
msgid "Device %s added"
msgstr "Устройство %s добавлено"
#: web/src/admin/events/render.ts
msgid "Device %s added on the portal"
msgstr "Устройство %s добавлено через портал"
#: web/src/admin/events/render.ts
msgid "Device %s changed"
msgstr "Устройство %s: настройки изменены"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Device %s changed network %s" msgid "Device %s changed network %s"
msgstr "Устройство %s сменило сеть %s" msgstr "Устройство %s сменило сеть %s"
@@ -2643,6 +2686,30 @@ msgstr "Устройство %s (%s): публичный ключ некорре
msgid "Device %s of %s: the public key is the server's own." msgid "Device %s of %s: the public key is the server's own."
msgstr "Устройство %s (%s): публичный ключ совпадает с ключом сервера." msgstr "Устройство %s (%s): публичный ключ совпадает с ключом сервера."
#: web/src/admin/events/render.ts
msgid "Device %s removed"
msgstr "Устройство %s удалено"
#: web/src/admin/events/render.ts
msgid "Device %s removed on the portal"
msgstr "Устройство %s удалено через портал"
#: web/src/admin/events/render.ts
msgid "Device %s renamed"
msgstr "Устройство %s: название изменено"
#: web/src/admin/events/render.ts
msgid "Device %s renamed on the portal"
msgstr "Устройство %s: название изменено через портал"
#: web/src/admin/events/render.ts
msgid "Device %s turned off"
msgstr "Устройство %s выключено"
#: web/src/admin/events/render.ts
msgid "Device %s turned on"
msgstr "Устройство %s включено"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Device %s went offline" msgid "Device %s went offline"
msgstr "Устройство %s отключилось" msgstr "Устройство %s отключилось"
@@ -2935,6 +3002,10 @@ msgstr "Дата окончания"
msgid "End date must be YYYY-MM-DD." msgid "End date must be YYYY-MM-DD."
msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД." msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД."
#: web/src/admin/events/render.ts
msgid "End date passed (%s) · access kept"
msgstr "Срок доступа закончился (%s) · доступ сохранён"
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc
msgid "End dates and quotas use the router clock." msgid "End dates and quotas use the router clock."
msgstr "Даты окончания и лимиты трафика считаются по часам роутера." msgstr "Даты окончания и лимиты трафика считаются по часам роутера."
@@ -4099,6 +4170,10 @@ msgstr "Метод не поддерживается."
msgid "Missing: %s." msgid "Missing: %s."
msgstr "Не хватает: %s." msgstr "Не хватает: %s."
#: web/src/shared/format.ts
msgid "Mobile"
msgstr "Мобильный"
#: web/src/admin/pages/person/limits.ts #: web/src/admin/pages/person/limits.ts
msgid "Monthly" msgid "Monthly"
msgstr "В месяц" msgstr "В месяц"
@@ -4278,6 +4353,10 @@ msgstr "Ключи обновлены %s"
msgid "New keys generated" msgid "New keys generated"
msgstr "Новые ключи созданы" msgstr "Новые ключи созданы"
#: web/src/admin/events/render.ts
msgid "New keys issued for device %s on the portal"
msgstr "Для устройства %s выпущены новые ключи через портал"
#: web/src/admin/pages/person/header.ts #: web/src/admin/pages/person/header.ts
msgid "New link" msgid "New link"
msgstr "Новая ссылка" msgstr "Новая ссылка"
@@ -5071,6 +5150,10 @@ msgstr "%s: удалено устройство %s"
msgid "Person %s removed device %s on their portal" msgid "Person %s removed device %s on their portal"
msgstr "%s: удалено устройство %s через портал" msgstr "%s: удалено устройство %s через портал"
#: web/src/admin/events/render.ts
msgid "Person %s renamed device %s on their portal"
msgstr "Пользователь %s изменил название устройства %s в личном портале"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Person %s resumed" msgid "Person %s resumed"
msgstr "%s: доступ возобновлён" msgstr "%s: доступ возобновлён"
@@ -7334,6 +7417,10 @@ msgstr "Вы"
msgid "You added circle %s" msgid "You added circle %s"
msgstr "Вы добавили круг %s" msgstr "Вы добавили круг %s"
#: web/src/admin/events/render.ts
msgid "You added device %s"
msgstr "Вы добавили устройство %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You added device %s for %s" msgid "You added device %s for %s"
msgstr "Вы добавили устройство %s (%s)" msgstr "Вы добавили устройство %s (%s)"
@@ -7342,10 +7429,18 @@ msgstr "Вы добавили устройство %s (%s)"
msgid "You added person %s" msgid "You added person %s"
msgstr "Вы добавили человека %s" msgstr "Вы добавили человека %s"
#: web/src/admin/events/render.ts
msgid "You added this person"
msgstr "Вы добавили этого человека"
#: web/src/admin/events/model.ts #: web/src/admin/events/model.ts
msgid "You changed circle %s" msgid "You changed circle %s"
msgstr "Вы изменили круг %s" msgstr "Вы изменили круг %s"
#: web/src/admin/events/render.ts
msgid "You changed device %s"
msgstr "Вы изменили устройство %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You changed device %s of %s" msgid "You changed device %s of %s"
msgstr "Вы изменили устройство %s (%s)" msgstr "Вы изменили устройство %s (%s)"
@@ -7358,6 +7453,10 @@ msgstr "Вы изменили настройки: %s"
msgid "You changed server %s" msgid "You changed server %s"
msgstr "Вы изменили сервер %s" msgstr "Вы изменили сервер %s"
#: web/src/admin/events/render.ts
msgid "You changed settings"
msgstr "Вы изменили настройки"
#: web/src/admin/events/model.ts #: web/src/admin/events/model.ts
msgid "You changed the personal portal" msgid "You changed the personal portal"
msgstr "Вы изменили настройки личного портала" msgstr "Вы изменили настройки личного портала"
@@ -7386,10 +7485,22 @@ msgstr "Вы импортировали настройки из файла"
msgid "You issued a new link for person %s" msgid "You issued a new link for person %s"
msgstr "Вы выпустили новую личную ссылку: %s" msgstr "Вы выпустили новую личную ссылку: %s"
#: web/src/admin/events/render.ts
msgid "You issued a new personal link"
msgstr "Вы выпустили новую личную ссылку"
#: web/src/admin/events/render.ts
msgid "You issued new keys for device %s"
msgstr "Вы выпустили новые ключи для устройства %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You issued new keys for device %s of %s" msgid "You issued new keys for device %s of %s"
msgstr "Вы выпустили новые ключи для устройства %s (%s)" msgstr "Вы выпустили новые ключи для устройства %s (%s)"
#: web/src/admin/events/render.ts
msgid "You paused access"
msgstr "Вы приостановили доступ"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You paused person %s" msgid "You paused person %s"
msgstr "Вы приостановили доступ: %s" msgstr "Вы приостановили доступ: %s"
@@ -7398,6 +7509,10 @@ msgstr "Вы приостановили доступ: %s"
msgid "You removed circle %s" msgid "You removed circle %s"
msgstr "Вы удалили круг %s" msgstr "Вы удалили круг %s"
#: web/src/admin/events/render.ts
msgid "You removed device %s"
msgstr "Вы удалили устройство %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You removed device %s from %s" msgid "You removed device %s from %s"
msgstr "Вы удалили устройство %s (%s)" msgstr "Вы удалили устройство %s (%s)"
@@ -7410,6 +7525,14 @@ msgstr "Вы удалили человека %s"
msgid "You removed server %s" msgid "You removed server %s"
msgstr "Вы удалили сервер %s" msgstr "Вы удалили сервер %s"
#: web/src/admin/events/render.ts
msgid "You removed this person"
msgstr "Вы удалили этого человека"
#: web/src/admin/events/render.ts
msgid "You renamed device %s"
msgstr "Вы изменили название устройства %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You renamed device %s of %s" msgid "You renamed device %s of %s"
msgstr "Вы переименовали устройство %s (%s)" msgstr "Вы переименовали устройство %s (%s)"
@@ -7430,10 +7553,18 @@ msgstr "Вы восстановили резервную копию из фай
msgid "You restored backup %s" msgid "You restored backup %s"
msgstr "Вы восстановили резервную копию %s" msgstr "Вы восстановили резервную копию %s"
#: web/src/admin/events/render.ts
msgid "You resumed access"
msgstr "Вы возобновили доступ"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You resumed person %s" msgid "You resumed person %s"
msgstr "Вы возобновили доступ: %s" msgstr "Вы возобновили доступ: %s"
#: web/src/admin/events/render.ts
msgid "You turned off device %s"
msgstr "Вы выключили устройство %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You turned off device %s of %s" msgid "You turned off device %s of %s"
msgstr "Вы выключили устройство %s (%s)" msgstr "Вы выключили устройство %s (%s)"
@@ -7450,6 +7581,10 @@ msgstr "Вы выключили личный портал"
msgid "You turned off the watchdog" msgid "You turned off the watchdog"
msgstr "Вы выключили автовосстановление" msgstr "Вы выключили автовосстановление"
#: web/src/admin/events/render.ts
msgid "You turned on device %s"
msgstr "Вы включили устройство %s"
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You turned on device %s of %s" msgid "You turned on device %s of %s"
msgstr "Вы включили устройство %s (%s)" msgstr "Вы включили устройство %s (%s)"
@@ -1187,12 +1187,22 @@ msgstr ""
msgid "Access ends %s" msgid "Access ends %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "Access ends in %s day"
msgid_plural "Access ends in %s days"
msgstr[0] ""
msgstr[1] ""
#: web/src/admin/netcheck.ts #: web/src/admin/netcheck.ts
msgid "Access ends in %s day (%s)." msgid "Access ends in %s day (%s)."
msgid_plural "Access ends in %s days (%s)." msgid_plural "Access ends in %s days (%s)."
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: web/src/admin/events/render.ts
msgid "Access ends in a few days"
msgstr ""
#: web/src/admin/netcheck.ts #: web/src/admin/netcheck.ts
msgid "Access ends today (%s)." msgid "Access ends today (%s)."
msgstr "" msgstr ""
@@ -1201,6 +1211,22 @@ msgstr ""
msgid "Access must be lan, internet or both." msgid "Access must be lan, internet or both."
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "Access paused"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Access paused - %s"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Access resumed"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Access resumed - %s"
msgstr ""
#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent #: package/luci-app-dawnline/root/usr/libexec/dawnline/agent
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc
@@ -1387,6 +1413,10 @@ msgstr ""
msgid "All components" msgid "All components"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "All devices removed, end date reached"
msgstr ""
#: web/src/admin/pages/overview.ts #: web/src/admin/pages/overview.ts
msgid "All good. Nothing needs you right now." msgid "All good. Nothing needs you right now."
msgstr "" msgstr ""
@@ -2523,6 +2553,18 @@ msgstr ""
msgid "Device" msgid "Device"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s added"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s added on the portal"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s changed"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Device %s changed network %s" msgid "Device %s changed network %s"
msgstr "" msgstr ""
@@ -2587,6 +2629,30 @@ msgstr ""
msgid "Device %s of %s: the public key is the server's own." msgid "Device %s of %s: the public key is the server's own."
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s removed"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s removed on the portal"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s renamed"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s renamed on the portal"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s turned off"
msgstr ""
#: web/src/admin/events/render.ts
msgid "Device %s turned on"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Device %s went offline" msgid "Device %s went offline"
msgstr "" msgstr ""
@@ -2879,6 +2945,10 @@ msgstr ""
msgid "End date must be YYYY-MM-DD." msgid "End date must be YYYY-MM-DD."
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "End date passed (%s) · access kept"
msgstr ""
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc
msgid "End dates and quotas use the router clock." msgid "End dates and quotas use the router clock."
msgstr "" msgstr ""
@@ -4043,6 +4113,10 @@ msgstr ""
msgid "Missing: %s." msgid "Missing: %s."
msgstr "" msgstr ""
#: web/src/shared/format.ts
msgid "Mobile"
msgstr ""
#: web/src/admin/pages/person/limits.ts #: web/src/admin/pages/person/limits.ts
msgid "Monthly" msgid "Monthly"
msgstr "" msgstr ""
@@ -4222,6 +4296,10 @@ msgstr ""
msgid "New keys generated" msgid "New keys generated"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "New keys issued for device %s on the portal"
msgstr ""
#: web/src/admin/pages/person/header.ts #: web/src/admin/pages/person/header.ts
msgid "New link" msgid "New link"
msgstr "" msgstr ""
@@ -5013,6 +5091,10 @@ msgstr ""
msgid "Person %s removed device %s on their portal" msgid "Person %s removed device %s on their portal"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "Person %s renamed device %s on their portal"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "Person %s resumed" msgid "Person %s resumed"
msgstr "" msgstr ""
@@ -7266,6 +7348,10 @@ msgstr ""
msgid "You added circle %s" msgid "You added circle %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You added device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You added device %s for %s" msgid "You added device %s for %s"
msgstr "" msgstr ""
@@ -7274,10 +7360,18 @@ msgstr ""
msgid "You added person %s" msgid "You added person %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You added this person"
msgstr ""
#: web/src/admin/events/model.ts #: web/src/admin/events/model.ts
msgid "You changed circle %s" msgid "You changed circle %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You changed device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You changed device %s of %s" msgid "You changed device %s of %s"
msgstr "" msgstr ""
@@ -7290,6 +7384,10 @@ msgstr ""
msgid "You changed server %s" msgid "You changed server %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You changed settings"
msgstr ""
#: web/src/admin/events/model.ts #: web/src/admin/events/model.ts
msgid "You changed the personal portal" msgid "You changed the personal portal"
msgstr "" msgstr ""
@@ -7318,10 +7416,22 @@ msgstr ""
msgid "You issued a new link for person %s" msgid "You issued a new link for person %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You issued a new personal link"
msgstr ""
#: web/src/admin/events/render.ts
msgid "You issued new keys for device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You issued new keys for device %s of %s" msgid "You issued new keys for device %s of %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You paused access"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You paused person %s" msgid "You paused person %s"
msgstr "" msgstr ""
@@ -7330,6 +7440,10 @@ msgstr ""
msgid "You removed circle %s" msgid "You removed circle %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You removed device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You removed device %s from %s" msgid "You removed device %s from %s"
msgstr "" msgstr ""
@@ -7342,6 +7456,14 @@ msgstr ""
msgid "You removed server %s" msgid "You removed server %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You removed this person"
msgstr ""
#: web/src/admin/events/render.ts
msgid "You renamed device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You renamed device %s of %s" msgid "You renamed device %s of %s"
msgstr "" msgstr ""
@@ -7362,10 +7484,18 @@ msgstr ""
msgid "You restored backup %s" msgid "You restored backup %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You resumed access"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You resumed person %s" msgid "You resumed person %s"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You turned off device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You turned off device %s of %s" msgid "You turned off device %s of %s"
msgstr "" msgstr ""
@@ -7382,6 +7512,10 @@ msgstr ""
msgid "You turned off the watchdog" msgid "You turned off the watchdog"
msgstr "" msgstr ""
#: web/src/admin/events/render.ts
msgid "You turned on device %s"
msgstr ""
#: web/src/admin/events/render.ts #: web/src/admin/events/render.ts
msgid "You turned on device %s of %s" msgid "You turned on device %s of %s"
msgstr "" msgstr ""
@@ -77,4 +77,8 @@ reload_service() {
service_triggers() { service_triggers() {
procd_add_reload_trigger dawnline procd_add_reload_trigger dawnline
# The portal's uhttpd reads its certificate once: an issued or renewed one needs a
# reload (procd restarts the portal alone, its cert file having changed).
procd_add_raw_trigger acme.issue 5000 /etc/init.d/dawnline reload
procd_add_raw_trigger acme.renew 5000 /etc/init.d/dawnline reload
} }
@@ -360,7 +360,7 @@ let LOCK = null;
for (let i = 0; i < 10 && !LOCK; i++) { for (let i = 0; i < 10 && !LOCK; i++) {
LOCK = upd.try_lock(); LOCK = upd.try_lock();
if (!LOCK) if (!LOCK)
system('usleep 100000 2>/dev/null || sleep 1'); sleep(100);
} }
if (!LOCK) if (!LOCK)
exit(0); exit(0);
@@ -1,10 +1,10 @@
{ {
"admin/network/dawnline": { "admin/services/dawnline": {
"title": "Dawnline", "title": "Dawnline",
"order": 65, "order": 65,
"action": { "action": {
"type": "alias", "type": "alias",
"path": "admin/network/dawnline/server" "path": "admin/services/dawnline/server"
}, },
"depends": { "depends": {
"acl": [ "acl": [
@@ -15,31 +15,31 @@
} }
} }
}, },
"admin/network/dawnline/overview": { "admin/services/dawnline/overview": {
"action": { "action": {
"type": "view", "type": "view",
"path": "dawnline/server" "path": "dawnline/server"
} }
}, },
"admin/network/dawnline/people": { "admin/services/dawnline/people": {
"action": { "action": {
"type": "view", "type": "view",
"path": "dawnline/people" "path": "dawnline/people"
} }
}, },
"admin/network/dawnline/activity": { "admin/services/dawnline/activity": {
"action": { "action": {
"type": "view", "type": "view",
"path": "dawnline/activity" "path": "dawnline/activity"
} }
}, },
"admin/network/dawnline/person": { "admin/services/dawnline/person": {
"action": { "action": {
"type": "view", "type": "view",
"path": "dawnline/person" "path": "dawnline/person"
} }
}, },
"admin/network/dawnline/server": { "admin/services/dawnline/server": {
"title": "Servers", "title": "Servers",
"order": 10, "order": 10,
"action": { "action": {
@@ -47,7 +47,7 @@
"path": "dawnline/server" "path": "dawnline/server"
} }
}, },
"admin/network/dawnline/diagnostics": { "admin/services/dawnline/diagnostics": {
"title": "Diagnostics", "title": "Diagnostics",
"order": 40, "order": 40,
"action": { "action": {
@@ -55,13 +55,13 @@
"path": "dawnline/diagnostics" "path": "dawnline/diagnostics"
} }
}, },
"admin/network/dawnline/health": { "admin/services/dawnline/health": {
"action": { "action": {
"type": "view", "type": "view",
"path": "dawnline/health" "path": "dawnline/health"
} }
}, },
"admin/network/dawnline/settings": { "admin/services/dawnline/settings": {
"title": "Settings", "title": "Settings",
"order": 60, "order": 60,
"action": { "action": {
@@ -69,7 +69,7 @@
"path": "dawnline/settings" "path": "dawnline/settings"
} }
}, },
"admin/network/dawnline/updates": { "admin/services/dawnline/updates": {
"title": "Components", "title": "Components",
"order": 70, "order": 70,
"action": { "action": {
@@ -79,14 +79,17 @@ function cached(key, ttl, fn) {
/* ---------- releases ---------- */ /* ---------- releases ---------- */
function slim(x) { function slim(x) {
let digests = {}; let digests = {}, ids = {};
for (let a in x.assets ?? []) for (let a in x.assets ?? []) {
if (match(a.digest ?? '', /^sha256:[0-9a-f]{64}$/)) if (match(a.digest ?? '', /^sha256:[0-9a-f]{64}$/))
digests[a.name] = substr(a.digest, 7); digests[a.name] = substr(a.digest, 7);
if (type(a.id) == 'int' && a.id > 0)
ids[a.name] = a.id;
}
return { return {
tag: x.tag_name, name: x.name ?? x.tag_name, published: x.published_at ?? null, tag: x.tag_name, name: x.name ?? x.tag_name, published: x.published_at ?? null,
prerelease: !!x.prerelease, url: x.html_url ?? null, body: substr(x.body ?? '', 0, 12000), prerelease: !!x.prerelease, url: x.html_url ?? null, body: substr(x.body ?? '', 0, 12000),
assets: map(x.assets ?? [], (a) => a.name), digests, assets: map(x.assets ?? [], (a) => a.name), digests, ids,
}; };
} }
@@ -194,6 +197,25 @@ export function sha256(path) {
return match(run(`sha256sum ${q(path)}`).out, /^([0-9a-f]{64})/)?.[1]; return match(run(`sha256sum ${q(path)}`).out, /^([0-9a-f]{64})/)?.[1];
}; };
/** A release file's URL on github.com in parts: { repo, tag, name }, or null for any other URL. */
export function release_file(url) {
let m = match(url ?? '', /^https:\/\/github\.com\/([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)\/releases\/download\/([^\/?#]+)\/([^\/?#]+)$/);
return m ? { repo: m[1], tag: m[2], name: m[3] } : null;
};
/** The same file through the API (api.github.com), when its release is known; else null. */
function asset_api_url(url) {
let f = release_file(url);
if (!f)
return null;
let id = null;
try {
id = release(f.repo, f.tag)?.ids?.[f.name];
}
catch (e) {}
return id ? `https://api.github.com/repos/${f.repo}/releases/assets/${id}` : null;
}
/** /**
* Download to a file. o: { sha256, mirrors, log }. Direct first; mirrors * Download to a file. o: { sha256, mirrors, log }. Direct first; mirrors
* only when the sha256 is known (from the API) and mirrors are allowed. A * only when the sha256 is known (from the API) and mirrors are allowed. A
@@ -203,24 +225,32 @@ export function sha256(path) {
export function download(url, dest, o) { export function download(url, dest, o) {
o ??= {}; o ??= {};
let want = o.sha256 ? lc(o.sha256) : null; let want = o.sha256 ? lc(o.sha256) : null;
let tries = [ url ]; let curl = have_curl();
let tries = [];
// Without curl a release file comes through the API first: github.com's redirect to it carries a
// Content-Security-Policy header that can outgrow uclient-fetch's 4 KB line buffer, and it stalls there.
let api = curl ? null : asset_api_url(url);
if (api)
push(tries, { u: api, accept: 'application/octet-stream' });
push(tries, { u: url });
let direct = length(tries);
if (want && o.mirrors && match(url, /^https:\/\/(github\.com|raw\.githubusercontent\.com)\//)) if (want && o.mirrors && match(url, /^https:\/\/(github\.com|raw\.githubusercontent\.com)\//))
for (let m in MIRRORS) for (let m in MIRRORS)
push(tries, m + url); push(tries, { u: m + url, mirror: true });
for (let i, u in tries) { for (let i, t in tries) {
let host = replace(u, /^https:\/\/([^\/]+)\/.*$/, '$1'); let host = replace(t.u, /^https:\/\/([^\/]+)\/.*$/, '$1');
if (i > 0) if (t.mirror)
o.log?.(sprintf(_('Trying mirror %s'), host)); o.log?.(sprintf(_('Trying mirror %s'), host));
let r = have_curl() let r = curl
? run(`curl -fsSL --connect-timeout 15 --max-time 300 --retry 1 -o ${q(dest)} ${q(u)}`) ? run(`curl -fsSL --connect-timeout 15 --max-time 300 --retry 1 -o ${q(dest)} ${q(t.u)}`)
: run(`uclient-fetch -q -T 30 -O ${q(dest)} ${q(u)}`); : run(`uclient-fetch -q -T 30 ${t.accept ? `--header=${q('Accept: ' + t.accept)} ` : ''}-O ${q(dest)} ${q(t.u)}`);
if (r.code == 0 && (stat(dest)?.size ?? 0) > 0) { if (r.code == 0 && (stat(dest)?.size ?? 0) > 0) {
if (!want || sha256(dest) == want) if (!want || sha256(dest) == want)
return u; return t.u;
o.log?.(sprintf(_("Warning: %s sent a file that does not match GitHub's sha256, discarded"), host)); o.log?.(sprintf(_("Warning: %s sent a file that does not match GitHub's sha256, discarded"), host));
} }
system(`rm -f ${q(dest)}`); system(`rm -f ${q(dest)}`);
if (i == 0 && length(tries) > 1) if (i == direct - 1 && length(tries) > direct)
o.log?.(_('GitHub did not answer, trying mirrors')); o.log?.(_('GitHub did not answer, trying mirrors'));
} }
return null; return null;
@@ -80,7 +80,7 @@ function releases(a) {
let page = +(a.page ?? 1); let page = +(a.page ?? 1);
if (page != int(page) || page < 1 || page > 50) if (page != int(page) || page < 1 || page > 50)
die(_('Unknown page.')); die(_('Unknown page.'));
return { releases: map(gh.releases(REPO, page), (x) => ({ ...x, body: null, digests: null })), page }; return { releases: map(gh.releases(REPO, page), (x) => ({ ...x, body: null, digests: null, ids: null })), page };
} }
/** Release notes for What's new: Dawnline by tag, or an AmneziaWG build's release. */ /** Release notes for What's new: Dawnline by tag, or an AmneziaWG build's release. */
@@ -94,7 +94,7 @@ function notes(a) {
r = gh.release(rp, `v${tag}`); r = gh.release(rp, `v${tag}`);
if (!r) if (!r)
die(sprintf(_('No release %s in %s.'), tag, rp)); die(sprintf(_('No release %s in %s.'), tag, rp));
return { ...r, digests: null, repo: rp }; return { ...r, digests: null, ids: null, repo: rp };
} }
/** What changed between the installed Dawnline and a release (points for the Components tab). */ /** What changed between the installed Dawnline and a release (points for the Components tab). */
@@ -111,8 +111,10 @@ function changes(a) {
} }
/** /**
* Start an update job. Returns the new job once its worker has written it, * Start an update job. Returns the new job once its worker has written it
* else null (the caller follows updates_status); never an older job. * (a quick check may be over by then), else null (the caller follows
* updates_status); never an older job. Waits two seconds at most: LuCI gives
* up on a call after twenty.
*/ */
function run(a) { function run(a) {
let what = a.what ?? 'check'; let what = a.what ?? 'check';
@@ -126,16 +128,17 @@ function run(a) {
if (upd.busy()) if (upd.busy())
die(_('Another component action is already running')); die(_('Another component action is already running'));
ensure_dir(RUN_DIR); ensure_dir(RUN_DIR);
let t0 = time(); let t0 = time(), prev = read_json(upd.JOB_FILE, null)?.id;
let args = substr(what, 0, 5) == 'check' ? `check ${substr(what, 6)}` : `install ${what}`; let args = substr(what, 0, 5) == 'check' ? `check ${substr(what, 6)}` : `install ${what}`;
// The job speaks the admin's language (use() let only a plain language code through). // The job speaks the admin's language (use() let only a plain language code through).
let lang = i18n.current(); let lang = i18n.current();
system(`${lang ? `DAWNLINE_LANG=${lang} ` : ''}start-stop-daemon -S -b -x /usr/libexec/dawnline/updater -- ${args}`); system(`${lang ? `DAWNLINE_LANG=${lang} ` : ''}start-stop-daemon -S -b -x /usr/libexec/dawnline/updater -- ${args}`);
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
let j = read_json(upd.JOB_FILE, null); let j = read_json(upd.JOB_FILE, null);
if (j?.state == 'running' && j.started >= t0) if (j && j.id != prev && j.started >= t0)
return { started: true, job: j }; return { started: true, job: j };
system('usleep 100000 2>/dev/null || sleep 1'); // ucode's own sleep: OpenWrt's BusyBox has no usleep.
sleep(100);
} }
return { started: true, job: null }; return { started: true, job: null };
} }
@@ -30,7 +30,7 @@ export function check(ctx) {
/** /**
* The sha256 a release publishes for a file: GitHub's own (API), else the * The sha256 a release publishes for a file: GitHub's own (API), else the
* release's sha256sums.txt fetched straight from github.com (never a mirror). * release's sha256sums.txt fetched straight from GitHub (never a mirror).
*/ */
function want_sha(ctx, tag, asset, dir) { function want_sha(ctx, tag, asset, dir) {
let want = gh.asset_sha256(REPO, tag, asset); let want = gh.asset_sha256(REPO, tag, asset);
@@ -5,7 +5,7 @@
import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs'; import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs';
import { _ } from 'dawnline.i18n'; import { _ } from 'dawnline.i18n';
export const VERSION = '0.16.0'; export const VERSION = '0.16.3';
/** GitHub repository with Dawnline releases (updates and the installer). */ /** GitHub repository with Dawnline releases (updates and the installer). */
export const REPO = 'tickcount/luci-app-dawnline'; export const REPO = 'tickcount/luci-app-dawnline';
export const RUN_DIR = '/var/run/dawnline'; export const RUN_DIR = '/var/run/dawnline';
+1 -1
View File
@@ -83,7 +83,7 @@ for (const [real, shown] of args.names)
args.mask.push([real, shown], [real.toLowerCase(), shown.toLowerCase()], [real.toUpperCase(), shown.toUpperCase()]); args.mask.push([real, shown], [real.toLowerCase(), shown.toLowerCase()], [real.toUpperCase(), shown.toUpperCase()]);
const INITIALS = args.names.map(([real, shown]) => [initials(real), initials(shown)]); const INITIALS = args.names.map(([real, shown]) => [initials(real), initials(shown)]);
const LUCI = `${args.router}/cgi-bin/luci/admin/network/dawnline`; const LUCI = `${args.router}/cgi-bin/luci/admin/services/dawnline`;
const USER = process.env.LUCI_USER || 'root'; const USER = process.env.LUCI_USER || 'root';
/* /*
+1 -1
View File
@@ -63,7 +63,7 @@ Install or upgrade on the router (OpenWrt 24.10 with opkg, or 25.12 with apk):
sh -c "\$(wget -qO- https://raw.githubusercontent.com/$REPO/main/install.sh)" sh -c "\$(wget -qO- https://raw.githubusercontent.com/$REPO/main/install.sh)"
\`\`\` \`\`\`
Or update from LuCI → Network → Dawnline → Components. Or update from LuCI → Services → Dawnline → Components.
EOF EOF
if [ -n "$PREV" ]; then if [ -n "$PREV" ]; then
printf '\n**Full Changelog**: https://github.com/%s/compare/%s...%s\n' "$REPO" "$PREV" "$TAG" printf '\n**Full Changelog**: https://github.com/%s/compare/%s...%s\n' "$REPO" "$PREV" "$TAG"
+25
View File
@@ -0,0 +1,25 @@
// dawnline.github: which URLs are a release's files (those can come through
// the API instead of github.com's redirect) and the points of a commit message.
import * as gh from 'dawnline.github';
test('release_file', () => {
eq(gh.release_file('https://github.com/tickcount/luci-app-dawnline/releases/download/v0.16.0/sha256sums.txt'),
{ repo: 'tickcount/luci-app-dawnline', tag: 'v0.16.0', name: 'sha256sums.txt' }, 'a Dawnline release file');
eq(gh.release_file('https://github.com/Slava-Shchipunov/awg-openwrt/releases/download/v24.10.4/kmod-amneziawg_v24.10.4_aarch64_cortex-a53_mediatek_filogic.ipk'),
{ repo: 'Slava-Shchipunov/awg-openwrt', tag: 'v24.10.4', name: 'kmod-amneziawg_v24.10.4_aarch64_cortex-a53_mediatek_filogic.ipk' },
'an AmneziaWG build');
eq(gh.release_file('https://ghfast.top/https://github.com/tickcount/luci-app-dawnline/releases/download/v0.16.0/a.ipk'), null, 'a mirror');
eq(gh.release_file('https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh'), null, 'not a release file');
eq(gh.release_file('https://github.com/tickcount/luci-app-dawnline/releases/latest'), null, 'the latest redirect');
eq(gh.release_file('https://github.com/a/b/releases/download/v1/x.ipk?raw=1'), null, 'a query');
eq(gh.release_file('https://github.com/a/b/releases/download/v1/sub/x.ipk'), null, 'a deeper path');
eq(gh.release_file(null), null, 'nothing');
});
test('points', () => {
eq(gh.points('Dawnline 0.16.0\n\n- Check no longer times out\n- Downloads without curl\n go through the API'),
[ 'Check no longer times out', 'Downloads without curl go through the API' ], 'a release commit, a wrapped point');
eq(gh.points('Fix the portal'), [ 'Fix the portal' ], 'another commit: its title');
eq(gh.points('Dawnline 0.16.0'), [], 'a bare release title');
eq(gh.points('Merge branch x\n\n- y'), [], 'a merge');
});
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.16.0", "version": "0.16.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.16.0", "version": "0.16.3",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"qrcode-generator": "2.0.4" "qrcode-generator": "2.0.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dawnline-web", "name": "dawnline-web",
"version": "0.16.0", "version": "0.16.3",
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
+1 -1
View File
@@ -448,7 +448,7 @@ function overviewTile(srv: Server): HTMLElement {
return E('div', { class: 'dl-bento-tile dl-disg' }, [ return E('div', { class: 'dl-bento-tile dl-disg' }, [
E('div', { class: 'dl-bento-head' }, [ E('div', { class: 'dl-bento-head' }, [
E('span', { class: 'dl-metric-label' }, _('Disguise')), E('span', { class: 'dl-metric-label' }, _('Disguise')),
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')), E('a', { href: `${L.url('admin/services/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')),
]), ]),
E('div', { class: 'dl-disg-id' }, [ E('div', { class: 'dl-disg-id' }, [
E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')), E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')),
+28 -13
View File
@@ -17,7 +17,20 @@ import { isOn, sw } from './ui/controls';
import { qrCode } from './ui/qr'; import { qrCode } from './ui/qr';
import { deviceNameHelp, type Help } from './netcheck'; import { deviceNameHelp, type Help } from './netcheck';
import { deviceStatus } from './ui/badges'; import { deviceStatus } from './ui/badges';
import { ago, bytes, defaultName, fitName, homeOf, isoDay, kindLabel, KINDS, netsLabel, todayOf } from '../shared/format'; import {
ago,
bytes,
defaultName,
fitName,
homeOf,
isoDay,
kindLabel,
netsLabel,
pickLabel,
PICKS,
todayOf,
type KindPick,
} from '../shared/format';
import { guardDeviceName } from '../shared/name-guard'; import { guardDeviceName } from '../shared/name-guard';
import { fill, fmt, locale, num } from '../shared/i18n'; import { fill, fmt, locale, num } from '../shared/i18n';
import { icon } from '../shared/icons'; import { icon } from '../shared/icons';
@@ -421,7 +434,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
}, },
_('Clear'), _('Clear'),
), ),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All activity')), E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('All activity')),
]), ]),
]), ]),
log, log,
@@ -610,44 +623,46 @@ export function addDevice(person: Person, o: DeviceOpts) {
while (taken.some((t) => t.toLowerCase() === name.toLowerCase())) name = fitName(base, ` ${++n}`); while (taken.some((t) => t.toLowerCase() === name.toLowerCase())) name = fitName(base, ` ${++n}`);
return name; return name;
}; };
let kind: Kind = 'phone'; // Mobile from here is a phone: the admin is never on the device itself (see KindPick).
const kindOf = (p: KindPick): Kind => (p === 'mobile' ? 'phone' : p);
let pick: KindPick = 'mobile';
const nameInput = E('input', { const nameInput = E('input', {
type: 'text', type: 'text',
class: 'cbi-input-text', class: 'cbi-input-text',
placeholder: suggest(kind), placeholder: suggest(kindOf(pick)),
}) as HTMLInputElement; }) as HTMLInputElement;
const said = nameGuard(nameInput, () => nameRow.refresh()); const said = nameGuard(nameInput, () => nameRow.refresh());
const nameRow = liveField(_('Name'), nameInput, () => const nameRow = liveField(_('Name'), nameInput, () =>
said( said(
nameInput.value.trim() nameInput.value.trim()
? deviceNameHelp(nameInput.value, taken, _('Shown in the portal and in the app.')) ? deviceNameHelp(nameInput.value, taken, _('Shown in the portal and in the app.'))
: { text: fmt(_('Named after its type: %s.'), suggest(kind)), bad: false }, : { text: fmt(_('Named after its type: %s.'), suggest(kindOf(pick))), bad: false },
), ),
); );
const kinds = E( const kinds = E(
'div', 'div',
{ class: 'dl-kinds', role: 'radiogroup', 'aria-label': _('Type') }, { class: 'dl-kinds', role: 'radiogroup', 'aria-label': _('Type') },
KINDS.map((k) => PICKS.map((k) =>
E( E(
'button', 'button',
{ {
type: 'button', type: 'button',
role: 'radio', role: 'radio',
class: k === kind ? 'on' : '', class: k === pick ? 'on' : '',
'aria-checked': k === kind ? 'true' : 'false', 'aria-checked': k === pick ? 'true' : 'false',
'data-kind': k, 'data-kind': k,
click: () => { click: () => {
kind = k; pick = k;
kinds.querySelectorAll('button').forEach((c) => { kinds.querySelectorAll('button').forEach((c) => {
const on = (c as HTMLElement).dataset.kind === k; const on = (c as HTMLElement).dataset.kind === k;
c.classList.toggle('on', on); c.classList.toggle('on', on);
c.setAttribute('aria-checked', on ? 'true' : 'false'); c.setAttribute('aria-checked', on ? 'true' : 'false');
}); });
nameInput.placeholder = suggest(k); nameInput.placeholder = suggest(kindOf(k));
nameRow.refresh(); nameRow.refresh();
}, },
}, },
[icon(k), E('span', {}, kindLabel(k))], [icon(k), E('span', {}, pickLabel(k))],
), ),
), ),
); );
@@ -704,8 +719,8 @@ export function addDevice(person: Person, o: DeviceOpts) {
notify(h.text, 'warning'); notify(h.text, 'warning');
return; return;
} }
const name = nameInput.value.trim() || suggest(kind); const name = nameInput.value.trim() || suggest(kindOf(pick));
const r = await attempt(() => api.deviceCreate(person.id, name, kind, isOn(bypass))); const r = await attempt(() => api.deviceCreate(person.id, name, kindOf(pick), isOn(bypass)));
if (!r) return; if (!r) return;
closeModal(); closeModal();
notify(fmt(_('%s added'), name), 'success', 3000); notify(fmt(_('%s added'), name), 'success', 3000);
+92 -29
View File
@@ -69,7 +69,8 @@ function eventIcon(st: Names, e: LogEvent): string {
/** A router day (YYYY-MM-DD) in the page's language; anything else as it came. */ /** A router day (YYYY-MM-DD) in the page's language; anything else as it came. */
const routerDay = (s: string) => (/^\d{4}-\d{2}-\d{2}$/.test(s) ? fmtDay(s) : s); const routerDay = (s: string) => (/^\d{4}-\d{2}-\d{2}$/.test(s) ? fmtDay(s) : s);
export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] { export function eventText(st: Pick<Status, 'people'>, e: LogEvent, personId?: string): Node[] {
const scoped = personId !== undefined && e.person === personId;
const person = st.people.find((p) => p.id === e.person); const person = st.people.find((p) => p.id === e.person);
const who = person?.name ?? e.pname ?? e.person ?? ''; const who = person?.name ?? e.pname ?? e.person ?? '';
const dev = person?.devices.find((d) => d.id === e.device)?.name ?? e.dname ?? ''; const dev = person?.devices.find((d) => d.id === e.device)?.name ?? e.dname ?? '';
@@ -88,33 +89,49 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
const w = _('You'); const w = _('You');
return s.startsWith(`${w} `) ? [E('span', { class: 'dl-you' }, w), ...say(s.slice(w.length), ...args)] : say(s, ...args); return s.startsWith(`${w} `) ? [E('span', { class: 'dl-you' }, w), ...say(s.slice(w.length), ...args)] : say(s, ...args);
}; };
const wd = b(dev ? `${who} · ${dev}` : who); const wd = b(scoped ? dev || _('a device') : dev ? `${who} · ${dev}` : who);
const detail = plainDetail(e); const detail = plainDetail(e);
const devName = b(detail || dev || _('a device')); const devName = b(detail || dev || _('a device'));
const by = eventBy(e); const by = eventBy(e);
if (by === 'admin') if (by === 'admin')
switch (e.type) { switch (e.type) {
case 'device_added': case 'device_added':
return you(_('You added device %s for %s'), devName, b(who)); return scoped ? you(_('You added device %s'), devName) : you(_('You added device %s for %s'), devName, b(who));
case 'device_removed': case 'device_removed':
return you(_('You removed device %s from %s'), devName, b(who)); return scoped ? you(_('You removed device %s'), devName) : you(_('You removed device %s from %s'), devName, b(who));
case 'paused': case 'paused':
return you(_('You paused person %s'), b(who)); return scoped ? you(_('You paused access')) : you(_('You paused person %s'), b(who));
case 'resumed': case 'resumed':
return you(_('You resumed person %s'), b(who)); return scoped ? you(_('You resumed access')) : you(_('You resumed person %s'), b(who));
case 'device_changed': { case 'device_changed': {
const d = b(dev || _('a device')); const d = b(dev || _('a device'));
if (detail.startsWith('renamed from ')) if (detail.startsWith('renamed from '))
return [...you(_('You renamed device %s of %s'), d, b(who)), m(` · ${fmt(_('was %s'), detail.slice(13))}`)]; return [
if (detail === 'turned off') return you(_('You turned off device %s of %s'), d, b(who)); ...(scoped ? you(_('You renamed device %s'), d) : you(_('You renamed device %s of %s'), d, b(who))),
if (detail === 'turned on') return you(_('You turned on device %s of %s'), d, b(who)); m(` · ${fmt(_('was %s'), detail.slice(13))}`),
];
if (detail === 'turned off')
return scoped ? you(_('You turned off device %s'), d) : you(_('You turned off device %s of %s'), d, b(who));
if (detail === 'turned on')
return scoped ? you(_('You turned on device %s'), d) : you(_('You turned on device %s of %s'), d, b(who));
// Its own link options by name ("mtu, keepalive"), as person_changed lists a person's. // Its own link options by name ("mtu, keepalive"), as person_changed lists a person's.
return [...you(_('You changed device %s of %s'), d, b(who)), ...(detail ? [m(` · ${deviceChangedText(detail)}`)] : [])]; return [
...(scoped ? you(_('You changed device %s'), d) : you(_('You changed device %s of %s'), d, b(who))),
...(detail ? [m(` · ${deviceChangedText(detail)}`)] : []),
];
} }
case 'device_keys': case 'device_keys':
return [...you(_('You issued new keys for device %s of %s'), devName, b(who)), m(` · ${_('it needs its new configuration')}`)]; return [
...(scoped
? you(_('You issued new keys for device %s'), devName)
: you(_('You issued new keys for device %s of %s'), devName, b(who))),
m(` · ${_('it needs its new configuration')}`),
];
case 'link_changed': case 'link_changed':
return [...you(_('You issued a new link for person %s'), b(who)), m(` · ${_('the old link stopped working')}`)]; return [
...(scoped ? you(_('You issued a new personal link')) : you(_('You issued a new link for person %s'), b(who))),
m(` · ${_('the old link stopped working')}`),
];
} }
switch (e.type) { switch (e.type) {
case 'connect': case 'connect':
@@ -136,35 +153,77 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
); );
case 'device_added': case 'device_added':
return by === 'portal' return by === 'portal'
? say(_('Person %s added device %s on their portal'), b(who), devName) ? scoped
: say(_('Person %s added device %s'), b(who), devName); ? say(_('Device %s added on the portal'), devName)
: say(_('Person %s added device %s on their portal'), b(who), devName)
: scoped
? say(_('Device %s added'), devName)
: say(_('Person %s added device %s'), b(who), devName);
case 'device_removed': case 'device_removed':
return by === 'portal' return by === 'portal'
? say(_('Person %s removed device %s on their portal'), b(who), devName) ? scoped
: say(_('Person %s removed device %s'), b(who), devName); ? say(_('Device %s removed on the portal'), devName)
: say(_('Person %s removed device %s on their portal'), b(who), devName)
: scoped
? say(_('Device %s removed'), devName)
: say(_('Person %s removed device %s'), b(who), devName);
case 'device_changed':
if (detail.startsWith('renamed from '))
return [
...(by === 'portal'
? scoped
? say(_('Device %s renamed on the portal'), b(dev || _('a device')))
: say(_('Person %s renamed device %s on their portal'), b(who), b(dev || _('a device')))
: say(_('Device %s renamed'), wd)),
m(` · ${fmt(_('was %s'), detail.slice(13))}`),
];
if (detail === 'turned off') return say(_('Device %s turned off'), wd);
if (detail === 'turned on') return say(_('Device %s turned on'), wd);
return [...say(_('Device %s changed'), wd), ...(detail ? [m(` · ${deviceChangedText(detail)}`)] : [])];
case 'device_keys': case 'device_keys':
return say(_('Person %s issued new keys for device %s on their portal'), b(who), devName); return scoped
? say(_('New keys issued for device %s on the portal'), devName)
: say(_('Person %s issued new keys for device %s on their portal'), b(who), devName);
case 'person_added': case 'person_added':
return you(_('You added person %s'), b(e.detail ?? who)); return scoped ? you(_('You added this person')) : you(_('You added person %s'), b(e.detail ?? who));
case 'person_removed': case 'person_removed':
return you(_('You removed person %s'), b(e.detail ?? who)); return scoped ? you(_('You removed this person')) : you(_('You removed person %s'), b(e.detail ?? who));
case 'person_changed': case 'person_changed':
// The detail lists changed fields by their option names (device_limit, expire_action). // The detail lists changed fields by their option names (device_limit, expire_action).
return [...you(_('You changed person %s'), b(who)), ...(detail ? [m(` · ${changedText(detail)}`)] : [])]; return [
...(scoped ? you(_('You changed settings')) : you(_('You changed person %s'), b(who))),
...(detail ? [m(` · ${changedText(detail)}`)] : []),
];
case 'expiring': { case 'expiring': {
const n = daysOf(e.detail ?? ''); const n = daysOf(e.detail ?? '');
return n != null return n != null
? say(N_(n, 'Person %s’s access ends in %s day', 'Person %s’s access ends in %s days'), b(who), m(num(n))) ? scoped
: say(_('Person %s’s access ends in a few days'), b(who)); ? say(N_(n, 'Access ends in %s day', 'Access ends in %s days'), m(num(n)))
: say(N_(n, 'Person %s’s access ends in %s day', 'Person %s’s access ends in %s days'), b(who), m(num(n)))
: scoped
? say(_('Access ends in a few days'))
: say(_('Person %s’s access ends in a few days'), b(who));
} }
case 'expired_kept': case 'expired_kept':
return say(_('Person %s’s end date passed (%s) · access kept'), b(who), m(routerDay(e.detail ?? ''))); return scoped
? say(_('End date passed (%s) · access kept'), m(routerDay(e.detail ?? '')))
: say(_('Person %s’s end date passed (%s) · access kept'), b(who), m(routerDay(e.detail ?? '')));
case 'paused': case 'paused':
return e.detail ? say(_('Person %s paused - %s'), b(who), m(reasonText(e.detail))) : say(_('Person %s paused'), b(who)); return e.detail
? scoped
? say(_('Access paused - %s'), m(reasonText(e.detail)))
: say(_('Person %s paused - %s'), b(who), m(reasonText(e.detail)))
: scoped
? say(_('Access paused'))
: say(_('Person %s paused'), b(who));
case 'resumed': case 'resumed':
return e.detail && e.detail !== 'active' return e.detail && e.detail !== 'active'
? say(_('Person %s resumed - %s'), b(who), m(reasonText(e.detail))) ? scoped
: say(_('Person %s resumed'), b(who)); ? say(_('Access resumed - %s'), m(reasonText(e.detail)))
: say(_('Person %s resumed - %s'), b(who), m(reasonText(e.detail)))
: scoped
? say(_('Access resumed'))
: say(_('Person %s resumed'), b(who));
case 'portal_blocked': case 'portal_blocked':
return say( return say(
_('%s blocked %s for 15 min after too many wrong codes'), _('%s blocked %s for 15 min after too many wrong codes'),
@@ -172,7 +231,7 @@ export function eventText(st: Pick<Status, 'people'>, e: LogEvent): Node[] {
e.detail === 'all Cloudflare visitors' ? m(_('all Cloudflare visitors')) : mono(e.detail ?? ''), e.detail === 'all Cloudflare visitors' ? m(_('all Cloudflare visitors')) : mono(e.detail ?? ''),
); );
case 'devices_removed': case 'devices_removed':
return say(_('Person %s - all devices removed, end date reached'), b(who)); return scoped ? say(_('All devices removed, end date reached')) : say(_('Person %s - all devices removed, end date reached'), b(who));
case 'device_failing': case 'device_failing':
return [...say(_('Device %s has a connection problem'), wd), ...(e.detail ? [m(` · ${linkStatesText(e.detail)}`)] : [])]; return [...say(_('Device %s has a connection problem'), wd), ...(e.detail ? [m(` · ${linkStatesText(e.detail)}`)] : [])];
case 'device_recovered': case 'device_recovered':
@@ -196,7 +255,11 @@ function serverPill(st: Names, e: LogEvent): HTMLElement | '' {
} }
/** An activity event as a row; `time` replaces the "5 min ago" (`now` is the router's clock). */ /** An activity event as a row; `time` replaces the "5 min ago" (`now` is the router's clock). */
export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { server?: boolean; time?: string } = {}): HTMLElement { export function eventRow(
st: Names & { now?: number },
e: LogEvent,
opts: { server?: boolean; time?: string; person?: string } = {},
): HTMLElement {
const sys = SYSTEM_EVENT[e.type]; const sys = SYSTEM_EVENT[e.type];
const by = eventBy(e); const by = eventBy(e);
return E('div', { class: `dl-row${by === 'admin' ? ' dl-ev-by-admin' : sys ? ` dl-ev-by-system ${sys[1]}` : ''}` }, [ return E('div', { class: `dl-row${by === 'admin' ? ' dl-ev-by-admin' : sys ? ` dl-ev-by-system ${sys[1]}` : ''}` }, [
@@ -205,7 +268,7 @@ export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { serv
: sys : sys
? E('span', { class: 'dl-ev-tile sys' }, icon(sys[0])) ? E('span', { class: 'dl-ev-tile sys' }, icon(sys[0]))
: E('span', { class: `dl-ev-tile ev ${EVENT_TONE[e.type] ?? ''}` }, icon(eventIcon(st, e))), : E('span', { class: `dl-ev-tile ev ${EVENT_TONE[e.type] ?? ''}` }, icon(eventIcon(st, e))),
E('span', { class: 'dl-row-main' }, eventText(st, e)), E('span', { class: 'dl-row-main' }, eventText(st, e, opts.person)),
opts.server === false ? '' : serverPill(st, e), opts.server === false ? '' : serverPill(st, e),
E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, opts.time ?? ago(e.ts, st.now)), E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, opts.time ?? ago(e.ts, st.now)),
]); ]);
+1 -1
View File
@@ -51,7 +51,7 @@ function moved(tab: '' | 'log') {
return () => ({ return () => ({
load: () => { load: () => {
ui.menu?.flushCache(); ui.menu?.flushCache();
location.replace(`${L.url('admin/network/dawnline/diagnostics')}${tab ? `?tab=${tab}` : ''}`); location.replace(`${L.url('admin/services/dawnline/diagnostics')}${tab ? `?tab=${tab}` : ''}`);
return new Promise(() => {}); return new Promise(() => {});
}, },
render: () => document.createElement('div'), render: () => document.createElement('div'),
+1 -1
View File
@@ -65,7 +65,7 @@ export function activity(page: ComponentsPage): HTMLElement {
E('div', { class: 'dl-panel-head pad' }, [ E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Activity')), E('h3', {}, _('Activity')),
E('span', { class: 'dl-spacer' }), E('span', { class: 'dl-spacer' }),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All in Log →')), E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('All in Log →')),
]), ]),
h.length h.length
? E('div', {}, h.slice(0, 8).map(row)) ? E('div', {}, h.slice(0, 8).map(row))
+1 -1
View File
@@ -160,7 +160,7 @@ export class ComponentsPage {
E('div', { class: 'dl-row-actions' }, [ E('div', { class: 'dl-row-actions' }, [
E( E(
'a', 'a',
{ class: 'cbi-button cbi-button-neutral dl-icon-btn', href: `${L.url('admin/network/dawnline/settings')}?section=updates` }, { class: 'cbi-button cbi-button-neutral dl-icon-btn', href: `${L.url('admin/services/dawnline/settings')}?section=updates` },
[icon('edit'), ' ', _('Settings')], [icon('edit'), ' ', _('Settings')],
), ),
button([icon('refresh'), ' ', _('Check all')], () => this.op('check', _('Checking all components')), 'neutral', { button([icon('refresh'), ' ', _('Check all')], () => this.op('check', _('Checking all components')), 'neutral', {
+7 -7
View File
@@ -34,7 +34,7 @@ interface Attention {
function attention(st: Status): Attention[] { function attention(st: Status): Attention[] {
const out: Attention[] = []; const out: Attention[] = [];
const link = (href: string, t: string) => E('a', { href }, t); const link = (href: string, t: string) => E('a', { href }, t);
const diagnostics = () => link(L.url('admin/network/dawnline/diagnostics'), _('Open Diagnostics')); const diagnostics = () => link(L.url('admin/services/dawnline/diagnostics'), _('Open Diagnostics'));
const today = todayOf(st.series); const today = todayOf(st.series);
// AmneziaWG itself can't run: the health notice says so once, not "Tunnel down" for every server. // AmneziaWG itself can't run: the health notice says so once, not "Tunnel down" for every server.
const awg = !!st.awg_state && !st.awg_state.ok; const awg = !!st.awg_state && !st.awg_state.ok;
@@ -111,12 +111,12 @@ function attention(st: Status): Attention[] {
text: [ text: [
fmt(_('Internet through the LAN is off: %s'), st.like_home.error), fmt(_('Internet through the LAN is off: %s'), st.like_home.error),
' ', ' ',
link(L.url('admin/network/dawnline/diagnostics'), _('Details')), link(L.url('admin/services/dawnline/diagnostics'), _('Details')),
], ],
}); });
// Only while setting up: an admin who keeps the portal off has decided so. // Only while setting up: an admin who keeps the portal off has decided so.
if (!st.settings.portal_enabled && !st.people.length) if (!st.settings.portal_enabled && !st.people.length)
out.push({ tone: '', text: [_('The personal portal is off.'), ' ', link(L.url('admin/network/dawnline/settings'), _('Turn on'))] }); out.push({ tone: '', text: [_('The personal portal is off.'), ' ', link(L.url('admin/services/dawnline/settings'), _('Turn on'))] });
return out; return out;
} }
@@ -221,7 +221,7 @@ export class ServerOverview {
E( E(
'div', 'div',
{ class: 'dl-map-off' }, { class: 'dl-map-off' },
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))), fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/services/dawnline/settings') }, _('Turn them on in Settings'))),
), ),
]); ]);
const map = (this.map = new ConnectionMap( const map = (this.map = new ConnectionMap(
@@ -268,7 +268,7 @@ export class ServerOverview {
E('div', { class: 'dl-panel-head pad' }, [ E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Needs attention')), E('h3', {}, _('Needs attention')),
E('span', { class: 'dl-spacer' }), E('span', { class: 'dl-spacer' }),
E('a', { href: L.url('admin/network/dawnline/diagnostics') }, _('Health')), E('a', { href: L.url('admin/services/dawnline/diagnostics') }, _('Health')),
]), ]),
att.length att.length
? att ? att
@@ -292,7 +292,7 @@ export class ServerOverview {
E('div', { class: 'dl-panel-head pad' }, [ E('div', { class: 'dl-panel-head pad' }, [
E('h3', {}, _('Activity')), E('h3', {}, _('Activity')),
E('span', { class: 'dl-spacer' }), E('span', { class: 'dl-spacer' }),
E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('View all')), E('a', { href: `${L.url('admin/services/dawnline/diagnostics')}?tab=log` }, _('View all')),
]), ]),
events.length events.length
? events.map((e) => eventRow(st, e)) ? events.map((e) => eventRow(st, e))
@@ -428,7 +428,7 @@ export class ServerOverview {
'a', 'a',
{ {
class: 'dl-onl-p sm more', class: 'dl-onl-p sm more',
href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(this.srvId)}&section=people&filter=online`, href: `${L.url('admin/services/dawnline/server')}?server=${encodeURIComponent(this.srvId)}&section=people&filter=online`,
title: _('Everyone online'), title: _('Everyone online'),
click: (ev: Event) => { click: (ev: Event) => {
if (this.go) { if (this.go) {
+2 -2
View File
@@ -281,7 +281,7 @@ export class PeoplePage {
{ class: 'alert-message warning' }, { class: 'alert-message warning' },
fill( fill(
_('No server yet. %s before adding people.'), _('No server yet. %s before adding people.'),
E('a', { href: L.url('admin/network/dawnline/server') }, _('Run the setup wizard')), E('a', { href: L.url('admin/services/dawnline/server') }, _('Run the setup wizard')),
), ),
), ),
E('div', { class: 'dl-toolbar' }, [ E('div', { class: 'dl-toolbar' }, [
@@ -847,7 +847,7 @@ export class PeoplePage {
' ', ' ',
E( E(
'a', 'a',
{ class: 'cbi-button cbi-button-neutral', href: `${L.url('admin/network/dawnline/settings')}?section=portal` }, { class: 'cbi-button cbi-button-neutral', href: `${L.url('admin/services/dawnline/settings')}?section=portal` },
_('Open Settings'), _('Open Settings'),
), ),
' ', ' ',
+4 -4
View File
@@ -34,7 +34,7 @@ function mapCard(page: PersonPage): HTMLElement {
E( E(
'div', 'div',
{ class: 'dl-map-off' }, { class: 'dl-map-off' },
fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))), fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/services/dawnline/settings') }, _('Turn them on in Settings'))),
), ),
]); ]);
const map = new ConnectionMap( const map = new ConnectionMap(
@@ -64,7 +64,7 @@ export function placesPart(page: PersonPage): HTMLElement | null {
E('span', { class: 'dl-sub' }, _('City-level, from the client IP')), E('span', { class: 'dl-sub' }, _('City-level, from the client IP')),
]), ]),
E('span', { class: 'dl-spacer' }), E('span', { class: 'dl-spacer' }),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/settings') }, _('Turn on')), E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/services/dawnline/settings') }, _('Turn on')),
]); ]);
if (page.mapOpen) return page.map && page.parts.places.contains(page.map.el) ? null : mapCard(page); if (page.mapOpen) return page.map && page.parts.places.contains(page.map.el) ? null : mapCard(page);
const since = st.now - 30 * 86400; const since = st.now - 30 * 86400;
@@ -108,10 +108,10 @@ export function activityPart(page: PersonPage): HTMLElement {
const e = latest[i]; const e = latest[i];
let n = 1; let n = 1;
while (e.type === 'roam' && latest[i + n]?.type === 'roam' && latest[i + n].device === e.device) n++; while (e.type === 'roam' && latest[i + n]?.type === 'roam' && latest[i + n].device === e.device) n++;
const row = eventRow(st, e, { server: false }); const row = eventRow(st, e, { server: false, person: p.id });
if (n > 1) { if (n > 1) {
const main = row.querySelector('.dl-row-main') as HTMLElement; const main = row.querySelector('.dl-row-main') as HTMLElement;
dom.content(main, [...eventText(st, e).slice(0, 3), E('span', { class: 'dl-muted' }, plural(n, '%s time', '%s times'))]); dom.content(main, [...eventText(st, e, p.id).slice(0, 3), E('span', { class: 'dl-muted' }, plural(n, '%s time', '%s times'))]);
main.title = latest main.title = latest
.slice(i, i + n) .slice(i, i + n)
.map((x) => x.detail ?? '') .map((x) => x.detail ?? '')
+2 -2
View File
@@ -1,4 +1,4 @@
// Person page (admin/network/dawnline/person?id=…): devices as cards, // Person page (admin/services/dawnline/person?id=…): devices as cards,
// locations, activity, and access & limits that apply immediately. // locations, activity, and access & limits that apply immediately.
// The parts live in ./header, ./devices, ./limits, ./pickers, ./activity and // The parts live in ./header, ./devices, ./limits, ./pickers, ./activity and
// ./dialogs; this class holds the state, the poller and the edits. // ./dialogs; this class holds the state, the poller and the edits.
@@ -66,7 +66,7 @@ export class PersonPage {
return E('div', { class: 'dl-empty' }, [ return E('div', { class: 'dl-empty' }, [
E('h3', {}, _('Person not found')), E('h3', {}, _('Person not found')),
E('p', {}, _('They may have been removed.')), E('p', {}, _('They may have been removed.')),
E('a', { class: 'cbi-button', href: L.url('admin/network/dawnline/server') }, _('Back to Servers')), E('a', { class: 'cbi-button', href: L.url('admin/services/dawnline/server') }, _('Back to Servers')),
]); ]);
this.p = p; this.p = p;
for (const k of ['crumbs', 'head', 'devices', 'traffic', 'places', 'activity', 'limits'] as Part[]) this.parts[k] = E('div', {}); for (const k of ['crumbs', 'head', 'devices', 'traffic', 'places', 'activity', 'limits'] as Part[]) this.parts[k] = E('div', {});
+2 -2
View File
@@ -48,7 +48,7 @@ const url = (server?: string, section?: string) => {
if (server) q.set('server', server); if (server) q.set('server', server);
if (section && section !== 'overview') q.set('section', section); if (section && section !== 'overview') q.set('section', section);
const s = q.toString(); const s = q.toString();
return `${L.url('admin/network/dawnline/server')}${s ? `?${s}` : ''}`; return `${L.url('admin/services/dawnline/server')}${s ? `?${s}` : ''}`;
}; };
export class ServerPage { export class ServerPage {
@@ -846,7 +846,7 @@ export class ServerPage {
'warn', 'warn',
_('AmneziaWG’s kernel module doesn’t load on this firmware'), _('AmneziaWG’s kernel module doesn’t load on this firmware'),
_('Try another build in Components, or update OpenWrt. The server can’t start until it loads.'), _('Try another build in Components, or update OpenWrt. The server can’t start until it loads.'),
E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/updates') }, _('Open Components')), E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/services/dawnline/updates') }, _('Open Components')),
), ),
]) ])
: ''; : '';
+2 -2
View File
@@ -134,9 +134,9 @@ export const MOVE_MS = 1600;
/** The shimmer sets off once the place it leaves has started to go gray (a share of the move). */ /** The shimmer sets off once the place it leaves has started to go gray (a share of the move). */
const LEAVE = 0.12; const LEAVE = 0.12;
/** The shimmer's length, a share of the arc: longer than the arc, so most of it is lit mid-move. */ /** The shimmer's length, a share of the arc: longer than the arc, so most of it is lit mid-move. */
export const BAND = 1.3; const BAND = 1.3;
/** ± this around the shimmer's middle is fully lit; it fades out to ±BAND/2. */ /** ± this around the shimmer's middle is fully lit; it fades out to ±BAND/2. */
export const FLAT = 0.32; const FLAT = 0.32;
/** A move into stay `k` (from stay k − 1), or stay `k` itself, `ms` long from `start`. */ /** A move into stay `k` (from stay k − 1), or stay `k` itself, `ms` long from `start`. */
export interface Step { export interface Step {
+1 -1
View File
@@ -180,7 +180,7 @@
.dl-fld { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; } .dl-fld { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.dl-fld-label { font-size: 13px; font-weight: 500; color: var(--dl-fg); } .dl-fld-label { font-size: 13px; font-weight: 500; color: var(--dl-fg); }
.dl-fld .cbi-input-text { width: 100%; box-sizing: border-box; } .dl-fld .cbi-input-text { width: 100%; box-sizing: border-box; }
.dl-kinds { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } .dl-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dl-kinds button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; .dl-kinds button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
height: 68px; border-radius: 10px; border: 1px solid var(--dl-line); color: var(--dl-fg-muted); font-size: 12px; font-weight: 500; text-align: center; min-width: 0; } height: 68px; border-radius: 10px; border: 1px solid var(--dl-line); color: var(--dl-fg-muted); font-size: 12px; font-weight: 500; text-align: center; min-width: 0; }
.dl-kinds button .dl-icon { width: 20px; height: 20px; } .dl-kinds button .dl-icon { width: 20px; height: 20px; }
+2 -1
View File
@@ -93,7 +93,8 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
prevId = before?.job?.id; prevId = before?.job?.id;
since = before?.now ?? 0; since = before?.now ?? 0;
const r = await api.updatesRun(what!); const r = await api.updatesRun(what!);
if (r.job && r.job.state === 'running' && r.job.id !== prevId) { // A quick check may already be over: still this click's job (updates_run never returns an older one).
if (r.job && r.job.id !== prevId) {
job = r.job; job = r.job;
known(r.job); known(r.job);
} }
+2 -2
View File
@@ -2,9 +2,9 @@
/** A server's People section (Servers page). */ /** A server's People section (Servers page). */
export function peopleUrl(server?: string): string { export function peopleUrl(server?: string): string {
return `${L.url('admin/network/dawnline/server')}?${server ? `server=${encodeURIComponent(server)}&` : ''}section=people`; return `${L.url('admin/services/dawnline/server')}?${server ? `server=${encodeURIComponent(server)}&` : ''}section=people`;
} }
export function personUrl(id: string, device?: string): string { export function personUrl(id: string, device?: string): string {
return `${L.url('admin/network/dawnline/person')}?id=${encodeURIComponent(id)}${device ? `&device=${encodeURIComponent(device)}` : ''}`; return `${L.url('admin/services/dawnline/person')}?id=${encodeURIComponent(id)}${device ? `&device=${encodeURIComponent(device)}` : ''}`;
} }
+2 -2
View File
@@ -48,7 +48,7 @@ export function fixAction(c: HealthCheck, run: (fix: string) => void, refresh: (
// install:awg installs AmneziaWG itself (the build for this firmware), the rest come from the feeds. // install:awg installs AmneziaWG itself (the build for this firmware), the rest come from the feeds.
if (fix.startsWith('install:')) return button(_('Install'), () => installFeature(fix.slice(8) as keyof Needs, refresh), kind); if (fix.startsWith('install:')) return button(_('Install'), () => installFeature(fix.slice(8) as keyof Needs, refresh), kind);
if (fix === 'updates') if (fix === 'updates')
return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/network/dawnline/updates') }, fixLabel(fix)); return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/services/dawnline/updates') }, fixLabel(fix));
return button(fixLabel(fix), () => run(fix), kind); return button(fixLabel(fix), () => run(fix), kind);
} }
@@ -89,7 +89,7 @@ export function healthNotices(checks: HealthCheck[], run: (fix: string) => void,
), ),
), ),
rest > 0 rest > 0
? E('a', { class: 'dl-row dl-notices-more', href: L.url('admin/network/dawnline/diagnostics') }, [ ? E('a', { class: 'dl-row dl-notices-more', href: L.url('admin/services/dawnline/diagnostics') }, [
fmt(_('%s more in Diagnostics'), num(rest)), fmt(_('%s more in Diagnostics'), num(rest)),
E('span', { class: 'dl-spacer' }), E('span', { class: 'dl-spacer' }),
'→', '→',
+8 -15
View File
@@ -7,7 +7,7 @@
// to add it there. // to add it there.
import type { ClientConfig, Kind } from '../../shared/types'; import type { ClientConfig, Kind } from '../../shared/types';
import { defaultName, fitName, kindLabel, netsLabel } from '../../shared/format'; import { defaultName, fitName, netsLabel, pickLabel, pickOf, PICKS, type KindPick } from '../../shared/format';
import { guardDeviceName } from '../../shared/name-guard'; import { guardDeviceName } from '../../shared/name-guard';
import { shake } from '../../shared/shake'; import { shake } from '../../shared/shake';
import { fmt, num, plural } from '../../shared/i18n'; import { fmt, num, plural } from '../../shared/i18n';
@@ -77,15 +77,8 @@ function guessName(kind: Kind): string {
return defaultName(kind); return defaultName(kind);
} }
/* // Mobile is a tablet when this page is open on one (see KindPick).
* Phones and tablets are one choice. The device is still kept as a phone or a const kindOf = (p: KindPick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet' ? 'tablet' : 'phone');
* tablet (the lines say "the tablet"): on the device itself the browser tells
* which; picked from elsewhere it is a phone.
*/
type Pick = 'computer' | 'mobile' | 'router' | 'other';
const pickLabel = (p: Pick): string => (p === 'mobile' ? _('Mobile') : kindLabel(p));
const pickOf = (k: Kind): Pick => (k === 'phone' || k === 'tablet' ? 'mobile' : k);
const kindOf = (p: Pick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet' ? 'tablet' : 'phone');
/** /**
* What they chose so far, kept outside the view: Back from "Open on the device" * What they chose so far, kept outside the view: Back from "Open on the device"
@@ -93,7 +86,7 @@ const kindOf = (p: Pick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet'
* typed (unset while the name is still the guess). * typed (unset while the name is still the guess).
*/ */
interface Draft { interface Draft {
pick?: Pick; pick?: KindPick;
bypass: boolean; bypass: boolean;
name?: string; name?: string;
} }
@@ -142,11 +135,11 @@ function vAdd(draft: Draft): View {
const st = state()!; const st = state()!;
const p = st.person; const p = st.person;
// The kinds this router takes, as the four choices. // The kinds this router takes, as the four choices.
const picks = (['computer', 'mobile', 'router', 'other'] as Pick[]).filter((k) => st.kinds.some((x) => pickOf(x) === k)); const picks = PICKS.filter((k) => st.kinds.some((x) => pickOf(x) === k));
const guess = picks.includes(pickOf(guessKind())) ? pickOf(guessKind()) : picks[0]; const guess = picks.includes(pickOf(guessKind())) ? pickOf(guessKind()) : picks[0];
let pick: Pick = draft.pick && picks.includes(draft.pick) ? draft.pick : guess; let pick: KindPick = draft.pick && picks.includes(draft.pick) ? draft.pick : guess;
const taken = new Set(p.devices.map((d) => d.name.toLowerCase())); const taken = new Set(p.devices.map((d) => d.name.toLowerCase()));
const suggest = (k: Pick) => { const suggest = (k: KindPick) => {
const n = k === pickOf(guessKind()) ? guessName(kindOf(k)) : defaultName(k === 'mobile' ? 'phone' : k); const n = k === pickOf(guessKind()) ? guessName(kindOf(k)) : defaultName(k === 'mobile' ? 'phone' : k);
// Stripped of what the router refuses and cut to its limit, the number after it too ("Galaxy S24+ 2"). // Stripped of what the router refuses and cut to its limit, the number after it too ("Galaxy S24+ 2").
if (!taken.has(fitName(n).toLowerCase())) return fitName(n); if (!taken.has(fitName(n).toLowerCase())) return fitName(n);
@@ -230,7 +223,7 @@ function vAdd(draft: Draft): View {
if (draft.name === undefined && pick === pickOf(guessKind())) input.value = suggest(pick); if (draft.name === undefined && pick === pickOf(guessKind())) input.value = suggest(pick);
}); });
// The picked tile rings itself where it stands (the ring does not travel between tiles). // The picked tile rings itself where it stands (the ring does not travel between tiles).
function choose(k: Pick) { function choose(k: KindPick) {
pick = draft.pick = k; pick = draft.pick = k;
tiles.forEach((t, i) => { tiles.forEach((t, i) => {
const on = picks[i] === k; const on = picks[i] === k;
+1 -1
View File
@@ -808,7 +808,7 @@ msgstr ""
msgid "Method not allowed." msgid "Method not allowed."
msgstr "" msgstr ""
#: web/src/portal/flows/add.ts #: web/src/shared/format.ts
msgid "Mobile" msgid "Mobile"
msgstr "" msgstr ""
+1 -1
View File
@@ -813,7 +813,7 @@ msgstr "Мбит/с"
msgid "Method not allowed." msgid "Method not allowed."
msgstr "Метод не поддерживается." msgstr "Метод не поддерживается."
#: web/src/portal/flows/add.ts #: web/src/shared/format.ts
msgid "Mobile" msgid "Mobile"
msgstr "Мобильный" msgstr "Мобильный"
+13 -3
View File
@@ -222,13 +222,23 @@ export function defaultName(k: Kind): string {
return k === 'other' ? _('Device') : kindLabel(k); return k === 'other' ? _('Device') : kindLabel(k);
} }
/** In picker order. */
export const KINDS: Kind[] = ['computer', 'phone', 'tablet', 'router', 'other'];
export function kindLabel(k: Kind): string { export function kindLabel(k: Kind): string {
return { computer: _('PC'), phone: _('Phone'), tablet: _('Tablet'), router: _('Router'), other: _('Other') }[k]; return { computer: _('PC'), phone: _('Phone'), tablet: _('Tablet'), router: _('Router'), other: _('Other') }[k];
} }
/**
* Adding a device, phones and tablets are one choice. The device is still
* kept as a phone or a tablet (the lines say "the tablet"): on the device
* itself the browser tells which; picked from elsewhere it is a phone.
*/
export type KindPick = 'computer' | 'mobile' | 'router' | 'other';
/** In picker order. */
export const PICKS: KindPick[] = ['computer', 'mobile', 'router', 'other'];
export const pickLabel = (p: KindPick): string => (p === 'mobile' ? _('Mobile') : kindLabel(p));
export const pickOf = (k: Kind): KindPick => (k === 'phone' || k === 'tablet' ? 'mobile' : k);
export function stateLabel(s: PersonState): string { export function stateLabel(s: PersonState): string {
return { return {
active: _('Active'), active: _('Active'),
+3
View File
@@ -4,6 +4,9 @@ const P: Record<string, string> = {
phone: '<rect x="7" y="2.5" width="10" height="19" rx="2.2"/><path d="M11 18.5h2"/>', phone: '<rect x="7" y="2.5" width="10" height="19" rx="2.2"/><path d="M11 18.5h2"/>',
computer: '<rect x="3" y="4.5" width="18" height="12" rx="1.8"/><path d="M2 19.5h20"/>', computer: '<rect x="3" y="4.5" width="18" height="12" rx="1.8"/><path d="M2 19.5h20"/>',
tablet: '<rect x="4.5" y="2.5" width="15" height="19" rx="2.2"/><path d="M11 18.5h2"/>', tablet: '<rect x="4.5" y="2.5" width="15" height="19" rx="2.2"/><path d="M11 18.5h2"/>',
// Phones and tablets as one choice (KindPick): a phone in front of a tablet, which stops short of it.
mobile:
'<path d="M9.5 6V4.7a2.2 2.2 0 0 1 2.2-2.2h7.1a2.2 2.2 0 0 1 2.2 2.2v11.6a2.2 2.2 0 0 1-2.2 2.2H14"/><rect x="3" y="8" width="8.5" height="13.5" rx="2.2"/><path d="M6.5 18.5h1.5"/>',
router: '<rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 16.5h.01M10.5 16.5h.01M8 13l-2-6M16 13l2-6"/>', router: '<rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 16.5h.01M10.5 16.5h.01M8 13l-2-6M16 13l2-6"/>',
server: server:
'<rect x="3" y="4" width="18" height="7" rx="1.8"/><rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"/>', '<rect x="3" y="4" width="18" height="7" rx="1.8"/><rect x="3" y="13" width="18" height="7" rx="1.8"/><path d="M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"/>',
-10
View File
@@ -10,11 +10,6 @@ const days: Pair[] = [
]; ];
describe('mirrored bars', () => { describe('mirrored bars', () => {
it('splits the height between the two directions around the hairline', () => {
const m = mirror(days, 64);
expect(m.top + m.bottom + 3).toBe(64);
});
it('fits both peaks on one scale, the tighter one filling its half', () => { it('fits both peaks on one scale, the tighter one filling its half', () => {
const m = mirror(days, 64); const m = mirror(days, 64);
expect(120 * m.scale).toBeLessThanOrEqual(m.top); expect(120 * m.scale).toBeLessThanOrEqual(m.top);
@@ -22,11 +17,6 @@ describe('mirrored bars', () => {
expect(Math.max(120 * m.scale - m.top, 40 * m.scale - m.bottom)).toBeCloseTo(0); expect(Math.max(120 * m.scale - m.top, 40 * m.scale - m.bottom)).toBeCloseTo(0);
}); });
it('keeps 55–80% of the height for downloads, however lopsided the days', () => {
expect(mirror([[0, 100]], 64).top).toBe(Math.round(61 * 0.8));
expect(mirror([[100, 1]], 64).top).toBe(Math.round(61 * 0.55));
});
it('draws a month without traffic', () => { it('draws a month without traffic', () => {
const m = mirror([[0, 0]], 34); const m = mirror([[0, 0]], 34);
expect(Number.isFinite(m.scale)).toBe(true); expect(Number.isFinite(m.scale)).toBe(true);
+3 -25
View File
@@ -11,22 +11,9 @@ const run = (x: number, t: number, frames = 1): number[] => {
}; };
describe('caret glide', () => { describe('caret glide', () => {
it('is 90% of the way in about 134 ms (8–9 frames), a touch over, then rests exactly on its target', () => { it('settles exactly on its target in either direction', () => {
const xs = run(0, 100); expect(run(0, 100).at(-1)).toBe(100);
expect(xs[7]).toBeLessThan(90); expect(run(100, 0).at(-1)).toBe(0);
expect(xs[8]).toBeGreaterThanOrEqual(90);
const peak = Math.max(...xs);
expect(peak).toBeGreaterThan(101);
expect(peak).toBeLessThan(103);
expect(xs.at(-1)).toBe(100);
expect(xs.length).toBeLessThan(40);
});
it('goes the same way to the left', () => {
const xs = run(100, 0);
expect(xs[8]).toBeLessThanOrEqual(10);
expect(Math.min(...xs)).toBeGreaterThan(-3);
expect(xs.at(-1)).toBe(0);
}); });
it('takes a late frame as up to 2.5 frames, and is simply there after a long gap', () => { it('takes a late frame as up to 2.5 frames, and is simply there after a long gap', () => {
@@ -84,13 +71,4 @@ describe('caret places', () => {
expect(places(field({ value: long, start: 0, end: 22 }), mono)).toEqual({ caret: 216, start: 16, end: 216, range: true }); expect(places(field({ value: long, start: 0, end: 22 }), mono)).toEqual({ caret: 216, start: 16, end: 216, range: true });
expect(places(field({ value: long, start: 0, end: 22, scroll: 20 }), mono)).toEqual({ caret: 216, start: 16, end: 216, range: true }); expect(places(field({ value: long, start: 0, end: 22, scroll: 20 }), mono)).toEqual({ caret: 216, start: 16, end: 216, range: true });
}); });
it('measures only the text before each end', () => {
const seen: string[] = [];
places(field({ value: 'iPad', start: 1, end: 3 }), (s) => {
seen.push(s);
return mono(s);
});
expect(seen).toEqual(['i', 'iPa']);
});
}); });
+27
View File
@@ -56,6 +56,33 @@ describe('events', () => {
expect(isProblem({ ts: 1, sys: { ts: 1, src: 'awg', level: 'down', msg: '' } })).toBe(true); expect(isProblem({ ts: 1, sys: { ts: 1, src: 'awg', level: 'down', msg: '' } })).toBe(true);
expect(isProblem({ ts: 1, ev: ev({ type: 'connect' }) })).toBe(false); expect(isProblem({ ts: 1, ev: ev({ type: 'connect' }) })).toBe(false);
}); });
it('renders portal and unattributed renames, including saved names of removed devices', () => {
for (const by of ['portal', undefined] as const) {
const event = ev({ type: 'device_changed', by, person: 'p1', device: 'd1', detail: 'renamed from Мяточька ПК' });
expect(text(eventText({ people }, event))).toBe(
by === 'portal'
? 'Person Myata renamed device Phone on their portal · was Мяточька ПК'
: 'Device Myata · Phone renamed · was Мяточька ПК',
);
expect(text(eventText({ people: [] }, { ...event, pname: 'Myata', dname: 'Phone' }))).toBe(text(eventText({ people }, event)));
}
});
it('omits the person only in their own activity and preserves the actor', () => {
const st = { people };
const rename = ev({ type: 'device_changed', by: 'portal', person: 'p1', device: 'd1', detail: 'renamed from Old' });
expect(text(eventText(st, rename, 'p1'))).toBe('Device Phone renamed on the portal · was Old');
expect(text(eventText(st, { ...rename, by: 'admin' }, 'p1'))).toBe('You renamed device Phone · was Old');
expect(text(eventText(st, rename, 'another-person'))).toBe(text(eventText(st, rename)));
expect(text(eventText(st, ev({ type: 'disconnect', person: 'p1', device: 'd1' }), 'p1'))).toBe('Device Phone went offline');
expect(text(eventText(st, ev({ person: 'p1', device: 'd1', detail: '1.2.3.4' }), 'p1'))).toBe('Device Phone connected from 1.2.3.4');
expect(text(eventText(st, ev({ type: 'roam', person: 'p1', device: 'd1', detail: '1 → 2' }), 'p1').slice(0, 3))).toBe(
'Device Phone changed network ',
);
expect(text(eventText(st, ev({ type: 'expiring', person: 'p1', detail: '3 days' }), 'p1'))).toBe('Access ends in 3 days');
expect(text(eventText(st, ev({ type: 'device_added', by: 'portal', person: 'p1', detail: 'Tablet' }), 'p1'))).toBe(
'Device Tablet added on the portal',
);
});
it('says what happened', () => { it('says what happened', () => {
const st = { people }; const st = { people };
expect(text(eventText(st, ev({ person: 'p1', device: 'd1', detail: '1.2.3.4', where: 'Berlin' })))).toBe( expect(text(eventText(st, ev({ person: 'p1', device: 'd1', detail: '1.2.3.4', where: 'Berlin' })))).toBe(
+1 -12
View File
@@ -5,8 +5,6 @@ import {
date, date,
dayDiff, dayDiff,
daysLeft, daysLeft,
defaultName,
DEVICE_NAME_MAX,
deviceNameFits, deviceNameFits,
endsIn, endsIn,
endsSoon, endsSoon,
@@ -14,7 +12,6 @@ import {
fmtDay, fmtDay,
kb, kb,
shiftDay, shiftDay,
todayOf,
validDeviceName, validDeviceName,
} from '../src/shared/format'; } from '../src/shared/format';
import { plural } from '../src/shared/i18n'; import { plural } from '../src/shared/i18n';
@@ -62,9 +59,7 @@ describe('router days', () => {
expect(endsIn(2)).toBe('ends tomorrow'); expect(endsIn(2)).toBe('ends tomorrow');
expect(endsIn(7)).toBe('ends in 7 days'); expect(endsIn(7)).toBe('ends in 7 days');
}); });
it('takes today from a series', () => {
expect(todayOf([{ day: '2026-10-15' }, { day: '2026-10-16' }])).toBe('2026-10-16');
});
it('shows a router day as that day in any time zone', () => { it('shows a router day as that day in any time zone', () => {
expect(fmtDay('2026-10-01')).toBe('1 Oct 2026'); expect(fmtDay('2026-10-01')).toBe('1 Oct 2026');
expect(date('2026-10-01')).toBe('1 Oct 2026'); expect(date('2026-10-01')).toBe('1 Oct 2026');
@@ -84,7 +79,6 @@ describe('numbers', () => {
describe('device names', () => { describe('device names', () => {
it('take letters of any language, digits, spaces and - _ . up to the limit', () => { it('take letters of any language, digits, spaces and - _ . up to the limit', () => {
expect(DEVICE_NAME_MAX).toBe(20);
expect(validDeviceName('Kitchen iPad')).toBe(true); expect(validDeviceName('Kitchen iPad')).toBe(true);
expect(validDeviceName('my-pc_2.home')).toBe(true); expect(validDeviceName('my-pc_2.home')).toBe(true);
expect(validDeviceName('Мой ноутбук')).toBe(true); expect(validDeviceName('Мой ноутбук')).toBe(true);
@@ -120,9 +114,4 @@ describe('device names', () => {
expect(fitName('Living room TV ab xy', ' 2')).toBe('Living room TV ab 2'); expect(fitName('Living room TV ab xy', ' 2')).toBe('Living room TV ab 2');
expect(validDeviceName(fitName('Redmi Note 13 Pro+ 5G', ' 12'))).toBe(true); expect(validDeviceName(fitName('Redmi Note 13 Pro+ 5G', ' 12'))).toBe(true);
}); });
it('names a device after its kind', () => {
expect(defaultName('phone')).toBe('Phone');
expect(defaultName('other')).toBe('Device');
});
}); });
+3 -11
View File
@@ -2,19 +2,11 @@ import { describe, expect, it } from 'vitest';
import { arc, cityPlaces, devicePlaces, separate, type MapData } from '../src/admin/map'; import { arc, cityPlaces, devicePlaces, separate, type MapData } from '../src/admin/map';
describe('arc (mapcn buildArcCoordinates)', () => { describe('arc (mapcn buildArcCoordinates)', () => {
it('runs from one point to the other in 64 steps', () => { it('runs from one point to the other', () => {
const pts = arc([-0.1276, 51.5074], [-74.006, 40.7128]); const pts = arc([-0.1276, 51.5074], [-74.006, 40.7128]);
expect(pts).toHaveLength(65);
expect(pts[0]).toEqual([-0.1276, 51.5074]); expect(pts[0]).toEqual([-0.1276, 51.5074]);
expect(pts[64][0]).toBeCloseTo(-74.006); expect(pts.at(-1)![0]).toBeCloseTo(-74.006);
expect(pts[64][1]).toBeCloseTo(40.7128); expect(pts.at(-1)![1]).toBeCloseTo(40.7128);
});
it('bends to the left of travel by a fifth of the distance', () => {
// Due east 10°: the control point sits 2° north of the middle, the curve's peak half of that.
const mid = arc([0, 0], [10, 0])[32];
expect(mid[0]).toBeCloseTo(5);
expect(mid[1]).toBeCloseTo(1);
}); });
it('takes the short way across the antimeridian', () => { it('takes the short way across the antimeridian', () => {
-9
View File
@@ -35,13 +35,4 @@ describe('motion', () => {
expect(s.at(s.duration)).toBe(1); expect(s.at(s.duration)).toBe(1);
} }
}); });
it('gives the bouncy spring its overshoot and the smooth one none', () => {
const peak = (s: typeof BOUNCY) => Math.max(...Array.from({ length: 200 }, (_, i) => s.at((s.duration * i) / 200)));
// skiper103: about 11% past the end, settled well inside a second.
expect(peak(BOUNCY)).toBeGreaterThan(1.08);
expect(peak(BOUNCY)).toBeLessThan(1.15);
expect(BOUNCY.duration).toBeLessThan(900);
expect(peak(SMOOTH)).toBeLessThanOrEqual(1);
});
}); });
+1 -27
View File
@@ -1,21 +1,5 @@
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { import { moment, msAt, placeKey, replayStays, shares, stays, stretches, ticks, timeline, visits } from '../src/admin/places/model';
BAND,
FLAT,
arrived,
bandMiddle,
moment,
msAt,
placeKey,
replayStays,
shares,
shimmerOpacity,
stays,
stretches,
ticks,
timeline,
visits,
} from '../src/admin/places/model';
import type { GeoPoint, LogEvent } from '../src/shared/types'; import type { GeoPoint, LogEvent } from '../src/shared/types';
const D = 'd_1'; const D = 'd_1';
@@ -148,16 +132,6 @@ describe('replay', () => {
const ms = msAt(st, steps, 38000); const ms = msAt(st, steps, 38000);
expect(moment(st, steps, ms).t).toBeCloseTo(38000, -1); expect(moment(st, steps, ms).t).toBeCloseTo(38000, -1);
}); });
it('runs the shimmer from before the place it leaves to past the next', () => {
expect(bandMiddle(0)).toBeCloseTo(-BAND / 2);
expect(bandMiddle(1)).toBeCloseTo(1 + BAND / 2);
expect(arrived(bandMiddle(0.3))).toBe(false);
expect(arrived(1 - FLAT)).toBe(true);
const ex = shimmerOpacity(0.5);
expect(ex[0]).toBe('interpolate');
expect(ex.slice(3)).toEqual([0, 1, FLAT, 1, BAND / 2, 0]);
});
}); });
describe('ticks', () => { describe('ticks', () => {
+2 -29
View File
@@ -7,42 +7,15 @@ const KEY = `vpn://${'A1b2C3d4'.repeat(180)}`;
const HUGE = 'A1b2C3d4'.repeat(425); const HUGE = 'A1b2C3d4'.repeat(425);
describe('qr', () => { describe('qr', () => {
it('draws the plain look as black squares on white in one path', () => { it('omits the centre mark on dense codes', () => {
const svg = qrSvg(LINK);
expect(svg).toContain('fill="#fff"');
expect(svg).toContain('shape-rendering="crispEdges"');
expect(svg).not.toContain('evenodd');
});
it('draws the night look as light dots on black with eyes, marked on links only', () => {
const link = qrSvg(LINK, 3, true, 'night'); const link = qrSvg(LINK, 3, true, 'night');
expect(link).toContain('fill="#0a0a0a"');
expect(link).toContain('fill-rule="evenodd"');
expect(link).not.toContain('crispEdges');
// The mark's light tile on a short code, none on a dense one. // The mark's light tile on a short code, none on a dense one.
expect(link).toContain('fill="#f2f2f2"/><g transform'); expect(link).toContain('<g transform');
expect(denseQr(KEY)).toBe(true); expect(denseQr(KEY)).toBe(true);
expect(qrSvg(KEY, 3, true, 'night')).not.toContain('<g transform'); expect(qrSvg(KEY, 3, true, 'night')).not.toContain('<g transform');
}); });
it('draws the day look with the night shapes, dark on white', () => {
const night = qrSvg(LINK, 3, true, 'night');
const day = qrSvg(LINK, 3, true, 'day');
expect(day).toMatch(/<rect width="(\d+)" height="\1" fill="#ffffff"\/>/);
expect(day).toContain('fill-rule="evenodd"');
expect(day).not.toContain('crispEdges');
// The same dots and eyes as at night, in the other colours; the mark's tile turns dark.
expect(day.replace(/#ffffff/g, 'BG').replace(/#0a0a0a/g, 'FG')).toBe(night.replace(/#0a0a0a/g, 'BG').replace(/#f2f2f2/g, 'FG'));
});
it('gives a dense night code fuller dots', () => {
expect(qrSvg(LINK, 3, true, 'night')).toContain('a0.42 0.42');
expect(qrSvg(KEY, 3, true, 'night')).toContain('a0.48 0.48');
});
it('says a 3.4 KB text does not fit instead of throwing, and keeps it from the camera', () => { it('says a 3.4 KB text does not fit instead of throwing, and keeps it from the camera', () => {
expect(HUGE.length).toBe(3400);
expect(() => qrFits(HUGE)).not.toThrow();
expect(qrFits(HUGE)).toBe(false); expect(qrFits(HUGE)).toBe(false);
expect(scannable(HUGE)).toBe(false); expect(scannable(HUGE)).toBe(false);
// It still fits a code, but too fine to read off a screen. // It still fits a code, but too fine to read off a screen.
+10 -12
View File
@@ -2,19 +2,17 @@ import { describe, expect, it } from 'vitest';
import { labelFade } from '../src/portal/ui/seg'; import { labelFade } from '../src/portal/ui/seg';
describe('picker names on a pick', () => { describe('picker names on a pick', () => {
it('blurs the picked name in a beat after the pill, and folds a shown one whole', () => { it('shortens a fade interrupted part-way', () => {
expect(labelFade({ width: 0, full: 90, opacity: 0 }, true)).toEqual({ duration: 280, delay: 70 });
expect(labelFade({ width: 90, full: 90, opacity: 1 }, false)).toEqual({ duration: 220, delay: 0 });
});
it('runs only what is left of a fade turned back half-way', () => {
// Picked again while it was folding away: it comes back from 40% at once. // Picked again while it was folding away: it comes back from 40% at once.
const opening = labelFade({ width: 0, full: 90, opacity: 0 }, true);
const closing = labelFade({ width: 90, full: 90, opacity: 1 }, false);
const back = labelFade({ width: 36, full: 90, opacity: 0.4 }, true); const back = labelFade({ width: 36, full: 90, opacity: 0.4 }, true);
expect(back.duration).toBeCloseTo(168); expect(back.duration).toBeGreaterThan(0);
expect(back.delay).toBeCloseTo(42); expect(back.duration).toBeLessThan(opening.duration);
// Left while it was still coming in: it folds from the wider of its width and its opacity. expect(back.delay).toBeLessThanOrEqual(opening.delay);
expect(labelFade({ width: 45, full: 90, opacity: 0.2 }, false).duration).toBeCloseTo(110); // Interrupted while opening: either width or opacity can keep the closing fade active.
expect(labelFade({ width: 9, full: 90, opacity: 0.7 }, false).duration).toBeCloseTo(154); expect(labelFade({ width: 45, full: 90, opacity: 0.2 }, false).duration).toBeLessThan(closing.duration);
expect(labelFade({ width: 9, full: 90, opacity: 0.7 }, false).duration).toBeLessThan(closing.duration);
}); });
it('leaves a folded name alone and a shown one picked again as it is', () => { it('leaves a folded name alone and a shown one picked again as it is', () => {
@@ -25,7 +23,7 @@ describe('picker names on a pick', () => {
it('keeps to its bounds when the readings are off (no width to measure, opacity past 1)', () => { it('keeps to its bounds when the readings are off (no width to measure, opacity past 1)', () => {
expect(labelFade({ width: 30, full: 0, opacity: 0 }, false).duration).toBe(0); expect(labelFade({ width: 30, full: 0, opacity: 0 }, false).duration).toBe(0);
expect(labelFade({ width: 200, full: 90, opacity: 0 }, false).duration).toBe(220); expect(labelFade({ width: 200, full: 90, opacity: 0 }, false)).toEqual(labelFade({ width: 90, full: 90, opacity: 0 }, false));
expect(labelFade({ width: 0, full: 90, opacity: 1.2 }, true).duration).toBe(0); expect(labelFade({ width: 0, full: 90, opacity: 1.2 }, true).duration).toBe(0);
}); });
}); });
-7
View File
@@ -2,7 +2,6 @@ import { describe, expect, it } from 'vitest';
import { import {
addLink, addLink,
appsFor, appsFor,
deviceNoun,
importPath, importPath,
importSteps, importSteps,
inWebview, inWebview,
@@ -53,12 +52,6 @@ describe('setup', () => {
expect(wantsAdd('')).toBe(false); expect(wantsAdd('')).toBe(false);
}); });
it('names the device being set up by its kind, not its name', () => {
expect(deviceNoun('phone')).toBe('phone');
expect(deviceNoun('computer')).toBe('computer');
expect(deviceNoun('other')).toBe('device');
});
it('knows whether the page is open on the device being set up', () => { it('knows whether the page is open on the device being set up', () => {
expect(sameDevice('phone', 'ios')).toBe(true); expect(sameDevice('phone', 'ios')).toBe(true);
expect(sameDevice('phone', 'mac')).toBe(false); expect(sameDevice('phone', 'mac')).toBe(false);
+1 -21
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { wayState, type WayState } from '../src/portal/way'; import { wayState } from '../src/portal/way';
import type { Device, SetupState } from '../src/shared/types'; import type { Device, SetupState } from '../src/shared/types';
/** When the sheet opened (router clock). */ /** When the sheet opened (router clock). */
@@ -73,24 +73,4 @@ describe('the set-up sheet’s way', () => {
expect(wayState(dev({ online: false, handshake: OPENED + 9, setup: null }), OPENED)).toBe('waiting'); expect(wayState(dev({ online: false, handshake: OPENED + 9, setup: null }), OPENED)).toBe('waiting');
expect(wayState(undefined, OPENED)).toBe('waiting'); expect(wayState(undefined, OPENED)).toBe('waiting');
}); });
it('follows a whole set-up: knocks, no data, imported again, connected', () => {
const seen: WayState[] = [];
const answers: Partial<Device>[] = [
{},
{ setup: setup('trying') },
{ setup: setup('trying') },
// The network let it through, but the phone holds an old configuration.
{ online: true, handshake: OPENED + 40 },
{ online: true, handshake: OPENED + 40, setup: setup('nodata', OPENED + 52) },
// Gone offline: plain waiting, no line of its own.
{ online: false, handshake: OPENED + 40 },
{ online: true, handshake: OPENED + 300, setup: setup('flowing', OPENED + 300) },
];
for (const a of answers) {
const st = wayState(dev(a), OPENED);
if (st !== seen[seen.length - 1]) seen.push(st);
}
expect(seen).toEqual(['waiting', 'trying', 'waiting', 'nodata', 'waiting', 'connected']);
});
}); });
+1 -1
View File
@@ -4,7 +4,7 @@
"installCommand": "npm ci", "installCommand": "npm ci",
"buildCommand": "npm run build:demo", "buildCommand": "npm run build:demo",
"outputDirectory": "dist/demo", "outputDirectory": "dist/demo",
"ignoreCommand": "[ \"$VERCEL_GIT_COMMIT_REF\" != main ] || git diff --quiet HEAD^ HEAD -- .", "ignoreCommand": "[ \"$VERCEL_GIT_COMMIT_REF\" != main ] || git diff --quiet \"$VERCEL_GIT_PREVIOUS_SHA\" HEAD -- .",
"headers": [ "headers": [
{ {
"source": "/(.*)", "source": "/(.*)",