瀏覽代碼

Some configuration settings for peertube

Bob Mottram 7 年之前
父節點
當前提交
a21d5528a0
共有 1 個檔案被更改,包括 61 行新增0 行删除
  1. 61
    0
      src/freedombone-app-peertube

+ 61
- 0
src/freedombone-app-peertube 查看文件

@@ -107,6 +107,67 @@ function install_interactive_peertube {
107 107
     APP_INSTALLED=1
108 108
 }
109 109
 
110
+function peertube_set_admin_email {
111
+    read_config_param $MY_EMAIL_ADDRESS
112
+    data=$(tempfile 2>/dev/null)
113
+    trap "rm -f $data" 0 1 2 5 15
114
+    dialog --title $"Set PeerTube administrator email address" \
115
+           --backtitle $"Freedombone Control Panel" \
116
+           --inputbox $"Admin email address" 8 75 "$MY_EMAIL_ADDRESS" 2>$data
117
+    sel=$?
118
+    case $sel in
119
+        0)  peertube_email=$(<$data)
120
+            if [[ "$peertube_email" != *' '* && "$peertube_email" != *','* && "$peertube_email" != *';'* && "$peertube_email" == *'@'* && "$peertube_email" == *'.'* ]]; then
121
+                if [ ${#peertube_email} -gt 8 ]; then
122
+                    sed -i "s|email:.*|email: '${peertube_email}'|g" $PEERTUBE_DIR/config/production.yaml
123
+                    systemctl restart peertube
124
+                    dialog --title $"Set PeerTube administrator email address" \
125
+                           --msgbox $"Set to $peertube_email" 6 75
126
+                fi
127
+            fi
128
+            ;;
129
+    esac
130
+    rm $data
131
+}
132
+
133
+function peertube_disable_signups {
134
+    dialog --title $"Disable PeerTube signups" \
135
+           --backtitle $"Freedombone Control Panel" \
136
+           --yesno $"\nDo you wish to disable further PeerTube signups?" 8 75
137
+    sel=$?
138
+    case $sel in
139
+        0) sed "0,/RE/s/enabled:.*/enabled: false/" $PEERTUBE_DIR/config/production.yaml;;
140
+        1) sed "0,/RE/s/enabled:.*/enabled: true/" $PEERTUBE_DIR/config/production.yaml;;
141
+        255) return;;
142
+    esac
143
+
144
+    systemctl restart peertube
145
+}
146
+
147
+function configure_interactive_peertube {
148
+    while true
149
+    do
150
+        data=$(tempfile 2>/dev/null)
151
+        trap "rm -f $data" 0 1 2 5 15
152
+        dialog --backtitle $"Freedombone Control Panel" \
153
+               --title $"PeerTube" \
154
+               --radiolist $"Choose an operation:" 10 70 4 \
155
+               1 $"Set administrator email address" off \
156
+               2 $"Disable or enable signups" off \
157
+               3 $"Exit" on 2> $data
158
+        sel=$?
159
+        case $sel in
160
+            1) break;;
161
+            255) break;;
162
+        esac
163
+        case $(cat $data) in
164
+            1) peertube_set_admin_email;;
165
+            2) peertube_disable_signups;;
166
+            3) break;;
167
+        esac
168
+    done
169
+}
170
+
110 171
 function change_password_peertube {
111 172
     PEERTUBE_USERNAME="$1"
112 173
     PEERTUBE_PASSWORD="$2"