瀏覽代碼

Include background image and title in postactiv interactive install

Bob Mottram 8 年之前
父節點
當前提交
35bbaca5a7
共有 1 個檔案被更改,包括 24 行新增5 行删除
  1. 24
    5
      src/freedombone-app-postactiv

+ 24
- 5
src/freedombone-app-postactiv 查看文件

@@ -100,15 +100,19 @@ function install_interactive_postactiv {
100 100
             if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
101 101
                 dialog --backtitle $"Freedombone Configuration" \
102 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 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 108
                        2> $data
107 109
             else
108 110
                 dialog --backtitle $"Freedombone Configuration" \
109 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 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 116
                        2> $data
113 117
             fi
114 118
             sel=$?
@@ -117,7 +121,14 @@ function install_interactive_postactiv {
117 121
                 255) exit 1;;
118 122
             esac
119 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 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 132
             if [ $POSTACTIV_DOMAIN_NAME ]; then
122 133
                 if [[ $POSTACTIV_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
123 134
                     POSTACTIV_DOMAIN_NAME=""
@@ -129,7 +140,7 @@ function install_interactive_postactiv {
129 140
                     dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
130 141
                 else
131 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 144
                         validate_freedns_code "$POSTACTIV_CODE"
134 145
                         if [ ! $VALID_CODE ]; then
135 146
                             POSTACTIV_DOMAIN_NAME=
@@ -142,8 +153,16 @@ function install_interactive_postactiv {
142 153
             fi
143 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 162
         # save the results in the config file
146 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 166
     fi
148 167
     write_config_param "POSTACTIV_DOMAIN_NAME" "$POSTACTIV_DOMAIN_NAME"
149 168
     APP_INSTALLED=1
@@ -685,7 +704,7 @@ function install_postactiv {
685 704
     install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
686 705
 
687 706
     function_check install_nodejs
688
-    install_nodejs pleroma-gnusocial
707
+    install_nodejs pleroma-postactiv
689 708
     install_pleroma "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
690 709
 
691 710
     expire_postactiv_posts