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

feat: async content download when creating via api #368

Merged
merged 3 commits into from
Feb 13, 2022
Merged

Conversation

fmartingr
Copy link
Member

@fmartingr fmartingr commented Feb 13, 2022

Added an async field to POST /api/bookmark to allow the fetching of the bookmarks content to be asynchronous. The bookmarks updated content (thumbnail and so) will only be shown in the frontend after a refresh.

Along with that, the extension API call has been left untouched since I wasn't able to test it. We need to fix #269 before improving the webextension support.

Fixes: #302
Blocked by: #367

@fmartingr fmartingr self-assigned this Feb 13, 2022
@fmartingr fmartingr changed the title feat: async content download when creating via api draft: feat: async content download when creating via api Feb 13, 2022
Invoking the content download code in a goroutine after saving the
bookmark, this way we can return a response to the user quickly while
the webpage is donwloaded and archived.

Cache api endpont (/api/cache) remains untouched until I understand
the logic behind it.

Also updated the API endpoint for the extension, though I'm unsure why
there's a difference between the "regular" API and the webext API,
they should be using the same APIs.
@fmartingr fmartingr changed the title draft: feat: async content download when creating via api feat: async content download when creating via api Feb 13, 2022
@fmartingr fmartingr merged commit fb0bf38 into master Feb 13, 2022
@fmartingr fmartingr deleted the feat/async-add branch February 13, 2022 20:09
@phiatlux
Copy link

Hi @fmartingr . Thank you for you work here. The async task is a major time-saver (at least for me).

It seems to me though, that the POST /api/bookmarks/ has a minor issue with its content field.
Although the rest of the elements (images, thumbnails, archives etc.) are being populated asynchronously, as expected, and they do appear after I refresh the home page, the content (html field) remains empty.
POST /api/bookmarks/ext doesn't have any issues. It fetches the data and populates all the fields correctly.

@fmartingr
Copy link
Member Author

It seems to me though, that the POST /api/bookmarks/ has a minor issue with its content field.
Although the rest of the elements (images, thumbnails, archives etc.) are being populated asynchronously, as expected, and they do appear after I refresh the home page, the content (html field) remains empty.
POST /api/bookmarks/ext doesn't have any issues. It fetches the data and populates all the fields correctly.

Hey @phiatlux thanks for reporting this! Since I mix and match the extension and the website I haven't caught that, I just assumed some sites had shitty HTML hierarchy and contect couldn't be extracted. I've opened #406 and will get on it ASAP.

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.

Add GET endpoint to add bookmarks to use with bookmarklet and other methods Add bookmarks asynchronously
2 participants