forked from mirrors/fancyindex
first version
This commit is contained in:
commit
9d467e78c1
7 changed files with 254 additions and 0 deletions
5
src/00_init.sh
Normal file
5
src/00_init.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$WEBUSER" ]; then
|
||||
addauth $WEBUSER $WEBPASSWORD
|
||||
fi
|
38
src/cmd/addauth.sh
Normal file
38
src/cmd/addauth.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
FPASS="/etc/nginx/.htpasswd"
|
||||
|
||||
error(){
|
||||
echo "ERROR : parameters invalid !" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo "Usage: addauth user password"
|
||||
echo "--help or -h : view help"
|
||||
}
|
||||
|
||||
load(){
|
||||
if [ ! -f $FPASS ]; then
|
||||
htpasswd -bc $FPASS $1 $2
|
||||
else
|
||||
htpasswd -b $FPASS $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
# no parameters
|
||||
[[ $# -lt 1 ]] && error
|
||||
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
;;
|
||||
|
||||
-h)
|
||||
usage
|
||||
;;
|
||||
|
||||
*)
|
||||
[[ $# -ne 2 ]] && error
|
||||
load $1 $2
|
||||
|
||||
esac
|
35
src/cmd/rmauth.sh
Normal file
35
src/cmd/rmauth.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
FPASS="/etc/nginx/.htpasswd"
|
||||
|
||||
error(){
|
||||
echo "ERROR : parameters invalid !" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo "Usage: rmauth user"
|
||||
echo "--help or -h : view help"
|
||||
}
|
||||
|
||||
load(){
|
||||
if [ -f $FPASS ]; then
|
||||
htpasswd -bD $FPASS $1
|
||||
fi
|
||||
}
|
||||
|
||||
# no parameters
|
||||
[[ $# -ne 1 ]] && error
|
||||
|
||||
case "$1" in
|
||||
--help)
|
||||
usage
|
||||
;;
|
||||
|
||||
-h)
|
||||
usage
|
||||
;;
|
||||
|
||||
*)
|
||||
load $1
|
||||
|
||||
esac
|
32
src/default.conf
Normal file
32
src/default.conf
Normal file
|
@ -0,0 +1,32 @@
|
|||
server {
|
||||
listen 80 default_server;
|
||||
client_max_body_size 1G;
|
||||
|
||||
location /fancyindex {
|
||||
rewrite /fancyindex/(.*) /$1 break;
|
||||
root /theme/Nginx-Fancyindex-Theme;
|
||||
}
|
||||
|
||||
location / {
|
||||
# manage DELETE AND MKDIR
|
||||
if (-d $request_filename) { rewrite ^(.*[^/])$ $1/ break; }
|
||||
|
||||
root /share;
|
||||
fancyindex on;
|
||||
fancyindex_localtime on;
|
||||
fancyindex_name_length 255; # Maximum file name length in bytes, change as you like.
|
||||
# theme
|
||||
fancyindex_header "/fancyindex/header.html";
|
||||
fancyindex_footer "/fancyindex/footer.html";
|
||||
fancyindex_ignore "fancyindex";
|
||||
|
||||
dav_methods PUT DELETE MKCOL COPY MOVE;
|
||||
dav_ext_methods PROPFIND OPTIONS;
|
||||
create_full_put_path on;
|
||||
dav_access user:rw group:rw all:rw;
|
||||
|
||||
auth_basic "Access restricted";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
}
|
||||
|
||||
}
|
19
src/entrypoint.sh
Normal file
19
src/entrypoint.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ $CONTAINER_TIMEZONE ] && [ "$SET_CONTAINER_TIMEZONE" = "false" ]; then
|
||||
echo ${CONTAINER_TIMEZONE} >/etc/timezone && dpkg-reconfigure -f noninteractive tzdata
|
||||
echo "Container timezone set to: $CONTAINER_TIMEZONE"
|
||||
export SET_CONTAINER_TIMEZONE=true
|
||||
else
|
||||
echo "Container timezone not modified"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'app' ]; then
|
||||
/bin/run-parts --verbose --regex '\.(sh)$' "/usr/share/docker-entrypoint.pre"
|
||||
cp /theme/Nginx-Fancyindex-Theme/mdl/color/$COLOR.min.css /theme/Nginx-Fancyindex-Theme/mdl/material.min.css
|
||||
nginx -g "daemon off;"
|
||||
/bin/run-parts --verbose --regex '\.(sh)$' "/usr/share/docker-entrypoint.post"
|
||||
fi
|
||||
|
||||
exec "$@"
|
Loading…
Add table
Add a link
Reference in a new issue