diff --git a/Makefile b/Makefile index 2b5755c..eacc611 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,11 @@ ECT_LEVEL=6 csv/webrings.csv: sh scripts/populate-webrings.sh +data/bookmarks.json: + sh scripts/get-bookmarks.sh + .PHONY: hugo -hugo: csv/webrings.csv $(SRCFILES) +hugo: csv/webrings.csv data/bookmarks.json $(SRCFILES) sh scripts/get-webmentions.sh hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR) mv $(OUTPUT_DIR)/about/_index.gmi $(OUTPUT_DIR)/about/index.gmi @@ -38,7 +41,7 @@ hugo: csv/webrings.csv $(SRCFILES) .PHONY: clean clean: - rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports + rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports data/webmentions.json csv/webrings.csv data/bookmarks.json .PHONY: lint-css lint-css: $(CSS_DIR)/*.css @@ -123,11 +126,11 @@ compress: gzip brotli .PHONY: gzip brotli compress .PHONY: xhtmlize -xhtmlize: +xhtmlize: hugo sh scripts/xhtmlize.sh $(OUTPUT_DIR) .PHONY: copy-to-xhtml -copy-to-xhtml: +copy-to-xhtml: xhtmlize find $(OUTPUT_DIR) -type f -name "*.html" | grep -v 'resume/index.html' | xargs -n1 sh scripts/copy-file-to-xhtml.sh .PHONY: deploy-html diff --git a/scripts/get-bookmarks.sh b/scripts/get-bookmarks.sh new file mode 100644 index 0000000..56196b3 --- /dev/null +++ b/scripts/get-bookmarks.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e -u +#shellcheck disable=SC3040 # This only sets pipefail if it's available and otherwise does nothing +set -o pipefail 2>/dev/null || true + +dirname="$(dirname "$0")" +curl_wrapper="$dirname/curl-wrapper.sh" +bookmarks_file="$dirname/../data/bookmarks.json" + +if command -v buku >/dev/null; then + buku -t public -j >"$bookmarks_file" +elif [ ! -f "$bookmarks_file" ]; then + "$curl_wrapper" 'https://seirdy.one/data/bookmarks.json' >"$bookmarks_file" +else + echo 'using cached bookmarks' +fi