Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions root/defaults/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ server {
client_max_body_size 10M;
proxy_pass http://127.0.0.1:CWS;
}
location SUBFOLDERfiles {
location = SUBFOLDERfiles {
return 301 SUBFOLDERfiles/;
}
location SUBFOLDERfiles/ {
fancyindex on;
fancyindex_footer SUBFOLDERnginx/footer.html;
fancyindex_header SUBFOLDERnginx/header.html;
Expand Down Expand Up @@ -111,7 +114,10 @@ server {
client_max_body_size 10M;
proxy_pass http://127.0.0.1:CWS;
}
location SUBFOLDERfiles {
location = SUBFOLDERfiles {
return 301 SUBFOLDERfiles/;
}
location SUBFOLDERfiles/ {
fancyindex on;
fancyindex_footer SUBFOLDERnginx/footer.html;
fancyindex_header SUBFOLDERnginx/header.html;
Expand Down
10 changes: 7 additions & 3 deletions root/etc/s6-overlay/s6-rc.d/init-nginx/run
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ cp /defaults/default.conf ${NGINX_CONFIG}
sed -i "s/3000/$CPORT/g" ${NGINX_CONFIG}
sed -i "s/3001/$CHPORT/g" ${NGINX_CONFIG}
sed -i "s/CWS/$CWS/g" ${NGINX_CONFIG}
# Drop the download endpoint BEFORE SUBFOLDER is substituted, so the addresses match
# the literal template token instead of user supplied text. A subfolder of "/files/"
# is legal and would otherwise make a looser pattern delete the dashboard root.
if [[ ${SELKIES_FILE_TRANSFERS,,} != *"download"* ]] || [[ ${HARDEN_DESKTOP,,} == "true" ]]; then
sed -i -e '/location = SUBFOLDERfiles {/,/^ }/d' \
-e '/location SUBFOLDERfiles\/ {/,/^ }/d' ${NGINX_CONFIG}
fi
sed -i "s|SUBFOLDER|$SFOLDER|g" ${NGINX_CONFIG}
sed -i "s|REPLACE_DOWNLOADS_PATH|$FILE_MANAGER_PATH|g" ${NGINX_CONFIG}
s6-setuidgid abc mkdir -p ${FILE_MANAGER_PATH}
if [[ ${SELKIES_FILE_TRANSFERS,,} != *"download"* ]] || [[ ${HARDEN_DESKTOP,,} == "true" ]]; then
sed -i '/files {/,/^ }/d' ${NGINX_CONFIG}
fi
if [ -n "${DISABLE_IPV6}" ]; then
sed -i '/listen \[::\]/d' ${NGINX_CONFIG}
fi
Expand Down
Loading