Desktop Components API v3.8
Endpoint: GET/POST /api/desktop-components.php
Auth: Session + CSRF
Manages per-user desktop component overrides (themes, widgets, hooks) and profiles.
List Active Components
http
GET /api/desktop-components.php?action=listResponse:
json
{
"components": [
{
"id": 42,
"component_id": "theme",
"component_type": "css",
"code": ":root { --accent: #e91e63; }",
"version": 2,
"is_active": true,
"metadata": {},
"updated_at": "2026-02-26 14:30:00"
}
]
}Get Component
http
GET /api/desktop-components.php?action=get&component_id=themeReturns the active version of a specific component.
Save Component
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "save",
"component_id": "theme",
"component_type": "css",
"code": ":root { --accent: #ff5722; --panel-bg: rgba(20,20,40,0.95); }",
"metadata": { "description": "Warm orange theme" }
}Response:
json
{
"ok": true,
"version": 3,
"component_id": "theme"
}Creates a new version. The previous version is deactivated, the new one becomes active.
Validation
- Maximum code size: 100KB
- JS blocklist:
eval(,Function(,XMLHttpRequest,document.cookie,localStorage - Blocked patterns return
400with error message
Version History
http
GET /api/desktop-components.php?action=history&component_id=themeResponse:
json
{
"versions": [
{ "version": 3, "is_active": true, "updated_at": "2026-02-26 15:00:00", "metadata": {} },
{ "version": 2, "is_active": false, "updated_at": "2026-02-26 14:30:00", "metadata": {} },
{ "version": 1, "is_active": false, "updated_at": "2026-02-26 14:00:00", "metadata": {} }
]
}Activate Version
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "activate",
"component_id": "theme",
"version": 1
}Rolls back to a previous version by activating it and deactivating the current one.
Reset Component
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "reset",
"component_id": "theme"
}Deactivates all versions of a component, restoring the default desktop behavior.
Profiles
Save Profile
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "save_profile",
"name": "Dark Minimal"
}Snapshots all active components into a named profile.
Response:
json
{
"ok": true,
"profile_id": 5,
"components_saved": 3
}Load Profile
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "load_profile",
"profile_id": 5
}Restores all components from a saved profile (creates new versions).
List Profiles
http
GET /api/desktop-components.php?action=profilesResponse:
json
{
"profiles": [
{
"id": 5,
"name": "Dark Minimal",
"is_default": false,
"components": ["theme", "widget-clock"],
"created_at": "2026-02-26 16:00:00"
}
]
}Delete Profile
http
POST /api/desktop-components.php
Content-Type: application/json
{
"action": "delete_profile",
"profile_id": 5
}Component Types
| Type | Injection Method | Example |
|---|---|---|
css | <style> element appended to <head> | Theme variables, animations |
js | Hook-based override via window.__niutonHooks | Dock customization, panel layout |
widget | DOM container in .desktop-area | Clock, weather, notes widget |
Error Responses
| Status | Error | Cause |
|---|---|---|
| 400 | Code zu gross | Component exceeds 100KB |
| 400 | Blockierter Code | JS contains blocked pattern |
| 400 | component_id erforderlich | Missing required parameter |
| 404 | Nicht gefunden | Component or profile not found |
| 405 | Method not allowed | Wrong HTTP method |