Compare commits

...

3 Commits

Author SHA1 Message Date
veclav talica
2ec92d2dee fix bug in main page article linking 2024-02-10 22:19:17 +05:00
veclav talica
dc929f199e remove xm.js 2024-02-10 22:16:07 +05:00
veclav talica
82b4976efb checksum based cache for neocities uploads 2024-02-10 22:15:32 +05:00
4 changed files with 11 additions and 1358 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ html/
**/.*/ **/.*/
**/*.jpg/ **/*.jpg/
**/*.png/ **/*.png/
**/*.upload-checksum

1351
html/xm.js

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@ for title in sorted(artciles.keys(), key=lambda a: artciles[a]["metadata"].get("
article = artciles[title] article = artciles[title]
metadata = article["metadata"] metadata = article["metadata"]
page += ( page += (
f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{article}.html)\n\n""" f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{title}.html)\n\n"""
f""">{metadata.get("Brief", "")}\n\n""" f""">{metadata.get("Brief", "")}\n\n"""
) )

View File

@ -1,12 +1,15 @@
#!/usr/bin/bash #!/usr/bin/bash
# todo: Create local cache containing file timestamps that were previously uploaded.
for cur in ./html/{*,*/*,*/*/*}; do for cur in ./html/{*,*/*,*/*/*}; do
if [[ "$cur" == *"/tracks/"* ]]; then if [ -f "$cur" ] && [[ ! "$cur" == *.upload-checksum ]]; then
continue if [ -f "$cur.upload-checksum" ]; then
fi c=$(cat "$cur.upload-checksum" | sha256sum -c 2> /dev/null)
if [ -f "$cur" ]; then if [[ "$c" == *OK ]]; then
echo "$cur is up-to-date, skipping"
continue
fi
fi
echo $(sha256sum "$cur") > "$cur.upload-checksum"
d=$(dirname $(realpath --relative-to="./html" "$cur")) d=$(dirname $(realpath --relative-to="./html" "$cur"))
if [[ "$d" == "." ]]; then if [[ "$d" == "." ]]; then
neocities upload $cur neocities upload $cur