diff --git a/Dockerfile b/Dockerfile index 2c045f7..29146c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,6 @@ RUN S6_VERSION="v3.2.1.0" && \ exit 1;; \ esac && \ curl -L -s -o /usr/local/bin/go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/${GO2RTC_VERSION}/go2rtc_linux_${GO2RTC_ARCH}" && \ - cp "/app/ring-mqtt/bin/go2rtc_linux_${GO2RTC_ARCH}" /usr/local/bin/go2rtc && \ chmod +x /usr/local/bin/go2rtc && \ rm -rf /app/ring-mqtt/bin && \ curl -J -L -o /tmp/bashio.tar.gz "https://github.com/hassio-addons/bashio/archive/${BASHIO_VERSION}.tar.gz" && \ diff --git a/bin/go2rtc_linux_amd64 b/bin/go2rtc_linux_amd64 deleted file mode 100644 index 610089f..0000000 Binary files a/bin/go2rtc_linux_amd64 and /dev/null differ diff --git a/bin/go2rtc_linux_arm b/bin/go2rtc_linux_arm deleted file mode 100644 index a1c3108..0000000 Binary files a/bin/go2rtc_linux_arm and /dev/null differ diff --git a/bin/go2rtc_linux_arm64 b/bin/go2rtc_linux_arm64 deleted file mode 100644 index d077bc2..0000000 Binary files a/bin/go2rtc_linux_arm64 and /dev/null differ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 080c9cc..db0dff2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,9 @@ +## v5.9.2 +This update attempts to workaround an issue causing MQTT automatic discovery to fail randomly in a small number of cases. As far as I can tell, this is an upstream issue as the API is reporting the MQTT service unavailable even though the Mosquitto addon is running and HA is connected. The new code simply checks that the MQTT service exist and uses the crednetials in any case, ignoring the reported service status. I have no idea if this will fix the reported issue as this code hasn't been touched in ages and I can't reproduce the issue, but I saw some other addons that made similar changes in recent months, so I thought it was worth a shot. + +**Dependency Updates** + - Go2RTC 1.9.12 (revert to upstream version as exec hang issues appear to be fixed now) + ## v5.9.1 **Bugs Fixed** Fix an issue introduced with new Express server that kept web authenticator UI from starting. diff --git a/init/s6/services.d/ring-mqtt/run b/init/s6/services.d/ring-mqtt/run index 977bf7f..7d1ba26 100644 --- a/init/s6/services.d/ring-mqtt/run +++ b/init/s6/services.d/ring-mqtt/run @@ -21,7 +21,7 @@ if [ -v HASSIO_TOKEN ]; then export DEBUG=$(bashio::config "debug") # Export MQTT service discovery data for use within NodeJS process - if bashio::services.available 'mqtt'; then + if bashio::var.has_value "$(bashio::services 'mqtt')"; then export HAMQTTHOST=$(bashio::services mqtt "host") export HAMQTTPORT=$(bashio::services mqtt "port") export HAMQTTUSER=$(bashio::services mqtt "username") diff --git a/lib/config.js b/lib/config.js index da81076..324431a 100644 --- a/lib/config.js +++ b/lib/config.js @@ -72,12 +72,12 @@ export default new class Config { mqttURL.hostname = process.env.HAMQTTHOST if (mqttURL.hostname === 'localhost' || mqttURL.hostname === '127.0.0.1') { debug(`Discovered invalid value for MQTT host: ${mqttURL.hostname}`) - debug('Overriding with default alias for Mosquitto MQTT addon') + debug('Overriding with default alias for the Mosquitto addon') mqttURL.hostname = 'core-mosquitto' } } else { - debug('No Home Assistant MQTT service found, using Home Assistant hostname as default') - mqttURL.hostname = process.env.HAHOSTNAME + debug('No Home Assistant MQTT service found, using the default alias for the Mosquitto addon') + mqttURL.hostname = 'core-mosquitto' } } else if (mqttURL.protocol === 'mqtts:') { mqttURL.hostname = process.env.HAHOSTNAME diff --git a/lib/web-service.js b/lib/web-service.js index bfd8aac..dcc1dd0 100644 --- a/lib/web-service.js +++ b/lib/web-service.js @@ -48,6 +48,10 @@ class WebService { if (generatedToken) { utils.event.emit('generated_token', generatedToken.refresh_token) res.json({ success: true }) + } else { + const errorMessage = 'Failed to generate authentication token, please verify the code and try again.' + debug(chalk.red(errorMessage)) + res.status(400).json({ error: errorMessage }) } } catch (error) { const errorMessage = error.message || 'The 2FA code was not accepted, please verify the code and try again.' diff --git a/package-lock.json b/package-lock.json index c6694b8..ae8a8a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ring-mqtt", - "version": "5.9.1", + "version": "5.9.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ring-mqtt", - "version": "5.9.1", + "version": "5.9.2", "license": "MIT", "dependencies": { "@homebridge/camera-utils": "^3.0.0", @@ -643,18 +643,18 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", - "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "version": "25.0.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.1.tgz", + "integrity": "sha512-czWPzKIAXucn9PtsttxmumiQ9N0ok9FrBwgRWrwmVLlp86BrMExzvXRLFYRJ+Ex3g6yqj+KuaxfX1JTgV2lpfg==", "license": "MIT", "dependencies": { "undici-types": "~7.16.0" } }, "node_modules/@types/readable-stream": { - "version": "4.0.22", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.22.tgz", - "integrity": "sha512-/FFhJpfCLAPwAcN3mFycNUa77ddnr8jTgF5VmSNetaemWB2cIlfCA9t0YTM3JAT0wOcv8D4tjPo7pkDhK3EJIg==", + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.23.tgz", + "integrity": "sha512-wwXrtQvbMHxCbBgjHaMGEmImFTQxxpfMOR/ZoQnXxB1woqkUbdLGFDgauo00Py9IudiaqSeiBiulSV9i6XIPig==", "license": "MIT", "dependencies": { "@types/node": "*" @@ -867,9 +867,9 @@ "license": "Python-2.0" }, "node_modules/asn1js": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.6.tgz", - "integrity": "sha512-UOCGPYbl0tv8+006qks/dTgV9ajs97X2p0FAbyS2iyCRrmLSRolDaHdp+v/CLgnzHc3fVB+CwYiUmei7ndFcgA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.7.tgz", + "integrity": "sha512-uLvq6KJu04qoQM6gvBfKFjlh6Gl0vOKQuR5cJMDHQkmwfMOQeN3F3SHCv9SNYSL+CRoHvOGFfllDlVz03GQjvQ==", "license": "BSD-3-Clause", "dependencies": { "pvtsutils": "^1.3.6", @@ -926,9 +926,9 @@ } }, "node_modules/bl": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/bl/-/bl-6.1.5.tgz", - "integrity": "sha512-XylDt2P3JBttAwLpORq/hOEX9eJzP0r6Voa46C/WVvad8D1J0jW5876txB8FnzKtbdnU6X4Y1vOEvC6PllJrDg==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/bl/-/bl-6.1.6.tgz", + "integrity": "sha512-jLsPgN/YSvPUg9UX0Kd73CXpm2Psg9FxMeCSXnk3WBO3CMT10JMwijubhGfHCnFu6TPn1ei3b975dxv7K2pWVg==", "license": "MIT", "dependencies": { "@types/readable-stream": "^4.0.0", @@ -2282,9 +2282,9 @@ } }, "node_modules/iconv-lite": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", - "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.1.tgz", + "integrity": "sha512-2Tth85cXwGFHfvRgZWszZSvdo+0Xsqmw8k8ZwxScfcBneNUraK+dxRxRm24nszx80Y0TVio8kKLt5sLE7ZCLlw==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -2609,12 +2609,12 @@ "license": "MIT" }, "node_modules/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", "license": "MIT", "dependencies": { - "jws": "^3.2.2", + "jws": "^4.0.1", "lodash.includes": "^4.3.0", "lodash.isboolean": "^3.0.3", "lodash.isinteger": "^4.0.4", @@ -2631,9 +2631,9 @@ } }, "node_modules/jwa": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", - "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", "license": "MIT", "dependencies": { "buffer-equal-constant-time": "^1.0.1", @@ -2642,12 +2642,12 @@ } }, "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", "license": "MIT", "dependencies": { - "jwa": "^1.4.1", + "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, @@ -3961,9 +3961,9 @@ } }, "node_modules/systeminformation": { - "version": "5.27.11", - "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.27.11.tgz", - "integrity": "sha512-K3Lto/2m3K2twmKHdgx5B+0in9qhXK4YnoT9rIlgwN/4v7OV5c8IjbeAUkuky/6VzCQC7iKCAqi8rZathCdjHg==", + "version": "5.27.13", + "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.27.13.tgz", + "integrity": "sha512-geeE/7eNDoOhdc9j+qCsLlwbcyh0HnqhOZzmfNK4WBioWGUZbhwYrg+YZsZ3UJh4tmybQsnDuqzr3UoumMifew==", "license": "MIT", "os": [ "darwin", diff --git a/package.json b/package.json index dbd05b6..8968f39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ring-mqtt", - "version": "5.9.1", + "version": "5.9.2", "type": "module", "description": "Ring Devices via MQTT", "main": "ring-mqtt.js", diff --git a/scripts/update2branch.sh b/scripts/update2branch.sh index 5b26a87..bb73746 100644 --- a/scripts/update2branch.sh +++ b/scripts/update2branch.sh @@ -22,7 +22,7 @@ else echo "The ring-mqtt-${BRANCH} branch has been updated." APK_ARCH="$(apk --print-arch)" - GO2RTC_VERSION="v1.9.4" + GO2RTC_VERSION="v1.9.12" case "${APK_ARCH}" in x86_64) GO2RTC_ARCH="amd64" @@ -39,23 +39,9 @@ else ;; esac rm -f /usr/local/bin/go2rtc -# curl -L -s -o /usr/local/bin/go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/${GO2RTC_VERSION}/go2rtc_linux_${GO2RTC_ARCH}" - cp "/app/ring-mqtt-${BRANCH}/bin/go2rtc_linux_${GO2RTC_ARCH}" /usr/local/bin/go2rtc + curl -L -s -o /usr/local/bin/go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/${GO2RTC_VERSION}/go2rtc_linux_${GO2RTC_ARCH}" chmod +x /usr/local/bin/go2rtc -# case "${APK_ARCH}" in -# x86_64) -# apk del npm nodejs -# apk add libstdc++ -# cd /opt -# wget https://unofficial-builds.nodejs.org/download/release/v22.11.0/node-v22.11.0-linux-x64-musl.tar.gz -# mkdir nodejs -# tar -zxvf *.tar.gz --directory /opt/nodejs --strip-components=1 -# ln -s /opt/nodejs/bin/node /usr/local/bin/node -# ln -s /opt/nodejs/bin/npm /usr/local/bin/npm -# ;; -# esac - cp -f "/app/ring-mqtt-${BRANCH}/init/s6/services.d/ring-mqtt/run" /etc/services.d/ring-mqtt/run chmod +x /etc/services.d/ring-mqtt/run fi \ No newline at end of file