diff --git a/app/crawler/notnotea.sh b/app/crawler/notes.sh similarity index 78% rename from app/crawler/notnotea.sh rename to app/crawler/notes.sh index 450a981..2e3780a 100644 --- a/app/crawler/notnotea.sh +++ b/app/crawler/notes.sh @@ -1,12 +1,12 @@ #! /bin/bash -notnotea() ( +notes() ( ids() { _recurse_ids "" "$(_tree)" } _tree() { - local cache_key="notnotea cache _tree" + local cache_key="notes cache _tree" if cache get "$cache_key"; then return 0 fi @@ -14,7 +14,7 @@ notnotea() ( } __tree() { - _nncurl $NNOTEA_ADDR/api/v0/tree + _nncurl $NOTES_ADDR/api/v0/tree } _nncurl() { @@ -59,16 +59,8 @@ notnotea() ( return 1 } - _tree_ids() { - _ncurl $NOTEA_ADDR/api/tree \ - | jq '.items | to_entries[].value.id' \ - | grep -v '^null$' \ - | jq -r . \ - | grep -v '^root$' - } - get() { - local cache_key="notnotea cache $1" + local cache_key="notes cache $1" if cache get "$cache_key"; then return 0 fi @@ -76,7 +68,7 @@ notnotea() ( } _get() { - _nncurl $NNOTEA_ADDR/api/v0/files/$1 + _nncurl $NOTES_ADDR/api/v0/files/$1 } put() { @@ -97,7 +89,7 @@ notnotea() ( -X PUT \ -H "Title: $title" \ -d @- \ - $NNOTEA_ADDR/api/v0/files/$id + $NOTES_ADDR/api/v0/files/$id } "$@" diff --git a/app/crawler/notnotea_test.sh b/app/crawler/notes_test.sh similarity index 92% rename from app/crawler/notnotea_test.sh rename to app/crawler/notes_test.sh index 0dce194..7614040 100644 --- a/app/crawler/notnotea_test.sh +++ b/app/crawler/notes_test.sh @@ -12,7 +12,7 @@ test_ids() { } } }' - notnotea eval "$(cat < /dev/null || return 101 (ids; true) | grep '^id\/subid$' > /dev/null || return 102 @@ -35,7 +35,7 @@ test_meta() { } } }' - notnotea eval "$(cat <