script: add more default trusted_clients to moonraker.conf template

the previous method of adding the host network range was too unreliable in some cases and didn't cover some popular usecases
This commit is contained in:
th33xitus
2021-07-11 19:13:37 +02:00
parent b44e855a98
commit 7984c28fe5
2 changed files with 13 additions and 3 deletions

View File

@@ -9,10 +9,14 @@ klippy_uds_address: %UDS%
[authorization]
trusted_clients:
127.0.0.1
%LAN%
::1/128
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
FE80::/10
::1/128
cors_domains:
*.lan
*.local

View File

@@ -277,7 +277,13 @@ create_moonraker_conf(){
sed -i "s|%LOG%|$LOG_PATH|" $MR_CONF
sed -i "s|%MR_DB%|$MR_DB|" $MR_CONF
sed -i "s|%UDS%|$KLIPPY_UDS|" $MR_CONF
sed -i "s|%LAN%|$LAN|" $MR_CONF
# if host ip is not in the default ip ranges, replace placeholder
# otherwise remove placeholder from config
if ! grep $LAN $MR_CONF; then
sed -i "s|%LAN%|$LAN|" $MR_CONF
else
sed -i "/%LAN%/d" $MR_CONF
fi
sed -i "s|%USER%|${USER}|g" $MR_CONF
ok_msg "moonraker.conf created!"
else