🗃️ Update codebase 🗃️

rootfs/usr/local/etc/docker/functions/entrypoint.sh
rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh
rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh
rootfs/usr/local/etc/docker/init.d/03-tor-server.sh
rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
rootfs/usr/share/httpd/default/hidden_service.html
rootfs/usr/share/httpd/default/hidden_services.html

Dockerfile
rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
This commit is contained in:
casjay
2025-10-22 12:13:32 -04:00
parent 91cbd47b4b
commit c791950cbe
2 changed files with 16 additions and 8 deletions

View File

@@ -275,8 +275,13 @@ __update_conf_files() {
# __replace "" "" "$CONF_DIR/nginx.conf"
# replace variables recursively
# __find_replace "" "" "$CONF_DIR"
if [ -n "$default_host" ] && [ -f "$WWW_ROOT_DIR/index.html" ]; then
sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$default_host'|g' "$WWW_ROOT_DIR/index.html"
if [ -f "$WWW_ROOT_DIR/index.html" ]; then
sed -i 's|REPLACE_ONION_WWW_DIR|'$WWW_ROOT_DIR'|g' "/data/htdocs/www/index.html"
[ -n "$default_host" ] && sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$default_host.onion'|g' "$WWW_ROOT_DIR/index.html" || sed -i '/REPLACE_DEFAULT_TOR_ADDRESS/d' "$WWW_ROOT_DIR/index.html"
fi
if [ -f "/data/htdocs/www/index.html" ]; then
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/www|g' "/data/htdocs/www/index.html"
[ -n "$default_host" ] && sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$default_host.onion'|g' "/data/htdocs/www/index.html" || sed -i '/REPLACE_DEFAULT_TOR_ADDRESS/d' "/data/htdocs/www/index.html"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# define actions
@@ -294,10 +299,8 @@ __update_conf_files() {
onion_site="$(basename -- $site)"
__onion_site_dir_is_empty "$onion_site" && NEW_SITE="yes"
[ -d "/data/htdocs/onions/$onion_site" ] || mkdir -p "/data/htdocs/onions/$onion_site"
if [ "$default_host" = "$onion_site" ]; then
if __onion_site_dir_is_empty "$onion_site"; then
cp -Rfa "$WWW_ROOT_DIR/." "/data/htdocs/onions/$onion_site/"
fi
if [ "$default_host" = "$onion_site" ] && __onion_site_dir_is_empty "$onion_site"; then
cp -Rfa "$WWW_ROOT_DIR/." "/data/htdocs/onions/$onion_site/"
else
if [ "$NEW_SITE" = "yes" ]; then
if [ -f "/usr/share/httpd/default/hidden_services.html" ]; then
@@ -309,11 +312,16 @@ __update_conf_files() {
fi
if [ ! -f "/config/nginx/vhosts.d/$onion_site.onion.conf" ]; then
cp -Rf "/config/nginx/vhosts.d/template" "/config/nginx/vhosts.d/$onion_site.onion.conf"
fi
if [ -f "/config/nginx/vhosts.d/$onion_site.onion.conf" ]; then
sed -i 's|REPLACE_ONION_PORT|'$SERVICE_PORT'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_SITE|'$onion_site.onion'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
fi
if [ -f "/data/htdocs/onions/$onion_site/index.html" ]; then
sed -i 's|REPLACE_ONION_ADDRESS|'$onion_site.onion'|g' "/data/htdocs/onions/$onion_site/index.html"
sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
fi
unset NEW_SITE
echo "Created $onion_site.onion in /data/htdocs/onions/$onion_site"