New: Settings page rebuilt with React UI and REST API - #243
Open
KingYes wants to merge 1 commit into
Open
Conversation
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.
✨ PR Description
1. Problem & Context
Settings page was a legacy PHP form-based UI; migrating to React + REST API for modern UX and maintainability. Enables settings management via REST while deprecating old AJAX pattern.
2. What Changed (Where)
class-aal-rest.php/settingsGET/PUT routes; new/logs/erasePOST route;check_settings_permissions()with nonce validationclass-aal-settings.phpsettings.js(new)api.jsfetchSettings(),saveSettings(),eraseLogs()wrappers; movedEXPORT_FILTER_KEYSconstant inside functionsettings-index.js(new)package.jsonsettings-index.jsto build scriptstest-settings-rest.php(new)3. How It Works
Request flow: React component calls
fetchSettings()→ REST API returns field schema + current values → user edits state →saveSettings()sends PUT with nonce header → PHP validates each field per type (numeric bounds, enum whitelist, empty string handling) → merges with existing options → returns success/error.Permission gate:
manage_optionscheck + nonce verification viaX-AAL-Settings-Nonceheader on every settings/erase endpoint. Field sanitization is per-key with explicit allowed values (IP sources hardcoded, yes/no enum, numeric bounds).4. Risks
Nonce misuse: Passing nonce via custom header instead of POST body—verify client-side code always includes it on PUT/POST (not a GET param). Backward compat: Removed AJAX reset callback and Settings API registration; verify no third-party code hooked
ajax_aal_reset_items. Build dependency: Settings page now requires npm build; missing assets show admin notice but could silently fail if build skipped.Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how