1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 12:52:10 +00:00

Use local buku to get bookmarks if possible

This commit is contained in:
Rohan Kumar 2023-11-29 00:33:06 -08:00
parent 4581c83561
commit a097b46950
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 24 additions and 4 deletions

View file

@ -22,8 +22,11 @@ ECT_LEVEL=6
csv/webrings.csv: csv/webrings.csv:
sh scripts/populate-webrings.sh sh scripts/populate-webrings.sh
data/bookmarks.json:
sh scripts/get-bookmarks.sh
.PHONY: hugo .PHONY: hugo
hugo: csv/webrings.csv $(SRCFILES) hugo: csv/webrings.csv data/bookmarks.json $(SRCFILES)
sh scripts/get-webmentions.sh sh scripts/get-webmentions.sh
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR) hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS) -d $(OUTPUT_DIR)
mv $(OUTPUT_DIR)/about/_index.gmi $(OUTPUT_DIR)/about/index.gmi mv $(OUTPUT_DIR)/about/_index.gmi $(OUTPUT_DIR)/about/index.gmi
@ -38,7 +41,7 @@ hugo: csv/webrings.csv $(SRCFILES)
.PHONY: clean .PHONY: clean
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 .PHONY: lint-css
lint-css: $(CSS_DIR)/*.css lint-css: $(CSS_DIR)/*.css
@ -123,11 +126,11 @@ compress: gzip brotli
.PHONY: gzip brotli compress .PHONY: gzip brotli compress
.PHONY: xhtmlize .PHONY: xhtmlize
xhtmlize: xhtmlize: hugo
sh scripts/xhtmlize.sh $(OUTPUT_DIR) sh scripts/xhtmlize.sh $(OUTPUT_DIR)
.PHONY: copy-to-xhtml .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 find $(OUTPUT_DIR) -type f -name "*.html" | grep -v 'resume/index.html' | xargs -n1 sh scripts/copy-file-to-xhtml.sh
.PHONY: deploy-html .PHONY: deploy-html

17
scripts/get-bookmarks.sh Normal file
View file

@ -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