Skip to content

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=list

Response:

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=theme

Returns 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 400 with error message

Version History

http
GET /api/desktop-components.php?action=history&component_id=theme

Response:

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=profiles

Response:

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

TypeInjection MethodExample
css<style> element appended to <head>Theme variables, animations
jsHook-based override via window.__niutonHooksDock customization, panel layout
widgetDOM container in .desktop-areaClock, weather, notes widget

Error Responses

StatusErrorCause
400Code zu grossComponent exceeds 100KB
400Blockierter CodeJS contains blocked pattern
400component_id erforderlichMissing required parameter
404Nicht gefundenComponent or profile not found
405Method not allowedWrong HTTP method

AI-Powered Cloud Desktop OS