Browser Documentation Editor
The docs site includes a Markdown editor with preview. Authorized users save changes through the hosted HyperAI API.
Current integration
| Component | Responsibility |
|---|---|
src/hooks/useAuth.js | Reads the browser's AuthToken state |
src/components/EditButton.jsx | Displays the edit action for signed-in state |
src/components/EditorModal.jsx | Loads Markdown, shows preview, and submits changes |
| HyperAI API Docs endpoints | Authenticate requests and handle GitHub file operations |
| GitHub Actions | Build and deploy changed documentation |
The current frontend calls https://api.hyperai.io/Docs/GetFile and https://api.hyperai.io/Docs/SaveFile.
The current HyperAI API source exposes /api/admin/docs/GetFile and /api/admin/docs/SaveFile, protected by SuperAdminAuthorize. These paths differ from the frontend's legacy URLs. Check the deployed API routing before relying on browser editing. The repo contains no standalone Express backend to install.
Edit a page
- Sign in through the supported HyperSpin account flow.
- Open a docs page and choose the edit action.
- Wait for the Markdown to load.
- Make the changes and review the preview.
- Select Save Changes.
- Wait for the save result.
- Check the deployment before expecting the served page to change.
The current read request selects the main branch. The save includes the original file SHA for concurrent-change detection.
The editor reloads the page after saving. Deployment runs separately, so an immediate reload still shows the previous build until deployment finishes.
Authentication
The UI reads the access token, user ID, username, and login time from AuthToken. Requests include Bearer authorization, LogTime, and UserId headers.
A visible edit button indicates local signed-in state. The API source requires super-admin access for Docs operations. Signing in alone does not grant editing permission.
Use the sign-in flow to refresh expired credentials. Keep account tokens out of screenshots, shared logs, and example configuration.
Local development
From the docs repo:
npm install
npm start
The local frontend still targets the hosted API. Local editor access depends on account authorization and the API's allowed origins.
For Markdown and layout work, edit files under docs/ and run npm run build. This route needs no browser editor session.
Common fixes
No edit button
Check signed-in state on the docs origin. Browser storage belongs to each origin, so a login on another site does not automatically populate this site's storage.
Loading or saving returns an error
Open browser developer tools and inspect the Docs request status and response. Reauthenticate for credential failures. Check API origin configuration for CORS failures.
Another edit changed the file
Copy your work before reloading. Load the newest file, apply your changes, and save with the new SHA.
The published page looks unchanged
Check the GitHub commit and docs deployment. A saved source file and a deployed website are separate results.