一分钟搭建影视站,支持Docker等部署方式
增强密码处理:将密码哈希化并替换HTML文件中的占位符
developer6324a7d67038
diff --git a/docker-entrypoint.sh b/docker-entrypoint.shindex 227e18d..1548304 100644--- a/docker-entrypoint.sh+++ b/docker-entrypoint.sh@@ -1,10 +1,25 @@#!/bin/shset -e+# Function to hash a string with SHA-256+hash_password() {+ if [ -z "$1" ]; then+ echo ""+ else+ echo -n "$1" | sha256sum | cut -d ' ' -f 1+ fi+}+# Function to replace environment variables in HTML filesreplace_env_vars() {- # Replace the password placeholder in all HTML files- find /usr/share/nginx/html -type f -name "*.html" -exec sed -i "s/window.__ENV__.PASSWORD = \"{{PASSWORD}}\";/window.__ENV__.PASSWORD = \"${PASSWORD:-}\";/g" {} \;+ # Hash the password if it exists+ local password_hash=""+ if [ -n "$PASSWORD" ]; then+ password_hash=$(hash_password "$PASSWORD")+ fi++ # Replace the password placeholder in all HTML files with the hashed password+ find /usr/share/nginx/html -type f -name "*.html" -exec sed -i "s/window.__ENV__.PASSWORD = \"{{PASSWORD}}\";/window.__ENV__.PASSWORD = \"${password_hash}\";/g" {} \;echo "Environment variables have been injected into HTML files."}