Update sites.inc

This commit is contained in:
2023-05-25 18:51:36 -05:00
parent 0e52fb3322
commit 139e7e6e87

View File

@@ -460,7 +460,7 @@ SITEINFO(){
done
if [ "${1}" == "edit" ]; then
echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}"
[ "${2}" == "" ] && echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}"
else
echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}"
fi
@@ -469,64 +469,78 @@ SITEINFO(){
declare -A SITELIST
if [ "${!gosite}" != "" ]; then
sites=$(find ${!gosite}/*); i=0
for sitefile in ${sites[@]}; do
site=${sitefile##*/}; site=${site/.conf/}
# if (( i % 12 == 0 )) || [ $i = 0 ]; then
# DIVIDER false yellow 98
# msg1="Site Address"; # c=0; spc1=''; spct=$((${cw_spc1}-${#msg1})); until [ $c = ${spct} ]; do spc1="${spc1} "; c=`expr $c + 1`; done
# msg2="Type"; # c=0; spc2=''; spct=$((${cw_spc2}-${#msg2})); until [ $c = ${spct} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
# msg3="SSL"; # c=0; spc3=''; spct=$((${cw_spc3}-${#msg3})); until [ $c = ${spct} ]; do spc3="${spc3} "; c=`expr $c + 1`; done
# msg4="HSTS"; # c=0; spc4=''; spct=$((${cw_spc4}-${#msg4})); until [ $c = ${spct} ]; do spc4="${spc4} "; c=`expr $c + 1`; done
# msg5="WBSKT"; # c=0; spc5=''; spct=$((${cw_spc5}-${#msg5})); until [ $c = ${spct} ]; do spc5="${spc5} "; c=`expr $c + 1`; done
# msg6="LOCK"; # c=0; spc6=''; spct=$((${cw_spc6}-${#msg6})); until [ $c = ${spct} ]; do spc6="${spc6} "; c=`expr $c + 1`; done
# msg7="Proxy Address & Port";
# # echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${msg1}${spc1}${msg2}${spc2}${msg3}${spc3}${msg4}${spc4}${msg5}${spc5}${msg6}${spc6}${msg7}${idsST[Reset]}${idsCL[Default]}"
# echo -en "${idsST[Bold]}${idsCL[LightCyan]}"
# printf "%-30s %-10s %-7s %-7s %-7s %-8s %-15s\n" "##) ${msg1}" "${msg2}" "${msg3}" "${msg4}" "${msg5}" "${msg6}" "${msg7}"
# echo -en "${idsST[Reset]}${idsCL[Default]}"
# DIVIDER false yellow 98
# else
# DIVIDER false darkGray 98
# fi
if [ "$(grep include/proxy.conf ${sitefile})" != "" ]; then
type='Proxy'
server=$(grep 'set $server' ${sitefile})
server=${server#*\"}; server=${server%\"*}
port=$(grep 'set $port' ${sitefile})
port=${port##* }; port=${port%;*}
c=0; spc7=''; spct=$((${cw_spc7}-${#server})); until [ $c = ${spct} ]; do spc7="${spc7} "; c=`expr $c + 1`; done
proxyhost="${server}${spc7}:${port}"
if [ "${1}" == "" ] || ([ "${1}" == "edit" ] && [ "${2}" == "" ]); then
for sitefile in ${sites[@]}; do
site=${sitefile##*/}; site=${site/.conf/}
if (( i % 12 == 0 )) || [ $i = 0 ]; then
DIVIDER false yellow 98
msg1="Site Address"; # c=0; spc1=''; spct=$((${cw_spc1}-${#msg1})); until [ $c = ${spct} ]; do spc1="${spc1} "; c=`expr $c + 1`; done
msg2="Type"; # c=0; spc2=''; spct=$((${cw_spc2}-${#msg2})); until [ $c = ${spct} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
msg3="SSL"; # c=0; spc3=''; spct=$((${cw_spc3}-${#msg3})); until [ $c = ${spct} ]; do spc3="${spc3} "; c=`expr $c + 1`; done
msg4="HSTS"; # c=0; spc4=''; spct=$((${cw_spc4}-${#msg4})); until [ $c = ${spct} ]; do spc4="${spc4} "; c=`expr $c + 1`; done
msg5="WBSKT"; # c=0; spc5=''; spct=$((${cw_spc5}-${#msg5})); until [ $c = ${spct} ]; do spc5="${spc5} "; c=`expr $c + 1`; done
msg6="LOCK"; # c=0; spc6=''; spct=$((${cw_spc6}-${#msg6})); until [ $c = ${spct} ]; do spc6="${spc6} "; c=`expr $c + 1`; done
msg7="Proxy Address & Port";
# echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${msg1}${spc1}${msg2}${spc2}${msg3}${spc3}${msg4}${spc4}${msg5}${spc5}${msg6}${spc6}${msg7}${idsST[Reset]}${idsCL[Default]}"
echo -en "${idsST[Bold]}${idsCL[LightCyan]}"
printf "%-30s %-10s %-7s %-7s %-7s %-8s %-15s\n" "##) ${msg1}" "${msg2}" "${msg3}" "${msg4}" "${msg5}" "${msg6}" "${msg7}"
echo -en "${idsST[Reset]}${idsCL[Default]}"
DIVIDER false yellow 98
else
DIVIDER false darkGray 98
fi
if [ "$(grep include/proxy.conf ${sitefile})" != "" ]; then
type='Proxy'
server=$(grep 'set $server' ${sitefile})
server=${server#*\"}; server=${server%\"*}
port=$(grep 'set $port' ${sitefile})
port=${port##* }; port=${port%;*}
c=0; spc7=''; spct=$((${cw_spc7}-${#server})); until [ $c = ${spct} ]; do spc7="${spc7} "; c=`expr $c + 1`; done
proxyhost="${server}${spc7}:${port}"
else
type='HTTP'
proxyhost=''
fi
[ "$(grep ssl_certificate ${sitefile})" != "" ] && ssl='Yes' || ssl=''
[ "$(grep include/hsts-support.conf ${sitefile})" != "" ] && hsts='Yes' || hsts=''
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt=''
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock=''
# msg1="${site}"; c=0; spc1=''; spct=$((${cw_spc1}-${#msg1})); until [ $c = ${spct} ]; do spc1="${spc1} "; c=`expr $c + 1`; done
# msg2="${type}"; c=0; spc2=''; spct=$((${cw_spc2}-${#msg2})); until [ $c = ${spct} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
# msg3="${ssl}"; c=0; spc3=''; spct=$((${cw_spc3}-${#msg3})); until [ $c = ${spct} ]; do spc3="${spc3} "; c=`expr $c + 1`; done
# msg4="${hsts}"; c=0; spc4=''; spct=$((${cw_spc4}-${#msg4})); until [ $c = ${spct} ]; do spc4="${spc4} "; c=`expr $c + 1`; done
# msg5="${wbskt}"; c=0; spc5=''; spct=$((${cw_spc5}-${#msg5})); until [ $c = ${spct} ]; do spc5="${spc5} "; c=`expr $c + 1`; done
# msg6="${lock}"; c=0; spc6=''; spct=$((${cw_spc6}-${#msg6})); until [ $c = ${spct} ]; do spc6="${spc6} "; c=`expr $c + 1`; done
# msg7="${proxyhost}";
i=`expr $i + 1`
SITELIST[${i}]=${site}
[ ${i} -lt 10 ] && ii=" ${i}" || ii=${i}
# echo -e "${ii}) ${msg1}${spc1}${msg2}${spc2}${msg3}${spc3}${msg4}${spc4}${msg5}${spc5}${msg6}${spc6}${msg7}"
printf "%-30s %-10s %-7s %-7s %-7s %-8s %-15s\n" "${ii}) ${site}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${lock}" "${proxyhost}"
done
fi
if [ "${1}" == "edit" ]; then
if [ "${2}" == "" ]; then
echo -en "\n${idsCL[LightCyan]}Enter the site number you want to edit: ${idsCL[Default]}"
read siteid
else
type='HTTP'
proxyhost=''
siteid=${2}
fi
site=${SITELIST[${siteid}]}
sitefile=${!gosite}/${site}.conf
[ "$(grep ssl_certificate ${sitefile})" != "" ] && ssl='Yes' || ssl=''
[ "$(grep include/hsts-support.conf ${sitefile})" != "" ] && hsts='Yes' || hsts=''
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt=''
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock=''
# msg1="${site}"; c=0; spc1=''; spct=$((${cw_spc1}-${#msg1})); until [ $c = ${spct} ]; do spc1="${spc1} "; c=`expr $c + 1`; done
# msg2="${type}"; c=0; spc2=''; spct=$((${cw_spc2}-${#msg2})); until [ $c = ${spct} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
# msg3="${ssl}"; c=0; spc3=''; spct=$((${cw_spc3}-${#msg3})); until [ $c = ${spct} ]; do spc3="${spc3} "; c=`expr $c + 1`; done
# msg4="${hsts}"; c=0; spc4=''; spct=$((${cw_spc4}-${#msg4})); until [ $c = ${spct} ]; do spc4="${spc4} "; c=`expr $c + 1`; done
# msg5="${wbskt}"; c=0; spc5=''; spct=$((${cw_spc5}-${#msg5})); until [ $c = ${spct} ]; do spc5="${spc5} "; c=`expr $c + 1`; done
# msg6="${lock}"; c=0; spc6=''; spct=$((${cw_spc6}-${#msg6})); until [ $c = ${spct} ]; do spc6="${spc6} "; c=`expr $c + 1`; done
# msg7="${proxyhost}";
i=`expr $i + 1`
SITELIST[${i}]=${site}
[ ${i} -lt 10 ] && ii=" ${i}" || ii=${i}
# echo -e "${ii}) ${msg1}${spc1}${msg2}${spc2}${msg3}${spc3}${msg4}${spc4}${msg5}${spc5}${msg6}${spc6}${msg7}"
# printf "%-30s %-10s %-7s %-7s %-7s %-8s %-15s\n" "${ii}) ${site}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${lock}" "${proxyhost}"
done
if [ "${1}" == "edit" ]; then
echo -en "\n${idsCL[LightCyan]}Enter the site number you want to edit: ${idsCL[Default]}"
read siteid
# site=${sites[${siteid}]}; site=${site/.conf/}
echo ${SITELIST[${siteid}]}
echo
echo -e "${idsCL[Cyan]}Site: ${idsST[Bold]}${site}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[LightCyan]}"
fi