Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0315c76
docs(spec): custom widget system + theme consolidation design
ZingerLittleBee May 28, 2026
9bd0d05
docs(spec): revise custom widget system per review (v2)
ZingerLittleBee May 28, 2026
5c4aca1
docs(plan): plan 1 — widget SDK + Registry + asset serving
ZingerLittleBee May 28, 2026
94994ce
feat(widget-sdk): scaffold workspace package
ZingerLittleBee May 28, 2026
3fa5dca
build(web): alias @serverbee/widget-sdk to source
ZingerLittleBee May 28, 2026
0e2f618
feat(widget-sdk): WidgetManifest types + validator
ZingerLittleBee May 28, 2026
ebe3153
feat(widget-sdk): defineWidget + WidgetModule types
ZingerLittleBee May 28, 2026
fdd021b
feat(widget-sdk): z mini-validator primitives
ZingerLittleBee May 28, 2026
3529f4d
feat(widget-sdk): host-runtime bridge
ZingerLittleBee May 28, 2026
c16ad43
feat(widget-sdk): live hooks (useServers/useServer/useMetric/useCapab…
ZingerLittleBee May 28, 2026
d19d062
feat(widget-sdk): useApiQuery/useApiMutation
ZingerLittleBee May 28, 2026
0673801
feat(widget-sdk): domain hooks (alerts/services/traffic/uptime/histor…
ZingerLittleBee May 28, 2026
6b56876
feat(widget-sdk): host hooks (useTheme/useConfigUpdate)
ZingerLittleBee May 28, 2026
be8d0b5
feat(widget-sdk): actions runner + ActionButton
ZingerLittleBee May 28, 2026
8f8eb4b
feat(widget-sdk): renderConfigForm + field renderers
ZingerLittleBee May 28, 2026
b00c756
feat(web): Widget Registry singleton
ZingerLittleBee May 28, 2026
2b247d2
feat(web): bootstrap loader (fetch list, import, isolate failures)
ZingerLittleBee May 28, 2026
8e67f09
fix(widget-sdk): replace constructor parameter shorthand for erasable…
ZingerLittleBee May 28, 2026
3d39ae9
feat(web): runtime bridge + import-map shims for widget SDK
ZingerLittleBee May 28, 2026
8327546
feat(server): widget_module sea-orm entity
ZingerLittleBee May 28, 2026
7ce5723
feat(server): migration for widget_module table
ZingerLittleBee May 28, 2026
55127e8
feat(server): widget manifest JSDoc extractor + validator
ZingerLittleBee May 28, 2026
bd29cc3
feat(server): WidgetModuleService + package extractor
ZingerLittleBee May 28, 2026
e2304a9
feat(server): /api/widget-modules list + asset endpoints
ZingerLittleBee May 28, 2026
85b3d83
test(server): integration tests for widget_module list + asset
ZingerLittleBee May 28, 2026
9b5b004
docs(plan): plan 2 — build pipeline + runtime bridge wire-up
ZingerLittleBee May 28, 2026
67c5c27
feat(web): add hello-world example builtin widget
ZingerLittleBee May 28, 2026
2b017ef
build(web): vite plugin emits builtin widget bundles + manifest
ZingerLittleBee May 28, 2026
ad49065
feat(server): register builtin widgets on boot from embedded manifest
ZingerLittleBee May 28, 2026
66fefa2
feat(server): serve Builtin widget assets via rust-embed
ZingerLittleBee May 28, 2026
d791b77
docs(plan): plan 3 — install UX + legacy theme cleanup
ZingerLittleBee May 28, 2026
0ecb2ff
feat(server): POST /api/widget-modules install + DELETE uninstall
ZingerLittleBee May 28, 2026
4fc2b8c
test(server): widget_module install + uninstall integration
ZingerLittleBee May 28, 2026
8c9d48a
feat(web): widget modules settings page (install URL/.js, list, unins…
ZingerLittleBee May 28, 2026
4105b2b
refactor(server): delete legacy spa_theme + custom_theme code
ZingerLittleBee May 28, 2026
6b6a791
refactor(web): delete legacy theme code (preset/custom/spa)
ZingerLittleBee May 28, 2026
3958e80
feat(server): widget module .zip collection install
ZingerLittleBee May 28, 2026
9f66a18
docs: bilingual custom widget guide (replaces theme docs)
ZingerLittleBee May 28, 2026
5532ecb
feat(server): add module_id column to dashboard_widget
ZingerLittleBee May 28, 2026
d813f55
feat(web): widget picker surfaces installed modules
ZingerLittleBee May 28, 2026
0983710
feat(web): WidgetRenderer dispatches module widgets to registry
ZingerLittleBee May 28, 2026
72457e2
build(server): ensure builtin-widgets dist dir exists pre-embed
ZingerLittleBee May 28, 2026
f1a007c
fix(server): cap source size for widget manifest regex extraction
ZingerLittleBee May 28, 2026
9571835
fix(server): cap widget zip total uncompressed bytes and entry count
ZingerLittleBee May 28, 2026
1d078d3
fix(server): widget module install + asset hardening
ZingerLittleBee May 28, 2026
12efae6
fix(server): SSRF guard + body cap + audit on widget module install
ZingerLittleBee May 28, 2026
412ffc2
test(server): widget module SSRF, role, and source-type conflict
ZingerLittleBee May 28, 2026
98f2992
feat(widget-sdk): introspect API + drop as any in form rendering
ZingerLittleBee May 28, 2026
148fb58
feat(widget-sdk): real form renderers for metricPath / color / duration
ZingerLittleBee May 28, 2026
531145b
feat(widget-sdk): reject duplicate action ids + drop component as-any…
ZingerLittleBee May 28, 2026
2b60962
feat(widget-sdk): sort useApiQuery params for stable URL + cache key
ZingerLittleBee May 28, 2026
fbf4f82
feat(widget-sdk): sdkVersion compat check at module load time
ZingerLittleBee May 28, 2026
bab01a4
feat(widget-sdk): live hooks via useSyncExternalStore
ZingerLittleBee May 28, 2026
e4ff35c
feat(widget-sdk): ActionButton with confirm dialog, toast, and audit …
ZingerLittleBee May 28, 2026
068df62
feat(web): wire widget runtime bridge to React Query + theme + sonner
ZingerLittleBee May 28, 2026
5106b45
fix(server): serve /runtime/* shims with no-cache headers
ZingerLittleBee May 28, 2026
486f7ff
feat(server): validate module_id references installed widget module
ZingerLittleBee May 28, 2026
3e0b05a
feat(web): file install accepts .zip + branches toast for collection
ZingerLittleBee May 28, 2026
853958e
feat(web): module-aware widget config dialog via SDK renderConfigForm
ZingerLittleBee May 28, 2026
674bf83
docs: spec dual-column reality + hook category fixes
ZingerLittleBee May 28, 2026
70c7b3a
docs: update widget safety surface + drop stale theme references
ZingerLittleBee May 28, 2026
3755f9c
chore(web): drop unused widget-config i18n keys from settings namespace
ZingerLittleBee May 28, 2026
b17196a
chore: bump version to v1.0.0-alpha.5
ZingerLittleBee May 28, 2026
16633c5
chore: silence ultracite errors in widget-sdk package
ZingerLittleBee May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0-alpha.5] - 2026-05-28

### Added

- **Custom widget system (B/C method)** -- New `@serverbee/widget-sdk` workspace package exposes `defineWidget`, a bundled `z` schema validator, and a typed hook surface (live: `useServers/useServer/useMetric/useCapability` via `useSyncExternalStore`; domain: `useHistory/useTraffic/useAlerts/useServiceMonitors/useUptime/useGeoIp`; host: `useTheme/useConfigUpdate`; escape hatches: `useApiQuery/useApiMutation`). Widgets are authored as a single ESM file with a top-of-file `@serverbee-widget` JSDoc manifest, statically extractable, no `eval`. Admins install via `POST /api/widget-modules` (URL or multipart upload) for single `.js`/`.mjs` files or `.zip` collection bundles with a `collection.json` index. Built-in widgets are emitted by a new Vite nested-build plugin to `apps/web/dist/builtin-widgets/`, embedded into the server binary via rust-embed, and registered at boot
- **Dashboard module rendering** -- `dashboard_widget` gained a `module_id` column; `widget_type='module'` widgets dispatch through the widget registry and render via the SDK component contract. The picker surfaces installed modules under a "Custom Widgets" section; the config dialog renders the module's `configSchema` via the SDK form renderer (real renderers for `z.metricPath`/`z.color`/`z.duration`) with friendly placeholders for missing modules or empty schemas. `ActionButton` from the SDK ships with confirm dialog, pending state, and success/error toast wiring
- **Bilingual widget docs** -- `apps/docs/content/docs/{en,cn}/custom-widgets.mdx` covers method B (single file) and method C (zip bundle) end-to-end: manifest fields, build pipeline with React/SDK externals, install flows, asset resolution rules, SDK surface summary, and the full safety/limits table

### Changed

- **Widget install hardening** -- SSRF guard now resolves DNS and rejects any host whose IP falls in a reserved/private range (loopback, RFC 1918, CGNAT, link-local incl. cloud metadata, IPv6 ULA/link-local, benchmarking, documentation, multicast, reserved); HTTP redirects are disabled; uploads enforce a per-route 1 MiB body limit with streaming size accounting; zip extraction caps total uncompressed size at 32 MiB across at most 64 entries; manifest extractor rejects sources > 1 MiB up front; id conflicts across `source_type` (e.g. upload trying to overwrite a builtin) return `409 Conflict`; `dashboard_widget.module_id` is validated against installed modules; SDK declarations carry a `sdkVersion` semver range checked at load time. Install and uninstall events emit audit log entries
- **Runtime bridge** -- `mountRuntimeBridge` now wires the SDK runtime to the live React Query servers cache and the host theme provider via `useSyncExternalStore`, surfaces sonner toasts, and exposes a confirm-dialog request channel. `/runtime/*` import-map shims are served with `Cache-Control: no-cache` to avoid stale shim drift across SPA upgrades. `defineWidget` rejects duplicate action ids

### Removed

- **Legacy SPA theme + custom CSS theme system** -- The `spa_theme` package upload feature, `custom_theme` CSS variable system, and seven preset themes are deleted in their entirety (backend service/router/entity, migrations dropping `spa_themes` and `custom_theme`, the appearance settings UI, preset CSS files, `theme_ref` from public status pages, and the `SERVERBEE_FEATURE__CUSTOM_THEMES` config field). The theme provider is collapsed to light/dark/system. The old `custom-themes.mdx` and `custom-frontend.mdx` doc pages are replaced by `custom-widgets.mdx`

## [1.0.0-alpha.4] - 2026-05-27

### Added
Expand Down
21 changes: 18 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
]

[workspace.package]
version = "1.0.0-alpha.4"
version = "1.0.0-alpha.5"
edition = "2024"
license = "AGPL-3.0-or-later"
repository = "https://github.com/ZingerLittleBee/ServerBee"
Expand Down
8 changes: 0 additions & 8 deletions apps/docs/content/docs/cn/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ ServerBee 使用 [figment](https://github.com/SergioBenitez/Figment) 库加载
| `SERVERBEE_AUTH__MAX_SERVERS` | `0` | 通过注册码接入的最大服务器数(0 = 不限制),尽力软限制 |
| `SERVERBEE_SERVER__TRUSTED_PROXIES` | 私有/回环 CIDR | 受信任的反向代理 CIDR 列表,默认信任 RFC 1918 + 回环地址。设为 `[]` 禁用 |
| `SERVERBEE_SCHEDULER__TIMEZONE` | `UTC` | 流量日聚合时区(如 `Asia/Shanghai`) |
| `SERVERBEE_FEATURE__CUSTOM_THEMES` | `true` | 将 `feature.custom_themes` 设为 false 可禁用用户自定义主题。自定义引用会在读取时强制转换为 `preset:default` |
| `SERVERBEE_LOG__LEVEL` | `info` | 日志级别:`trace`/`debug`/`info`/`warn`/`error` |
| `SERVERBEE_LOG__FILE` | `""` | 日志文件路径,留空输出到 stdout |

Expand Down Expand Up @@ -353,13 +352,6 @@ ip_quality_event_days = 90
# 默认: "UTC"
timezone = "UTC"

# --- 功能开关 ---
[feature]
# 是否启用用户自定义主题
# 设为 false 时,自定义主题引用会在读取时强制转换为 preset:default
# 默认: true
custom_themes = true

# --- GeoIP 地理位置 ---
[geoip]
# MaxMind 兼容 MMDB 数据库文件路径,路径非空时使用自定义 GeoIP;为空时可在设置页下载 DB-IP Lite
Expand Down
222 changes: 0 additions & 222 deletions apps/docs/content/docs/cn/custom-frontend.mdx

This file was deleted.

Loading
Loading