memos
memos copied to clipboard
Inconvenient backups / exports
Is your feature request related to a problem?
Since people invest heavily into their journals, and this is a self-hosted software, it would be nice to see if we could get some option to export markdown PDF exports. I used to use the MiniDiary app on MacOS and they had pretty nice options.
We need to have some system that allows us to, independently of our hosting provider, make backups and ensure data integrity.
Describe the solution you'd like
Probably the simplest integration would be to just use the already existing storage configuration used to store uploaded assets, and also allow to set "daily/weekly/monthly" internal when SQLite database would be copied to the destination (for example S3 compatible storage), thus allowing quick, reliable, and painless restores.
I am not sure how would it go with importing, but I am sure that even if an option exists to just overwrite the old database via the SFTP/Database tool, that will be fine by most users.
Additional context
No response
Given that there is a REST API available, it should be possible to do both imports and exports via the API.
For example the curl example from the docs:
curl http://localhost:5230/api/v1/memo \
-H "Accept: application/json" \
-H "Authorization: Bearer $TOKEN"
will list memos, while this python script posted by someone on the Discord shows how to do a very basic import using the API.
Admittedly this requires some programming knowledge but perhaps a kind soul will come along and create some user friendly scripts or GUI tools to do imports/exports.
This issue is stale because it has been open 14 days with no activity.
@maks
Given that there is a REST API available, it should be possible to do both imports and exports via the API.
For example the curl example from the docs:
curl http://localhost:5230/api/v1/memo \ -H "Accept: application/json" \ -H "Authorization: Bearer $TOKEN"will list memos, while this python script posted by someone on the Discord shows how to do a very basic import using the API.
Admittedly this requires some programming knowledge but perhaps a kind soul will come along and create some user friendly scripts or GUI tools to do imports/exports.
vim ./batch_upload.sh # Go into your unzipped directory and edit it
#!/bin/bash
# Set your access token
ACCESS_TOKEN="eyJhbGciOiJIUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJuYW1lIjoiIiwiaXNzIjoibWVtb3MiLCJzdWIiOiIxIiwiYXVkIjpbInVzZXIuYWNjZXNzLXRva2VuIl0sImV4cCI6MTcwNzY0NDg1OCwiaWF0IjoxNzA3MDQwMDU4fQ.bThLilrM-RtGO_jjxhZvr2LSca4FAgt5chY5r4A6s64"
# Set the server URL
SERVER_URL="http://192.168.10.100:5230/api/v1/memo"
# Loop through all Markdown files in the current directory
for file in *.md; do
# Check if the file is a regular file
if [ -f "$file" ]; then
# Read the content of the Markdown file and escape special characters
content=$(cat "$file" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')
# Prepare the JSON payload
json_payload="{\"content\":\"$content\"}"
# Send the content to the remote server using curl
curl --request POST "$SERVER_URL" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--data "$json_payload"
# Add a newline for better separation between requests
echo -e "\n\n"
fi
done
- Remember to modify the value of the "ACCESS_TOKEN" and "SERVER_URL"
chmod u+x ./batch_upload.sh# Add user executable permissions for the script./batch_upload.sh# Run the script- Version: v0.19.1
Notes
- This Bash script can only be used to batch upload the contents of markdown files in the current directory.
- If latecomers can add support for images, it will become more complete.
References
- ChatGPT
How to export memos to local as a corn set in backend?
Issue is not in English. It has been translated automatically.
How to export memos to local as a corn set in backend?