Support markdown within gnusocial
This commit is contained in:
parent
c23ec71ad0
commit
9b7b89a789
|
@ -201,6 +201,8 @@ MICROBLOG_THEME_REPO="https://git.gnu.io/h2p/Qvitter.git"
|
|||
MICROBLOG_THEME_COMMIT='8abbdeb3c0a6a34754411452ae832d2f19cef7ab'
|
||||
MICROBLOG_WELCOME_MESSAGE=$'<h1>Welcome to $MICROBLOG_DOMAIN_NAME – a federated microblog</h1><p>Another Freedombone site</p>'
|
||||
MICROBLOG_BACKGROUND_IMAGE_URL=
|
||||
MICROBLOG_MARKDOWN_REPO="https://github.com/chimo/gs-markdown"
|
||||
MICROBLOG_MARKDOWN_COMMIT='184801fba1418548045242f4a55d55c29f6a06da'
|
||||
|
||||
# Domain name for hubzilla installation
|
||||
HUBZILLA_DOMAIN_NAME=
|
||||
|
@ -8998,7 +9000,7 @@ function install_gnu_social_theme {
|
|||
if grep -q "GNU Social theme commit" $COMPLETION_FILE; then
|
||||
CURRENT_MICROBLOG_THEME_COMMIT=$(grep "GNU Social theme commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
|
||||
if [[ "$CURRENT_MICROBLOG_THEME_COMMIT" != "$MICROBLOG_THEME_COMMIT" ]]; then
|
||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins
|
||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/Qvitter
|
||||
git_pull $MICROBLOG_THEME_REPO $MICROBLOG_THEME_COMMIT
|
||||
sed -i "s/GNU Social theme commit.*/GNU Social theme commit:$MICROBLOG_THEME_COMMIT/g" $COMPLETION_FILE
|
||||
chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local
|
||||
|
@ -9087,6 +9089,58 @@ function install_gnu_social_theme {
|
|||
echo 'install_gnu_social_theme' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function install_gnu_social_markdown {
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
apt-get -y install pkg-php-tools
|
||||
|
||||
# update to the next commit
|
||||
if grep -q "addPlugin('Markdown'" /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/config.php; then
|
||||
if grep -q "GNU Social Markdown commit" $COMPLETION_FILE; then
|
||||
CURRENT_MICROBLOG_MARKDOWN_COMMIT=$(grep "GNU Social Markdown commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
|
||||
if [[ "$CURRENT_MICROBLOG_MARKDOWN_COMMIT" != "$MICROBLOG_MARKDOWN_COMMIT" ]]; then
|
||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/Markdown
|
||||
git_pull $MICROBLOG_MARKDOWN_REPO $MICROBLOG_MARKDOWN_COMMIT
|
||||
sed -i "s/GNU Social Markdown commit.*/GNU Social Markdown commit:$MICROBLOG_MARKDOWN_COMMIT/g" $COMPLETION_FILE
|
||||
chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local
|
||||
fi
|
||||
else
|
||||
echo "GNU Social Markdown commit:$MICROBLOG_MARKDOWN_COMMIT" >> $COMPLETION_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -Fxq "install_gnu_social_markdown" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins ]; then
|
||||
mkdir -p /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins
|
||||
fi
|
||||
|
||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins
|
||||
git_clone $MICROBLOG_MARKDOWN_REPO Markdown
|
||||
cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/local/plugins/Markdown
|
||||
git checkout $MICROBLOG_MARKDOWN_COMMIT -b $MICROBLOG_MARKDOWN_COMMIT
|
||||
composer install
|
||||
|
||||
microblog_config_file=/var/www/$MICROBLOG_DOMAIN_NAME/htdocs/config.php
|
||||
if ! grep -q "addPlugin('Markdown'" $microblog_config_file; then
|
||||
echo "" >> $microblog_config_file
|
||||
echo "// Markdown settings" >> $microblog_config_file
|
||||
echo "addPlugin('Markdown', array('parser' => 'gfm'));" >> $microblog_config_file
|
||||
fi
|
||||
|
||||
if ! grep -q "GNU Social Markdown commit" $COMPLETION_FILE; then
|
||||
echo "GNU Social Markdown commit:$MICROBLOG_MARKDOWN_COMMIT" >> $COMPLETION_FILE
|
||||
fi
|
||||
|
||||
chown -R www-data:www-data /var/www/$MICROBLOG_DOMAIN_NAME/htdocs
|
||||
|
||||
echo 'install_gnu_social_markdown' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function install_hubzilla {
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
|
@ -10541,6 +10595,7 @@ mark_blog_domain
|
|||
install_gnu_social
|
||||
expire_gnu_social_posts
|
||||
install_gnu_social_theme
|
||||
install_gnu_social_markdown
|
||||
install_rss_reader
|
||||
install_rss_mobile_reader
|
||||
install_hubzilla
|
||||
|
|
Loading…
Reference in New Issue