hedgedoc-migrator/README.md
2022-09-15 19:31:00 +02:00

50 lines
1.1 KiB
Markdown

# Hedgedoc Migrator
Simple script to migrate content from one Hedgedoc instance to another.
## Cypress
Follow the guide over [here](https://docs.cypress.io/guides/getting-started/installing-cypress#Linux-Prerequisites).
You also require NodeJS. Run `npm ci` to install the required packages.
### Execution
To start cypress, simply execute `npx cypress open`. Then click `E2E Testing` and run using electron. This step could be automated using the `cypress` [API](https://docs.cypress.io/guides/guides/module-api).
## Python
Create new python venv:
```
python -m venv venv
```
Activate the new environment (linux)
```
source venv/bin/activate
```
Install the requirements
```
pip install -r requirements.txt
```
### Execution
Start the extractor
```
python hedgedoc-image.py --replace new_netloc meta_pad1 meta_pad2 ...
```
For example:
```
python hedgedoc-image.py --replace pad.hacknang.de https://md.margau.net/dbk-meta
```
### Produced files
The python scripts produces a `pads.json` which contains the mapping from `old_url` to `new_url`.
All images land in `images/uploads`. Only images hosted on the `old_pads` URL are saved