fix: Clean Output Buffering & Add API Dashboard#30
Merged
Conversation
- Add `exit` and `cleanOutputBuffers` to API responses to prevent HTML appending. - Update CORS headers. - Add Standalone Dashboard for API visualization.
- 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`.
Contributor
There was a problem hiding this comment.
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()andexitstatements 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.
…orce structure refresh on create
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Beschreibung
Dieser PR addressiert mehrere Probleme mit der API Response-Handhabung und fügt ein Standalone Dashboard hinzu.
Änderungen
Fix: Headers already sent / HTML Appended to JSON
RouteCollection.php(handle()Methode) undpages/openapi.phpwurdeexit;hinzugefügt.rex_response::cleanOutputBuffers()wird konsistent aufgerufen.Verbesserte CORS Header
Access-Control-Allow-Originbasierend auf dem Origin-Request-Header, um Cross-Origin-Requests vom Dashboard zu ermöglichen.