feat(web): add media API endpoints for admin#2953
Merged
ComputelessComputer merged 6 commits intomainfrom Jan 11, 2026
Merged
Conversation
- Remove Decap CMS files (config.yml, index.html, media-library.js, etc.) - Remove netlify-identity-redirect.js and its reference in __root.tsx - Move mdx-format-core.js to scripts/ folder (still used by format-mdx.js) - Add admin authentication with email whitelist - Add admin layout route with auth guard - Add admin dashboard and media library placeholder pages - Update handbook documentation to reflect new admin system Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
The _admin prefix creates a pathless layout route which conflicts with _view's index.tsx since both resolve to '/'. Renaming to 'admin' creates routes at /admin/* which don't conflict. Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
- Add github-media.ts with utilities for listing, uploading, deleting, moving files and creating folders via GitHub API - Add /api/admin/media/list endpoint for listing media files - Add /api/admin/media/upload endpoint for uploading files - Add /api/admin/media/delete endpoint for batch deleting files - Add /api/admin/media/move endpoint for moving/renaming files - Add /api/admin/media/create-folder endpoint for creating folders - All endpoints protected with admin authentication check Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Jan 10, 2026
Base automatically changed from
devin/1768030596-remove-decap-admin-auth
to
main
January 11, 2026 14:31
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for howto-fix-macos-audio-selection canceled.
|
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Removed unnecessary blank lines in github-media.ts
21f8de5 to
f449cee
Compare
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.
Summary
This PR adds backend API endpoints for managing media files in the admin interface. It builds on PR #1 which added the admin authentication foundation.
New files:
src/functions/github-media.ts- Utility functions for GitHub API operations (list, upload, delete, move, create folder)src/routes/api/admin/media/list.ts- GET endpoint to list media files in a directorysrc/routes/api/admin/media/upload.ts- POST endpoint to upload new filessrc/routes/api/admin/media/delete.ts- POST endpoint to batch delete filessrc/routes/api/admin/media/move.ts- POST endpoint to move/rename filessrc/routes/api/admin/media/create-folder.ts- POST endpoint to create foldersAll endpoints are protected by admin authentication via
fetchAdminUser().Review & Testing Checklist for Human
/api/admin/media/listwithout authentication and with a non-admin user - both should return 401YUJONGLEE_GITHUB_TOKEN_REPOenv var is configured and has repo write permissionsgetFullPath()function handles paths like/images/blog,images/blog, andblogdifferently - verify these all resolve correctlyRecommended test plan:
GET /api/admin/media/listto verify listing worksPOST /api/admin/media/uploadPOST /api/admin/media/movePOST /api/admin/media/deleteNotes
This is PR #2 in a stacked PR series implementing issue #2948. The UI for the media library will come in PR #3.
The move operation is not atomic - it copies the file first, then deletes the original. This matches how GitHub's API works (no native move operation).
Requested by: @ComputelessComputer
Devin session: https://app.devin.ai/sessions/5c615647f58c421dabccc0cdd5b4270c