Bladeren bron

Abstract out the markdown plugin

Bob Mottram 7 jaren geleden
bovenliggende
commit
a1939bb4cd
3 gewijzigde bestanden met toevoegingen van 63 en 57 verwijderingen
  1. 1
    52
      src/freedombone-app-gnusocial
  2. 5
    4
      src/freedombone-app-postactiv
  3. 57
    1
      src/freedombone-utils-gnusocialtools

+ 1
- 52
src/freedombone-app-gnusocial Bestand weergeven

41
 GNUSOCIAL_ADMIN_PASSWORD=
41
 GNUSOCIAL_ADMIN_PASSWORD=
42
 
42
 
43
 GNUSOCIAL_BACKGROUND_IMAGE_URL=
43
 GNUSOCIAL_BACKGROUND_IMAGE_URL=
44
-GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
45
-GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
46
 
44
 
47
 GNUSOCIAL_TITLE='Pleroma FE'
45
 GNUSOCIAL_TITLE='Pleroma FE'
48
 
46
 
55
                      GNUSOCIAL_WELCOME_MESSAGE
53
                      GNUSOCIAL_WELCOME_MESSAGE
56
                      GNUSOCIAL_BACKGROUND_IMAGE_URL
54
                      GNUSOCIAL_BACKGROUND_IMAGE_URL
57
                      DDNS_PROVIDER
55
                      DDNS_PROVIDER
58
-                     GNUSOCIAL_MARKDOWN_COMMIT
59
                      GNUSOCIAL_TITLE
56
                      GNUSOCIAL_TITLE
60
                      GNUSOCIAL_EXPIRE_MONTHS
57
                      GNUSOCIAL_EXPIRE_MONTHS
61
                      MY_USERNAME)
58
                      MY_USERNAME)
788
     install_completed gnusocial_main
785
     install_completed gnusocial_main
789
 }
786
 }
790
 
787
 
791
-function install_gnusocial_markdown {
792
-    GNUSOCIAL_PATH=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
793
-
794
-    # update to the next commit
795
-    function_check set_repo_commit
796
-    set_repo_commit $GNUSOCIAL_PATH/local/plugins/Markdown "gnusocial Markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT" $GNUSOCIAL_MARKDOWN_REPO
797
-
798
-    if [[ $(app_is_installed gnusocial_markdown) == "1" ]]; then
799
-        return
800
-    fi
801
-
802
-    if [ -d $GNUSOCIAL_PATH/local/plugins/Markdown ]; then
803
-        rm -rf $GNUSOCIAL_PATH/local/plugins/Markdown
804
-    fi
805
-
806
-    if [ ! -d $GNUSOCIAL_PATH/local/plugins ]; then
807
-        mkdir -p $GNUSOCIAL_PATH/local/plugins
808
-    fi
809
-
810
-    cd $GNUSOCIAL_PATH/local/plugins
811
-
812
-    if [ -d /repos/gnusocial-markdown ]; then
813
-        mkdir Markdown
814
-        cp -r -p /repos/gnusocial-markdown/. Markdown
815
-        cd Markdown
816
-        git pull
817
-    else
818
-        function_check git_clone
819
-        git_clone $GNUSOCIAL_MARKDOWN_REPO Markdown
820
-    fi
821
-
822
-    cd $GNUSOCIAL_PATH/local/plugins/Markdown
823
-    git checkout $GNUSOCIAL_MARKDOWN_COMMIT -b $GNUSOCIAL_MARKDOWN_COMMIT
824
-
825
-    gnusocial_config_file=$GNUSOCIAL_PATH/config.php
826
-    if ! grep -q "addPlugin('Markdown'" $gnusocial_config_file; then
827
-        echo "" >> $gnusocial_config_file
828
-        echo "// Markdown settings" >> $gnusocial_config_file
829
-        echo "addPlugin('Markdown');" >> $gnusocial_config_file
830
-    fi
831
-
832
-    set_completion_param "gnusocial markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
833
-
834
-    chown -R www-data:www-data $GNUSOCIAL_PATH
835
-
836
-    install_completed gnusocial_markdown
837
-}
838
-
839
 function install_gnusocial {
788
 function install_gnusocial {
840
     if [ ! $ONION_ONLY ]; then
789
     if [ ! $ONION_ONLY ]; then
841
         ONION_ONLY='no'
790
         ONION_ONLY='no'
844
     install_gnusocial_main
793
     install_gnusocial_main
845
     expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
794
     expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
846
     install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
795
     install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
847
-    install_gnusocial_markdown
796
+    install_gnusocial_markdown "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
848
     install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
797
     install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
849
     install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
798
     install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
850
 
799
 

+ 5
- 4
src/freedombone-app-postactiv Bestand weergeven

807
 
807
 
808
     install_postactiv_main
808
     install_postactiv_main
809
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
809
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
810
+    install_gnusocial_markdown "$POSTACTIV_DOMAIN_NAME" "postactiv"
810
     install_gnusocial_plugin_sharings "$POSTACTIV_DOMAIN_NAME" "postactiv"
811
     install_gnusocial_plugin_sharings "$POSTACTIV_DOMAIN_NAME" "postactiv"
811
     install_gnusocial_plugin_sharings_theme "$POSTACTIV_DOMAIN_NAME" "postactiv"
812
     install_gnusocial_plugin_sharings_theme "$POSTACTIV_DOMAIN_NAME" "postactiv"
812
-    #function_check install_nodejs
813
-    #install_nodejs pleroma-postactiv
814
-
815
-    #install_armadillo_front_end "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL"
816
 
813
 
817
     # Currently Pleroma won't install on ARM systems
814
     # Currently Pleroma won't install on ARM systems
818
     # because it uses node-sass which doesn't support ARM
815
     # because it uses node-sass which doesn't support ARM
835
 
832
 
836
     systemctl restart nginx
833
     systemctl restart nginx
837
 
834
 
835
+    # Set qvitter to be the default UI. It's probably the most stable.
836
+    # And doesn't forget logins
837
+    gnusocial_use_qvitter postactiv
838
+
838
     APP_INSTALLED=1
839
     APP_INSTALLED=1
839
 }
840
 }
