WARNING - Use this script at your own discretion. It's a prototype and not exhaustively tested and might throw HTTP errors that were not encounted for.
````
# CodiMD Note Exporter + Hedgedoc Note Importer
This little tool is intended to help you **backup** the notes that your CodiMD history shows to a local folder.
@@ -33,10 +37,10 @@ If you only want to export your visited documents and import them manually, just
- Go to https://md.inf.tu-dresden.de/
- Click on your username in the upper right and hit "*Export user data*"
- Download the file "archive.zip" and place it in the same folder as this file (README.md)
-**Weed the archive out**! Most likely, it will contain a lot of unused or empty documents. Delete those files in place
in the archive, don't extract them.
-**Weed your archive out**! Most likely, it will contain a lot of unused or empty documents. Delete those files in
place in the archive, don't extract them.
### 2. Extract the value of your CodiMD session cookie
### 2. Extract the Value of Your Codimd Session Cookie
To ensure that the script can access the documents you accessed in our CodiMD instance, you need to extract the value of
the `connect.sid` browser cookie for the
@@ -56,27 +60,27 @@ Now, the instructions are similar for Chrome and Firefox:
5. In the list, search for a cookie with the name `connect.sid`
6. Select and copy the value. It must start with the character sequence `s%3A`.
### 3. Extract the value of your HedgeDoc session cookie
### 3. Extract the Value of Your Hedgedoc Session Cookie
Follow the instructions from step 2, but copy the value of the cookie key `connect.hedgeDoc.sid`
### 4. Execute the script via the command line
### 4. Execute the Script via the Command Line
Execute `./md-import-export.py` or `python3 md-import-export.py` in a
shell. The script will ask for your session ids and download the notes you visited to the relative path
`./codimd-documents`.
shell. The script will ask for your session IDs and download the notes you visited to the relative
path `./codimd-documents`.
Please note that your CodiMD history might reference already deleted notes or notes you no
longer have access to. The URLs of these inaccessible notes are listed as part of the
output of the script.
Furthermore, the script tries to upload every file with a `.md` extension to our HedgeDoc instance.
Furthermore, the script tries to upload every file in the archive with a `.md` extension to our HedgeDoc instance.
### 5. Visit the Uploaded Documents to Make Them Appear in Your Hedgedoc History
Uploading the documents is not enough to make them appear in your HedgeDoc history.
You need to visit them at least once to make them available.
The script automatically generates a file `history_scripts/hedgedocu_documents_to_visit.url`.
You can either visit every file manually or execute the bash script `history_scripts/visit_migrated_documents.sh`.
This script will ask you for a browser to open the documents and then open them in batches of 50 URLs.
You can either visit every file manually or execute the bash script `history_scripts/visit_migrated_documents.sh` (Unix & MacOS).
Feel free to contribute a Batch-Script for Windows environments.
Be aware: this might be pretty resource intensive and might take a while.