improved subdomain detection
now we compare against public-suffix list (mozilla) to know if a site is sub domain.
This commit is contained in:
parent
827e5aa20b
commit
42f3736f61
8447
lib/public_suffix_list.dat
Normal file
8447
lib/public_suffix_list.dat
Normal file
File diff suppressed because it is too large
Load diff
21
plugins/site
21
plugins/site
|
@ -29,13 +29,6 @@ if [[ "$type" == "-cache" && -n $cache ]]; then
|
|||
cache="$2"
|
||||
fi
|
||||
|
||||
# Check if site is sub-domain
|
||||
subdom=$(echo "${domain}" | cut -d'.' -f 3 -s)
|
||||
if [[ -z $subdom ]]; then
|
||||
subdomflag="0"
|
||||
else
|
||||
subdomflag="1"
|
||||
fi
|
||||
|
||||
# Extract value if exist
|
||||
if [[ $type == "-parked="* || $type == "-proxy="* || $type == "-wp="* || $type == "-wpsubdir="* || $type == "-wpsubdom="* ]]; then
|
||||
|
@ -48,6 +41,20 @@ if [[ $cache == "-root="* ]]; then
|
|||
fi
|
||||
|
||||
|
||||
# Check if site is sub-domain
|
||||
if [[ -n $domain && $type =~ ^(-html|-php|-mysql|-wp|-wpsubdir|-wpsubdom|-parked)$ ]]; then
|
||||
count=1
|
||||
while true; do
|
||||
tld=$(echo "${domain}" | rev | cut -d'.' -f -$count -s | rev)
|
||||
if ! grep -Fxq "$tld" /opt/webinoly/lib/public_suffix_list.dat; then
|
||||
break
|
||||
fi
|
||||
count=$[$count+1]
|
||||
done
|
||||
[[ -z $(echo "$(echo "${domain}" | rev | cut -d'.' -f $count- -s | rev)" | cut -d'.' -f 2 -s) ]] && subdomflag="0" || subdomflag="1"
|
||||
fi
|
||||
|
||||
|
||||
# Evaluate if site to create is WP ( 0 = noWP, 1 = WP, 2 = WP with default values, 3 = WP with custom values )
|
||||
wp="0"
|
||||
if [[ $type == "-wp" || $type == "-wpsubdir" || $type == "-wpsubdom" ]]; then
|
||||
|
|
Loading…
Reference in a new issue