840
 
841
 

+ 57
- 1
src/freedombone-utils-gnusocialtools Bestand weergeven

42
 SHARINGS_THEME_REPO="http://git.lasindias.club/manuel/SharingsTheme"
42
 SHARINGS_THEME_REPO="http://git.lasindias.club/manuel/SharingsTheme"
43
 SHARINGS_THEME_COMMIT='7106c7ef03'
43
 SHARINGS_THEME_COMMIT='7106c7ef03'
44
 
44
 
45
+GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
46
+GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
47
+
45
 function qvitter_update_background {
48
 function qvitter_update_background {
46
     domain_name="$1"
49
     domain_name="$1"
47
     ext=$2
50
     ext=$2
48
 
51
 
49
     if [ -d /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img ]; then
52
     if [ -d /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img ]; then
50
-        cp bg_custom.${ext} /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img
53
+        if [ -f bg_custom.${ext} ]; then
54
+            cp bg_custom.${ext} /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img
55
+        fi
51
         if ! grep -q "bg_custom.${ext}" /var/www/${domain_name}/htdocs/config.php; then
56
         if ! grep -q "bg_custom.${ext}" /var/www/${domain_name}/htdocs/config.php; then
52
             if grep -q 'sitebackground' /var/www/${domain_name}/htdocs/config.php; then
57
             if grep -q 'sitebackground' /var/www/${domain_name}/htdocs/config.php; then
53
                 sed -i '/sitebackground/d' /var/www/${domain_name}/htdocs/config.php
58
                 sed -i '/sitebackground/d' /var/www/${domain_name}/htdocs/config.php
1009
     install_completed ${social_app_name}_plugin_sharings_theme
1014
     install_completed ${social_app_name}_plugin_sharings_theme
1010
 }
1015
 }
1011
 
1016
 
1017
+function install_gnusocial_markdown {
1018
+    domain_name=$1
1019
+    social_app_name=$2
1020
+
1021
+    GNUSOCIAL_PATH=/var/www/$domain_name/htdocs
1022
+
1023
+    # update to the next commit
1024
+    function_check set_repo_commit
1025
+    set_repo_commit $GNUSOCIAL_PATH/local/plugins/Markdown "$social_app_name Markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT" $GNUSOCIAL_MARKDOWN_REPO
1026
+
1027
+    if [[ $(app_is_installed ${social_app_name}_markdown) == "1" ]]; then
1028
+        return
1029
+    fi
1030
+
1031
+    if [ -d $GNUSOCIAL_PATH/local/plugins/Markdown ]; then
1032
+        rm -rf $GNUSOCIAL_PATH/local/plugins/Markdown
1033
+    fi
1034
+
1035
+    if [ ! -d $GNUSOCIAL_PATH/local/plugins ]; then
1036
+        mkdir -p $GNUSOCIAL_PATH/local/plugins
1037
+    fi
1038
+
1039
+    cd $GNUSOCIAL_PATH/local/plugins
1040
+
1041
+    if [ -d /repos/gnusocial-markdown ]; then
1042
+        mkdir Markdown
1043
+        cp -r -p /repos/gnusocial-markdown/. Markdown
1044
+        cd Markdown
1045
+        git pull
1046
+    else
1047
+        function_check git_clone
1048
+        git_clone $GNUSOCIAL_MARKDOWN_REPO Markdown
1049
+    fi
1050
+
1051
+    cd $GNUSOCIAL_PATH/local/plugins/Markdown
1052
+    git checkout $GNUSOCIAL_MARKDOWN_COMMIT -b $GNUSOCIAL_MARKDOWN_COMMIT
1053
+
1054
+    gnusocial_config_file=$GNUSOCIAL_PATH/config.php
1055
+    if ! grep -q "addPlugin('Markdown'" $gnusocial_config_file; then
1056
+        echo "" >> $gnusocial_config_file
1057
+        echo "// Markdown settings" >> $gnusocial_config_file
1058
+        echo "addPlugin('Markdown');" >> $gnusocial_config_file
1059
+    fi
1060
+
1061
+    set_completion_param "$social_app_name markdown commit" "$GNUSOCIAL_MARKDOWN_COMMIT"
1062
+
1063
+    chown -R www-data:www-data $GNUSOCIAL_PATH
1064
+
1065
+    install_completed ${social_app_name}_markdown
1066
+}
1067
+
1012
 # NOTE: deliberately there is no "exit 0"
1068
 # NOTE: deliberately there is no "exit 0"