-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.sh
executable file
·45 lines (41 loc) · 1.39 KB
/
post.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
echo Please run ipfs daemon or setup the service
set -o xtrace # Show the commands like bat files do
# sudo pacman -S go-ipfs
# ipfs init
# get the key
# Git no support hard links
# symlinks dont work with ipfs as of writing
mkdir -p ./publishlinked/
if cmp --silent -- "./publishlinked/index.html" "./index.html"; then
echo index.html already linked
else
rm ./publishlinked/index.html
ln index.html publishlinked/
fi
if cmp --silent -- "./publishlinked/favicon.ico" "./favicon.ico"; then
echo favicon.ico already linked
else
rm ./publishlinked/favicon.ico
ln favicon.ico publishlinked/
fi
s=$(bash -c "ipfs add -r publishlinked | grep -v /")
ss=($s)
sss=${ss[1]}
echo $sss
# ipfs daemon & # Does not work if already running
ipfs name publish --key=GitKey $sss
echo Remember to pin to pinata before you close the dev environment
# Add to pinata for quick clouflare link
#. ./secrets.sh
#curl -X POST -H "Content-Type: multipart/form-data; pinata_api_key: \"$PIN_KEY\"; pinata_secret_api_key: \"$PIN_SEC\"" -d "{hashToPin: $sss}" https://api.pinata.cloud/pinning/pinByHash
# Getting Close
# curl --location --request POST 'https://api.pinata.cloud/pinning/pinByHash' \
# --header "'pinata_api_key: $PIN_KEY'" \
# --header "'pinata_secret_api_key: $PIN_SEC'" \
# --header 'Content-Type: application/json' \
# --data-raw "'{
# "hashToPin": "$sss",
# "pinataMetadata": {
# "name": "postedfolder"
# }
# }'"