#!/bin/bash # source neocities key variable from file, curl "https://USER:PASS@neocities.org/api/key" . path/to/key delete(){ curl -s -H "Authorization: Bearer $key" \ -d "filenames[]=$1" \ "https://neocities.org/api/delete" } upload12(){ curl -s -H "Authorization: Bearer $key" \ -F $2=@$1 https://neocities.org/api/upload } list(){ files="/tmp/templist" curl -s -H "Authorization: Bearer $key" \ "https://neocities.org/api/list" |jq '.files[].path'| tr -d '"' > $files cat $files echo " " cat $files| grep -E "*[0-9].htm"|sort -V } ex(){ echo hi } : << '@testDump' exit # get files in b/ from neocities curl -s -H "Authorization: Bearer $key" \ "https://neocities.org/api/list?path=b" >json # from output, list filenames cat json |jq '.files[].path' shot # from output, list file: filenames, byte size cat json |jq -r '.files|map("file: \(.path), \(.size)")|.[]' exit; # from faq: curl "https://YOURUSER:YOURPASS@neocities.org/api/info" # site views curl -s "https://neocities.org/api/info?sitename=hemisc"|jq '.info.views' curl "https://USER:PASS@neocities.org/api/list" curl -d "filenames[]=img1.jpg" -d "filenames[]=img2.jpg" \ "https://YOURUSER:YOURPASS@neocities.org/api/delete" #Upload a single local file (local.html), which will be named hello.html on your site: curl -F "hello.html=@local.html" "https://USER:PASS@neocities.org/api/upload" curl -H "Authorization: Bearer $key" \ https://neocities.org/api/list?path=b https://neocities.org/api/info # from neoup curl -F $fname=@$1 https://$NEO_USER:$NEO_PASS@neocities.org/api/upload #https://neocities.org/api #https://shapeshed.com/jq-json/#how-to-find-a-key-and-value #https://github.com/stedolan/jq/issues/189 #https://github.com/stedolan/jq/issues/370 @testDump ex # must not put exit in this file