Last active
October 9, 2022 21:10
-
-
Save brettinternet/b5729957d3255b8d75d8df209d9f8819 to your computer and use it in GitHub Desktop.
Develop PrivateBin client views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://github.com/PrivateBin/PrivateBin | |
if [ ! -f ./conf.ini ]; then | |
curl https://github.com/PrivateBin/PrivateBin/blob/master/cfg/conf.sample.php \ | |
--output ./conf.ini | |
fi | |
mkdir -p tpl | |
if [ ! -f ./tpl/bootstrap.php ]; then | |
curl https://raw.githubusercontent.com/PrivateBin/PrivateBin/master/tpl/bootstrap.php \ | |
--output ./tpl/bootstrap.php | |
fi | |
# https://hub.docker.com/r/privatebin/nginx-fpm-alpine/ | |
NAME=privatebin | |
[ ! "$(docker ps -a | grep $NAME)" ] && docker run -p 8080:8080 \ | |
-v $PWD/data:/srv/data \ | |
-v $PWD/conf.ini:/srv/cfg/conf.php \ | |
-v $PWD/tpl:/srv/tpl \ | |
--name $NAME \ | |
-d \ | |
privatebin/nginx-fpm-alpine | |
# https://github.com/PrivateBin/PrivateBin/wiki/Development#subresource-integrity-for-javascript-resources | |
docker cp $NAME:/var/www/js/privatebin.js privatebin.js | |
echo "privatebin.js subresource integrity:" | |
openssl dgst -sha512 -binary privatebin.js | openssl enc -base64 | |
/bin/rm privatebin.js | |
if command -v entr &> /dev/null; then | |
find tpl -type f -iname \*.php | \ | |
entr docker restart $NAME | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment