Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spec] Support File blocks #53

Closed
3 tasks
otoyo opened this issue Feb 13, 2023 · 1 comment · Fixed by #65
Closed
3 tasks

[Spec] Support File blocks #53

otoyo opened this issue Feb 13, 2023 · 1 comment · Fixed by #65

Comments

@otoyo
Copy link
Owner

otoyo commented Feb 13, 2023

Definition

  1. 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
  2. Component is defined in src/components/notion-blocks/File.astro
    • The component displays a download link to the file like Feature/Add the file block #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
This was referenced Feb 13, 2023
@otoyo
Copy link
Owner Author

otoyo commented Feb 20, 2023

Because downloading images to the local works well, I implemented file blocks also as the local download instead of the above.
#65

@otoyo otoyo closed this as completed Feb 20, 2023
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 a pull request may close this issue.

1 participant