diff --git a/3dprinter-octoprint/build.yaml b/3dprinter-octoprint/build.yaml index 28f6dc1..e2ceeb3 100644 --- a/3dprinter-octoprint/build.yaml +++ b/3dprinter-octoprint/build.yaml @@ -9,4 +9,4 @@ labels: org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant." org.opencontainers.image.source: "https://github.com/fredrikbaberg/3dprinter-addons" args: - OCTOPRINT_VERSION: "1.8.6" + OCTOPRINT_VERSION: "1.8.2" diff --git a/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh b/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh index cb1620e..3911823 100644 --- a/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh +++ b/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh @@ -28,12 +28,12 @@ if [ ! -f /data/config/octoprint/config.yaml ]; then fi fi -{ # Make sure Ingress user for OctoPrint exists. - bashio::log.notice "Ensure Ingress user (homeassistant) exist." - if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then - new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) - octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null - fi -} || { # catch - bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." -} +# { # Make sure Ingress user for OctoPrint exists. +# bashio::log.notice "Ensure Ingress user (homeassistant) exist." +# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then +# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) +# octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null +# fi +# } || { # catch +# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." +# } diff --git a/3dprinter-octoprint/rootfs/scripts/set_octoprint_config.sh b/3dprinter-octoprint/rootfs/scripts/set_octoprint_config.sh new file mode 100644 index 0000000..de539a2 --- /dev/null +++ b/3dprinter-octoprint/rootfs/scripts/set_octoprint_config.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash +# Set/update parts of OctoPrint config to work with addon. + +export OCTOPRINT_HOME=/data/config/octoprint + +# Access control +octoprint -b $OCTOPRINT_HOME config set --json accessControl ' +{ + "localNetworks": [ + "127.0.0.0/8", + "::1/128", + "172.30.32.2" + ] +} +' + +# API config +octoprint -b $OCTOPRINT_HOME config set --json api ' +{ + "allowCrossOrigin": true +} +' + +# Folder config +octoprint -b $OCTOPRINT_HOME config set --json folder ' +{ + "generated": "/tmp/octoprint/generated", + "timelapse_tmp": "/tmp/octoprint/timelapse/tmp" +} +' + +# Server config +octoprint -b $OCTOPRINT_HOME config set --json server ' +{ + "allowFraming": true, + "commands": { + "serverRestartCommand": "/scripts/octoprint_restart.sh", + "systemRestartCommand": "/scripts/system_restart.sh", + "systemShutdownCommand": "/scripts/system_shutdown.sh" + } +} +' +# Webcam config +octoprint -b $OCTOPRINT_HOME config set --json webcam ' +{ + "ffmpeg": "/usr/bin/ffmpeg" +} +' \ No newline at end of file