diff --git a/Makefile b/Makefile index d10b9d6..528f6d5 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ deploy: pinlist.txt mkdir -p $(PINLIST_DIR) cat ./pinlist.txt > $(PINLIST_DIR)/pinlist.txt cat ./bin/pin.sh > $(PINLIST_DIR)/pin.sh + cat ./README.md > $(PINLIST_DIR)/README.md ipfs add -r $(IPFS_ROOT) | \ tail -1 | \ awk -F' ' '{print $$2}' | \ diff --git a/README.md b/README.md index ab8eb1c..7fc404a 100644 --- a/README.md +++ b/README.md @@ -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 -of IPFS paths. The list itself will be periodically generated from this -repo and placed into ipfs under my namespace, allowing people to -fetch it consistently and automatically update their pinning lists. +This is a repo that generates an input file for a script that can be run +from cron to pin a bunch of IPFS paths. The list itself will be +periodically generated from this repo and placed into ipfs under my +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 * not too big (blogs, metadata, documents) + * try to keep it under 1-200MiB * not general purpose software mirrors / etc * maybe later + +# Author + +* Jeffrey Paul +* https://github.com/sneak +* https://twitter.com/sneakdotberlin +* http://localhost:8080/ipns/QmaN64WRYdHBojWFQRLxkdjtX6TEnqnCq8uAugpyJJpCVp/ diff --git a/bin/pin.sh b/bin/pin.sh index 5fd8d74..cfa9056 100755 --- a/bin/pin.sh +++ b/bin/pin.sh @@ -1,9 +1,35 @@ -#!/usr/bin/env bash +#!/bin/bash +# +# ipfs-pinlist-cdn +# https://github.com/sneak/ipfs-pinlist-cdn/ +# author: Jeffrey Paul + SNEAKID="QmaN64WRYdHBojWFQRLxkdjtX6TEnqnCq8uAugpyJJpCVp" RESOURCE="$(ipfs resolve /ipns/$SNEAKID/pinlist/pinlist.txt)" -# first add normal ipfs ones -ipfs cat $RESOURCE | +# i know that ipfs pin add can read stdin +# 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 '^\/ipfs\/' | - ipfs pin add + egrep '^\/ipfs\/' +); 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