Repository navigation
Feature/note downloading - #47
Merged
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.
Linked Issues
Closes #27 #35
Summary
Adds signed URL generation for previews and downloads, plus a dashboard download button that uses the new
/api/notes/[id]/downloadroute and deducts credits fromprofiles.credit_scorestorage.ts: Creates a server-only helper that makes Supabase signed URLs with a default 1‑hour TTL~/notes/route.ts: When listing notes, it now turns preview file keys into signed preview URLs~/download/route.ts: New endpoint that checks login, charges credits (fromprofiles.credit_score), records the download, then streams the file (best way i could find to make it so only authenticated user can download)page.tsx: Adds a “Download” button per note card that calls the download API and saves the file locallydashboard.css: Styles the new download buttonstorage.md: Documents signed URL usage for previews and that downloads are streamed via the APIHow to Test
Sign in and open
/dashboardClick “Download” on a note card; confirm the file opens and credits decrease
Verify preview thumbnails still load in the notes list
Checklist