Browse Source

Include background image and title in postactiv interactive install

Bob Mottram 8 years ago
parent
commit
35bbaca5a7
1 changed files with 24 additions and 5 deletions
  1. 24
    5
      src/freedombone-app-postactiv

+ 24
- 5
src/freedombone-app-postactiv View File

100
             if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
100
             if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
101
                 dialog --backtitle $"Freedombone Configuration" \
101
                 dialog --backtitle $"Freedombone Configuration" \
102
                        --title $"PostActiv Configuration" \
102
                        --title $"PostActiv Configuration" \
103
-                       --form $"\nPlease enter your postactiv details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
103
+                       --form $"\nPlease enter your PostActiv details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
104
                        $"Domain:" 1 1 "$(grep 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
104
                        $"Domain:" 1 1 "$(grep 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
105
-                       $"Code:" 2 1 "$(grep 'POSTACTIV_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 25 33 255 \
105
+                       $"Totle:" 2 1 "$(grep '$POSTACTIV_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
106
+                       $"Background image URL:" 3 1 "$(grep '$POSTACTIV_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
107
+                       $"Code:" 4 1 "$(grep 'POSTACTIV_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
106
                        2> $data
108
                        2> $data
107
             else
109
             else
108
                 dialog --backtitle $"Freedombone Configuration" \
110
                 dialog --backtitle $"Freedombone Configuration" \
109
                        --title $"PostActiv Configuration" \
111
                        --title $"PostActiv Configuration" \
110
-                       --form $"\nPlease enter your postactiv details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
112
+                       --form $"\nPlease enter your PostActiv details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
111
                        $"Domain:" 1 1 "$(grep 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
113
                        $"Domain:" 1 1 "$(grep 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
114
+                       $"Title:" 2 1 "$(grep '$POSTACTIV_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
115
+                       $"Background image URL:" 3 1 "$(grep '$POSTACTIV_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
112
                        2> $data
116
                        2> $data
113
             fi
117
             fi
114
             sel=$?
118
             sel=$?
117
                 255) exit 1;;
121
                 255) exit 1;;
118
             esac
122
             esac
119
             POSTACTIV_DOMAIN_NAME=$(cat $data | sed -n 1p)
123
             POSTACTIV_DOMAIN_NAME=$(cat $data | sed -n 1p)
124
+            title=$(cat $data | sed -n 2p)
125
+            if [ ${#title} -gt 1 ]; then
126
+                POSTACTIV_TITLE=$welcome_msg
127
+            fi
120
             img_url=$(cat $data | sed -n 3p)
128
             img_url=$(cat $data | sed -n 3p)
129
+            if [ ${#img_url} -gt 1 ]; then
130
+                POSTACTIV_BACKGROUND_IMAGE_URL=$img_url
131
+            fi
121
             if [ $POSTACTIV_DOMAIN_NAME ]; then
132
             if [ $POSTACTIV_DOMAIN_NAME ]; then
122
                 if [[ $POSTACTIV_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
133
                 if [[ $POSTACTIV_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
123
                     POSTACTIV_DOMAIN_NAME=""
134
                     POSTACTIV_DOMAIN_NAME=""
129
                     dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
140
                     dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
130
                 else
141
                 else
131
                     if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
142
                     if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
132
-                        POSTACTIV_CODE=$(cat $data | sed -n 2p)
143
+                        POSTACTIV_CODE=$(cat $data | sed -n 4p)
133
                         validate_freedns_code "$POSTACTIV_CODE"
144
                         validate_freedns_code "$POSTACTIV_CODE"
134
                         if [ ! $VALID_CODE ]; then
145
                         if [ ! $VALID_CODE ]; then
135
                             POSTACTIV_DOMAIN_NAME=
146
                             POSTACTIV_DOMAIN_NAME=
142
             fi
153
             fi
143
         done
154
         done
144
 
155
 
156
+        # remove any invalid characters
157
+        if [ ${#POSTACTIV_TITLE} -gt 0 ]; then
158
+            new_title=$(echo "$POSTACTIV_TITLE" | sed "s|'||g")
159
+            POSTACTIV_TITLE="$new_title"
160
+        fi
161
+
145
         # save the results in the config file
162
         # save the results in the config file
146
         write_config_param "POSTACTIV_CODE" "$POSTACTIV_CODE"
163
         write_config_param "POSTACTIV_CODE" "$POSTACTIV_CODE"
164
+        write_config_param "POSTACTIV_TITLE" "$POSTACTIV_TITLE"
165
+        write_config_param "POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_BACKGROUND_IMAGE_URL"
147
     fi
166
     fi
148
     write_config_param "POSTACTIV_DOMAIN_NAME" "$POSTACTIV_DOMAIN_NAME"
167
     write_config_param "POSTACTIV_DOMAIN_NAME" "$POSTACTIV_DOMAIN_NAME"
149
     APP_INSTALLED=1
168
     APP_INSTALLED=1
685
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
704
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
686
 
705
 
687
     function_check install_nodejs
706
     function_check install_nodejs
688
-    install_nodejs pleroma-gnusocial
707
+    install_nodejs pleroma-postactiv
689
     install_pleroma "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
708
     install_pleroma "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
690
 
709
 
691
     expire_postactiv_posts
710
     expire_postactiv_posts