Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CodiMD export script
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stgroup
misc
CodiMD export script
Commits
127c4906
Commit
127c4906
authored
2 years ago
by
Andreas Domanowski
Browse files
Options
Downloads
Patches
Plain Diff
Add instructions in stdout
parent
18127beb
No related branches found
No related tags found
1 merge request
!1
Hedgedoc import
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common.py
+10
-2
10 additions, 2 deletions
common.py
md-import-export.py
+2
-2
2 additions, 2 deletions
md-import-export.py
with
12 additions
and
4 deletions
common.py
+
10
−
2
View file @
127c4906
...
...
@@ -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
"
\t
1. Open the developer tools (Shortcut: F12
"
)
print
(
f
"
\t
2. Select
\"
Storage -> Cookies
\"
(Firefox) or
\"
Application -> Cookies
\"
"
)
print
(
f
"
\t
3. Copy the value for the cookie named
{
cookie_key
}
"
)
print
(
f
"
\t
4. 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
"
)
This diff is collapsed.
Click to expand it.
md-import-export.py
+
2
−
2
View file @
127c4906
...
...
@@ -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
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment