Selaa lähdekoodia

Placeholder web user interface

Bob Mottram 7 vuotta sitten
vanhempi
commit
a6e2b54950
2 muutettua tiedostoa jossa 28 lisäystä ja 0 poistoa
  1. 3
    0
      src/freedombone-utils-setup
  2. 25
    0
      src/freedombone-utils-web

+ 3
- 0
src/freedombone-utils-setup Näytä tiedosto

@@ -1076,6 +1076,9 @@ function setup_web {
1076 1076
 
1077 1077
     function_check install_web_server_access_control
1078 1078
     install_web_server_access_control
1079
+
1080
+    function_check install_web_local_user_interface
1081
+    install_web_local_user_interface
1079 1082
 }
1080 1083
 
1081 1084
 function upgrade_apps {

+ 25
- 0
src/freedombone-utils-web Näytä tiedosto

@@ -1070,4 +1070,29 @@ function email_install_tls {
1070 1070
     fi
1071 1071
 }
1072 1072
 
1073
+function install_web_local_user_interface {
1074
+    # TODO
1075
+    # This is intended as a placeholder for a potential local web user interface
1076
+    # similar to Plinth or the yunohost admin interface
1077
+    local_hostname=$(cat /etc/avahi/avahi-daemon.conf | grep 'host-name' | awk -F '=' '{print $2}').local
1078
+
1079
+    mkdir -p /var/www/${local_hostname}/htdocs
1080
+    echo '<html>' > /var/www/${local_hostname}/htdocs/index.html
1081
+    echo '  <body>' >> /var/www/${local_hostname}/htdocs/index.html
1082
+    echo "  This is a test on $local_hostname" >> /var/www/${local_hostname}/htdocs/index.html
1083
+    echo '  </body>' >> /var/www/${local_hostname}/htdocs/index.html
1084
+    echo '</html>' >> /var/www/${local_hostname}/htdocs/index.html
1085
+    chown -R www-data:www-data /var/www/${local_hostname}/htdocs
1086
+
1087
+    nginx_file=/etc/nginx/sites-available/$local_hostname
1088
+    echo 'server {' > $nginx_file
1089
+    echo '  listen 80;' >> $nginx_file
1090
+    echo '  listen [::]:80;' >> $nginx_file
1091
+    echo "  server_name ${local_hostname};" >> $nginx_file
1092
+    echo "  root /var/www/${local_hostname}/htdocs;" >> $nginx_file
1093
+    echo '  index index.html;' >> $nginx_file
1094
+    echo '}' >> $nginx_file
1095
+    nginx_ensite $local_hostname
1096
+}
1097
+
1073 1098
 # NOTE: deliberately no exit 0