Compare commits
2
Commits
f39a7b5a09
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1aa724e90f | ||
|
|
f5186e57b5 |
+1
-1
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Joplin Terminal (official npm package)
|
# Joplin Terminal (official npm package)
|
||||||
RUN npm install --loglevel=error -g joplin
|
RUN npm install --loglevel=error -g joplin@3.7.1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY pyproject.toml requirements.txt ./
|
COPY pyproject.toml requirements.txt ./
|
||||||
|
|||||||
+27
-2
@@ -7,6 +7,31 @@ RESULT_JSON="/app/data/last_result.json"
|
|||||||
|
|
||||||
log() { printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; }
|
log() { printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; }
|
||||||
fail() { log "ERROR: $*"; exit 1; }
|
fail() { log "ERROR: $*"; exit 1; }
|
||||||
|
joplin_sync() {
|
||||||
|
local tmp
|
||||||
|
local status
|
||||||
|
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
|
||||||
|
set +e
|
||||||
|
joplin --profile "$PROFILE" sync 2>&1 | tee "$tmp"
|
||||||
|
status=${PIPESTATUS[0]}
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ "$status" -ne 0 ]]; then
|
||||||
|
rm -f "$tmp"
|
||||||
|
fail "Joplin sync failed with exit code $status"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -Eqi 'Last error:|(^|[[:space:]])Error:' "$tmp"; then
|
||||||
|
log "ERROR: Joplin reported a sync error:"
|
||||||
|
grep -Ei 'Last error:|(^|[[:space:]])Error:' "$tmp" || true
|
||||||
|
rm -f "$tmp"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$tmp"
|
||||||
|
}
|
||||||
|
|
||||||
: "${JOPLIN_WEBDAV_URL:?JOPLIN_WEBDAV_URL is required}"
|
: "${JOPLIN_WEBDAV_URL:?JOPLIN_WEBDAV_URL is required}"
|
||||||
: "${JOPLIN_WEBDAV_USERNAME:?JOPLIN_WEBDAV_USERNAME is required}"
|
: "${JOPLIN_WEBDAV_USERNAME:?JOPLIN_WEBDAV_USERNAME is required}"
|
||||||
@@ -33,7 +58,7 @@ fi
|
|||||||
|
|
||||||
# Pull the current remote state first. This is important when PC/mobile also use the same WebDAV target.
|
# Pull the current remote state first. This is important when PC/mobile also use the same WebDAV target.
|
||||||
log "Synchronising Joplin from WebDAV before writing..."
|
log "Synchronising Joplin from WebDAV before writing..."
|
||||||
joplin --profile "$PROFILE" sync
|
joplin_sync
|
||||||
|
|
||||||
if [[ "${JOPLIN_WRITE_ENABLED,,}" != "true" ]]; then
|
if [[ "${JOPLIN_WRITE_ENABLED,,}" != "true" ]]; then
|
||||||
log "JOPLIN_WRITE_ENABLED=false: sync-only safety mode. No paper note will be written."
|
log "JOPLIN_WRITE_ENABLED=false: sync-only safety mode. No paper note will be written."
|
||||||
@@ -86,6 +111,6 @@ log "Importing report into Joplin notebook: $JOPLIN_NOTEBOOK"
|
|||||||
joplin --profile "$PROFILE" import "$TMP_MD" "$JOPLIN_NOTEBOOK" --format md -f
|
joplin --profile "$PROFILE" import "$TMP_MD" "$JOPLIN_NOTEBOOK" --format md -f
|
||||||
|
|
||||||
log "Synchronising Joplin changes to WebDAV..."
|
log "Synchronising Joplin changes to WebDAV..."
|
||||||
joplin --profile "$PROFILE" sync
|
joplin_sync
|
||||||
|
|
||||||
log "Completed: $REPORT_TITLE ($REPORT_COUNT papers)"
|
log "Completed: $REPORT_TITLE ($REPORT_COUNT papers)"
|
||||||
|
|||||||
@@ -10,5 +10,12 @@
|
|||||||
"open_until": 0.0,
|
"open_until": 0.0,
|
||||||
"reason": null,
|
"reason": null,
|
||||||
"strikes": {}
|
"strikes": {}
|
||||||
|
},
|
||||||
|
"ieee": {
|
||||||
|
"open_until": 1790933827.9323854,
|
||||||
|
"reason": "http_403",
|
||||||
|
"strikes": {
|
||||||
|
"http_403": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user