Placeholder web user interface

This commit is contained in:
Bob Mottram 2018-01-07 14:47:43 +00:00
parent 1cea492656
commit a6e2b54950
2 changed files with 28 additions and 0 deletions

View File

@ -1076,6 +1076,9 @@ function setup_web {
function_check install_web_server_access_control
install_web_server_access_control
function_check install_web_local_user_interface
install_web_local_user_interface
}
function upgrade_apps {

View File

@ -1070,4 +1070,29 @@ function email_install_tls {
fi
}
function install_web_local_user_interface {
# TODO
# This is intended as a placeholder for a potential local web user interface
# similar to Plinth or the yunohost admin interface
local_hostname=$(cat /etc/avahi/avahi-daemon.conf | grep 'host-name' | awk -F '=' '{print $2}').local
mkdir -p /var/www/${local_hostname}/htdocs
echo '<html>' > /var/www/${local_hostname}/htdocs/index.html
echo ' <body>' >> /var/www/${local_hostname}/htdocs/index.html
echo " This is a test on $local_hostname" >> /var/www/${local_hostname}/htdocs/index.html
echo ' </body>' >> /var/www/${local_hostname}/htdocs/index.html
echo '</html>' >> /var/www/${local_hostname}/htdocs/index.html
chown -R www-data:www-data /var/www/${local_hostname}/htdocs
nginx_file=/etc/nginx/sites-available/$local_hostname
echo 'server {' > $nginx_file
echo ' listen 80;' >> $nginx_file
echo ' listen [::]:80;' >> $nginx_file
echo " server_name ${local_hostname};" >> $nginx_file
echo " root /var/www/${local_hostname}/htdocs;" >> $nginx_file
echo ' index index.html;' >> $nginx_file
echo '}' >> $nginx_file
nginx_ensite $local_hostname
}
# NOTE: deliberately no exit 0