Files
YMhut-box-C-/server/unified-management
QWQLwToo 2513eb2903
build-winui / winui (push) Has been cancelled
继续更新 update 门户站点界面和功能
2026-06-26 20:17:48 +08:00
..
2026-06-26 13:28:09 +08:00
2026-06-26 13:28:09 +08:00
2026-06-26 13:28:09 +08:00
2026-06-26 13:28:09 +08:00

YMhut Unified Management

This service unifies the old server/update and server/feedback-mailer projects.

What It Provides

  • Go backend with SQLite by default.
  • Optional MySQL configuration with runtime status and failover hooks.
  • Legacy routes for update-info.json, tool-status.json, media-types.json, modules.json, downloads, and feedback.
  • New client discovery through /api/client/bootstrap.
  • Admin login with default account admin/admin.
  • Login captcha, HttpOnly session cookie, and CSRF checks.
  • In-process media/data source service with scheduled health checks.
  • Vue admin/portal source and Rust WASM helper source.

Run

cd server\unified-management
go mod tidy
go run main.go

The startup preflight prints:

  • the accepted entrypoint: go run main.go
  • the listen address
  • storage, SQLite, legacy JSON, downloads, and frontend dist status

Alternative command entrypoint:

go run .\cmd\unified-management

Tests:

go test ./...

Frontend Build Check

Startup preflight checks both built web apps:

  • web/admin/dist/index.html
  • web/admin/dist/assets
  • web/portal/dist/index.html
  • web/portal/dist/assets

If either frontend is missing, the service still starts, but the preflight log tells you to run the frontend build. Release binaries built with embed_web report that embedded frontend assets are being used instead. Build the local dist files with:

cd server\unified-management\web\admin
npm install
npm run build

cd ..\portal
npm install
npm run build

The Go server serves portal assets from /assets/* and admin assets from /admin/assets/*. Disk dist files are preferred during development; embedded assets are used as the release fallback.

Release Binaries

Build frontend assets and produce merged backend binaries for Windows and Linux. The scripts run npm run build for both web apps and compile Go with -tags embed_web, so the resulting binaries include the admin and portal frontends:

cd server\unified-management
.\scripts\build-release.ps1 -Version 0.1.0

Linux/macOS shell:

cd server/unified-management
VERSION=0.1.0 ./scripts/build-release.sh

Outputs are written to dist-release/:

  • ymhut-unified-management-windows-amd64.exe
  • ymhut-unified-management-linux-amd64
  • ymhut-unified-management-linux-arm64

Default Port

The default listen address is :33550.

Override it with either:

$env:YMHUT_LISTEN=":33551"

or:

$env:PORT="33551"

Environment

  • YMHUT_LISTEN: listen address, default :33550
  • YMHUT_BASE_URL: public endpoint, default https://update.ymhut.cn
  • YMHUT_DB_PROVIDER: sqlite or mysql
  • YMHUT_SQLITE_PATH: SQLite path
  • YMHUT_MYSQL_DSN: MySQL DSN
  • YMHUT_UPDATE_PUBLIC_DIR: legacy update public directory
  • YMHUT_DOWNLOADS_DIR: package download directory
  • YMHUT_SOURCE_CHECK_SECONDS: source health check interval

Frontend

  • web/admin: Vue admin console source
  • web/portal: Vue public portal source
  • web/wasm: Rust WASM helpers

Rust WASM functions:

  • compareVersions
  • normalizeReleaseManifest
  • validateSourceCatalog
  • scoreEndpointHealth
  • mergeLegacyMediaTypes