diff --git a/Dockerfile b/Dockerfile
index aa5d4df..77d86bd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -138,6 +138,10 @@ RUN echo "Updating system files "; \
RUN echo "Custom Settings"; \
$SHELL_OPTS; \
+ wget "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb" -O "/tmp/GeoLite2-ASN.mmdb" || rm -Rf "/tmp/GeoLite2-ASN.mmdb" \
+ wget "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb" -O "/tmp/GeoLite2-City.mmdb" || rm -Rf "/tmp/GeoLite2-City.mmdb" \
+ wget "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb" -O "/tmp/GeoLite2-Country.mmdb" || rm -Rf "/tmp/GeoLite2-Country.mmdb" \
+ for mmdb in GeoLite2-ASN.mmdb GeoLite2-City.mmdb GeoLite2-Country.mmdb; do [ -f "/tmp/$mmdb" ] && mv -f "/tmp/$mmdb" "/opt/echoip/geoip/$mmdb"; done \
echo ""
RUN echo "Setting up users and scripts "; \
diff --git a/rootfs/opt/echoip/html/index.html b/rootfs/opt/echoip/html/index.html
index 50f32d2..bed6ab2 100644
--- a/rootfs/opt/echoip/html/index.html
+++ b/rootfs/opt/echoip/html/index.html
@@ -343,10 +343,10 @@
- hosted on REPLACE_HOST_NAME
+ hosted on: REPLACE_HOST_NAME
Server IPV4: REPLACE_CURRENT_IP_4
- Server IPV6: REPLACE_CURRENT_IP_6
- Last updated on REPLACE_MODIFIED
+ Server IPV6: REPLACE_CURRENT_IP_6
+ Last updated on: REPLACE_MODIFIED
diff --git a/rootfs/usr/local/etc/docker/bin/echoip-cli b/rootfs/usr/local/etc/docker/bin/echoip-cli
index 99347ee..3870c8d 100755
--- a/rootfs/usr/local/etc/docker/bin/echoip-cli
+++ b/rootfs/usr/local/etc/docker/bin/echoip-cli
@@ -1,4 +1,11 @@
#!/usr/bin/env sh
[ -n "$SERVICE_PORT" ] || SERVICE_PORT="80"
-[ -n "$WORK_DIR" ] || WORK_DIR="/opt/echoip"
-/opt/echoip/echoip -r -s -p -l :$SERVICE_PORT -H X-Real-IP -H x-forwarded-for -t $WORK_DIR/html -a $WORK_DIR/geoip/GeoLite2-ASN.mmdb -c $WORK_DIR/geoip/GeoLite2-City.mmdb -f $WORK_DIR/geoip/GeoLite2-Country.mmdb
+[ -n "$WORK_DIR" ] && [ -d "$WORK_DIR" ] || WORK_DIR="/opt/echoip"
+/opt/echoip/echoip -r -s -p \
+ -l :$SERVICE_PORT \
+ -H X-Real-IP \
+ -H x-forwarded-for \
+ -t $WORK_DIR/html \
+ -a $WORK_DIR/geoip/GeoLite2-ASN.mmdb \
+ -c $WORK_DIR/geoip/GeoLite2-City.mmdb \
+ -f $WORK_DIR/geoip/GeoLite2-Country.mmdb
diff --git a/rootfs/usr/local/etc/docker/init.d/zz-echoip.sh b/rootfs/usr/local/etc/docker/init.d/zz-echoip.sh
index 2a79ae2..91765a0 100755
--- a/rootfs/usr/local/etc/docker/init.d/zz-echoip.sh
+++ b/rootfs/usr/local/etc/docker/init.d/zz-echoip.sh
@@ -201,15 +201,15 @@ __update_conf_files() {
[ -d "/data/echoip" ] && cp -Rf "/data/echoip/." "/opt/echoip/"
sed -i "s|REPLACE_HOST_NAME|$sysname|g" /opt/echoip/html/index.html
sed -i "s|REPLACE_MODIFIED|$(date +'%Y-%m-%d at %H:%M')|g" /opt/echoip/html/index.html
- if [ -n "$host_ip_4" ]; then
- sed -i "s|REPLACE_CURRENT_IP_4|$host_ip_4|g" /opt/echoip/html/index.html
- else
+ if [ -z "$host_ip_4" ]; then
sed -i '/REPLACE_CURRENT_IP_4/d' /opt/echoip/html/index.html
- fi
- if [ -n "$host_ip_6" ]; then
- sed -i "s|REPLACE_CURRENT_IP_6|$host_ip_6|g" /opt/echoip/html/index.html
else
+ sed -i "s|REPLACE_CURRENT_IP_4|$host_ip_4|g" /opt/echoip/html/index.html
+ fi
+ if [ -z "$host_ip_6" ]; then
sed -i '/REPLACE_CURRENT_IP_6/d' /opt/echoip/html/index.html
+ else
+ sed -i "s|REPLACE_CURRENT_IP_6|$host_ip_6|g" /opt/echoip/html/index.html
fi
return $exitCode
}