naibaandcloudcode 472174640a feat(settings): add reserved hosts field and surface NAT errors
Add the reserved_hosts setting (input + i18n across all locales) so operators
behind a reverse proxy can declare public dashboard hostnames members must not
register as NAT domains (GHSA-x6fg-52vr-hj4w).

Show the backend error message on NAT create/update failure instead of a
generic "unexpected error", so a reserved-host rejection is explained.

Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
2026-05-31 02:04:47 +00:00
2024-12-15 09:45:56 +08:00
2024-12-13 23:51:33 +08:00
2025-10-02 14:23:11 +08:00
2024-12-13 23:51:33 +08:00
2024-12-13 23:51:33 +08:00
2024-12-13 23:51:33 +08:00
2024-12-13 23:51:33 +08:00

Nezha Admin Frontend

Bootstrap

npx swagger-typescript-api -p http://localhost:8008/swagger/doc.json -o ./src/types -n api.ts --no-client --union-enums

End-to-end tests

Playwright suite lives in tests/e2e/ and runs in CI via .github/workflows/e2e.yml. The workflow checks out the backend (nezhahq/nezha master), starts it on 127.0.0.1:8008, then runs npm run e2e here.

Run locally

First install browsers once:

npm run e2e:install

Then start the backend separately. The shape the CI workflow uses is:

# in a checkout of nezhahq/nezha
mkdir -p cmd/dashboard/admin-dist cmd/dashboard/user-dist
printf '<!doctype html><title>admin e2e</title>\n' > cmd/dashboard/admin-dist/index.html
printf '<!doctype html><title>user e2e</title>\n' > cmd/dashboard/user-dist/index.html
go install github.com/swaggo/swag/cmd/swag@latest
"$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs
go build -o /tmp/nezha-dashboard ./cmd/dashboard

NZ_LISTENHOST=127.0.0.1 NZ_LISTENPORT=8008 \
  NZ_JWTSECRETKEY=e2e-jwt-secret-key-min-32-chars-long-ok \
  NZ_AGENTSECRETKEY=e2e-agent-secret-32-bytes-long-ok \
  NZ_SITENAME=nezha-e2e GIN_MODE=release \
  /tmp/nezha-dashboard -c data/config.yaml -db data/sqlite.db

Then back in this repo:

npm run e2e            # Vite dev server starts automatically
npm run e2e -- --ui    # interactive runner for debugging

Reusing a running stack

If you already have Vite (npm run dev) and the backend up:

E2E_SKIP_WEBSERVER=1 E2E_BASE_URL=http://localhost:5173 npm run e2e

Override credentials for a non-default admin account with E2E_ADMIN_USER and E2E_ADMIN_PASS.

Triaging a CI failure

The workflow uploads two artifacts on failure:

  • playwright-report — HTML report; open index.html locally.
  • dashboard-log — full backend stdout/stderr for the test run.
S
Description
No description provided
Readme Apache-2.0
2.1 MiB
Languages
TypeScript 91.6%
HTML 7.4%
CSS 0.7%
JavaScript 0.3%