Update to OctoPrint, 2022.11.01.

This commit is contained in:
Fredrik Baberg 2022-11-05 16:24:05 +01:00
parent 4f39bc500e
commit 870a831e2e
6 changed files with 35 additions and 10 deletions

View File

@ -1,3 +1,9 @@
- 2022.11.01
- Add reverse proxy config for camera with Ingress (untested).
- Only create OctoPrint user if missing.
- Update documentation.
- Mark mode optional.
- Update OctoPrint to 1.8.6 - Update OctoPrint to 1.8.6
- Update icon to coloured nozzle. - Update icon to coloured nozzle.
- Clean-up Caddy config. - Clean-up Caddy config.

View File

@ -1,3 +1,15 @@
# Dev # Addon configuration
> image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
## Camera URL
**Note: Currently not working.**
Through setting a camera URL you should be able to access the camera stream even when using Ingress.
## Mode
By specifying a different mode you can instead access recovery and reverse proy test page. Normally this should not be needed.
# Notes etc.
> image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}

View File

@ -1,5 +1,5 @@
# 3DPrinter-OctoPrint # 3DPrinter-OctoPrint
Provides OctoPrint as an addon to Home Assistant. **Note: Currently not in a ready-to-use state.**
**Note: Currently not in a ready-to-use state.** Provides OctoPrint as an addon to Home Assistant.

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint" name: "3DPrinter-OctoPrint"
version: "2022.11.0" version: "2022.11.01"
slug: "3dprinter-octoprint" slug: "3dprinter-octoprint"
description: "OctoPrint as an addon, no additional bells and whistles." description: "OctoPrint as an addon, no additional bells and whistles."
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint" url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
@ -28,5 +28,5 @@ options:
mode: normal mode: normal
schema: schema:
camera_url: "url?" camera_url: "url?"
mode: "list(normal|recovery|reverse_proxy_test)" mode: "list(normal|recovery|reverse_proxy_test)?"
tmpfs: true tmpfs: true

View File

@ -28,12 +28,13 @@ if [ ! -f /data/config/octoprint/config.yaml ]; then
fi fi
fi fi
# TODO: Check if user already exists before setting password.
{ # Make sure Ingress user for OctoPrint exists. { # Make sure Ingress user for OctoPrint exists.
bashio::log.notice "Ensure Ingress user (homeassistant) exist." bashio::log.notice "Ensure Ingress user (homeassistant) exist."
new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
new_password=homeassistant new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
octoprint --basedir /data/config/octoprint user add homeassistant --password "$new_password" --group users --group admins # 2> /dev/null new_password=homeassistant
octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
fi
} || { # catch } || { # catch
bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
} }

View File

@ -11,6 +11,12 @@
remote_ip 172.30.32.2 remote_ip 172.30.32.2
} }
uri strip_prefix {{ .ingress_entry }} uri strip_prefix {{ .ingress_entry }}
handle_path /camera/* {
reverse_proxy @ingress {{ .camera_host }} {
}
}
handle { handle {
{{ if eq .mode "recovery" }} {{ if eq .mode "recovery" }}
rewrite / /recovery rewrite / /recovery