Skip to content

Comments

feat(web): add Google Docs import API endpoints#2960

Merged
ComputelessComputer merged 21 commits intomainfrom
devin/1768033298-google-docs-import
Jan 11, 2026
Merged

feat(web): add Google Docs import API endpoints#2960
ComputelessComputer merged 21 commits intomainfrom
devin/1768033298-google-docs-import

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 10, 2026

Summary

Adds backend API endpoints for importing content from published Google Docs and converting it to MDX format. This is PR #7 in the stacked PR series for issue #2948 (new blog admin site).

New endpoints:

  • POST /api/admin/import/google-docs - Fetches a published Google Doc, converts HTML to Markdown, and generates MDX with frontmatter
  • POST /api/admin/import/save - Saves MDX content to the GitHub repository in the specified content folder

The HTML-to-Markdown conversion handles headings, bold/italic/underline, links, images, lists, blockquotes, code blocks, and common HTML entities. Both endpoints require admin authentication.

Updates since last revision

  • Fixed TanStack Router API pattern to use createFileRoute with server.handlers instead of createAPIFileRoute
  • Improved file existence check in save.ts to properly handle non-404 errors (403, 500, etc.) instead of treating any non-OK response as "file doesn't exist"

Review & Testing Checklist for Human

  • Test HTML-to-Markdown conversion quality - The conversion uses regex which may not handle complex/nested HTML well. Test with a real Google Doc containing various formatting (nested lists, bold links, tables, etc.) to verify output quality
  • Verify ordered lists - The current implementation converts all <li> to - (unordered). If numbered lists are important, this needs fixing
  • Test image handling - Images remain as Google-hosted URLs which may break over time. Consider if images should be downloaded and re-uploaded to the media library
  • Verify the document must be "published to web" - The endpoint fetches from /pub URL. Test error handling when document is not published
  • Check hardcoded repo values - save.ts hardcodes fastrepl/hyprnote and main branch. Verify this is acceptable or if it should be configurable

Recommended test plan:

  1. Create a Google Doc with various formatting (headings, bold, italic, links, images, lists, blockquotes)
  2. Publish the document to web (File > Share > Publish to web)
  3. Call the /api/admin/import/google-docs endpoint with the URL
  4. Review the generated MDX for formatting accuracy
  5. Call /api/admin/import/save to verify file creation in GitHub

Notes

This PR adds only the backend endpoints. A follow-up PR (#8) will add the admin UI for the import workflow. The regex-based HTML parsing is a known limitation - a proper HTML parser library would be more robust but adds dependencies.

Link to Devin run: https://app.devin.ai/sessions/5c615647f58c421dabccc0cdd5b4270c
Requested by: @ComputelessComputer

devin-ai-integration bot and others added 8 commits January 10, 2026 07:40
- 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>
- Add responsive file grid with folder and image thumbnails
- Add drag-and-drop file upload functionality
- Add breadcrumb navigation for folder hierarchy
- Add file selection with batch delete support
- Add create folder functionality
- Add copy-to-clipboard for file paths
- Show file sizes and loading states

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
- Add select all / deselect all functionality
- Add batch download for selected files
- Add batch move with folder picker dialog
- Add selection toolbar with count display
- Improve selection UI with cancel button

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
- Add right-click context menu for files and folders
- Add individual item actions: download, copy path, copy as PNG
- Add rename functionality with modal dialog
- Add move functionality from context menu
- Add delete functionality from context menu
- Context menu auto-closes on click outside

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
… library

- Add collapsible left sidebar with search input
- Add file type filter (All, Images, Videos, Documents)
- Add folder tree navigation with expandable nodes
- Add clear filters button when filters are active
- Filter items by search query and file type
- Show helpful message when no files match filters
- Sidebar toggle button in header

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
- Add /api/admin/import/google-docs endpoint to parse published Google Docs
- Convert Google Docs HTML to Markdown format
- Generate MDX with proper frontmatter (title, author, date, etc.)
- Add /api/admin/import/save endpoint to save MDX files to content folder
- Support multiple content folders (articles, changelog, docs, etc.)
- Admin authentication required for all endpoints

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 3 commits January 10, 2026 08:27
- Change from createAPIFileRoute to createFileRoute with server.handlers
- Use fetchAdminUser instead of isAdmin for auth check
- Fix indentation to match existing API route patterns

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
…handler

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Base automatically changed from devin/1768033096-media-sidebar-search to main January 11, 2026 16:36
… context menu features)

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@netlify
Copy link

netlify bot commented Jan 11, 2026

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 7728990
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6963d20d2b100400080941bf
😎 Deploy Preview https://deploy-preview-2960--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 11, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 7728990
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6963d20d179a7a00071b03a3

@netlify
Copy link

netlify bot commented Jan 11, 2026

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit 7728990
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/6963d20dae77020008a11408

@ComputelessComputer ComputelessComputer merged commit 342d028 into main Jan 11, 2026
19 checks passed
@ComputelessComputer ComputelessComputer deleted the devin/1768033298-google-docs-import branch January 11, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant