[Spec] Support File blocks
otoyo opened this issue · 1 comments
otoyo commented
Definition
- API endpoint is defined in
src/pages/api/blocks/[id].ts
- The endpoint is used for fetching the file URL(S3 signed URL) of the File blocks if the URL is expired
- The endpoint allows
GET /api/blocks/:id
as a request - The endpoint returns JSON data of the block if the block type is 'file'
- if the block type is not 'file', the endpoint respond 403 for security reasons
- Component is defined in
src/components/notion-blocks/File.astro
- The component displays a download link to the file like #51
- The component make a request to the API to refresh the URL from front-end
- The request is made IF...
- the file URL is expired
- the download link is clicked
Tips
- The download link element should have the expiry time in a data attribute like
data-expiry-time="2023-02-13T..."
TODO
- Install adapter for Cloudflare worker
- Add an API endpoint as
/api/blocks/[id].ts
- Define
src/components/notion-blocks/File.astro