From df688cbae2cdf248cdfc5b27827170de76d5eda7 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 23 May 2018 21:40:40 +0200 Subject: [PATCH] :ambulance: Fixes SSL support for OTA server --- sonweb/rootfs/etc/cont-init.d/12-patches.sh | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sonweb/rootfs/etc/cont-init.d/12-patches.sh b/sonweb/rootfs/etc/cont-init.d/12-patches.sh index cd476a5..f7df462 100644 --- a/sonweb/rootfs/etc/cont-init.d/12-patches.sh +++ b/sonweb/rootfs/etc/cont-init.d/12-patches.sh @@ -32,5 +32,26 @@ if [[ "$?" -ne 0 ]]; then hass.die 'Patching SonWEB SelfUpdate failed' fi - hass.log.debug 'Applied SonWEB SelfUpdate fix' + +patch -F2 -R --ignore-whitespace \ + /var/www/sonweb/pages/device_update.php << 'PATCH' +--- device_update.php 2018-05-23 21:31:36.000000000 +0200 ++++ device_update.php 2018-05-23 21:30:19.000000000 +0200 +@@ -5,7 +5,7 @@ + $subdir = str_replace( "\\", "/", $subdir ); + $subdir = $subdir == "/" ? "" : $subdir; + +- $otaServer = $_SERVER['REQUEST_SCHEME'] . "://".$localIP.":".$_SERVER[ "SERVER_PORT" ]._BASEURL_.""; ++ $otaServer = "http://".$localIP.":".$_SERVER[ "SERVER_PORT" ]._BASEURL_.""; + + if ( isset( $_POST[ 'minimal_firmware_path' ] ) && !empty( $_POST[ 'minimal_firmware_path' ] ) ) { + $ota_minimal_firmware_url = $otaServer."data/firmwares/sonoff-minimal.bin"; +PATCH + +# shellcheck disable=SC2181 +if [[ "$?" -ne 0 ]]; +then + hass.die 'Patching SonWEB OTA over HTTPS failed' +fi +hass.log.debug 'Applied SonWEB OTA over HTTPS fix'