Skip to content

feat: file upload for local subscriptions & large content optimization#20

Open
123hi123 wants to merge 1 commit intoResinat:masterfrom
123hi123:feat/subscription-file-upload-and-large-content
Open

feat: file upload for local subscriptions & large content optimization#20
123hi123 wants to merge 1 commit intoResinat:masterfrom
123hi123:feat/subscription-file-upload-and-large-content

Conversation

@123hi123
Copy link
Copy Markdown

Summary

  • File upload for local subscriptions: Added an "Upload File" button to create and edit forms for local subscriptions. Uses FileReader + useRef to store content in memory without rendering it in a <textarea>, preventing browser freeze on large files (e.g. 67 MB / 189K nodes).
  • Strip content from list API responses: The ListSubscriptions, CreateSubscription, and UpdateSubscription API responses no longer include the content field. This prevents transferring large subscription bodies on every 30-second poll, which previously caused 700+ MB browser memory usage. GetSubscription still returns full content for single-item retrieval.
  • Edit form fix: Separated edit validation schema so that existing local subscriptions with nodes can be edited (change name, enable/disable, toggle ephemeral) without re-submitting content. Shows a "N nodes loaded (content managed by server)" hint instead of an empty textarea.
  • Better feedback: Success toasts now show imported/current node count. File reading and large file submission show loading states.

Test plan

  • Create a local subscription by uploading a large YAML/JSON file — verify nodes are imported and toast shows count
  • Refresh the page — verify browser memory stays low (no 700 MB spike)
  • Open the edit drawer for the subscription — verify it shows "N nodes loaded" hint, not an empty textarea
  • Change settings (e.g. toggle ephemeral) and save — verify it succeeds without requiring content re-upload
  • Upload a new file in the edit form — verify content is replaced

🤖 Generated with Claude Code

Backend:
- Strip `content` from List/Create/Update subscription API responses to
  prevent transferring large local subscription bodies (e.g. 67 MB) on
  every 30-second poll, which caused 700+ MB browser memory usage
- GetSubscription still returns full content for single-item retrieval

Frontend (SubscriptionPage):
- Add file upload button for local subscriptions (create & edit forms)
  using FileReader + useRef to avoid rendering large content in textarea
- Show file loading state ("读取中...") and large file submit state
- Display node count in create/update success toasts
- Separate edit validation schema: skip content requirement when editing
  an existing subscription that already has nodes
- Show "N nodes loaded (content managed by server)" hint instead of
  empty textarea when editing large local subscriptions
- Add i18n keys for all new UI strings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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