Abstract out the markdown plugin

This commit is contained in:
Bob Mottram 2017-06-18 13:19:55 +01:00
parent 955142b382
commit a1939bb4cd
3 changed files with 63 additions and 57 deletions

View File

@ -41,8 +41,6 @@ GNUSOCIAL_COMMIT='1517deeeb621a0256106d0108855e8827713e2cc'
GNUSOCIAL_ADMIN_PASSWORD=
GNUSOCIAL_BACKGROUND_IMAGE_URL=
GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
GNUSOCIAL_TITLE='Pleroma FE'
@ -55,7 +53,6 @@ gnusocial_variables=(ONION_ONLY
GNUSOCIAL_WELCOME_MESSAGE
GNUSOCIAL_BACKGROUND_IMAGE_URL
DDNS_PROVIDER
GNUSOCIAL_MARKDOWN_COMMIT
GNUSOCIAL_TITLE
GNUSOCIAL_EXPIRE_MONTHS
MY_USERNAME)
@ -788,54 +785,6 @@ function install_gnusocial_main {
install_completed gnusocial_main
}
function install_gnusocial_markdown {
GNUSOCIAL_PATH=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
# update to the next commit
function_check set_repo_commit
set_repo_commit $GNUSOCIAL_PATH/local/plugins/Markdown "gnusocial Markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT" $GNUSOCIAL_MARKDOWN_REPO
if [[ $(app_is_installed gnusocial_markdown) == "1" ]]; then
return
fi
if [ -d $GNUSOCIAL_PATH/local/plugins/Markdown ]; then
rm -rf $GNUSOCIAL_PATH/local/plugins/Markdown
fi
if [ ! -d $GNUSOCIAL_PATH/local/plugins ]; then
mkdir -p $GNUSOCIAL_PATH/local/plugins
fi
cd $GNUSOCIAL_PATH/local/plugins
if [ -d /repos/gnusocial-markdown ]; then
mkdir Markdown
cp -r -p /repos/gnusocial-markdown/. Markdown
cd Markdown
git pull
else
function_check git_clone
git_clone $GNUSOCIAL_MARKDOWN_REPO Markdown
fi
cd $GNUSOCIAL_PATH/local/plugins/Markdown
git checkout $GNUSOCIAL_MARKDOWN_COMMIT -b $GNUSOCIAL_MARKDOWN_COMMIT
gnusocial_config_file=$GNUSOCIAL_PATH/config.php
if ! grep -q "addPlugin('Markdown'" $gnusocial_config_file; then
echo "" >> $gnusocial_config_file
echo "// Markdown settings" >> $gnusocial_config_file
echo "addPlugin('Markdown');" >> $gnusocial_config_file
fi
set_completion_param "gnusocial markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
chown -R www-data:www-data $GNUSOCIAL_PATH
install_completed gnusocial_markdown
}
function install_gnusocial {
if [ ! $ONION_ONLY ]; then
ONION_ONLY='no'
@ -844,7 +793,7 @@ function install_gnusocial {
install_gnusocial_main
expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
install_gnusocial_markdown
install_gnusocial_markdown "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"

View File

@ -807,12 +807,9 @@ function install_postactiv {
install_postactiv_main
install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
install_gnusocial_markdown "$POSTACTIV_DOMAIN_NAME" "postactiv"
install_gnusocial_plugin_sharings "$POSTACTIV_DOMAIN_NAME" "postactiv"
install_gnusocial_plugin_sharings_theme "$POSTACTIV_DOMAIN_NAME" "postactiv"
#function_check install_nodejs
#install_nodejs pleroma-postactiv
#install_armadillo_front_end "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL"
# Currently Pleroma won't install on ARM systems
# because it uses node-sass which doesn't support ARM
@ -835,6 +832,10 @@ function install_postactiv {
systemctl restart nginx
# Set qvitter to be the default UI. It's probably the most stable.
# And doesn't forget logins
gnusocial_use_qvitter postactiv
APP_INSTALLED=1
}

View File

@ -42,12 +42,17 @@ SHARINGS_COMMIT='d5c6c7f855d9afff9086c09ea706f38c859bc0d4'
SHARINGS_THEME_REPO="http://git.lasindias.club/manuel/SharingsTheme"
SHARINGS_THEME_COMMIT='7106c7ef03'
GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
function qvitter_update_background {
domain_name="$1"
ext=$2
if [ -d /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img ]; then
cp bg_custom.${ext} /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img
if [ -f bg_custom.${ext} ]; then
cp bg_custom.${ext} /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img
fi
if ! grep -q "bg_custom.${ext}" /var/www/${domain_name}/htdocs/config.php; then
if grep -q 'sitebackground' /var/www/${domain_name}/htdocs/config.php; then
sed -i '/sitebackground/d' /var/www/${domain_name}/htdocs/config.php
@ -1009,4 +1014,55 @@ function install_gnusocial_plugin_sharings_theme {
install_completed ${social_app_name}_plugin_sharings_theme
}
function install_gnusocial_markdown {
domain_name=$1
social_app_name=$2
GNUSOCIAL_PATH=/var/www/$domain_name/htdocs
# update to the next commit
function_check set_repo_commit
set_repo_commit $GNUSOCIAL_PATH/local/plugins/Markdown "$social_app_name Markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT" $GNUSOCIAL_MARKDOWN_REPO
if [[ $(app_is_installed ${social_app_name}_markdown) == "1" ]]; then
return
fi
if [ -d $GNUSOCIAL_PATH/local/plugins/Markdown ]; then
rm -rf $GNUSOCIAL_PATH/local/plugins/Markdown
fi
if [ ! -d $GNUSOCIAL_PATH/local/plugins ]; then
mkdir -p $GNUSOCIAL_PATH/local/plugins
fi
cd $GNUSOCIAL_PATH/local/plugins
if [ -d /repos/gnusocial-markdown ]; then
mkdir Markdown
cp -r -p /repos/gnusocial-markdown/. Markdown
cd Markdown
git pull
else
function_check git_clone
git_clone $GNUSOCIAL_MARKDOWN_REPO Markdown
fi
cd $GNUSOCIAL_PATH/local/plugins/Markdown
git checkout $GNUSOCIAL_MARKDOWN_COMMIT -b $GNUSOCIAL_MARKDOWN_COMMIT
gnusocial_config_file=$GNUSOCIAL_PATH/config.php
if ! grep -q "addPlugin('Markdown'" $gnusocial_config_file; then
echo "" >> $gnusocial_config_file
echo "// Markdown settings" >> $gnusocial_config_file
echo "addPlugin('Markdown');" >> $gnusocial_config_file
fi
set_completion_param "$social_app_name markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
chown -R www-data:www-data $GNUSOCIAL_PATH
install_completed ${social_app_name}_markdown
}
# NOTE: deliberately there is no "exit 0"