initial refactor

This commit is contained in:
2025-06-07 16:33:55 -04:00
parent 5ac011f02b
commit b09446668d
249 changed files with 74 additions and 186 deletions

View File

@@ -0,0 +1,35 @@
apiVersion: v1
data:
natpmp.sh: |
#!/bin/sh
while true; do
date
natpmpc -a 1 0 udp 60 -g 10.2.0.1 && natpmpc -a 1 0 tcp 60 -g 10.2.0.1 > /tmp/natpmpc_output || {
echo -e "ERROR with natpmpc command \a"
break
}
port=$(grep 'TCP' /tmp/natpmpc_output | grep -o 'Mapped public port [0-9]*' | awk '{print $4}')
currentPort=$(curl -XGET 'http://127.0.0.1:8080/api/v2/app/preferences' | jq '.listen_port')
echo "Opened port: $port"
echo "Current port: $currentPort"
if [ "$currentPort" != "$port" ]; then
echo "Current port is different. Changing from $currentPort to $port"
code=$(curl --write-out '%{http_code}' --silent --output /dev/null -XPOST -d "json={\"listen_port\":$port}" "http://127.0.0.1:8080/api/v2/app/setPreferences")
if [ "$code" != "200" ]; then
echo "ERROR: port change failed with status code $code"
else
echo "Port changed to $port successfully"
fi
fi
sleep 45
done
kind: ConfigMap
metadata:
creationTimestamp: null
name: natpmp-script
namespace: media