跳到主要内容

web_user plugin

Web management entry for OpenSynaptic nodes. Provides a built-in dashboard, REST API, user management, plugin control, transport control, and a command console.

Default address: http://127.0.0.1:8765/


Start the Server

# Start from CLI (blocks until Ctrl+C)
os-node web-user --cmd start -- --host 127.0.0.1 --port 8765 --block

# Standalone alias (after install)
os-web --cmd start -- --host 127.0.0.1 --port 8765 --block

# Start in background (returns immediately)
os-node web-user --cmd start -- --host 0.0.0.0 --port 8765

Open http://127.0.0.1:8765/ for the built-in management dashboard.


Authentication

Config keyDefaultDescription
auth_enabledfalseIf true, management API calls require X-Admin-Token header
admin_token""Required token value
read_onlyfalseIf true, all write operations return 403
management_enabledtrueIf false, all /api/* management endpoints return 403

Send the token as a request header:

X-Admin-Token: your-secret-token

API Endpoint Quick Reference

Health

MethodPathAuthReturns
GET/healthNone{"ok": true, "service": "web_user"}
GET/api/healthNoneSame as above

Dashboard and Overview

MethodPathAuthQuery params
GET/api/dashboardMgmtsections=identity,transport (optional)
GET/api/overviewMgmt

/api/dashboard response:

{
"ok": true,
"dashboard": {
"identity": { "device_id": "HUB_01", "assigned_id": 1, "version": "1.3.1", "timestamp": 1700000000 },
"transport": { "active_transporters": ["udp"], "transporters_status": {"udp": true}, "timestamp": 1700000000 },
"pipeline": { "standardizer_cache_entries": 42, "fusion_template_count": 8, "timestamp": 1700000000 },
"plugins": { "mount_index": ["tui", "web_user"], "runtime_index": {"tui": {"loaded": true}}, "timestamp": 1700000000 },
"db": { "enabled": true, "dialect": "sqlite", "timestamp": 1700000000 }
}
}

Config

MethodPathAuthDescription
GET/api/config?key=a.b.cMgmtRead one config key (dot path)
PUT/api/configMgmt + WriteWrite one config key
GET/api/options/schema?only_writable=1MgmtFull option schema
PUT/api/optionsMgmt + WriteBatch-update options

PUT /api/config body:

{ "key": "engine_settings.precision", "value": 8, "value_type": "int" }

PUT /api/options body:

{
"updates": [
{ "key": "engine_settings.precision", "value": 8, "value_type": "int" },
{ "key": "RESOURCES.service_plugins.web_user.ui_compact", "value": true, "value_type": "bool" }
]
}

UI Settings

MethodPathAuthDescription
GET/api/ui/configMgmtRead UI appearance settings
PUT/api/ui/configMgmt + WriteUpdate UI appearance settings

GET /api/ui/config response:

{
"ok": true,
"ui": {
"ui_enabled": true,
"ui_theme": "router-dark",
"ui_layout": "sidebar",
"ui_refresh_seconds": 3,
"ui_compact": false
}
}

Jobs (OS CLI)

MethodPathAuthDescription
GET/api/oscli/jobsMgmtList jobs; ?id= for single; ?include_output=1 for output
GET/api/oscli/metricsMgmtAggregate execution metrics
POST/api/oscli/executeMgmt + WriteSubmit CLI command as background job

POST /api/oscli/execute body:

{ "command": "plugin-test --suite component", "background": true }

Response:

{ "ok": true, "job_id": "abc123", "status": "queued" }

Plugins

MethodPathAuthDescription
GET/api/pluginsMgmtList all plugins + runtime state
POST/api/pluginsMgmt + WriteLoad, enable/disable, or run sub-command
GET/api/plugins/config?plugin=NAMEMgmtPlugin option schema
PUT/api/plugins/configMgmt + WriteUpdate plugin option
GET/api/plugins/commands?plugin=NAMEMgmtPlugin sub-command list
GET/api/plugins/visual-schema?plugin=NAMEMgmtPlugin display metadata

POST /api/plugins — load:

{ "plugin": "tui", "action": "load" }

POST /api/plugins — enable/disable:

{ "plugin": "tui", "action": "set_enabled", "enabled": false }

POST /api/plugins — run sub-command:

{ "plugin": "tui", "action": "cmd", "sub_cmd": "render", "args": ["--section", "transport"] }

Transport

MethodPathAuthDescription
GET/api/transportMgmtAll transport layer status
POST/api/transportMgmt + WriteEnable/disable or reload a medium

GET /api/transport response:

{
"ok": true,
"transport": {
"active_transporters": ["udp"],
"transporters_status": { "udp": true, "tcp": false },
"transport_status": { "quic": false },
"physical_status": { "uart": false },
"application_status": { "mqtt": false }
},
"items": [{ "medium": "udp", "enabled": true }]
}

POST /api/transport — enable:

{ "medium": "udp", "enabled": true }

POST /api/transport — reload driver:

{ "medium": "udp", "reload": true }

Display API

MethodPathAuthDescription
GET/api/display/providersMgmtList all registered display providers
GET/api/display/render/{section}MgmtRender one section; ?format=json|html|text
GET/api/display/allMgmtRender all sections; ?format=json|html

Built-in section paths: opensynaptic_core/identity, opensynaptic_core/config, opensynaptic_core/transport, opensynaptic_core/pipeline, opensynaptic_core/plugins, opensynaptic_core/db.

Data Query API

MethodPathAuthDescription
GET/api/data/packetsStandardQuery historical packets
GET/api/data/packets/{uuid}StandardGet one packet by UUID
GET/api/data/sensorsStandardQuery sensor readings
GET/api/data/devicesStandardList known devices

GET /api/data/packets query parameters: device_id, status, since, until, limit (max 500), offset.

GET /api/data/sensors query parameters: device_id, sensor_id, since, until, limit, offset.

User Management

MethodPathAuthDescription
GET/usersStandardList users
POST/usersStandard + WriteCreate user
PUT/users/{username}Standard + WriteUpdate role or enabled flag
DELETE/users/{username}Standard + WriteDelete user

POST /users body:

{ "username": "alice", "role": "user", "enabled": true }

PUT /users/alice body:

{ "role": "admin", "enabled": false }

GET /users response:

{
"users": [
{ "username": "admin", "role": "admin", "enabled": true },
{ "username": "alice", "role": "user", "enabled": true }
]
}

Legacy Execute

MethodPathAuthDescription
POST/api/cli/executeMgmt + WriteRun CLI command inline (blocks)
{ "command": "status" }

UI Config Keys

Set via CLI or HTTP under RESOURCES.service_plugins.web_user:

KeyTypeDefaultDescription
ui_enabledbooltrueEnable/disable the / management page
ui_themestr"router-dark""router-dark" or "router-light"
ui_layoutstr"sidebar""sidebar" (only current option)
ui_refresh_secondsint3Dashboard auto-refresh interval
ui_compactboolfalseCompact row density

The built-in Auto Option Studio reads /api/options/schema and auto-generates typed controls:

  • bool → toggle selector
  • int / float → numeric input with step
  • str → text input
  • json → JSON textarea

The built-in Command Console executes OS CLI commands through /api/oscli/execute and shows real-time job output.


Plugin CLI Commands

# Server control
os-web --cmd start -- --host 127.0.0.1 --port 8765 --block
os-web --cmd stop
os-web --cmd status

# Read information
os-web --cmd dashboard
os-web --cmd list # list users

# User management
os-web --cmd add -- --username alice --role admin
os-web --cmd update -- --username alice --role user --disable
os-web --cmd delete -- --username alice

# Option control
os-web --cmd options-schema -- --only-writable
os-web --cmd options-set -- --key engine_settings.precision --value 8 --type int
os-web --cmd options-apply -- --updates '[{"key":"engine_settings.precision","value":8,"value_type":"int"}]'

# Execute CLI command through web plugin
os-web --cmd cli -- --line "plugin-test --suite component"

Full API Reference

For complete request/response schemas and all query parameters, see:

Web API Command Reference