mirror of
https://github.com/mtan93/homeassistant-addons.git
synced 2026-03-08 05:21:51 +00:00
🚀 Angry-ip-scanner: Change tp ghcr (#118)
This commit is contained in:
6
angryipscanner/rootfs/etc/cont-init.d/nginx.sh
Normal file
6
angryipscanner/rootfs/etc/cont-init.d/nginx.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Configure NGINX for use with Angry IP Scanner
|
||||
# ==============================================================================
|
||||
ingress_entry=$(bashio::addon.ingress_entry)
|
||||
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" /etc/nginx/nginx.conf
|
||||
7
angryipscanner/rootfs/etc/cont-init.d/novnc.sh
Normal file
7
angryipscanner/rootfs/etc/cont-init.d/novnc.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Setup noVNC
|
||||
# ==============================================================================
|
||||
declare ingress_entry
|
||||
ingress_entry=$(bashio::addon.ingress_entry)
|
||||
sed -i "s#websockify#${ingress_entry#?}/novnc/websockify#g" /usr/share/novnc/vnc_lite.html
|
||||
96
angryipscanner/rootfs/etc/nginx/nginx.conf
Normal file
96
angryipscanner/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,96 @@
|
||||
worker_processes 1;
|
||||
pid /var/run/nginx.pid;
|
||||
error_log /dev/stdout info;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
proxy_read_timeout 1200;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# Ingress
|
||||
server {
|
||||
listen 8099 default_server;
|
||||
|
||||
allow 172.30.32.2;
|
||||
deny all;
|
||||
|
||||
server_name _;
|
||||
access_log /dev/stdout combined;
|
||||
|
||||
client_max_body_size 4G;
|
||||
keepalive_timeout 5;
|
||||
|
||||
root /dev/null;
|
||||
|
||||
location /websocket {
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location /novnc {
|
||||
proxy_pass http://127.0.0.1:5901/;
|
||||
proxy_redirect default;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
# location / {
|
||||
# proxy_pass http://127.0.0.1:40850;
|
||||
# proxy_redirect default;
|
||||
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# proxy_set_header Host $http_host;
|
||||
# proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
# sub_filter_once off;
|
||||
# sub_filter_types *;
|
||||
|
||||
# # Disable Discovery from Dresden
|
||||
# sub_filter 'phoscon.de/discover' 'phoscon.de/discover_disable';
|
||||
# sub_filter 'dresden-light.appspot.com/discover' 'dresden-light.appspot.com/discover_disable';
|
||||
# sub_filter 'queryDresdenDiscovery(url){' 'queryDresdenDiscovery(url){ return Promise.resolve([]);';
|
||||
|
||||
# # Do not probe our subnets from Ingress
|
||||
# sub_filter 'probeSubnet(ip) {' 'probeSubnet(ip) { throw new Error(\'avail\');';
|
||||
|
||||
# # Prevent unauthenticated requests to go to Home Assistant, triggering IP bans
|
||||
# sub_filter '/api/config?_=\' + Date.now()' '%%ingress_entry%%/api/config?_=\' + Date.now()';
|
||||
|
||||
# # Stop guessing URL's
|
||||
# sub_filter 'if (err === \'avail\')' 'if (err === \'avail\' && false)';
|
||||
|
||||
# # Correctly handle redirect to login
|
||||
# sub_filter 'window.location.href = \'/pwa/login.html\';' 'window.location.href = \'%%ingress_entry%%/pwa/login.html\';';
|
||||
|
||||
# # Patch Websocket support
|
||||
# sub_filter 'WebSocket(prot+host+":"+port)' 'WebSocket(prot+window.location.host+\'%%ingress_entry%%/websocket\')';
|
||||
|
||||
# # The Manifest is useless and causes unneeded failing requests @ the Home Assistant server
|
||||
# sub_filter '<link rel="manifest" href="/pwa/manifest.json">' '';
|
||||
# }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
51
angryipscanner/rootfs/etc/services.d/angryipscanner/run
Normal file
51
angryipscanner/rootfs/etc/services.d/angryipscanner/run
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start angryipscanner service
|
||||
# ==============================================================================
|
||||
TMP_FOLDER=$(mktemp -d)
|
||||
|
||||
# VNC is not enabled as a separate service, as it cannot handle multiple
|
||||
# session when running in the foreground.
|
||||
VNC_PORT="$(bashio::addon.port 5900)"
|
||||
ARCH="$(bashio::info.arch)"
|
||||
|
||||
# Fix tigervnc for 32 bits ARM
|
||||
if [[ "armhf armv7" = *"${ARCH}"* ]]; then
|
||||
export LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1
|
||||
fi
|
||||
|
||||
# Fix tigervnc for 64 bits ARM
|
||||
if [[ "aarch64" = "${ARCH}" ]]; then
|
||||
export LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1
|
||||
fi
|
||||
|
||||
# Run it only on localhost if not expose
|
||||
if bashio::var.has_value "${VNC_PORT}"; then
|
||||
bashio::log.warning "Your direct VNC access is not protected!"
|
||||
LOCAL_ONLY=no
|
||||
else
|
||||
LOCAL_ONLY=yes
|
||||
fi
|
||||
|
||||
export XDG_RUNTIME_DIR="${TMP_FOLDER}"
|
||||
export DISPLAY=":0"
|
||||
|
||||
bashio::log.info "Starting VNC server (local/${LOCAL_ONLY})..."
|
||||
tigervncserver \
|
||||
-name "Home Assistant - Angry IP Scanner" \
|
||||
-geometry 1920x1080 \
|
||||
-depth 16 \
|
||||
-localhost ${LOCAL_ONLY} \
|
||||
-SecurityTypes None \
|
||||
--I-KNOW-THIS-IS-INSECURE \
|
||||
"${DISPLAY}" \
|
||||
&> /dev/null
|
||||
|
||||
# Wait for VNC server to start before continuing
|
||||
bashio::log.info "Angry IP Scanner waiting for VNC to start"
|
||||
bashio::net.wait_for 5900
|
||||
|
||||
|
||||
# Start Angry IP Scanner
|
||||
bashio::log.info "Starting the Angry IP Scanner gateway..."
|
||||
exec ipscan
|
||||
8
angryipscanner/rootfs/etc/services.d/nginx/finish
Normal file
8
angryipscanner/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
7
angryipscanner/rootfs/etc/services.d/nginx/run
Normal file
7
angryipscanner/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start NGINX service
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info "Starting Nginx..."
|
||||
exec nginx
|
||||
11
angryipscanner/rootfs/etc/services.d/websockify/run
Normal file
11
angryipscanner/rootfs/etc/services.d/websockify/run
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start Websockify
|
||||
# ==============================================================================
|
||||
|
||||
# Wait until vnc is up and running
|
||||
bashio::log.info "Websockify waiting for VNC to start"
|
||||
bashio::net.wait_for 5900
|
||||
|
||||
bashio::log.info "Starting websockify..."
|
||||
exec websockify -v --web /usr/share/novnc/ 127.0.0.1:5901 127.0.0.1:5900
|
||||
Reference in New Issue
Block a user