From 0628fc7bea2e2e7ddc4f9d307ac6b6c8ade9315d Mon Sep 17 00:00:00 2001 From: LailaTheElf Date: Thu, 4 Sep 2025 10:58:30 +0200 Subject: [PATCH] update hedgedoc update scripts --- pull_from_hd.sh | 13 +++++++------ push_to_hd.sh | 25 ++++++++++--------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/pull_from_hd.sh b/pull_from_hd.sh index 4bd1313..06b6d07 100755 --- a/pull_from_hd.sh +++ b/pull_from_hd.sh @@ -4,9 +4,12 @@ server='https://live.kladjes.nl' main_index_id="tPb3Up1fQEuZ86yrJSkYRQ" cli_url="https://raw.githubusercontent.com/hedgedoc/cli/refs/heads/master/bin/hedgedoc" -hd_cli="./hedgedoc" -# HEDGEDOC_SERVER="https://live.kladjes.nl" -hd="$hd_cli" +HEDGEDOC_SERVER="$server" +if [ ! -f "./hedgedoc" ]; then + curl $cli_url -o "./hedgedoc" + chmod +x "./hedgedoc" +fi +. ./hedgedoc --import function download_cli() { if [ ! -f "$hd_cli" ]; then @@ -19,7 +22,7 @@ function get_md() { local note_id="$1" local out_path="$2" echo "get_md: '$note_id' '$out_path'" - $hd export --md "$note_id" "$out_path" + export_note --md "$note_id" "$out_path" } function get_index() { @@ -42,7 +45,5 @@ function get_index() { done } -download_cli - # mkdir -p "./out" get_index "$main_index_id" "./markdown" diff --git a/push_to_hd.sh b/push_to_hd.sh index a129eaf..2ef10fa 100755 --- a/push_to_hd.sh +++ b/push_to_hd.sh @@ -4,29 +4,25 @@ server='https://live.kladjes.nl' main_index_id="tPb3Up1fQEuZ86yrJSkYRQ" cli_url="https://raw.githubusercontent.com/hedgedoc/cli/refs/heads/master/bin/hedgedoc" -hd_cli="./hedgedoc" -# HEDGEDOC_SERVER="https://live.kladjes.nl" -hd="$hd_cli" - -function download_cli() { - if [ ! -f "$hd_cli" ]; then - curl $cli_url -o "$hd_cli" - chmod +x "$hd_cli" - fi -} +HEDGEDOC_SERVER="$server" +if [ ! -f "./hedgedoc" ]; then + curl $cli_url -o "./hedgedoc" + chmod +x "./hedgedoc" +fi +. ./hedgedoc --import function get_md() { local note_id="$1" local out_path="$2" echo "get_md: '$note_id' '$out_path'" - $hd export --md "$note_id" "$out_path" + export_note --md "$note_id" "$out_path" } function push_md() { local note_id="$1" local src_path="$2" - echo "push_md: '$note_id' '$src_path'" - $hd import "$note_id" "$out_path" + echo "push_md: '$src_path' '$note_id'" + import_note "$src_path" "$note_id" } function get_index() { @@ -49,7 +45,6 @@ function get_index() { done } -download_cli +user_login --email kladjes@finnvanreenen.nl -# mkdir -p "./out" get_index "$main_index_id" "./markdown"