From a391d251dd0d9165581f2713d6afaf7c85997c1f Mon Sep 17 00:00:00 2001 From: msglm Date: Mon, 17 Jul 2023 04:14:29 -0500 Subject: IPFS publishing is now optional --- README.md | 2 ++ stashley | 25 ++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index faa8f54..621bb35 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ The format for files is as follows: ``` name=PersonalityName +IPFS=true [socialMedia] urls=["example.com", "example.org"] @@ -15,6 +16,7 @@ A filled example is as follows: ``` name="Sashley" +IPFS=true [toyhouse] urls=["https://toyhou.se/sashley/art"] diff --git a/stashley b/stashley index ec6a97c..b24df37 100755 --- a/stashley +++ b/stashley @@ -1,7 +1,7 @@ #!/bin/sh tomlq -r '.|keys_unsorted[]' "$1" | while IFS= read -r site; do - if [ "$site" != "name" ] + if [ "$site" != "name" ] && [ "$site" != "IPFS" ] then tomlq -r ".$site.urls[]" "$1" | while IFS= read -r url; do @@ -24,18 +24,17 @@ done fdupes -dIr . -ipfs --help || exit 0 - -if [ "$(ipfs --help)" = 0 ] +if [ "$(tomlq -r '.IPFS' "$1")" = "true" ] then - ## Add new content to personality-archive - personalityName=$(tomlq -r '.name' "$1") - ipfs files mkdir /personality-archive - personalityHash=$(ipfs add -Q -r .) - ipfs files rm -r /personality-archive/"$personalityName" - ipfs files cp /ipfs/"$personalityHash" /personality-archive/"$personalityName" - ## Update IPNS with new personality-archive - personalityArchiveLocationHash=$(ipfs files stat --hash /personality-archive) - ipfs name publish "$personalityArchiveLocationHash" +## Add new content to personality-archive +personalityName=$(tomlq -r '.name' "$1") +ipfs files mkdir /personality-archive +personalityHash=$(ipfs add -Q -r .) +ipfs files rm -r /personality-archive/"$personalityName" +ipfs files cp /ipfs/"$personalityHash" /personality-archive/"$personalityName" + +## Update IPNS with new personality-archive +personalityArchiveLocationHash=$(ipfs files stat --hash /personality-archive) +ipfs name publish "$personalityArchiveLocationHash" fi -- cgit v1.2.3