This commit is contained in:
Jeffrey Paul 2017-01-09 11:11:04 +01:00
parent 1e1185a24e
commit eb18f3299b
3 changed files with 56 additions and 12 deletions

View File

@ -12,6 +12,7 @@ deploy: pinlist.txt
mkdir -p $(PINLIST_DIR) mkdir -p $(PINLIST_DIR)
cat ./pinlist.txt > $(PINLIST_DIR)/pinlist.txt cat ./pinlist.txt > $(PINLIST_DIR)/pinlist.txt
cat ./bin/pin.sh > $(PINLIST_DIR)/pin.sh cat ./bin/pin.sh > $(PINLIST_DIR)/pin.sh
cat ./README.md > $(PINLIST_DIR)/README.md
ipfs add -r $(IPFS_ROOT) | \ ipfs add -r $(IPFS_ROOT) | \
tail -1 | \ tail -1 | \
awk -F' ' '{print $$2}' | \ awk -F' ' '{print $$2}' | \

View File

@ -1,15 +1,32 @@
# ipfs-autopin # ipfs-pinlist-cdn
I want more stuff to get pinned on more hosts. I want more stuff to get pinned on more IPFS hosts.
This is a repo that generates a script that can be run to pin a bunch This is a repo that generates an input file for a script that can be run
of IPFS paths. The list itself will be periodically generated from this from cron to pin a bunch of IPFS paths. The list itself will be
repo and placed into ipfs under my namespace, allowing people to periodically generated from this repo and placed into ipfs under my
fetch it consistently and automatically update their pinning lists. namespace, allowing people to fetch it consistently and automatically update
their pinning lists.
# Requirements # How To Use
```
# Adding Content
https://github.com/sneak/ipfs-pinlist-cdn
# Requirements For Inclusion
* general-purpose interest * general-purpose interest
* not too big (blogs, metadata, documents) * not too big (blogs, metadata, documents)
* try to keep it under 1-200MiB
* not general purpose software mirrors / etc * not general purpose software mirrors / etc
* maybe later * maybe later
# Author
* Jeffrey Paul <sneak@sneak.berlin>
* https://github.com/sneak
* https://twitter.com/sneakdotberlin
* http://localhost:8080/ipns/QmaN64WRYdHBojWFQRLxkdjtX6TEnqnCq8uAugpyJJpCVp/

View File

@ -1,9 +1,35 @@
#!/usr/bin/env bash #!/bin/bash
#
# ipfs-pinlist-cdn
# https://github.com/sneak/ipfs-pinlist-cdn/
# author: Jeffrey Paul <sneak@sneak.berlin>
SNEAKID="QmaN64WRYdHBojWFQRLxkdjtX6TEnqnCq8uAugpyJJpCVp" SNEAKID="QmaN64WRYdHBojWFQRLxkdjtX6TEnqnCq8uAugpyJJpCVp"
RESOURCE="$(ipfs resolve /ipns/$SNEAKID/pinlist/pinlist.txt)" RESOURCE="$(ipfs resolve /ipns/$SNEAKID/pinlist/pinlist.txt)"
# first add normal ipfs ones # i know that ipfs pin add can read stdin
ipfs cat $RESOURCE | # but sometimes it lags pretty badly or freezes
# and i think invoking it for each pin is hopefully
# going to be more reliable.
# i have setup this regex so that hopefully
# no matter what i put in the pinlist file it doesn't
# result in RCE on your box.
# first add normal ipfs resource pins
for IPFSPATH in $(
ipfs cat $RESOURCE |
egrep '^\/ip[fn]s\/[a-zA-Z0-9\-\_\/\.]{5,70}$' | egrep '^\/ip[fn]s\/[a-zA-Z0-9\-\_\/\.]{5,70}$' |
egrep '^\/ipfs\/' | egrep '^\/ipfs\/'
ipfs pin add ); do
ipfs pin add $IPFSPATH
done
# then resolve ipns names in pinlist and pin those targets too
for IPNSPATH in $(
ipfs cat $RESOURCE |
egrep '^\/ip[fn]s\/[a-zA-Z0-9\-\_\/\.]{5,70}$' |
egrep '^\/ipns\/'
); do
echo $IPNSPATH | ipfs resolve | ipfs pin add
done