Skip to content
Snippets Groups Projects
Commit 127c4906 authored by Andreas Domanowski's avatar Andreas Domanowski
Browse files

Add instructions in stdout

parent 18127beb
No related branches found
No related tags found
1 merge request!1Hedgedoc import
......@@ -7,9 +7,17 @@ else:
getpass = input
def get_sessionid(cookie_key):
def get_sessionid(service_name, cookie_key):
"""Ask the user for the session id, if it's not configured as an envvar."""
sid = getpass(f"Please provide your CodiMD session id ({cookie_key} cookie): ")
print(f"You now will be asked for your session cookie for {service_name}")
print(f"To extract this cookie, you need to open your browser with an active and logged-in {service_name} session")
print(f"In Firefox or Chrome, you can do this by following the following steps:")
print(f"\t1. Open the developer tools (Shortcut: F12")
print(f"\t2. Select \"Storage -> Cookies\" (Firefox) or \"Application -> Cookies\"")
print(f"\t3. Copy the value for the cookie named {cookie_key}")
print(f"\t4. Input it in the prompt")
sid = getpass(f"Please provide your {service_name} session id ({cookie_key} cookie): ")
if sid.startswith("s%3A"):
return sid
raise SystemExit(f"error: the supplied session id seems to be malformed")
......@@ -4,5 +4,5 @@ from hedgedoc_import import import_into_hedgedoc
if __name__ == "__main__":
export_folder = "codimd-documents"
export_from_codimd("http://localhost:3001", get_sessionid("connect.sid"), export_folder)
import_into_hedgedoc("http://hedgedoc:3000", get_sessionid("connect.hedgeDoc.sid"), export_folder, "archive.zip")
export_from_codimd("http://localhost:3001", get_sessionid("CodiMD", "connect.sid"), export_folder)
import_into_hedgedoc("http://hedgedoc:3000", get_sessionid("HedgeDoc", "connect.hedgeDoc.sid"), export_folder, "archive.zip")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment