From 3d72294e8c5a88c45909f7e881cfa85044d735f9 Mon Sep 17 00:00:00 2001 From: anoduck <9925396+anoduck@users.noreply.github.com> Date: Mon, 4 Nov 2024 04:59:41 -0500 Subject: feat(content): :sparkles: Creation of documents server Created Document server to avoid further issues with link referencing #24 --- sync.sh | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'sync.sh') diff --git a/sync.sh b/sync.sh index 6bccfae..5d415db 100755 --- a/sync.sh +++ b/sync.sh @@ -4,10 +4,43 @@ # ------------------------- REPO="$HOME/Sandbox/hinode-template" SRC="$REPO/public/" +DSRC="$REPO/docs-server/" REMOTE="216.189.157.213" DST="/var/www/htdocs/corruptlamar" +DSDST="/var/www/htdocs/docs" USERNAME="anoduck" API="f18dd78af41a4d1ab6d15d7099522c61" +KEYFILE="$SRC/$API.txt" +# ------------------------------------------ +# request='POST /IndexNow HTTP/1.1 +# Content-Type: application/json; charset=utf-8 +# Host: api.indexnow.org +# { +# "host": "corruptlamar.com", +# "key": "f18dd78af41a4d1ab6d15d7099522c61", +# "keyLocation": "https://corruptlamar.com/f18dd78af41a4d1ab6d15d7099522c61.txt", +# "urlList": [ +# "https://corruptlamar.com/url1", +# "https://corruptlamar.com/folder/url2", +# "https://corruptlamar.com/url3" +# ] +# }' +# ------------------------------------------ +INDATA='{ + "host": "corruptlamar.com", + "key": "f18dd78af41a4d1ab6d15d7099522c61", + "keyLocation": "https://corruptlamar.com/f18dd78af41a4d1ab6d15d7099522c61.txt", + "urlList": [ + "https://corruptlamar.com/", + "https://corruptlamar.com/evidence", + "https://corruptlamar.com/legal", + "https://corruptlamar.com/posts", + "https://corruptlamar.com/persons", + "https://corruptlamar.com/video", + ] +}' +INHEADER = "Content-Type: application/json; charset=utf-8" +INHOST = "api.indexnow.org" # ------------------------------------------ compush() { git add . @@ -29,22 +62,17 @@ sync() { # $SRC_PATH must be _closed_ and ends _with_ a "/". # $DST_PATH must be _open_ and ends _with_ _NO_ "/". rsync -azv -e ssh --delete "$SRC" "$USERNAME"@"$REMOTE":"$DST" + rsync -azv -e ssh --delete "$DSRC" "$USERNAME"@"$REMOTE":"$DSDST" } indexnow() { - request='POST /IndexNow HTTP/1.1 -Content-Type: application/json; charset=utf-8 -Host: api.indexnow.org -{ - "host": "www.example.org", - "key": "f18dd78af41a4d1ab6d15d7099522c61", - "keyLocation": "https://www.example.org/f18dd78af41a4d1ab6d15d7099522c61.txt", - "urlList": [ - "https://www.example.org/url1", - "https://www.example.org/folder/url2", - "https://www.example.org/url3" - ] -}' + curl --data "$INDATA" --header "$INHEADER" "$INHOST" +} + +generate_key() { + if ! [[ -e "$KEYFILE" ]] ; then + echo "$KEY" > "$KEYFILE" + fi } # ------------------------------------------ if [[ ! "$PWD" == "$REPO" ]]; then @@ -53,6 +81,7 @@ fi # compush build cd "$SRC" || return +generate_key && indexnow #alt_files echo "Skipping cleaning of alt files" cd "$REPO" || return -- cgit v1.2.3