Merge pull request #20 from fredrikbaberg/dev_octoprint

Revert OctoPrint version; disable creation of Ingress user
This commit is contained in:
Fredrik Baberg 2022-12-19 14:16:46 +01:00 committed by GitHub
commit aa0d6496ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 10 deletions

36
.devcontainer.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "Example devcontainer for add-on repositories",
"image": "ghcr.io/home-assistant/devcontainer:addons",
"appPort": [
"7123:8123",
"7357:4357"
],
"postStartCommand": "sudo -E bash devcontainer_bootstrap",
"runArgs": [
"-e",
"GIT_EDITOR=code --wait",
"--privileged"
],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"extensions": [
"timonwong.shellcheck",
"esbenp.prettier-vscode"
],
"mounts": [
"type=volume,target=/var/lib/docker"
],
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}

19
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Home Assistant",
"type": "shell",
"command": "sudo chmod a+x /usr/bin/supervisor* && sudo -E supervisor_run",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}

View File

@ -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"

View File

@ -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."
# }

View File

@ -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"
}
'