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: Export all user Memos as a .zip of Markdown files #2757

Closed
wants to merge 6 commits into from
Closed

feat: Export all user Memos as a .zip of Markdown files #2757

wants to merge 6 commits into from

Conversation

nalderto
Copy link
Contributor

This PR adds an "Export Memos" button to the Setting => My Account page. This will download a zip folder, generated by the server, containing all of the user's Memos in Markdown files. The individual memos filenames are named after their creation date in RFC3339 format. This PR is should partially address this open enhancement to improve exports with Memos.

I also resolved some memory leaks with downloading images and files in the share dialog.

image

@nalderto nalderto requested a review from boojack as a code owner January 14, 2024 21:25
@boojack
Copy link
Member

boojack commented Jan 16, 2024

Thanks for the PR, there are some points I would like to clarify about import/export:

  • I think import/export operations should be very infrequent;
  • It's more convenient to import/export directly through the database;
  • Memos now is mainly suit for person/family or friends, not for strangers on the internet. All data is stored on the user's machine.

So I don't think we need to do export in UI. Are there any other reasons about this feature? @nalderto

@nalderto
Copy link
Contributor Author

  • I agree import/export is infrequent, but don't necessarily think that means that it shouldn't be included in the UI. Folks don't change things like "Allow user signup" that often, but that doesn't mean it shouldn't be in the UI.
  • Presently in Memos, yes, it is easier to import/export via the database. However, I think that is something we should strive to make easier. If folks decide they want to move to another Notes app, we shouldn't expect them to have to access the DB directly to export their data. This is a feature that is expected and desired with other notes apps.
  • Less tech savvy friends/family should be able to export their data without having to have their Memos admin export their data manually.

For example, Joplin has this functionality
image

I foresee a separate tab in Settings for Import/Export instead of always having it in "My Account", however since we would only have export functionality at the moment, I figured "My Account" is fine for now.

@boojack
Copy link
Member

boojack commented Jan 16, 2024

Not the same as Joplin, memos is deployed by someone and can be used by others. In case one user has a large amount of data, it may take up a lot of resources when exporting or even cause the service to hang. So perhaps export should be an administrator's function.

@nalderto
Copy link
Contributor Author

That's fair, although with the infrequency of exports occurring and friends/family use case of Memos, I don't see that being a major issue. Making it an admin only is better than nothing, although that makes it difficult to export other users' data. The file creation is all done in memory, so I would hope that performance wouldn't be impacted significantly with an export

@boojack
Copy link
Member

boojack commented Jan 16, 2024

SGTM. It's better to use APIv2(protobuf + gRPC) to implement the export api instead of the deprecated one.

@nalderto
Copy link
Contributor Author

Gotcha! I wasn’t sure if I should use v1 or v2. I can re-implement this with the v2 API in a couple weeks if you’d like.

@erbanku
Copy link

erbanku commented Jan 22, 2024

@boojack @nalderto

Merging the PR is highly advisable for those like me needing reliable export features.

I frequently use Obsidian and various other note-taking apps for my day-to-day tasks, and for quick notes, I turn to Memos because it's incredibly user-friendly & handy. In this case, I aim to export my memos to a local storage solution to unify all my notes in a single location. Having this export capability is a critical requirement for me.

Previously, before the Open API was phased out, I could export all my memos seamlessly using the memos-export service. Regrettably, this is no longer possible.

@erbanku
Copy link

erbanku commented Jan 22, 2024

I can backup database files, but the database files are very inconvenient for further interactions with notes.

I think we can not implement the import function, but the export function is necessary. There are already many users requesting a similar function in GitHub Issues, I hope it can be implemented.

@Tslmuun
Copy link

Tslmuun commented Jan 25, 2024

thank you for your work.Memos as a distributed platform, I believe the export/import feature is very important, users can freely migrate to another site. thank you again.

@nalderto
Copy link
Contributor Author

I'm closing this PR, because I made a new PR to implement the streaming gRPC endpoint to download the zip folder.

@nalderto nalderto closed this Jan 29, 2024
@nalderto nalderto deleted the export-all-memos branch January 29, 2024 06:37
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.

4 participants