Add gnusocial nsfw plugin

This commit is contained in:
Bob Mottram 2016-07-24 10:48:06 +01:00
parent 602bb38178
commit 8eb474a1e9
1 changed files with 625 additions and 574 deletions

View File

@ -49,6 +49,10 @@ SHARINGS_COMMIT='d5c6c7f855d9afff9086c09ea706f38c859bc0d4'
SHARINGS_THEME_REPO="http://git.lasindias.club/manuel/SharingsTheme"
SHARINGS_THEME_COMMIT='7106c7ef03'
# NSFW plugin
GNUSOCIAL_NSFW_REPO="https://gitgud.io/ShitposterClub/SensitiveContent"
GNUSOCIAL_NSFW_COMMIT='a096bbe0cfae9a9b177682920ffb58d32a48e136'
function gnusocial_running_script {
if ! grep -Fxq "install_gnusocial" $COMPLETION_FILE; then
return
@ -792,6 +796,52 @@ function install_gnusocial_markdown {
echo 'install_gnusocial_markdown' >> $COMPLETION_FILE
}
function install_gnusocial_plugin_nsfw {
if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins ]; then
echo $'No local/plugins directory found for the microblog'
exit 37252
fi
# update to the next commit
function_check set_repo_commit
set_repo_commit /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins "GNU Social NSFW plugin commit" "$GNUSOCIAL_NSFW_COMMIT" $GNUSOCIAL_NSFW_REPO
if grep -Fxq "install_gnusocial_plugin_nsfw" $COMPLETION_FILE; then
return
fi
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins
function_check git_clone
git_clone $GNUSOCIAL_NSFW_REPO NSFW
if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/NSFW ]; then
echo $'Unable to clone microblog NSFW plugin'
exit 36738
fi
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/NSFW
git stash
git checkout master
git branch -D $GNUSOCIAL_NSFW_COMMIT
git checkout $GNUSOCIAL_NSFW_COMMIT -b $GNUSOCIAL_NSFW_COMMIT
# enable the plugin
if ! grep -q "addPlugin('SensitiveContent');" /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/config.php; then
echo "addPlugin('SensitiveContent');" >> /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/config.php
fi
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
php scripts/checkschema.php
chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
if ! grep -q "GNU Social NSFW plugin commit" $COMPLETION_FILE; then
echo "GNU Social NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT" >> $COMPLETION_FILE
else
sed -i "s|GNU Social NSFW plugin commit.*|GNU Social NSFW plugin commit:$GNUSOCIAL_NSFW_COMMIT|g" $COMPLETION_FILE
fi
echo 'install_gnusocial_plugin_nsfw' >> $COMPLETION_FILE
}
function install_gnusocial {
if grep -Fxq "install_gnusocial" $COMPLETION_FILE; then
return
@ -802,6 +852,7 @@ function install_gnusocial {
install_gnusocial_markdown
install_gnusocial_plugin_sharings
install_gnusocial_plugin_sharings_theme
install_gnusocial_plugin_nsfw
echo 'install_gnusocial' >> $COMPLETION_FILE
}