mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
add basic auth
This commit is contained in:
parent
d16d45e04b
commit
c6760e1de9
2 changed files with 20 additions and 3 deletions
|
@ -364,7 +364,11 @@ fi
|
||||||
uptime=$(uptime --pretty)
|
uptime=$(uptime --pretty)
|
||||||
datetime=$(date)
|
datetime=$(date)
|
||||||
|
|
||||||
# write results to a json file on RAM disk cache
|
# if running as user "pi":
|
||||||
|
# - write results to a JSON file on RAM disk
|
||||||
|
# - update info.html file
|
||||||
|
if [ "${EUID}" == "$(id -u pi)" ]; then
|
||||||
|
|
||||||
cat <<EOF > /var/cache/raspiblitz/info.json
|
cat <<EOF > /var/cache/raspiblitz/info.json
|
||||||
{
|
{
|
||||||
"uptime": "${uptime}",
|
"uptime": "${uptime}",
|
||||||
|
@ -396,7 +400,9 @@ cat <<EOF > /var/cache/raspiblitz/info.json
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# update info.html file
|
# use Jinja2 and apply json data to template to procude static html file
|
||||||
/usr/local/bin/j2 /var/www/blitzweb/info/info.j2 /var/cache/raspiblitz/info.json -o /var/cache/raspiblitz/info.html
|
/usr/local/bin/j2 /var/www/blitzweb/info/info.j2 /var/cache/raspiblitz/info.json -o /var/cache/raspiblitz/info.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|
|
@ -27,4 +27,15 @@ A+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!L
|
||||||
|
|
||||||
root /var/www/blitzweb;
|
root /var/www/blitzweb;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to displaying a 404.
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /info/ {
|
||||||
|
auth_basic "BlitzWeb Admin";
|
||||||
|
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue