Skip to content

Comments

fix: Clean Output Buffering & Add API Dashboard#30

Merged
dergel merged 9 commits intomainfrom
feature/api-dashboard-and-headers-fix
Feb 19, 2026
Merged

fix: Clean Output Buffering & Add API Dashboard#30
dergel merged 9 commits intomainfrom
feature/api-dashboard-and-headers-fix

Conversation

@skerbis
Copy link
Member

@skerbis skerbis commented Feb 19, 2026

Beschreibung

Dieser PR addressiert mehrere Probleme mit der API Response-Handhabung und fügt ein Standalone Dashboard hinzu.

Änderungen

  1. Fix: Headers already sent / HTML Appended to JSON

    • In RouteCollection.php (handle() Methode) und pages/openapi.php wurde exit; hinzugefügt.
    • Dies verhindert, dass REDAXO nach dem Senden des JSON-Contents noch weiteres HTML (z.B. Debug-Output, Shutdown-Funktionen) anhängt, was zu invalidem JSON führte.
    • rex_response::cleanOutputBuffers() wird konsistent aufgerufen.
  2. Verbesserte CORS Header

    • Explizites Setzen von Access-Control-Allow-Origin basierend auf dem Origin-Request-Header, um Cross-Origin-Requests vom Dashboard zu ermöglichen.

- Add `exit` and `cleanOutputBuffers` to API responses to prevent HTML appending.
- Update CORS headers.
- Add Standalone Dashboard for API visualization.
Copilot AI review requested due to automatic review settings February 19, 2026 18:32
- Add 'Create' button to structure view and tree nodes.
- Implement modal form for creating articles/categories.
- Handle POST requests to `structure/articles` and `structure/categories`.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses critical JSON response corruption issues and adds a comprehensive standalone dashboard for the REDAXO API. The main fix ensures that API responses are properly terminated to prevent REDAXO from appending HTML output to JSON responses, which was causing invalid JSON errors.

Changes:

  • Fixed JSON response corruption by adding cleanOutputBuffers() and exit statements to API response handlers
  • Implemented CORS support with headers for cross-origin requests and OPTIONS preflight handling
  • Added a feature-rich standalone HTML/JS/CSS dashboard for API testing and visualization

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.

File Description
lib/RouteCollection.php Added CORS headers and OPTIONS preflight handling, added exit statement to prevent HTML appending
pages/openapi.php Changed OpenAPI config output from YAML to JSON, added buffer cleaning and exit statement
assets/dashboard/index.html New 1966-line standalone dashboard with comprehensive API visualization features
assets/dashboard/README.md Documentation for dashboard usage, features, and setup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dergel dergel merged commit 3661146 into main Feb 19, 2026
@dergel dergel deleted the feature/api-dashboard-and-headers-fix branch February 19, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants