New: Settings page rebuilt with React UI and REST API - #243
Merged
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 migrated from WordPress native forms to React UI backed by REST API, enabling modern component reuse and decoupling frontend from admin-menu-based rendering.
2. What Changed (Where)
class-aal-rest.php/settingsGET/PUT routes and/logs/erasePOST; newcheck_settings_permissions()validates nonce + admin capclass-aal-settings.php<div id="aal-settings-root">container for React mountsettings.js(new)api.jsfetchSettings(),saveSettings(),eraseLogs()wrappers passing nonce via custom headerpackage.jsonsettings-index.jsentry point3. How It Works
Settings endpoint returns schema + current values; React component renders inputs tied to state, POSTs changes to REST endpoint. Nonce passed in
X-AAL-Settings-Nonceheader (created server-side, injected viawindow.aalAdmin). Backend validates: logs_lifespan as non-negative int-or-empty, yes/no flags, IP source against whitelist. Erase endpoint gated byaal_allow_option_erase_logsfilter.4. Risks
REST endpoint lacks rate limiting (could spam settings updates). Nonce regeneration per pageload means concurrent requests fail—consider session-bound nonce or longer TTL. Plugin-side validation mirrors frontend (logs_lifespan range, enum values) but no assertion that schema matches saved settings structure—schema drift could silently skip unknown keys.
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