From 2f89a270ebe5f2cbc6c79292e0869ace6052636d Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 11 Mar 2024 00:26:47 -0500 Subject: [PATCH 001/108] Update allskyWebsite.html: fix missing double quote in And put quotes around what looks like a link --- html/documentation/settings/allskyWebsite.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/documentation/settings/allskyWebsite.html b/html/documentation/settings/allskyWebsite.html index 8b2dff40f..fd9594ec4 100644 --- a/html/documentation/settings/allskyWebsite.html +++ b/html/documentation/settings/allskyWebsite.html @@ -34,7 +34,7 @@

Make sure you follow the -Allsky Website Installation Instructions +Allsky Website Installation Instructions exactly to install the Allsky Website on your Pi and/or a remote server.

@@ -846,7 +846,7 @@

homePage settings

  • prelink - Text before the link (e.g., "Click").
  • message - - What the link says (here to go to Google). + What the link says ("here to go to Google").
  • url - The location the user is taken to when clicking on the link ("https://google.com").
  • title - From 38ad06cca4d787bc0b623e8d5e4f53a6a6c7b96e Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:31:44 -0500 Subject: [PATCH 002/108] Update other.html: fix tips.html link --- html/documentation/troubleshooting/other.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/troubleshooting/other.html b/html/documentation/troubleshooting/other.html index d0e0f8c9e..faea514b7 100644 --- a/html/documentation/troubleshooting/other.html +++ b/html/documentation/troubleshooting/other.html @@ -80,7 +80,7 @@

    Can't save image because one is already being saved

    Or, make the allsky/tmp directory a memory-filesystem if not already done during installation. See the - Reducing wear on your SDcard + Reducing wear on your SDcard tip. From 71f4c1426447f0e25d7d126d021388f699d63eb4 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:32:34 -0500 Subject: [PATCH 003/108] Update allskyWebsite.html: 2 bugs: missing --- html/documentation/settings/allskyWebsite.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html/documentation/settings/allskyWebsite.html b/html/documentation/settings/allskyWebsite.html index fd9594ec4..22eb9606c 100644 --- a/html/documentation/settings/allskyWebsite.html +++ b/html/documentation/settings/allskyWebsite.html @@ -34,7 +34,7 @@

    Make sure you follow the -Allsky Website Installation Instructions +Allsky Website Installation Instructions exactly to install the Allsky Website on your Pi and/or a remote server.

    @@ -305,9 +305,9 @@

    Settings for various combinations

     PROTOCOL="local"
     IMAGE_DIR="${ALLSKY_WEBSITE}"
    -VIDEOS_DIR="${$MAGE_DIR}/videos"
    -KEOGRAM_DIR="${$MAGE_DIR}/keograms"
    -STARTRAILS_DIR="${$MAGE_DIR}/startrails"
    +VIDEOS_DIR="${IMAGE_DIR}/videos"
    +KEOGRAM_DIR="${IMAGE_DIR}/keograms"
    +STARTRAILS_DIR="${IMAGE_DIR}/startrails"
     
  • @@ -846,7 +846,7 @@

    homePage settings

  • prelink - Text before the link (e.g., "Click").
  • message - - What the link says ("here to go to Google"). + What the link says (here to go to Google).
  • url - The location the user is taken to when clicking on the link ("https://google.com").
  • title - From a74c5c38fbc155ab7ae77917233a3f5cb67f6c9b Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 29 Mar 2024 21:55:42 +0000 Subject: [PATCH 004/108] Updates to dark theme --- html/documentation/css/custom.css | 310 ++++++++++++++++++++++++++---- 1 file changed, 276 insertions(+), 34 deletions(-) diff --git a/html/documentation/css/custom.css b/html/documentation/css/custom.css index 22ffc6835..babd49f4e 100644 --- a/html/documentation/css/custom.css +++ b/html/documentation/css/custom.css @@ -5,6 +5,20 @@ --navbar-border-color-dark: #333333; --WebUI-setting-color: #00009b; --WebUI-setting-color-dark: #68a0ff; + --WebUI-value-color: #555; + --WebUI-value-background-color: #e4e4e4; + --WebUI-link-color: #4b4a4b; + --WebUI-link-background-color: #f8f8f8; + --WebUI-subSetting-color: black; + --WebUI-subSetting-background-color: #aac; + --WebUI-subSetting-background-color-dark: #339; + --dark-text: #aaaaaa; + --dark-text-reversed: #eeeeee; + --rowSeparator: 1px solid #d3d3d3; + --rowSeparator-dark: 1px solid #707070; + --btn-hover-color: black; + --btn-dark-color: #bfbfbf; + --panel-heading-color: #6b6b6b; } .page-header { @@ -15,6 +29,12 @@ margin-right: 5px; } +.center-text { + text-align: center; +} +.center-div { + margin: auto; +} .valign-center { display: flex; align-items: center; @@ -31,7 +51,7 @@ margin-right: 15px; } .version-title { - margin-left: 40px; + margin-left: 10px; display: inline-block; font-size: 80%; opacity: 0.7; @@ -39,13 +59,17 @@ .version-title-color { color: #777; } +.dark .version-title-color { + color: var(--dark-text); +} +.navbar-toggle { float: left; margin-left: 10px; } @media (max-width: 450px) {.version-title { font-size: 75%; }} @media (max-width: 400px) {.version-title { font-size: 65%; }} @media (min-width: 796px) { /* was 768px */ .sidebar { width: 210px; } .navbar-title { display: inline-block; } - #page-wrapper { margin-left: 210px; padding: 0 30px; } + #page-wrapper { margin-left: 210px; } .navbar-collapse { display: block; visibility: visible; } } @media (max-width: 795px) { @@ -60,26 +84,45 @@ } .right-panel .panel:first-of-type { - margin: 20px 0; + margin: 10px 0; } +hr.panel-primary { + border-top-width: 10px; +} .panel-primary { - border-color: #6b6b6b; + border-color: var(--panel-heading-color); } .panel-primary>.panel-heading { - border-color: #6b6b6b; - background-color: #6b6b6b; + border-color: var(--panel-heading-color); + background-color: var(--panel-heading-color); } .panel-footer { background-color: #f2f1f0; + margin-bottom: 1em; } .settingInput { /* Input field in Allsky Settings page */ width: 120px; } +.settingInputSelect { + padding: 0px 3px 0px 3px; + text-align: right; +} +.settingInputTextNumber { + padding: 0px 3px 0px 0px; + text-align: right; +} +.settingInputWidetext { + padding: 6px 5px; +} +.settingInputBoolean { + margin-bottom: -3px !important; + border-radius: 4px; +} .info-item { width: 140px; @@ -92,9 +135,11 @@ .switch-field { font-family: "Lucida Grande", Tahoma, Verdana, sans-serif; - margin: 3px 2px -15px 0; + /* old values: margin: 3px 2px -15px 0; */ + margin: 2px 0 -2px 0; display: inline-block; overflow: hidden; + border-radius: 4px; } .switch-field input { @@ -156,7 +201,7 @@ h2 { body.dark { background-color: #222222; - color: #888888; + color: var(--dark-text); } .dark #page-wrapper { @@ -169,13 +214,17 @@ body.dark { border: 1px solid var(--navbar-border-color-dark); } +.dark .navbar-brand { + color: var(--dark-text); +} + .dark .sidebar ul li { border-bottom: 1px solid #333333; } .dark .sidebar ul li a, .dark .sidebar ul li span { - color: #888888; + color: var(--dark-text); } .dark .sidebar ul li a.active { @@ -190,17 +239,31 @@ body.dark { background-color: #272727; } -.dark .panel-default { +.dark .panel-default, +.dark .panel-primary { border-color: #333333; } .dark .panel-heading, .dark .panel-footer { - color: #888888; + color: var(--dark-text); border-color: #333333; background-color: #171717; } +.highlightedBox { + border: 4px dashed red; + margin-top: 30px; + margin-bottom: 30px; + padding: 10px 5px 10px 5px; +} +.bullet { + font-weight: bold; + font-size: 125%; + display: inline; + vertical-align: top; +} + .alert { padding: 5px; margin-bottom: 3px; @@ -211,7 +274,14 @@ button.close { margin-top: -2px; } .alert td { - padding: 0 10px 0 3px; + padding: 5px 10px 5px 5px; +} +.alert td .important { + font-weight: bold; + font-size: 150%; + padding-top: 1em; + padding-bottom: 1em; + padding-left: 1em; } table .alert-dismissable button { font-size: 175%; @@ -232,27 +302,35 @@ table .alert-dismissable { } .dark .alert-message, .dark .alert-info { color: #23485a; - border-color: #99ccdd; - background-color: #8b989f; } .dark .alert-success { color: #95bb85; border-color: #8f9d84; background-color: #044a05; } -.dark .alert-warning { +.dark .alert-warning, .dark .alert-warning a { color: #c0bba0; border-color: #c0bba0; background-color: #8a6b3b; } -.dark .alert-danger { +.dark .alert-danger, .dark .alert-danger a { color: #f1b1b1; border-color: #f1b1b1; background-color: #a94442; } -.alert-danger { - border-top-width: 10px; - border-bottom-width: 10px; +.alert-danger, .alert-warning { + border-top-width: 3px; + border-bottom-width: 3px; +} +.dark .alert-info { + color: #888888 !important; + background-color: #111111 !important; + border: 1px solid green !important; +} +.dark .alert-warning { + color: #888888 !important; + background-color: #111111 !important; + border: 1px solid green !important; } .dark .form-control, @@ -260,10 +338,18 @@ table .alert-dismissable { .dark input[type="number"], .dark select { background-color: #171717; - color: #888888; + color: var(--dark-text); border-color: #555555; } +input[type="text"].has-error { + border-color: #d41c0f !important; +} + +.text-danger { + color: #d41c0f !important; +} + .dark .progress { background-color: #171717; } @@ -299,7 +385,7 @@ table .alert-dismissable { .dark .switch-field label { background-color: #171717; - color: #888888; + color: var(--dark-text); } .dark .switch-field input:checked + label { @@ -363,6 +449,45 @@ table .alert-dismissable { border-color: #ad5451; } +.btn-delete { + color: white; + border: 1px solid #d42f3a; + background-color: #d9534f; +} +.btn-delete:hover { + color: black; + background-color: #f96f6f; +} +.dark .btn-delete { + color: black; +} + +.btn.focus.navbar-btn, +.btn:focus.navbar-btn, +.btn:hover.navbar-btn +{ + color: var(--dark-text); + border: 1px solid var(--dark-text); +} +.dark .btn.focus.navbar-btn, +.dark .btn:focus.navbar-btn, +.dark .btn:hover.navbar-btn, +.dark .help-block +{ + color: var(--dark-text-reversed); +} +.advanced, .btn-advanced { /* "advanced" options are highlighted in same color as button */ + background-color: #fffcc0; +} +.dark .advanced, .dark .btn-advanced { + color: #bfbfbf; + border-color: #bdb173; + background-color: #837a2f; +} +.advanced-nocolor { + background-color: inherit; +} + .dark .btn-primary:hover, .dark .btn-success:hover, .dark .btn-warning:hover, @@ -401,12 +526,62 @@ table .alert-dismissable { background-color: #aaa; text-align: center; font-weight: bold; - font-size: 1.25em; - padding: 3px 0 3px 0; + padding: 1px 3px 1px 3px; } .dark .settingsHeader { background-color: #555; } +table.settingsHeader { + font-size: 1.25em; + padding: 3px 3px 3px 3px; +} +.subSettingsHeader { + color: var(--WebUI-subSetting-color); + background-color: var(--WebUI-subSetting-background-color); + text-align: center; + font-weight: bold; + padding: 1px 3px 1px 3px; +} +div.subSettingsHeader { + font-size: 1.05em; + margin: 0 3em 0 3em; + padding: 3px 0px; +} +.dark .subSettingsHeader { + margin: 0 3em 0 0em; +} +.dark .subSettingsHeader { + background-color: #111111; + color: green; + margin-top: 10px; +} +.headingRow { + font-size: 110%; + border-top: 10px solid transparent; + border-bottom: 5px solid transparent; +} +.headingRowPadding { + border-top: 3px solid transparent; + border-bottom: 3px solid transparent; +} +.columnHeader { + background-color: #aac; + text-align: center; + font-weight: bold; + font-size: 1.05em; + padding: 0; +} +.dark .columnHeader { + background-color: #339 +} + +.headingToggle { + cursor: pointer; + padding-left: 0.5em; +} +.headingTitle { + width: 100%; +} .boxShadow { -webkit-box-shadow: 2px 3px rgb(0,0,0,15%); @@ -415,10 +590,10 @@ table .alert-dismissable { /* separate table rows */ .rowSeparator { - border-bottom: 1px solid #d3d3d3; + border-bottom: 1px solid var(--rowSeparator); } .dark .rowSeparator { - border-bottom: 1px solid #707070; + border-bottom-color: var(--rowSeparator-dark); } /* used in system.php */ .progress-bar { @@ -467,13 +642,16 @@ select { .dark .btn-white { border-color: #ffffff; } .btn-black { background-color: #333333; border-color: #777777; color: white; } -.btn-black:hover { background-color: #888888; border-color: #000000; color: white; } +.btn-black:hover { background-color: var(--dark-text); border-color: #000000; color: white; } .dark .btn-black { border-color: #ffffff; } /* Error messages */ .errorMsg, .errorMsgBig { color: red; } .errorMsgBig { font-size: 200%; } -.errorMsgBox { border: 2px solid red; padding-left: 5px; } +.errorMsgBox { + padding-left: 5px; + padding-right: 5px +} .EXPIRED { color: red; font-weight: bold; } .systemPageAdditionsLineType { @@ -520,22 +698,28 @@ select { .nowrap { white-space: nowrap; } +.WebUILink { /* link on the WebUI to one of its pages */ + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 0 .2em; + color: var(--WebUI-link-color); + background-color: var(--WebUI-link-background-color); + border-bottom: 1px solid #e7e7e7; +} .WebUISetting { /* Matches what's in the WebUI */ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; color: var(--WebUI-setting-color); font-weight: bold; } .dark .WebUISetting { - color: var(--WebUI-setting-color-dark); + color: #5cb85c; } .WebUIValue { padding: 0 3px 0 3px; font-size: 14px; - font-family: "Helvetica Neue", Helvetica, Arial; font-family: inherit; - color: #555; + color: var(--WebUI-value-color); + background-color: var(--WebUI-value-background-color); border: 1px solid #ccc; - background-color: #e4e4e4; border-radius: 4px; } @@ -560,7 +744,9 @@ select { } .live_container { background-color: black; - margin-bottom: 15px; +} +.current { + width: 100%; } div.sticky { @@ -573,8 +759,8 @@ div.sticky { border: 2px solid var(--WebUI-setting-color); } .dark div.sticky { - background-color: var(--navbar-background-color-dark); - border-color: var(--WebUI-setting-color-dark); + background-color: #111111; + border: 1px solid green; } #backToTopBtn { display: none; /* Hidden by default */ @@ -595,3 +781,59 @@ div.sticky { #backToTopBtn:hover { background-color: #888; /* Add a lighter-grey background on hover */ } + + +.middleVerticalAlign { + vertical-align: middle; +} +.centerImg { + display: block; + margin-left: auto; + margin-right: auto; +} + +.externalSmall { /* the icon indicated a new web page */ + font-size: 90%; +} + +.removeMessage { + color: red; + font-weight: bold; + font-size: 150%; + margin-top: 10px; + margin-bottom: 10px; +} +.dark .removeMessage { + color: white; +} + +/* Classes specific to WebUI pages */ +.editorForm { + display: inline-block; + width: auto; + margin-right: 15px; + margin-bottom: 5px; +} +.editorSaveChanges { + margin-bottom: 5px; +} +.editorBottomSection { + margin-top: 15px; +} +.functionsListFileType { + float: left; + width: 100%; + margin-bottom: 2px; +} +.functionsListTypeImg { + margin-left: 10px; + max-width: 50%; + max-height:100px; +} +.imagesSortOrder { + font-size: 60%; + +.as-nav-toggle { + float: left !important; + margin-left: 5px; +} From 161b9ac9fff48e8f72f7b90c8a458243d33b26df Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Mon, 13 May 2024 02:44:54 +0100 Subject: [PATCH 005/108] #3611 Remove photutils as a requirement --- config_repo/requirements-32.txt | 1 - config_repo/requirements-64.txt | 1 - config_repo/requirements-bookworm-32.txt | 1 - config_repo/requirements-bookworm-64.txt | 1 - config_repo/requirements-buster.txt | 1 - config_repo/requirements.txt | 1 - 6 files changed, 6 deletions(-) diff --git a/config_repo/requirements-32.txt b/config_repo/requirements-32.txt index d8caf04fc..9d5aa1c0f 100644 --- a/config_repo/requirements-32.txt +++ b/config_repo/requirements-32.txt @@ -7,7 +7,6 @@ astral pytz scipy<=1.8.1 paho-mqtt -photutils astropy suncalc Adafruit-Blinka diff --git a/config_repo/requirements-64.txt b/config_repo/requirements-64.txt index 685b872f3..e1caaa47f 100644 --- a/config_repo/requirements-64.txt +++ b/config_repo/requirements-64.txt @@ -7,7 +7,6 @@ astral pytz scipy paho-mqtt -photutils astropy suncalc Adafruit-Blinka diff --git a/config_repo/requirements-bookworm-32.txt b/config_repo/requirements-bookworm-32.txt index b011884a3..af76210a0 100644 --- a/config_repo/requirements-bookworm-32.txt +++ b/config_repo/requirements-bookworm-32.txt @@ -7,7 +7,6 @@ astral pytz scipy<=1.11.3 paho-mqtt -photutils astropy suncalc Adafruit-Blinka diff --git a/config_repo/requirements-bookworm-64.txt b/config_repo/requirements-bookworm-64.txt index 685b872f3..e1caaa47f 100644 --- a/config_repo/requirements-bookworm-64.txt +++ b/config_repo/requirements-bookworm-64.txt @@ -7,7 +7,6 @@ astral pytz scipy paho-mqtt -photutils astropy suncalc Adafruit-Blinka diff --git a/config_repo/requirements-buster.txt b/config_repo/requirements-buster.txt index f3cb3b294..c079217a3 100644 --- a/config_repo/requirements-buster.txt +++ b/config_repo/requirements-buster.txt @@ -7,7 +7,6 @@ astral pytz scipy<=1.8.1 paho-mqtt -photutils astropy==4.3.1 suncalc Adafruit-Blinka diff --git a/config_repo/requirements.txt b/config_repo/requirements.txt index d8caf04fc..9d5aa1c0f 100644 --- a/config_repo/requirements.txt +++ b/config_repo/requirements.txt @@ -7,7 +7,6 @@ astral pytz scipy<=1.8.1 paho-mqtt -photutils astropy suncalc Adafruit-Blinka From 1dee82a1e8dc30da01a4f1dcc0caf386e3765544 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 24 Jun 2024 17:15:16 +0100 Subject: [PATCH 006/108] #3697 Fix for bit depth when loading images in flows --- scripts/modules/allsky_loadimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modules/allsky_loadimage.py b/scripts/modules/allsky_loadimage.py index f0f60c282..9a3ec7dce 100644 --- a/scripts/modules/allsky_loadimage.py +++ b/scripts/modules/allsky_loadimage.py @@ -26,7 +26,7 @@ def loadimage(params, event): result = "Image {0} Loaded".format(s.CURRENTIMAGEPATH) try: - s.image = cv2.imread(s.CURRENTIMAGEPATH) + s.image = cv2.imread(s.CURRENTIMAGEPATH, cv2.IMREAD_UNCHANGED) if s.image is None: result = s.ABORT except Exception as e: From 0a9c6fe9d9b96c235883f3409dda5d50436971ff Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Jun 2024 23:47:33 +0100 Subject: [PATCH 007/108] #3707 Fix for Astropy on Buster --- install.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install.sh b/install.sh index bc23885b6..7b270721e 100755 --- a/install.sh +++ b/install.sh @@ -2334,6 +2334,14 @@ install_overlay() fi fi + # Astropy is no longer supported on Buster due to its dependencies requiring later versions of Python + # This *hack* will force the require version of astropy onto Buster + if [[ ${PI_OS} == "buster" ]]; then + display_msg --log warning "Forcing build of Astropy on ${PI_OS}." + pip3 install setuptools setuptools_scm wheel cython==0.29.22 jinja2==2.10.3 numpy markupsafe==2.0.1 extension-helpers + pip3 install --no-build-isolation astropy==4.3.1 + fi + local TMP="${ALLSKY_INSTALLATION_LOGS}/${NAME}" display_msg --log progress "Installing ${NAME}${M}:" local COUNT=0 From b1f890abb08e9eb57d0c7a33be5008edf218c528 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 30 Jun 2024 22:28:17 +0100 Subject: [PATCH 008/108] #3714 Revert image change --- scripts/modules/allsky_loadimage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modules/allsky_loadimage.py b/scripts/modules/allsky_loadimage.py index 9a3ec7dce..f0f60c282 100644 --- a/scripts/modules/allsky_loadimage.py +++ b/scripts/modules/allsky_loadimage.py @@ -26,7 +26,7 @@ def loadimage(params, event): result = "Image {0} Loaded".format(s.CURRENTIMAGEPATH) try: - s.image = cv2.imread(s.CURRENTIMAGEPATH, cv2.IMREAD_UNCHANGED) + s.image = cv2.imread(s.CURRENTIMAGEPATH) if s.image is None: result = s.ABORT except Exception as e: From 6d2e38bf49eaa754c26ed067665633b58e7e2548 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 13 Aug 2024 20:05:34 +0100 Subject: [PATCH 009/108] #3778 Hotfix for clear sky module and mqtt --- scripts/modules/allsky_clearsky.py | 128 ++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 38 deletions(-) diff --git a/scripts/modules/allsky_clearsky.py b/scripts/modules/allsky_clearsky.py index 3fed9840e..af1ec485e 100755 --- a/scripts/modules/allsky_clearsky.py +++ b/scripts/modules/allsky_clearsky.py @@ -24,12 +24,12 @@ "name": "Clear Sky Alarm", "description": "Clear Sky Alarm", "module": "allsky_clearsky", - "version": "v1.0.0", + "version": "v1.0.1", "events": [ "day", "night" ], - "experimental": "true", + "experimental": "true", "arguments":{ "detectionThreshold": 0.55, "distanceThreshold": 20, @@ -41,8 +41,10 @@ "roi": "", "roifallback": 5, "mqttenable": "False", + "mqttusesecure": "true", "mqttbroker": "", "mqttport": 1883, + "mqttloopdelay": "5", "mqttusername": "", "mqttpassword": "", "mqtttopic": "SKYSTATE", @@ -55,8 +57,8 @@ "help": "The area of the image to check for clear skies. Format is x1,y1,x2,y2", "type": { "fieldtype": "roi" - } - }, + } + }, "roifallback" : { "required": "true", "description": "Fallback %", @@ -99,7 +101,7 @@ "min": 0, "max": 100, "step": 1 - } + } }, "template1" : { "required": "true", @@ -110,16 +112,16 @@ "min": 0, "max": 100, "step": 1 - } - }, + } + }, "mask" : { "required": "false", "description": "Mask Path", "help": "The name of the image mask. THis mask is applied when counting stars bit not visible in the final image", "type": { "fieldtype": "image" - } - }, + } + }, "annotate" : { "required": "false", "description": "Annotate Stars", @@ -127,7 +129,7 @@ "tab": "Debug", "type": { "fieldtype": "checkbox" - } + } }, "debug" : { "required": "false", @@ -136,14 +138,14 @@ "tab": "Debug", "type": { "fieldtype": "checkbox" - } + } }, "debugimage" : { "required": "false", "description": "Debug Image", "help": "Image to use for debugging. DO NOT set this unless you know what you are doing", - "tab": "Debug" - }, + "tab": "Debug" + }, "mqttenable" : { "required": "false", "description": "Enable MQTT", @@ -151,13 +153,21 @@ "tab": "MQTT", "type": { "fieldtype": "checkbox" - } - }, + } + }, + "mqttusesecure": { + "required": "false", + "description": "Use Secure Connection", + "tab": "MQTT", + "type": { + "fieldtype": "checkbox" + } + }, "mqttbroker" : { "required": "false", "description": "MQTT Broker address", "help": "MQTT Broker address", - "tab": "MQTT" + "tab": "MQTT" }, "mqttport" : { "required": "false", @@ -169,32 +179,50 @@ "min": 1, "max": 65536, "step": 1 - } + } }, + "mqttloopdelay": { + "required": "false", + "description": "Loop Delay(s)", + "help": "The loop delay, only increase this if you experience issues with messages missing in the broker", + "tab": "MQTT", + "type": { + "fieldtype": "spinner", + "min": 0.5, + "max": 10, + "step": 0.5 + } + }, "mqttusername" : { "required": "false", "description": "MQTT Username", "help": "MQTT Username", - "tab": "MQTT" - }, + "tab": "MQTT" + }, "mqttpassword" : { "required": "false", "description": "MQTT Pasword", "help": "MQTT Password", - "tab": "MQTT" + "tab": "MQTT" }, "mqtttopic" : { "required": "false", "description": "MQTT Topic", "help": "MQTT Topic the sky state is published to", - "tab": "MQTT" - } + "tab": "MQTT" + } }, - "enabled": "false" + "enabled": "false" } +def MQTTonConnect(client, userdata, flags, rc, properties=None): + s.log(4, f"INFO: MQTT - CONNACK received with code {rc}.") + +def MQTTonPublish(client, userdata, mid, properties=None): + s.log(4, f"INFO: MQTT - Message published {mid}.") + def onPublish(client, userdata, mid, properties=None): - s.log(4,"INFO: Sky state published to MQTT Broker mid {0}".format(mid)) + s.log(4,"INFO: Sky state published to MQTT Broker mid {0}".format(mid)) def clearsky(params, event): #ONLY AT NIGHT ! @@ -211,11 +239,13 @@ def clearsky(params, event): fallback = s.int(params["roifallback"]) mqttenable = params["mqttenable"] + mqttusesecure = params["mqttusesecure"] mqttbroker = params["mqttbroker"] mqttport = s.int(params["mqttport"]) mqttusername = params["mqttusername"] - mqttpassword = params["mqttpassword"] + mqttpassword = params["mqttpassword"] mqtttopic = params["mqtttopic"] + mqttloopdelay = params["mqttloopdelay"] starCount = "" @@ -235,10 +265,10 @@ def clearsky(params, event): image = s.image if mask != "": - maskPath = os.path.join(s.getEnvironmentVariable("ALLSKY_OVERLAY"),"images",mask) + maskPath = os.path.join(s.getEnvironmentVariable("ALLSKY_OVERLAY", fatal=True),"images",mask) imageMask = cv2.imread(maskPath,cv2.IMREAD_GRAYSCALE) if debug: - s.writeDebugImage(metaData["module"], "image-mask.png", imageMask) + s.writeDebugImage(metaData["module"], "image-mask.png", imageMask) if len(image.shape) == 2: grayImage = image @@ -266,10 +296,10 @@ def clearsky(params, event): x2 = s.int((imageWidth / 2) + (imageWidth / fallbackAdj)) y2 = s.int((imageHeight / 2) + (imageHeight / fallbackAdj)) - croppedImage = grayImage[y1:y2, x1:x2] + croppedImage = grayImage[y1:y2, x1:x2] if debug: - s.writeDebugImage(metaData["module"], "cropped.png", croppedImage) + s.writeDebugImage(metaData["module"], "cropped.png", croppedImage) starTemplateSize = starTemplate1Size * 4 if (starTemplateSize % 2) != 0: @@ -322,30 +352,52 @@ def clearsky(params, event): cv2.circle(croppedImage, (star[0] + wOffset, star[1] + hOffset), 10, (255, 255, 255), 1) if debug: - s.writeDebugImage(metaData["module"], "result.png", croppedImage) - + s.writeDebugImage(metaData["module"], "result.png", croppedImage) + starCount = len(starList) if starCount >= clearvalue: - s.log(4,"INFO: Sky is clear. {0} Stars found, clear limit is {1}".format(starCount, clearvalue)) + s.log(4,"INFO: Sky is clear. {0} stars found, clear limit is {1}".format(starCount, clearvalue)) skyState = "Clear" else: - s.log(4,"INFO: Sky is NOT clear. {0} Stars found, clear limit is {1}".format(starCount, clearvalue)) + s.log(4,"INFO: Sky is NOT clear. {0} stars found, clear limit is {1}".format(starCount, clearvalue)) skyState = "NOT Clear" if mqttenable: s.log(4,"INFO: Sending sky state {0} to MQTT Broker {1} using topic {2}".format(skyState, mqttbroker, mqtttopic)) + + channel_topic = mqtttopic + if channel_topic == "": + s.log(0, "ERROR:MQTT - Please specify a topic to publish") + return + client = paho.Client(client_id="", userdata=None, protocol=paho.MQTTv5) - client.on_publish = onPublish - client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS) - client.username_pw_set(mqttusername, mqttpassword) + client.on_connect = MQTTonConnect + client.on_publish = MQTTonPublish + if mqttusername != "" and mqttpassword!= "": + client.username_pw_set(mqttusername, mqttpassword) + + if mqttbroker== "": + s.log(0, "ERROR: MQTT - Please specify a MQTT host to publish to") + return + + if mqttusesecure: + client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS) + client.connect(mqttbroker, mqttport) - result = client.publish(mqtttopic, skyState) + + client.publish(mqtttopic, skyState ,qos=1) + s.log(1, f"INFO: MQTT - Published to MQTT on channel: {channel_topic}") + delay = int(mqttloopdelay) + client.loop(delay) + client.disconnect() + else: s.log(4,"INFO: MQTT disabled") + s.setEnvironmentVariable("AS_SKYSTATE", skyState) os.environ["AS_SKYSTATE"] = skyState - os.environ["AS_SKYSTATESTARS"] = str(starCount) + s.setEnvironmentVariable("AS_SKYSTATESTARS", str(starCount)) return "Sky is {0}".format(skyState) def clearsky_cleanup(): From 7196dbd158fb447a8b29dc1fc56c18677fd1adef Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Sep 2024 01:51:51 -0600 Subject: [PATCH 010/108] Update and rename bug_report.md to 2-bug_report.yml --- .github/ISSUE_TEMPLATE/2-bug_report.yml | 72 +++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 70 ------------------------ 2 files changed, 72 insertions(+), 70 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/2-bug_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/2-bug_report.yml b/.github/ISSUE_TEMPLATE/2-bug_report.yml new file mode 100644 index 000000000..d639ea2d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-bug_report.yml @@ -0,0 +1,72 @@ +name: Bug Report +description: Let us know of an Allsky problem. +title: "[BUG] " +body: + - type: markdown + attributes: + value: | + > [!IMPORTANT] + > If you have a QUESTION, enter a GitHub [Discussion](https://github.com/AllskyTeam/allsky/discussions). Do NOT create an Issue. + > If this is a FEATURE REQUEST, go back a page and select the `Feature Request` template. + - type: markdown + attributes: + value: | + > [!IMPORTANT] + > First look in the GitHub [Issues](https://github.com/AllskyTeam/allsky/issues) and [Discussions](https://github.com/AllskyTeam/allsky/discussions) pages. + > Most problems have already been reported by other people, so add to their Issue instead of creating a new one. + - type: input + id: camera + attributes: + label: Camera model + placeholder: "[enter brand and model]" + validations: + required: true + - type: dropdown + id: OS + attributes: + label: Operating System + options: + - Buster + - Bullseye + - Bookworm + - Not a Pi + validations: + required: true + - type: input + id: allsky_version + attributes: + label: Allsky version + placeholder: "[see: ~/allsky/version]" + validations: + required: true + - type: input + id: pi + attributes: + label: "Pi and amount of memory (512 MB, 1, 2, 4, or 8 GB)" + validations: + required: true + - type: textarea + id: bug_description + attributes: + label: Bug Description + description: | + \* Include a clear and concise description of what the problem is. + \* Include a screenshot of any error message(s). + \* Can you reproduce it? If so, how? + \* Did any settings or anything else change? + validations: + required: true + - type: textarea + id: logs + attributes: + label: Log / configuration files + description: | + ATTACH files, do NOT copy/paste them: +   + Follow the instructions for "Reporting Issues" in the Wiki, then attach `/var/log/allsky.log`. +   + Attach `~/allsky/config/settings.json`, appending `.txt` to its name first. +   + If your problem is with an **Allsky Website**, also attach: + \* `~/allsky/html/allsky/configuration.json` (local Website) + \* `~/allsky/config/remote_configuration.json` (remote Website) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 3b8a564b7..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -name: Bug report -about: If you have a QUESTION enter a Discussion item using the link above. Do NOT enter an Issue. -title: "[BUG]" ---- - - - - -# Is this a QUESTION or FEATURE REQUEST? - -If so, please add a Discussion item by clicking on the Discussions link above; do NOT create an Issue. - - - - -  -## Look in the Wiki before submitting this Issue -The Wiki has lots of information including troubleshooting tips for the vast majority of known issues. - - -   - - - - - -### Environment - -* Camera: ZWO or RPi - include the model -* OS: Buster or Bullseye -* Allsky version: - * The newest software includes a file called ~/allsky/version - * If it does not exist, run: grep Software /var/log/allsky.log -* Pi model and amount of memory (512 MB, 1, 2, 4, or 8 GB) - - - - -### Bug Description - -* Include a clear and concise description of what the bug is. -* Can it be reproduced? If so, how? -* Did anything change? Any settings? Most issues occur after a change was made. -* Please include the exact messages or a screenshot. -* If this is a configuration-related issue (or you are not sure), attach these files, appending ".txt" to their names first: - * Allsky problems: - * ~/allsky/config/config.sh - * ~/allsky/config/settings.json - * ~/allsky/config/ftp-settings.sh (only for upload-related problems) - * Allsky Website problems: - * ~/allsky/html/allsky/configuration.json (local Website) - * ~/allsky/config/remote_configuration.json (remote Website) - - -If you have program output or multi-line messages to include, -add it like this so it formats correctly (note the lines with tildas): - -~~~ -output/message line 1 -output/message line 2 -~~~ - - - - -### Log / configuration files - -Follow the instructions for Reporting Issues in the Wiki, then ATTACH a copy of the file(s) above. -Do NOT copy/paste them into this Issue. From 543533cc4b5936dc50e1920fa0500a4f78de4bb2 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Sep 2024 01:52:22 -0600 Subject: [PATCH 011/108] Add files via upload --- .github/1-feature_request.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/1-feature_request.yml diff --git a/.github/1-feature_request.yml b/.github/1-feature_request.yml new file mode 100644 index 000000000..fc77bc74e --- /dev/null +++ b/.github/1-feature_request.yml @@ -0,0 +1,20 @@ +name: Feature Request +description: Suggest an idea for Allsky +title: "[FEATURE REQUEST]" +labels: "enhancement" +body: + - type: markdown + attributes: + value: | + > [!IMPORTANT] + > If you have a QUESTION, enter a GitHub [Discussion](https://github.com/AllskyTeam/allsky/discussions). Do NOT create an Issue. + + > First look in the GitHub [Issues](https://github.com/AllskyTeam/allsky/issues) and [Discussions](https://github.com/AllskyTeam/allsky/discussions) pages. + > Make sure no one else has already requested this feature. If someone has and you have additional information, add it to the existing request. + - type: textarea + id: request + attributes: + label: If this is a new feature, describe what you would like. + description: Screenshots of examples are helpful. + validations: + required: true From 83c5da021692d97f1e680bb7a9362855312af23d Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Sep 2024 01:55:09 -0600 Subject: [PATCH 012/108] Rename .github/1-feature_request.yml to .github/ISSUE_TEMPLATE/1-feature_request.yml --- .github/{ => ISSUE_TEMPLATE}/1-feature_request.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => ISSUE_TEMPLATE}/1-feature_request.yml (100%) diff --git a/.github/1-feature_request.yml b/.github/ISSUE_TEMPLATE/1-feature_request.yml similarity index 100% rename from .github/1-feature_request.yml rename to .github/ISSUE_TEMPLATE/1-feature_request.yml From 55f1429c51d308a013a48530f0dd72c9d1f267fd Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Sep 2024 01:57:03 -0600 Subject: [PATCH 013/108] Update 1-feature_request.yml: add space --- .github/ISSUE_TEMPLATE/1-feature_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1-feature_request.yml b/.github/ISSUE_TEMPLATE/1-feature_request.yml index fc77bc74e..2b260a46f 100644 --- a/.github/ISSUE_TEMPLATE/1-feature_request.yml +++ b/.github/ISSUE_TEMPLATE/1-feature_request.yml @@ -1,6 +1,6 @@ name: Feature Request description: Suggest an idea for Allsky -title: "[FEATURE REQUEST]" +title: "[FEATURE REQUEST] " labels: "enhancement" body: - type: markdown @@ -8,7 +8,7 @@ body: value: | > [!IMPORTANT] > If you have a QUESTION, enter a GitHub [Discussion](https://github.com/AllskyTeam/allsky/discussions). Do NOT create an Issue. - + >   > First look in the GitHub [Issues](https://github.com/AllskyTeam/allsky/issues) and [Discussions](https://github.com/AllskyTeam/allsky/discussions) pages. > Make sure no one else has already requested this feature. If someone has and you have additional information, add it to the existing request. - type: textarea From 0687909fc682b8d9d6dc6627480f09072df25a75 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 13 Sep 2024 21:50:51 +0100 Subject: [PATCH 014/108] #advisory-fix-1 Fix for no authentication check when saving config files --- html/includes/save_file.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/html/includes/save_file.php b/html/includes/save_file.php index 953edd8e5..5c1d2908b 100644 --- a/html/includes/save_file.php +++ b/html/includes/save_file.php @@ -1,6 +1,10 @@ Date: Fri, 13 Sep 2024 22:09:54 +0100 Subject: [PATCH 015/108] #advisory-fix-1 Bump version --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 8248b309e..ea90d1a6b 100644 --- a/version +++ b/version @@ -1 +1 @@ -v2023.05.01_04 +v2023.05.01_05 From 0cf4bf626e94007b1023eb080b3b4f0b75d15dde Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Sep 2024 21:00:50 +0100 Subject: [PATCH 016/108] #3867 Remove module upload functions --- html/includes/module.php | 3 --- html/includes/moduleutil.php | 36 ------------------------------------ html/js/modules/modules.js | 30 ------------------------------ 3 files changed, 69 deletions(-) diff --git a/html/includes/module.php b/html/includes/module.php index 1fa567ca3..9692ca806 100644 --- a/html/includes/module.php +++ b/html/includes/module.php @@ -52,9 +52,6 @@ function DisplayModule() {
  • -
  • - -
  • diff --git a/html/includes/moduleutil.php b/html/includes/moduleutil.php index 6dfd5dcda..02f4fac20 100644 --- a/html/includes/moduleutil.php +++ b/html/includes/moduleutil.php @@ -380,42 +380,6 @@ public function deleteModules() { } } - public function postUpload() { - $data = $_FILES['module-file']; - $sourcePath = $_FILES['module-file']['tmp_name']; - $scriptName = str_replace("zip","py",$_FILES['module-file']['name']); - - $targetPath = $this->userModules . '/' . $scriptName ; - - $zipArchive = new ZipArchive(); - $zipArchive->open($sourcePath); - for ($i = 0; $i < $zipArchive->numFiles; $i++) { - $stat = $zipArchive->statIndex($i); - - $nameInArchive = $stat['name']; - - if ($scriptName == $nameInArchive) { - $fp = $zipArchive->getStream($nameInArchive); - if (!$fp) { - $this->send500('Unable to extract module from zip file'); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - - $file = fopen($targetPath, 'wb'); - fwrite($file, $contents); - fclose($file); - $this->sendResponse(); - break; - } - } - $this->send500('Unable to locate module in zip file'); - } - public function getReset() { $flow = $_GET['flow']; diff --git a/html/js/modules/modules.js b/html/js/modules/modules.js index 8a69dffcf..106908091 100644 --- a/html/js/modules/modules.js +++ b/html/js/modules/modules.js @@ -849,27 +849,6 @@ class MODULESEDITOR { } } - #uploadFile(form) { - $.LoadingOverlay('show'); - $('#module-upload-dialog').modal('hide'); - - $.ajax({ - type: 'POST', - url: 'includes/moduleutil.php?request=Upload', - data: new FormData(form), - contentType: false, - cache: false, - processData: false, - context: this - }).done(function () { - this.#buildUI(); - }).fail(function () { - bootbox.alert('Failed to upload the plugin. Unable to move the file'); - }).always(function () { - $.LoadingOverlay('hide'); - }); - } - #showDebug() { $.ajax({ url: 'includes/moduleutil.php?request=Modules&event=' + this.#eventName, @@ -1044,15 +1023,6 @@ class MODULESEDITOR { } }); - $(document).on('click', '#module-editor-new', () => { - $('#module-upload-dialog').modal('show'); - }); - - $('#module-upload-dialog-form').on('submit', (e) => { - e.preventDefault(); - this.#uploadFile(e.target); - }); - this.#buildUI(); } From 63ab25474abb03454d1b0d732fe68a6273425390 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 4 Oct 2024 23:43:55 -0500 Subject: [PATCH 017/108] Update README.md: bump to _05 plus other changes that should have already been included. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ae72faf43..004841586 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Allsky Camera ![Release](https://img.shields.io/badge/Version-v2023.05.01_04-green.svg) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MEBU2KN75G2NG&source=url) +# Allsky Camera ![Release](https://img.shields.io/badge/Version-v2023.05.01_05-green.svg) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MEBU2KN75G2NG&source=url) This is the source code for the Allsky Camera project described [on Instructables](http://www.instructables.com/id/Wireless-All-Sky-Camera/).   @@ -15,8 +15,8 @@ This is the source code for the Allsky Camera project described [on Instructable You will need the following: - * A Raspberry Pi (Zero 2, 2, 3, 4) running Pi OS. - * A camera (Raspberry Pi HQ, Module 3, or RPi compatible, or ZWO ASI) + * A Raspberry Pi (Zero 2, 2, 3, 4, or 5) running Pi OS. + * A camera (Raspberry Pi HQ, Module 3, or RPi compatible, or ZWO ASI released before October 2023)   @@ -33,10 +33,10 @@ You will need the following:   ## Software Installation - + Detailed installation instructions can be found at [Installing / Upgrading --> Allsky](https://htmlpreview.github.io/?https://raw.githubusercontent.com/thomasjacquin/allsky/master/html/documentation/installations/Allsky.html). --- From c42a889cc35ef2e5e100626b39c3cb741923e215 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 4 Oct 2024 23:48:28 -0500 Subject: [PATCH 018/108] Update changeLog.html: Mention _05 fix --- html/documentation/changeLog.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/html/documentation/changeLog.html b/html/documentation/changeLog.html index 4db498ba9..ce2a440c1 100644 --- a/html/documentation/changeLog.html +++ b/html/documentation/changeLog.html @@ -38,6 +38,17 @@ Check out this page. + +

    v2023.05.01_05 - Point Release # 5

    +
    + +

    Bug Fixes

    +
      +
    • Fixed security bug that allowed hackers to overwrite Allsky files.
    • +
    + +
    +

    v2023.05.01_04 - Point Release # 4

    From b61223172232b7c933e0de0ad6231df967328a81 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 27 Nov 2024 06:38:53 -0600 Subject: [PATCH 019/108] Update save_file.php: Remove error lines * RASPI_ADMIN_DETAILS is already defined in functions.php do don't redefine it. * raspap.php doesn't exist so delete the reference to it. These two lines caused errors in the lighttpd log file. --- html/includes/save_file.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/html/includes/save_file.php b/html/includes/save_file.php index ca064fc2a..87337c5e4 100644 --- a/html/includes/save_file.php +++ b/html/includes/save_file.php @@ -7,8 +7,6 @@ include_once('functions.php'); initialize_variables(); -define('RASPI_ADMIN_DETAILS', RASPI_CONFIG . '/raspap.auth'); -include_once('raspap.php'); include_once('authenticate.php'); $debug = false; From 1cbcdb279ad2f3df169c088899aa0e31b5178b81 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 27 Nov 2024 06:41:30 -0600 Subject: [PATCH 020/108] Update datautil.php: delete reference to raspap.php, which doesn't exist --- html/includes/datautil.php | 1 - 1 file changed, 1 deletion(-) diff --git a/html/includes/datautil.php b/html/includes/datautil.php index b47596720..7d89d3079 100644 --- a/html/includes/datautil.php +++ b/html/includes/datautil.php @@ -3,7 +3,6 @@ include_once('functions.php'); initialize_variables(); // sets some variables -include_once('raspap.php'); include_once('authenticate.php'); class DATAUTIL From 1194c3efa569e29476db706efe926602d113bd40 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:00:29 -0600 Subject: [PATCH 021/108] Update changeLog.html: remove incorrect reference to new settings --- html/documentation/changeLog.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/html/documentation/changeLog.html b/html/documentation/changeLog.html index e199d3791..cd7dc6399 100644 --- a/html/documentation/changeLog.html +++ b/html/documentation/changeLog.html @@ -322,10 +322,6 @@

    Deleted Settings

    was deleted. It brightened every pixel by the amount specified and is not needed with allsky cameras.
  • -
  • The new Nighttime Capture and - Nighttime Save settings - are the same as the daytime versions, except for nighttime. -
  • Bug Fixes

    From 3f5dce6cc454c4522d8c64e6c9088e4c98e28e60 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 1 Dec 2024 09:34:59 -0600 Subject: [PATCH 022/108] Update README.md: fix typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca9f47a5c..cf3a1add8 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ In order to run the Allsky software you need: See the [detailed installation instructions](https://htmlpreview.github.io/?https://raw.githubusercontent.com/AllskyTeam/allsky/master/html/documentation/installations/Allsky.html). @@ -79,7 +79,7 @@ It should be used before requesting support on GitHub. ## Allsky Website and remote server -The local Allsky Website (i.e., on the Pi) in installed with Allsky but must be enabled in the WebUI in order to use it. +The local Allsky Website (i.e., on the Pi) is installed with Allsky but must be enabled in the WebUI in order to use it. You can also install the Allsky Website on a remote server so it can be viewable via the Internet. See [Installation / Upgrading --> Website](https://htmlpreview.github.io/?https://raw.githubusercontent.com/AllskyTeam/allsky/master/html/documentation/installations/AllskyWebsite.html) for information on how to install and configure an Allsky Website. From 954fa8d99f52817c9282c0bd1497dc47659535b2 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:14:17 -0600 Subject: [PATCH 023/108] Update generateForDay.sh: fix typo in setting name Thanks to dg8yho. Fixes #4000 --- scripts/generateForDay.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh index 16513efc4..0e4f4f948 100755 --- a/scripts/generateForDay.sh +++ b/scripts/generateForDay.sh @@ -207,7 +207,7 @@ else # Local Websites don't have directory or file name choices. if [[ ${R_WEB_USE} == "true" ]]; then - R_WEB_DEST_DIR="$( settings ".remotewebimagedir" )" + R_WEB_DEST_DIR="$( settings ".remotewebsiteimagedir" )" if [[ -n ${R_WEB_DEST_DIR} && ${R_WEB_DEST_DIR: -1:1} != "" ]]; then R_WEB_DEST_DIR="${R_WEB_DEST_DIR}/" fi From 017fb8e705a1a279589c8572223d3b8e1b121251 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 1 Dec 2024 20:15:59 -0600 Subject: [PATCH 024/108] Add files via upload --- assets/TestPlan.xlsx | Bin 0 -> 18515 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/TestPlan.xlsx diff --git a/assets/TestPlan.xlsx b/assets/TestPlan.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..53294aaf6347c139675d26f019ea45991281567d GIT binary patch literal 18515 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 bZ|46BGxAcPpZ)*<0QdR(!=)mH|G4^pQ>Ky3 literal 0 HcmV?d00001 From b335c2fac1ba53e7d6ef573c3536d5ef975ae9df Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:11:46 -0600 Subject: [PATCH 025/108] Update options.json.repo: Update label --- config_repo/options.json.repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_repo/options.json.repo b/config_repo/options.json.repo index b8c02b16f..93fecfce4 100644 --- a/config_repo/options.json.repo +++ b/config_repo/options.json.repo @@ -756,7 +756,7 @@ "name" : "determinefocus", "default" : false, "description" : "Enable to have the image focus determined and output via the 'FOCUS' variable.", -"label" : "Focus Mode", +"label" : "Record Focus", "type" : "boolean", "usage" : "capture", "action" : "stop" From a7cd8afad6786e050a943fc1fd7b0aeb02c6b6a4 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:18:43 -0600 Subject: [PATCH 026/108] Update allsky.html: Add "Record Focus" --- html/documentation/settings/allsky.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/html/documentation/settings/allsky.html b/html/documentation/settings/allsky.html index 6406d53ed..60166c072 100644 --- a/html/documentation/settings/allsky.html +++ b/html/documentation/settings/allsky.html @@ -416,6 +416,11 @@ No flip How to flip the image (No flip, Horizontal, Vertical, or Both). + +Record Focus + No + Enable to have the overall focus of the image determined and output via the 'FOCUS' variable, which can then be used in an overlay. + Consistent Delays Between Images Yes Enable this to force the time between the start of exposures to be a consistent length From 583356e0f278ff65f3282fa2ff40425a5e9bf268 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 5 Dec 2024 22:36:28 +0000 Subject: [PATCH 027/108] Resolve merge conflicts --- scripts/modules/allsky_clearsky.py | 61 +++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/scripts/modules/allsky_clearsky.py b/scripts/modules/allsky_clearsky.py index 9ee324d8c..af1ec485e 100755 --- a/scripts/modules/allsky_clearsky.py +++ b/scripts/modules/allsky_clearsky.py @@ -24,7 +24,7 @@ "name": "Clear Sky Alarm", "description": "Clear Sky Alarm", "module": "allsky_clearsky", - "version": "v1.0.0", + "version": "v1.0.1", "events": [ "day", "night" @@ -41,8 +41,10 @@ "roi": "", "roifallback": 5, "mqttenable": "False", + "mqttusesecure": "true", "mqttbroker": "", "mqttport": 1883, + "mqttloopdelay": "5", "mqttusername": "", "mqttpassword": "", "mqtttopic": "SKYSTATE", @@ -153,6 +155,14 @@ "fieldtype": "checkbox" } }, + "mqttusesecure": { + "required": "false", + "description": "Use Secure Connection", + "tab": "MQTT", + "type": { + "fieldtype": "checkbox" + } + }, "mqttbroker" : { "required": "false", "description": "MQTT Broker address", @@ -171,6 +181,18 @@ "step": 1 } }, + "mqttloopdelay": { + "required": "false", + "description": "Loop Delay(s)", + "help": "The loop delay, only increase this if you experience issues with messages missing in the broker", + "tab": "MQTT", + "type": { + "fieldtype": "spinner", + "min": 0.5, + "max": 10, + "step": 0.5 + } + }, "mqttusername" : { "required": "false", "description": "MQTT Username", @@ -193,6 +215,12 @@ "enabled": "false" } +def MQTTonConnect(client, userdata, flags, rc, properties=None): + s.log(4, f"INFO: MQTT - CONNACK received with code {rc}.") + +def MQTTonPublish(client, userdata, mid, properties=None): + s.log(4, f"INFO: MQTT - Message published {mid}.") + def onPublish(client, userdata, mid, properties=None): s.log(4,"INFO: Sky state published to MQTT Broker mid {0}".format(mid)) @@ -211,11 +239,13 @@ def clearsky(params, event): fallback = s.int(params["roifallback"]) mqttenable = params["mqttenable"] + mqttusesecure = params["mqttusesecure"] mqttbroker = params["mqttbroker"] mqttport = s.int(params["mqttport"]) mqttusername = params["mqttusername"] mqttpassword = params["mqttpassword"] mqtttopic = params["mqtttopic"] + mqttloopdelay = params["mqttloopdelay"] starCount = "" @@ -335,12 +365,33 @@ def clearsky(params, event): if mqttenable: s.log(4,"INFO: Sending sky state {0} to MQTT Broker {1} using topic {2}".format(skyState, mqttbroker, mqtttopic)) + + channel_topic = mqtttopic + if channel_topic == "": + s.log(0, "ERROR:MQTT - Please specify a topic to publish") + return + client = paho.Client(client_id="", userdata=None, protocol=paho.MQTTv5) - client.on_publish = onPublish - client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS) - client.username_pw_set(mqttusername, mqttpassword) + client.on_connect = MQTTonConnect + client.on_publish = MQTTonPublish + if mqttusername != "" and mqttpassword!= "": + client.username_pw_set(mqttusername, mqttpassword) + + if mqttbroker== "": + s.log(0, "ERROR: MQTT - Please specify a MQTT host to publish to") + return + + if mqttusesecure: + client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS) + client.connect(mqttbroker, mqttport) - result = client.publish(mqtttopic, skyState) + + client.publish(mqtttopic, skyState ,qos=1) + s.log(1, f"INFO: MQTT - Published to MQTT on channel: {channel_topic}") + delay = int(mqttloopdelay) + client.loop(delay) + client.disconnect() + else: s.log(4,"INFO: MQTT disabled") From 01764fa73eabbfcf33de79886875adeaf34f1dd6 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 5 Dec 2024 23:00:29 +0000 Subject: [PATCH 028/108] Resolve merge conflicts --- html/includes/moduleutil.php | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/html/includes/moduleutil.php b/html/includes/moduleutil.php index 306ca6933..5c530f614 100644 --- a/html/includes/moduleutil.php +++ b/html/includes/moduleutil.php @@ -385,42 +385,6 @@ public function deleteModules() { } } - public function postUpload() { - $data = $_FILES['module-file']; - $sourcePath = $_FILES['module-file']['tmp_name']; - $scriptName = str_replace("zip","py",$_FILES['module-file']['name']); - - $targetPath = $this->userModules . '/' . $scriptName ; - - $zipArchive = new ZipArchive(); - $zipArchive->open($sourcePath); - for ($i = 0; $i < $zipArchive->numFiles; $i++) { - $stat = $zipArchive->statIndex($i); - - $nameInArchive = $stat['name']; - - if ($scriptName == $nameInArchive) { - $fp = $zipArchive->getStream($nameInArchive); - if (!$fp) { - $this->send500('Unable to extract module from zip file'); - } - - $contents = ''; - while (!feof($fp)) { - $contents .= fread($fp, 1024); - } - fclose($fp); - - $file = fopen($targetPath, 'wb'); - fwrite($file, $contents); - fclose($file); - $this->sendResponse(); - break; - } - } - $this->send500('Unable to locate module in zip file'); - } - public function getReset() { $flow = $_GET['flow']; From 8285e4de65414287df8065a04f46ceada362cc34 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:04:29 -0600 Subject: [PATCH 029/108] Rename remote_website_install.sh to remoteWebsiteInstall.sh --- remote_website_install.sh => remoteWebsiteInstall.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename remote_website_install.sh => remoteWebsiteInstall.sh (100%) diff --git a/remote_website_install.sh b/remoteWebsiteInstall.sh similarity index 100% rename from remote_website_install.sh rename to remoteWebsiteInstall.sh From de42bc5a72ad28d47931f685d099da595ba8345a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:06:36 -0600 Subject: [PATCH 030/108] Update AllskyWebsite.html: rename to remoteWebsiteInstall.sh --- html/documentation/installations/AllskyWebsite.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/installations/AllskyWebsite.html b/html/documentation/installations/AllskyWebsite.html index 576fea5fc..675afe30b 100644 --- a/html/documentation/installations/AllskyWebsite.html +++ b/html/documentation/installations/AllskyWebsite.html @@ -98,7 +98,7 @@

    Install a remote Allsky Website

    Remote Website subsection. Make sure to enable Use Remote Website as well as enough other settings so Allsky can upload a file to the Website. -
  • Run cd ~/allsky; ./remote_website_install.sh +
  • Run cd ~/allsky; ./remoteWebsiteInstall.sh to upload a default configuration file to your server, leaving the master copy on the Pi.
      From 82c575cd6131a8e01b631d3d69c391ed945fc79f Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 6 Dec 2024 20:07:10 +0000 Subject: [PATCH 031/108] Rename for release --- remoteWebsiteInstall.sh | 838 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 838 insertions(+) create mode 100755 remoteWebsiteInstall.sh diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh new file mode 100755 index 000000000..6115f5646 --- /dev/null +++ b/remoteWebsiteInstall.sh @@ -0,0 +1,838 @@ +#!/bin/bash + +# shellcheck disable=SC2317 + +# Install or upgrade a remote Allsky Website. + +# TODO: handle interrupts like in install.sh + +# shellcheck disable=SC2155 +[[ -z ${ALLSKY_HOME} ]] && export ALLSKY_HOME="$( realpath "$( dirname "${BASH_ARGV0}" )" )" +ME="$( basename "${BASH_ARGV0}" )" + +#shellcheck source-path=. +source "${ALLSKY_HOME}/variables.sh" || exit "${EXIT_ERROR_STOP}" +#shellcheck source-path=scripts +source "${ALLSKY_SCRIPTS}/functions.sh" || exit "${EXIT_ERROR_STOP}" +#shellcheck source-path=scripts +source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP}" + +# display_msg() sends log entries to this file. +# shellcheck disable=SC2034 +DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log" + +# Config variables +HAVE_NEW_CONFIG="false" +HAVE_PRIOR_CONFIG="false" +HAVE_NEW_REMOTE_CONFIG="false" +HAVE_REALLY_OLD_REMOTE_CONFIG="false" +CONFIG_TO_USE="" # which Website configuration file to use? +CONFIG_MESSAGE="" +REMOTE_WEBSITE_EXISTS="false" + +# Dialog size variables +DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 )) +DIALOG_HEIGHT=25 + +# Remote connectivity variables +REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )" +REMOTE_USER="$( settings ".REMOTEWEBSITE_USER" "${ALLSKY_ENV}" )" +REMOTE_HOST="$( settings ".REMOTEWEBSITE_HOST" "${ALLSKY_ENV}" )" +REMOTE_PORT="$( settings ".REMOTEWEBSITE_PORT" "${ALLSKY_ENV}" )" +REMOTE_PASSWORD="$( settings ".REMOTEWEBSITE_PASSWORD" "${ALLSKY_ENV}" )" +REMOTE_DIR="$( settings ".remotewebsiteimagedir" "${SETTINGS_FILE}" )" +REMOTE_PROTOCOL="$( settings ".remotewebsiteprotocol" "${SETTINGS_FILE}" )" +REMOTE_PROTOCOL="${REMOTE_PROTOCOL,,}" # convert to lowercase + +#### TODO: this script needs to support ALL protocols, not just *ftp*. +# When it does, remove this check. +if [[ ${REMOTE_PROTOCOL} != "sftp" && ${REMOTE_PROTOCOL} != "ftp" && ${REMOTE_PROTOCOL} != "ftps" ]]; then + echo -e "\n\n" + echo "************* NOTICE *************" + echo "This script currently only supports ftp protocols." + echo "Support for the '${REMOTE_PROTOCOL}' protocol will be added in" + echo "the first point release." + echo -e "\n" + echo "In the meantime, if you have an existing remote Allsky Website," + echo "it should continue to work." + echo -e "\n" + + exit 0 +fi + +# Titles for various dialogs +# don't use: DIALOG_BACK_TITLE="Allsky Remote Website Installer" +DIALOG_WELCOME_TITLE="Allsky Remote Website Installer" +DIALOG_PRE_CHECK="${DIALOG_WELCOME_TITLE} - Pre Installation Checks" +DIALOG_INSTALL="Installing Remote Website" +DIALOG_DONE="Remote Website Installation Completed" +DIALOG_TITLE_LOG="Allsky Remote Website Installation Log" + +# Old Allksy Website files that should be removed if they exist. +OLD_CONFIG_NAME="config.js" +OLD_FILES_TO_REMOVE=( \ + "${OLD_CONFIG_NAME}" \ + "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" \ + "getTime.php" \ + "virtualsky.json" \ + "README.md" \ + "myImages") + +############################################## functions + +# Prompt the user to enter (y)/(yes) or (n)/(no). +# This function is only used when running in text (--text) mode. +function enter_yes_no() +{ + local TEXT="${1}" + local RESULT=1 + local ANSWER + + while true; do + echo -e "${TEXT}" + read -r -p "Do you want to continue? (y/n): " ANSWER + ANSWER="${ANSWER,,}" # convert to lowercase + + if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then + return 0 + elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then + return 1 + else + echo -e "\nInvalid response. Please enter y/yes or n/no." + fi + done + + return ${RESULT} +} + +# prompt the user to press any key. +# This function is only used when running in text (--text) mode. +function press_any_key() +{ + echo -e "${1}\nPress any key to continue..." + read -r -n1 -s +} + +# Add a common heading to the dialog text. +function add_dialog_heading() +{ + local DIALOG_TEXT="${1}" + + ## We no longer add the remote URL but have left this code in case we want + ## to add something else in the future. + ## Only the: ITEM_TO_ADD=xxx line should need changing. + echo "${DIALOG_TEXT}" + return + + if [[ ${TEXT_ONLY} == "true" ]]; then + DIALOG_RED="${RED}" + DIALOG_NORMAL="${NC}" + fi + + local ITEM_TO_ADD="${REMOTE_URL}" + local PADDING=$(( ((DIALOG_WIDTH-6) - ${#ITEM_TO_ADD}) / 2 )) + local ITEM_TO_ADD="$( printf "%${PADDING}s%s" "" "${ITEM_TO_ADD}" )" + + echo -e "\n${DIALOG_RED}${ITEM_TO_ADD}${DIALOG_NORMAL}\n${DIALOG_TEXT}" +} + +# Displays the specified type of Dialog, or in text mode just displays the text. +# ${1} - The box type +# ${2} - The title for the dialog +# ${3} - The text to disply in the dialog +# ${4} - Optional additional arguments to dialog +# +# Return - 1 if the user selected "No"; 0 otherwise +function display_box() +{ + local DIALOG_TYPE="${1}" + local DIALOG_TITLE="${2}" + local DIALOG_TEXT="${3}" + local MORE_ARGS="${4}" + + DIALOG_TEXT="$( add_dialog_heading "${DIALOG_TEXT}" )" + if [[ ${TEXT_ONLY} == "true" ]]; then + local RET=0 + if [[ ${DIALOG_TYPE} == "--msgbox" ]]; then + press_any_key "${DIALOG_TEXT}" + elif [[ ${DIALOG_TYPE} == "--yesno" ]]; then + enter_yes_no "${DIALOG_TEXT}" + RET=$? + else + echo -e "${DIALOG_TEXT}" + fi + return ${RET} + fi + + # Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \ + # shellcheck disable=SC2086 + dialog \ + --colors \ + --title "${DIALOG_TITLE}" \ + ${MORE_ARGS} \ + "${DIALOG_TYPE}" "${DIALOG_TEXT}" ${DIALOG_HEIGHT} ${DIALOG_WIDTH} + return $? +} + +# Displays a file Dialog, or in text mode just displays the file. +# ${1} - The title for the dialog +# ${2} - The filename to display +# +# Returns - Nothing +function display_log_file() +{ + local DIALOG_TITLE="${1}" + local FILENAME="${2}" + + if [[ ${TEXT_ONLY} == "true" ]]; then + cat "${FILENAME}" + return + fi + + dialog \ + --clear \ + --colors \ + --title "${DIALOG_TITLE}" \ + --textbox "${FILENAME}" 22 77 +} + +# Runs the pre installation checks to determine the following: +# - Is there a remote Website? +# - Which configuration file to use for the remote Website? +# +# The configuration file to use is decided using the following, in order: +# +# 1a. If ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, use it. +# +# 1b. If ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, +# copy it to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it. +# +# 2a. If there's a remote Website with a ${ALLSKY_WEBSITE_CONFIGURATION_NAME} file, +# save it locally as ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it. +# +# 2b. If there is a remote Website with an old-style configuration file (${OLD_CONFIG_NAME}), +# create a NEW ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it. +# Don't bother trying to convert from old-style files. +function pre_install_checks() +{ + display_msg --logonly info "Start pre installation checks." + + local MSG="" + local DIALOG_TEXT DT + DIALOG_TEXT="\nWelcome to the Allsky Remote Website Installer!\n\n" + DIALOG_TEXT+="\nRunning pre installation checks.\n\n" + + DIALOG_TEXT+="\n1 - Checking for remote Website configuration file on Pi: " + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + + if [[ -f ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then + # 1a. + DT="FOUND" + MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." + display_msg --logonly info "${MSG}" + HAVE_NEW_CONFIG="true" + +### FIX / TODO: Should this be used? +# During Allsky upgrades, if the OLD directory exists users are asked if +# it should be used. If "yes", then the prior remote Website config file was +# copied to the new Allsky, so 1a should match. +# If the user answered "no", don't use OLD Allsky, we probably shouldn't either. + elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then + # 1b. + DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'" + MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}." + display_msg --logonly info "${MSG}" + HAVE_PRIOR_CONFIG="true" + + else + DT="NOT FOUND" + display_msg --logonly info "No local config files found." + fi + DIALOG_TEXT+="${DT}." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + + DIALOG_TEXT+="\n2 - Checking for existing remote Website: " + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + local INDENT=" " + REMOTE_WEBSITE_EXISTS="$( check_if_website_exists )" + if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then + + # If we didn't find a remote Website configuration file on the Pi, + # it's "should be" an old-style Website since the user wasn't + # using the WebUI to configure it. + + DIALOG_TEXT+="FOUND." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + + # 2a. + DIALOG_TEXT+="\n${INDENT}* Checking it for new-style configuration file: " + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}") + if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then + HAVE_NEW_REMOTE_CONFIG="true" + DIALOG_TEXT+="Found." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + MSG="Found a current configuration file on the remote server." + display_msg --logonly info "${MSG}" + else + # 2b. + DIALOG_TEXT+="Not found." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + + DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:" + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}") + if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then + HAVE_REALLY_OLD_REMOTE_CONFIG="true" + DT="FOUND" + MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website." + display_msg --logonly info "${MSG}" + else + # This "shouldn't" happen - the remote Website should have SOME type + # of configuration file. + DT="NOT FOUND" + fi + DIALOG_TEXT+="${DT}." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + fi + else + # No remote Website found. + DIALOG_TEXT+="NOT FOUND." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + + if [[ ${HAVE_NEW_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then + DIALOG_TEXT+="${DIALOG_RED}" + DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists" + DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found." + DIALOG_TEXT+="\n${INDENT}What is the configuration file for?" + DIALOG_TEXT+="${DIALOG_NORMAL}" + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + fi + + fi + + if [[ ${HAVE_NEW_CONFIG} == "true" ]]; then + if [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then + MSG="A remote configuration file was found but using the local version instead." + else + MSG="Using the local remote configuration file (no remote file found)." + fi + display_msg --logonly info "${MSG}" + CONFIG_TO_USE="local" # it may be old or current format + CONFIG_MESSAGE="the current remote" + + elif [[ ${HAVE_PRIOR_CONFIG} == "true" ]]; then + local B="$( basename "${PRIOR_ALLSKY_DIR}" )" + MSG="Using the ${B} configuration file." + display_msg --logonly info "${MSG}" + CONFIG_TO_USE="prior" # it may be old or current format + CONFIG_MESSAGE="the ${B}" + + elif [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then + MSG="Using new-style Website configuration file on the remote Website;" + MSG+=" it will be downloaded and saved locally." + display_msg --logonly info "${MSG}" + CONFIG_TO_USE="remoteNew" + CONFIG_MESSAGE="the remote Website's" + + elif [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]]; then + MSG="Old ${OLD_CONFIG_NAME} found." + MSG+=" Creating a new configuration file that the user must manually update." + display_msg --logonly info "${MSG}" + CONFIG_TO_USE="remoteReallyOld" + CONFIG_MESSAGE="a new" + + else + MSG="Unable to determine the configuration file to use. A new one will be created." + display_msg --logonly info "${MSG}" + CONFIG_TO_USE="new" + fi + + DIALOG_TEXT+="\n * Checking ability to upload to it: " + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + display_msg --logonly info "Checking remote Website connectivity." + local ERR="$( check_connectivity )" + if [[ -z ${ERR} ]]; then + DIALOG_TEXT+="PASSED." + display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + show_debug_message "The remote Website connectivity test succeeded." + else + local ERROR_MSG="\nERROR: The remote Website connectivity check failed." + display_aborted "${ERROR_MSG}" "${ERR}" + fi + + display_msg --logonly info "Completed pre installation checks." + + # Prompt the user to continue. This is so they can see the above messages. + DIALOG_TEXT+="\n\n\n${DIALOG_UNDERLINE}Press OK to continue${DIALOG_NORMAL}" + display_box "--msgbox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" +} + +# Displays the welcome dialog indicating what steps will be taken +function display_welcome() +{ + if [[ ${TEXT_ONLY} == "true" ]]; then + DIALOG_RED="${RED}" + DIALOG_NORMAL="${NC}" + fi + + if [[ ${AUTO_CONFIRM} == "false" ]]; then + display_msg --logonly info "Displaying the welcome dialog." + local DIALOG_TEXT="\n\ + This script will now:\n\n\ + \ + 1) Use ${CONFIG_MESSAGE} configuration file.\n\ + 2) Upload the new remote Website code.\n\ + 3) Upload the remote Website configuration file.\n\ + 4) Enable the remote Website.\n\n\ + \ + ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\ + - Overwrite the old Allsky web files on the remote server.\n\ + - Remove any old Allsky files from the remote server.\n\n\n\ + ${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}" + + if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then + display_aborted "--user" "at the Welcome dialog" "" + fi + else + display_msg --logonly info "Ignored welcome prompt as auto confirm option specified." + fi +} + +# Displays the aborted dialog. This is used when an error is encountered or the user cancels. +# ${1} - Extra text to display in the dialog +# ${2} - Error message (or "" if no error) +function display_aborted() +{ + if [[ ${1} == "--user" ]]; then + local ABORT_MSG="USER ABORTED INSTALLATION" + shift + else + local ABORT_MSG="INSTALLATION ABORTED" + fi + local EXTRA_TEXT="${1}" + local ERROR_MSG="${2}" + + display_msg --logonly info "${ABORT_MSG} ${EXTRA_TEXT}.\n" + local MSG="\nInstallation of the remote Website aborted ${EXTRA_TEXT}." + + if [[ -n ${ERROR_MSG} ]]; then + local DIALOG_PROMPT="${MSG}\n\n" + DIALOG_PROMPT+="${DIALOG_UNDERLINE}Would you like to view the error message?${DIALOG_NORMAL}" + if display_box "--yesno" "${DIALOG_INSTALL}" "${DIALOG_PROMPT}" ; then + display_box "--msgbox" "${DIALOG_TITLE_LOG}" "${ERROR_MSG}" "--scrollbar" +if false; then + display_log_file "${DIALOG_TITLE_LOG}" "${DISPLAY_MSG_LOG}" +fi + fi + fi + + clear # Gets rid of background color from last 'dialog' command. + # Not needed: display_msg info "${ERROR_MSG}" + + exit 1 +} + +# Displays the completed dialog, used at the end of the installation process. +function display_complete() +{ + local EXTRA_TEXT="" + local E=" Please use the WebUI's 'Editor' page to replace any '${NEED_TO_UPDATE}' with the correct values." + if [[ ${CONFIG_TO_USE} == "new" ]]; then + EXTRA_TEXT="\nA new configuration file was created for your remote Website." + EXTRA_TEXT+="${E}" + elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then + EXTRA_TEXT="\nYou have a very old remote Allsky Website so a new configuration file was created." + EXTRA_TEXT+="${E}" + fi + + display_msg --logonly info "INSTALLATION COMPLETED.\n" + + local DIALOG_TEXT="\n\ + The installation of the remote Website is complete\n\ + and the remote Website should be working.\n\n\ + Please check it.\n\n\ + Use the WebUI's 'Editor' page to change settings for your Website.${EXTRA_TEXT}" + display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}" + + clear # Gets rid of background color from last 'dialog' command. + display_msg info "\nEnjoy your remote Allsky Website!\n" +} + +# Check connectivity to the remote Website by trying to upload a file to it. +# Return "" for success, else the error message. +function check_connectivity() +{ + local TEST_FILE="${ME}.txt" + local ERR + + if ERR="$( "${ALLSKY_SCRIPTS}/testUpload.sh" --website --silent --file "${TEST_FILE}" 2>&1 )" ; then + remove_remote_file "${TEST_FILE}" "do not check" + echo "" + else + echo "${ERR}" + fi +} + +# Displays a debug message in the log if the debug flag has been specified on the command line. +function show_debug_message() +{ + if [[ ${DEBUG} == "true" ]]; then + display_msg --logonly debug "${1}" + fi +} + +# Update a Website config file if it's an old version. +function update_old() +{ + local FILE="${1}" + + local PRIOR_VERSION="$( settings ".${WEBSITE_CONFIG_VERSION}" "${FILE}" )" + local NEW_VERSION="$( settings ".${WEBSITE_CONFIG_VERSION}" "${REPO_WEBCONFIG_FILE}" )" + if [[ ${PRIOR_VERSION} < "${NEW_VERSION}" ]]; then + # Old version, so update to format of the current version. + update_old_website_config_file "${FILE}" "${PRIOR_VERSION}" "${NEW_VERSION}" + return 0 + fi + return 1 +} + +# Creates the remote Website configuration file if needed. +# See 'pre_install_checks' for details on which configuration file is used. +function create_website_config() +{ + local MSG="Creating configuration file from ${CONFIG_MESSAGE}" + display_msg --logonly info "${MSG}" + + if [[ ${CONFIG_TO_USE} == "new" || ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then + # Need a new config file so copy it from the repo and replace as many + # placeholders as we can. + local DEST_FILE="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + cp "${REPO_WEBCONFIG_FILE}" "${DEST_FILE}" + replace_website_placeholders "remote" + + MSG="Created a new ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}" + MSG+=" from repo and updated placeholders." + display_msg --logonly info "${MSG}" + + elif [[ ${CONFIG_TO_USE} == "local" ]]; then + # Using the remote config file on the Pi which may be new or old format. + MSG="Using existing ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}" + if update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ; then + MSG+=" and converting to newest format." + fi + display_msg --logonly info "${MSG}" + + elif [[ ${CONFIG_TO_USE} == "prior" ]]; then + # Use the config file from the prior Allsky, replacing as many placeholders as we can. + # If the file is an older version, convert to the newest format. + cp "${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + replace_website_placeholders "remote" + update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + + MSG="Copied ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} from the" + MSG+=" $( basename "${PRIOR_ALLSKY_DIR}" ) directory and updated placeholders." + display_msg --logonly info "${MSG}" + + elif [[ ${CONFIG_TO_USE} == "remoteNew" ]]; then + # Use the new remote config file since none were found locally. + # Replace placeholders and convert it to the newest format. + # Remember that the remote file name is different than what we store on the Pi. + if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_FILE}" 2>&1 )"; then + replace_website_placeholders "remote" + update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + + MSG="Downloaded ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}," + MSG+=" to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." + display_msg --logonly info "${MSG}" + else + # This "shouldn't" happen since we either already checked the file exists, + # or we uploaded it. + MSG="Failed to download ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}." + MSG+=" Where did it go?" + display_aborted "${MSG}" "${ERR}" + fi + fi +} + +# Check if a remote file, or array of files, exist. +# ${1} - The base url +# ${2} - "and"/"or" If "and" then all files must exist, if "or" then any of the files can exist. +# ${3}... - the files +# +# Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist. +function check_if_files_exist() +{ + local URL="${1}" + local AND_OR="${2}" + shift 2 + local RET_CODE=1 + + for FILE in "$@"; do + url="${URL}/${FILE}" + HTTP_STATUS="$( curl -o /dev/null --head --silent --write-out "%{http_code}" "$url" )" + + local PRE_MSG="File ${FILE} ${url}" + if [[ ${HTTP_STATUS} == "200" ]] ; then + show_debug_message "${PRE_MSG} exists on the remote server" + RET_CODE=0 + else + show_debug_message "${PRE_MSG} does not exists on the remote server" + if [[ ${AND_OR} == "and" ]]; then + return 1 + fi + fi + done + + return ${RET_CODE} +} + +# Deletes a file from the remote server. +# ${1} - The name of the file to delete +# ${2} - If set to "check", first check if the file exists +# +# Returns - Nothing +function remove_remote_file() +{ + local FILENAME="${1}" + local CHECK="${2}" + + if [[ ${CHECK} == "check" ]]; then + if ! check_if_files_exist "${REMOTE_URL}" "or" "${FILENAME}" ; then + show_debug_message "===== not on server" + return + fi + fi + +# TODO: This assumes ftp is used to upload files +# upload.sh should accept "--remove FILE" option. + local CMDS="" ERR + [[ -n ${REMOTE_DIR} ]] && CMDS="cd '${REMOTE_DIR}' ;" + CMDS+=" rm -r '${FILENAME}' ; bye" + + ERR="$( lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \ + "${REMOTE_PORT}" \ + "${REMOTE_PROTOCOL}://${REMOTE_HOST}" \ + -e "${CMDS}" 2>&1 )" + if [[ $? -eq 0 ]] ; then + MSG="Deleted remote file '${FILENAME}'" + else + MSG="Unable to delete remote file '${FILENAME}': ${ERR}" + fi + + display_msg --logonly info "${MSG}" +} + +# Check if a remote Website exists. +# The check is done by looking for the following files: +# If any of the ${CONFIG_FILES} files exist AND +# all of the ${WEBSITE_FILES} exist then assume we have a remote Website. +# +# Returns - echo "true" if it exists, else "false" +function check_if_website_exists() +{ + local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}") + local WEBSITE_FILES=("index.php" "functions.php") + + if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then + show_debug_message "Found a remote Website config file" + + if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then + display_msg --logonly info "Found a remote Allsky Website at ${REMOTE_URL}" + echo "true" + return 0 + fi + fi + echo "false" + return 1 +} + +# Uploads the Website code from ${ALLSKY_WEBSITE} and removes any old Allsky +# files that are no longer used. +function upload_remote_website() +{ + if [[ ${SKIP_UPLOAD} == "true" ]]; then + display_msg --logonly info "Skipping upload per user request.\n" + return + fi + + local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG + + if [[ -n ${REMOTE_PORT} ]]; then + REMOTE_PORT="-p ${REMOTE_PORT}" + fi + + MSG="Starting upload to the remote Website" + [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}" + if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then + + # Don't upload images if the remote Website exists (we assume it already + # has the images). + # However, we must upload the index.php files. + EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos" + +# FIX: the --include doesn't work - the files aren't uploaded. +# Do we need to do a second lftp mirror to upload them? + EXCLUDE_FOLDERS+=" --include keograms/index.php" + EXCLUDE_FOLDERS+=" --include startrails/index.php" + EXCLUDE_FOLDERS+=" --include videos/index.php" + MSG+=" (without videos, images, and their thumbnails)." + fi + display_msg --logonly info "${MSG}${EXTRA_TEXT}." + + MSG="\n${MSG}\n\nThis may take several minutes..." + display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}" + +# TODO: upload.sh should have a "--mirror from_directory to_directory" option. +# This would also fix the problem that we're assuming the "ftp" protocol is used. + local NL="$( echo -e "\n " )" # Need space otherwise it doesn't work - not sure why + local CMDS=" lcd '${ALLSKY_WEBSITE}'" + CMDS+="${NL}set dns:fatal-timeout 10; set net:max-retries 2; set net:timeout 10" + # shellcheck disable=SC2086 + if [[ -n "${REMOTE_DIR}" ]]; then + CMDS+="${NL}cd '${REMOTE_DIR}'" + else + CMDS+="${NL}cd ." # for debugging + fi + CMDS+="${NL}mirror --reverse --no-perms --verbose --overwrite --ignore-time --transfer-all" + [[ -n ${EXCLUDE_FOLDERS} ]] && CMDS+=" ${EXCLUDE_FOLDERS}" + CMDS+="${NL}bye" + + local TMP="${ALLSKY_TMP}/remote_upload.txt" + echo -e "CMDS=${CMDS}\n======" > "${TMP}" + # shellcheck disable=SC2086 + lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \ + ${REMOTE_PORT} "${REMOTE_PROTOCOL}://${REMOTE_HOST}" -e "${CMDS}" >> "${TMP}" 2>&1 + local RET_CODE=$? + + # Ignore stuff not supported by all FTP servers and stuff we don't want to see. + local IGNORE="operation not supported|command not understood|hostname checking disabled|Overwriting old file" + MSG="$( grep -v -i -E "${IGNORE}" "${TMP}" )" + # If the "mirror" command causes any of the messages above, + # they are counted as errors. + if [[ ${RET_CODE} -ne 0 ]]; then + MSG="$( echo -e "RET_CODE=${RET_CODE}\nCMDS=${CMDS}\n${MSG}" | sed -e 's/$/\\n/' )" + display_aborted "while uploading Website" "${MSG}" + fi + + display_msg --logonly info "$( indent --spaces "${MSG}" )" + + # Remove any old core files no longer required + for FILE_TO_DELETE in "${OLD_FILES_TO_REMOVE[@]}"; do + remove_remote_file "${FILE_TO_DELETE}" "check" + done + + display_msg --logonly info "Website upload complete" +} + +# Uploads the configuration file for the remote Website. +function upload_config_file() +{ + local MSG="\nUploading remote Allsky configuration file" + display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}" + display_msg --logonly info "Uploading Website configuration file." + + local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web \ + "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_DIR}" \ + "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" 2>&1 )" + if [[ $? -eq 0 ]]; then + MSG="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} uploaded to" + MSG+="${REMOTE_DIR}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}" + show_debug_message "${MSG}" + else + display_msg --logonly info " Failed: ${ERR}" + display_aborted "at the configuration file upload" "${ERR}" + fi +} + +# Displays the script's help. +usage_and_exit() +{ + local RET C MSG + + RET=${1} + if [[ ${RET} -eq 0 ]]; then + C="${YELLOW}" + else + C="${RED}" + fi + MSG="Usage: ${ME} [--help] [--debug] [--skipupload] [-auto] [--text]" + { + echo -e "\n${C}${MSG}${NC}" + echo + echo "'--help' displays this message and exits." + echo + echo "'--debug' adds addtional debugging information to the installation log." + echo + echo "'--skipupload' Skips uploading of the remote Website code." + echo " Must only be used if advised by Allsky support." + echo + echo "'--auto' Accepts all prompts by default" + echo + echo "'--text' Text only mode, do not use any dialogs" + echo + } >&2 + exit "${RET}" +} + +# Disable the remote Website. +function disable_remote_website() +{ + update_json_file ".useremotewebsite" "false" "${SETTINGS_FILE}" + display_msg --logonly info "Remote Website temporarily disabled." +} +# Enable the remote Website. +function enable_remote_website() +{ + update_json_file ".useremotewebsite" "true" "${SETTINGS_FILE}" + display_msg --logonly info "Remote Website enabled." +} + +############################################## main body +OK="true" +HELP="false" +SKIP_UPLOAD="false" +AUTO_CONFIRM="false" +TEXT_ONLY="false" +DEBUG="false" + +while [[ $# -gt 0 ]]; do + ARG="${1}" + case "${ARG,,}" in + --help) + HELP="true" + ;; + --debug) + DEBUG="true" + ;; + --skipupload) + SKIP_UPLOAD="true" + ;; + --auto) + AUTO_CONFIRM="true" + ;; + --text) + TEXT_ONLY="true" + LOG_TYPE="--log" + ;; + *) + display_msg --log error "Unknown argument: '${ARG}'." + OK="false" + ;; + esac + shift +done + +[[ ${HELP} == "true" ]] && usage_and_exit 0 +[[ ${OK} == "false" ]] && usage_and_exit 1 + +display_msg --logonly info "STARTING INSTALLATION.\n" + +pre_install_checks +display_welcome +create_website_config +disable_remote_website +upload_remote_website +upload_config_file +enable_remote_website +display_complete From 06024bfae22f799c27add38333d3c23482e753bd Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:11:47 -0600 Subject: [PATCH 032/108] Update changeLog.html: rename remote_website_install.sh --- html/documentation/changeLog.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/documentation/changeLog.html b/html/documentation/changeLog.html index cd7dc6399..aaa6240fa 100644 --- a/html/documentation/changeLog.html +++ b/html/documentation/changeLog.html @@ -123,11 +123,11 @@

      Enhancements / Changes

      Image Directory in the WebUI.
    • Installing a Website on a remote server is significantly easier as well. - Use the new remote_website_install.sh command; + Use the new remoteWebsiteInstall.sh command; it will upload the Allsky Website files for you and remove any old, unneeded files. If this is a new remote Website, - remote_website_install.sh will ask you whether or not to + remoteWebsiteInstall.sh will ask you whether or not to also upload any startrails, keograms, and timelapse videos on your Pi.
    • Images, timelapse, keograms, and startrails can now be written From 66e703199cc04b56921f3423b576c81aa6a517e5 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:12:45 -0600 Subject: [PATCH 033/108] Update layout.html: rename remote_website_install.sh --- html/documentation/explanations/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/explanations/layout.html b/html/documentation/explanations/layout.html index 4dbfe8d8a..1077e3977 100644 --- a/html/documentation/explanations/layout.html +++ b/html/documentation/explanations/layout.html @@ -157,7 +157,7 @@ You'll normally view the Allsky Documentation via the WebUI's Documentation link instead of this file. -
    • remote_website_install.sh +
    • remoteWebsiteInstall.sh
      The program used to prepare an optional remote Allsky Website. This should only be run after viewing the From 4bb34c9fd5ce68171e366caf89b7f2cf48726d17 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:14:17 -0600 Subject: [PATCH 034/108] Update install.sh: rename remote_website_install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a2c8c7e21..c54b4c2f0 100755 --- a/install.sh +++ b/install.sh @@ -2503,7 +2503,7 @@ restore_prior_files() MSG="Your remote Website needs to be updated to this newest version." MSG+="\nIt is at version ${PRIOR_V}" # This command will update the version. - MSG+="\n\nRun: cd ~/allsky; ./remote_website_install.sh" + MSG+="\n\nRun: cd ~/allsky; ./remoteWebsiteInstall.sh" display_msg --log notice "${MSG}" fi else From 9935303bd324f1a22c1e7531088ca837105622c7 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:15:05 -0600 Subject: [PATCH 035/108] Update checkAllsky.sh: rename remote_website_install.sh --- scripts/checkAllsky.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh index f29d3a82e..ed3a0cb6e 100755 --- a/scripts/checkAllsky.sh +++ b/scripts/checkAllsky.sh @@ -786,7 +786,7 @@ if [[ ${CHECK_ERRORS} == "true" ]]; then if [[ ${S_useremotewebsite} == "true" && ! -f ${f} ]]; then heading "Error" echo "${WSNs}${S_useremotewebsite_label}${WSNe} is enabled but '${f}' does not exist." - echo "FIX: Either disable ${WSNs}${S_useremotewebsite_label}${WSNe} or run 'cd ~/allsky; ./remote_website_install.sh'." + echo "FIX: Either disable ${WSNs}${S_useremotewebsite_label}${WSNe} or run 'cd ~/allsky; ./remoteWebsiteInstall.sh'." fi ##### Check dark frames From ac2e4e484f77a4dad08bb7627023c88571ec8db3 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 7 Dec 2024 23:56:42 +0000 Subject: [PATCH 036/108] #4014 Hotfix for missing dialog installation --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 87ae62db1..0bcb6ceb4 100755 --- a/install.sh +++ b/install.sh @@ -3516,7 +3516,7 @@ install_installer_dependencies() display_msg --log progress "Installing installer dependencies." TMP="${ALLSKY_LOGS}/installer.dependencies.log" { - sudo apt-get update && run_aptGet gawk jq + sudo apt-get update && run_aptGet gawk jq dialog } > "${TMP}" 2>&1 check_success $? "gawk,jq installation failed" "${TMP}" "${DEBUG}" || exit_with_image 1 "${STATUS_ERROR}" "gawk,jq install failed." From 1aec341cfff328cc98b52958119ef210d42a7a4e Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:19:16 -0600 Subject: [PATCH 037/108] Update functions.php --- html/includes/functions.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/html/includes/functions.php b/html/includes/functions.php index e380b18ec..10e692898 100644 --- a/html/includes/functions.php +++ b/html/includes/functions.php @@ -10,12 +10,21 @@ // This file sets all the define() variables. $defs = 'allskyDefines.inc'; if ((include $defs) == false) { - echo "
      "; - echo "The installation of the WebUI is incomplete.
      "; + echo "
      "; + echo "The installation of Allsky is incomplete.
      "; echo "File '$defs' not found.
      "; - echo "Please run the following to fix:"; + echo "
      "; + echo "

      "; - echo " cd ~/allsky; ./install.sh --function create_webui_defines"; + echo "
      "; + echo "If you have NOT installed Allsky please install it by running:"; + echo "
      "; + echo "
         cd ~/allsky; ./install.sh
      "; + echo "The WebUI will not work until Allsky is installed."; + + echo "


      "; + echo "If you HAVE successfully installed Allsky, run the following to fix this problem:"; + echo "
         cd ~/allsky; ./install.sh --function create_webui_defines
      "; echo "
      "; exit(1); } From abfd1e852203560f1cd34533e79e7e8a3a676549 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:50:32 -0600 Subject: [PATCH 038/108] Update viewSettings.php: improve message If a user goes to a Website that has never been enabled, the files in the "viewSettings/" directory won't exist, and they'll get a somewhat useless message. Improve the message by telling them how to fix the problem. --- html/allsky/viewSettings.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/allsky/viewSettings.php b/html/allsky/viewSettings.php index 9725d42c2..a5ab83b6c 100644 --- a/html/allsky/viewSettings.php +++ b/html/allsky/viewSettings.php @@ -9,6 +9,9 @@ echo "
      "; echo "This Allsky Website is not fully configured so its settings cannot be displayed."; echo "
      It is missing the '$settingsScript' file."; + echo "

      "; + echo "To fix: make sure the Website is enabled in the Websites and Remote Server Settings"; + echo "section of the WebUI's Allsky Settings page."; echo "
      "; exit(1); } From e5e40529d60a79988008611874378ae74026b2a6 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:09:47 -0600 Subject: [PATCH 039/108] Update checkAllsky.sh: Separate messages when in WebUI When checkAllsky.sh output is displayed in the WebUI there is no space between messages so it's hard to read. Fix by adding a blank line between messages. --- scripts/checkAllsky.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh index ed3a0cb6e..b870c711c 100755 --- a/scripts/checkAllsky.sh +++ b/scripts/checkAllsky.sh @@ -119,14 +119,19 @@ function heading() if [[ ${FROM_WEBUI} == "true" ]]; then # Don't display the header when run from the WebUI. - return + DISPLAY_HEADER="false" fi if [[ ${DISPLAY_HEADER} == "true" ]]; then [[ ${NUM_HEADER_CALLS} -gt 1 ]] && echo -e "${NL}" echo -e "${STRONGs}---------- ${HEADER}${SUB_HEADER} ----------${STRONGe}${NL}" else - echo "${STRONGs}-----${STRONGe}" # Separates lines within a header group + # Separate entries within a header group + if [[ ${FROM_WEBUI} == "true" ]]; then + echo + else + echo "${STRONGs}-----${STRONGe}" + fi fi } From f320dd96499800f8191cc13198cfb6903eeead85 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:11:57 -0600 Subject: [PATCH 040/108] Update custom.css: add noChanges class --- html/documentation/css/custom.css | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/html/documentation/css/custom.css b/html/documentation/css/custom.css index 21fbf7d5b..323bb12ab 100644 --- a/html/documentation/css/custom.css +++ b/html/documentation/css/custom.css @@ -269,6 +269,12 @@ body.dark { vertical-align: top; } +.noChanges { + font-weight: bold; + font-size: 110%; + padding: 5px 0 5px 2px; +} + .alert { padding: 5px; margin-bottom: 3px; @@ -887,4 +893,4 @@ div.sticky { } .ml-5 { margin-left: 3rem !important; -} \ No newline at end of file +} From 96b010d9c46c35cc34f12e753290328a2d9cee1a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:13:09 -0600 Subject: [PATCH 041/108] Update allskySettings.php: add "noChanges" class And change the message type to "message" since it's not a warning. --- html/includes/allskySettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/allskySettings.php b/html/includes/allskySettings.php index 615607215..43ff2a1f4 100644 --- a/html/includes/allskySettings.php +++ b/html/includes/allskySettings.php @@ -504,8 +504,8 @@ function DisplayAllskyConfig() { if ($ok) { if (! $changesMade && ! $fromConfiguration) { - $msg = "No settings changed. Nothing updated."; - $status->addMessage($msg, 'warning'); + $msg = "
      No settings changed. Nothing updated.
      "; + $status->addMessage($msg, 'message'); $msg = ""; } else if ($changes !== "") { $moreArgs = ""; From 51791e4ba1be1c8453f1ee2c3783fa181ebc64c1 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:51:28 -0600 Subject: [PATCH 042/108] Update installUpgradeFunctions.sh: Create file if needed If the installation log file doesn't exist and we try to write to it, we'll get an error. --- scripts/installUpgradeFunctions.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh index b20501efe..5f3a5524a 100644 --- a/scripts/installUpgradeFunctions.sh +++ b/scripts/installUpgradeFunctions.sh @@ -228,6 +228,10 @@ function display_msg() # ${DISPLAY_MSG_LOG} be set if ${LOG_IT} is true, but just in case, check. [[ ${LOG_IT} == "false" || -z ${DISPLAY_MSG_LOG} ]] && return + if [[ ! -f ${DISPLAY_MSG_LOG} ]]; then + mkdir -p "$( dirname "${DISPLAY_MSG_LOG}" )" + touch "${DISPLAY_MSG_LOG}" + fi # Strip out all color escape sequences before adding to log file. # The message may have an actual escape character or may have the From d2486a87b62879d88d59463b1465273ec2797292 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:09:34 -0600 Subject: [PATCH 043/108] Update install.sh: Warn in no RPi camera command was found --- install.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 0bcb6ceb4..a1e9592ff 100755 --- a/install.sh +++ b/install.sh @@ -302,10 +302,11 @@ CT=() # Camera Type array - what to display in whiptail get_connected_cameras() { - local CMD CC MSG NUM_RPI=0 NUM_ZWO=0 + local CMD CMD_RET CC MSG NUM_RPI=0 NUM_ZWO=0 # true == ignore errors. ${CMD} will be "" if no command found. CMD="$( determineCommandToUse "false" "" "true" 2> /dev/null )" + CMD_RET=$? # return of 2 means no command was found setup_rpi_supported_cameras "${CMD}" # Will create full file is CMD == "" # RPi format: RPi \t camera_number \t camera_sensor [\t optional_other_stuff] @@ -357,7 +358,12 @@ get_connected_cameras() whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3 MSG="No connected cameras were detected." - display_msg --log error "${MSG}" + local MSG2="" + if [[ ${CMD_RET} -eq 2 ]]; then + MSG2="No command to take RPi images was found" + MSG2+=" - make sure 'libcamera-apps' is installed if you have an RPi camera." + fi + display_msg --log error "${MSG}" "${MSG2}" exit_installation 1 "${STATUS_NO_CAMERA}" "" fi @@ -540,6 +546,7 @@ do_save_camera_capabilities() MSG="No camera was found; one must be connected and working for the installation to succeed.\n" MSG+="After connecting your camera, re-run the installation." whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3 + display_msg --log error "No camera detected - installation aborted." [[ -s ${TMP} ]] && display_msg --log error "$( < "${TMP}" )" exit_with_image 1 "${STATUS_ERROR}" "No camera detected" @@ -3518,8 +3525,8 @@ install_installer_dependencies() { sudo apt-get update && run_aptGet gawk jq dialog } > "${TMP}" 2>&1 - check_success $? "gawk,jq installation failed" "${TMP}" "${DEBUG}" || - exit_with_image 1 "${STATUS_ERROR}" "gawk,jq install failed." + check_success $? "gawk,jq,dialog installation failed" "${TMP}" "${DEBUG}" || + exit_with_image 1 "${STATUS_ERROR}" "gawk,jq,dialog install failed." STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" ) } @@ -3901,4 +3908,4 @@ else fi display_msg progress "\nEnjoy Allsky!\n" -exit_installation 0 "${STATUS_OK}" "" \ No newline at end of file +exit_installation 0 "${STATUS_OK}" "" From 33574ea3c33c58809c237754a6f98709d521feed Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:10:47 -0600 Subject: [PATCH 044/108] Update functions.sh: Keep track of RPi command was found --- scripts/functions.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index f7bc21e71..4a727e246 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -187,7 +187,7 @@ function determineCommandToUse() local PREFIX="${2}" # Only used if calling doExit(). local IGNORE_ERRORS="${3:-false}" # True if just checking - local CRET RET MSG EXIT_MSG + local CRET RET MSG EXIT_MSG CMD_FOUND="false" # If libcamera is installed and works, use it. # If it's not installed, or IS installed but doesn't work (the user may not have it configured), @@ -203,7 +203,9 @@ function determineCommandToUse() CRET=$? fi if [[ ${CRET} -eq 0 ]]; then - # Found the command - see if it works. + CMD_FOUND="true" # one of the commands were found. + + # Found a command - see if it works. "${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1 RET=$? if [[ ${RET} -eq 137 ]]; then @@ -230,9 +232,15 @@ function determineCommandToUse() fi fi - return 1 + if [[ ${CMD_FOUND} == "true" ]]; then + return 1 + else + return 2 # no command was found + fi fi + CMD_FOUND="true" # some command was found. + # On Buster, raspistill sometimes hangs if no camera is found, # so work around that. if ! timeout 4 "${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1 ; then From 531c3111eec953f861192873b145707ddd33afd1 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:17:54 -0600 Subject: [PATCH 045/108] Update install.sh: Pass results of determineCommandToUse() --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a1e9592ff..9f46f6528 100755 --- a/install.sh +++ b/install.sh @@ -312,7 +312,7 @@ get_connected_cameras() # RPi format: RPi \t camera_number \t camera_sensor [\t optional_other_stuff] # ZWO format: ZWO \t camera_number \t camera_model # "true" == ignore errors - get_connected_cameras_info "true" > "${CONNECTED_CAMERAS_INFO}" 2>/dev/null + get_connected_cameras_info --cmd "${CMD}" "true" > "${CONNECTED_CAMERAS_INFO}" 2>/dev/null # Get the RPi connected cameras, if any. CC="" From 97e6160b04f26b0756550ef071cb76a0c46ecdc2 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:22:04 -0600 Subject: [PATCH 046/108] Update functions.sh: check if determineCommandToUse() was already run --- scripts/functions.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 4a727e246..c8996ecd8 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -269,6 +269,12 @@ function determineCommandToUse() # Prepend each line with the CAMERA_TYPE. function get_connected_cameras_info() { + local RUN_dCTU="true" # determine Command To Use + if [[ ${1} == "--cmd" ]]; then + RUN_dCTU="false" + CMD_TO_USE_="${2}" + shift 2 + fi local IGNORE_ERRORS="${1:-false}" ####### Check for RPi @@ -276,7 +282,8 @@ function get_connected_cameras_info() # RPi camera_number camera_sensor # for each camera found. # camera_sensor will be one word. - if [[ -z ${CMD_TO_USE_} ]]; then + # Only run determineCommandToUse() if it wasn't already run. + if [[ -z ${CMD_TO_USE_} && ${RUN_dCTU} == "true" ]]; then determineCommandToUse "false" "" "${IGNORE_ERRORS}" > /dev/null fi if [[ -n ${CMD_TO_USE_} ]]; then From da2bc7325a8c8c821a35d836230256a9b74e3fb0 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 16:08:15 -0600 Subject: [PATCH 047/108] Update removeBadImages.sh: include timelapse in Usage message --- scripts/removeBadImages.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/removeBadImages.sh b/scripts/removeBadImages.sh index 40f3541fa..1176ae876 100755 --- a/scripts/removeBadImages.sh +++ b/scripts/removeBadImages.sh @@ -21,7 +21,8 @@ usage_and_exit() local RET="${1}" { echo - echo "Remove images with corrupt data which might mess up startrails and keograms." + echo "Remove images with corrupt data which might mess up startrails, keograms, and timelapse." + echo [ "${RET}" -ne 0 ] && echo -en "${RED}" echo -n "Usage: ${ME} [--help] [--debug] directory [file]" [ "${RET}" -ne 0 ] && echo -e "${NC}" From 880f2f7cbe180fa9095f03040bf0a39d259df742 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:11:55 -0600 Subject: [PATCH 048/108] Update functions.sh: Check for "Planetary Camera" in ZWO name This is the same as the recent problem with an older ASI120 camera with "ZWOptical company" in its USB name. --- scripts/functions.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index c8996ecd8..7948728ee 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -317,7 +317,8 @@ function get_connected_cameras_info() { if ($1 == "Bus" && $3 == "Device") { ZWO = $7; - if (ZWO == "ZWOptical" && $8 == "company") { + if ((ZWO == "ZWOptical" && $8 == "company") || + (ZWO == "Planetary" && $8 == "Camera")) { model = $9; model_cont = 10; } else { From 9a407bf7c95a111679c727f226c7a4f4caf04726 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:23:31 -0600 Subject: [PATCH 049/108] Update 2-bug_report.yml: mention attaching "install.log" if needed --- .github/ISSUE_TEMPLATE/2-bug_report.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/2-bug_report.yml b/.github/ISSUE_TEMPLATE/2-bug_report.yml index 9418fa4c7..cb1ba1a65 100644 --- a/.github/ISSUE_TEMPLATE/2-bug_report.yml +++ b/.github/ISSUE_TEMPLATE/2-bug_report.yml @@ -53,20 +53,20 @@ body: \* Include a clear and concise description of what the problem is. \* Include a screenshot of any error message(s). \* Can you reproduce it? If so, how? - \* Did any settings or anything else change? validations: required: true - type: textarea id: logs attributes: - label: Log / configuration files + label: Log and configuration files (ATTACH files, do NOT copy/paste them) description: | - ATTACH files, do NOT copy/paste them: + If the problem occured during installation, attach: + \* `~/allsky/config/logs/install.log`   - Follow the instructions for "Reporting Issues" in the Wiki, then attach `/var/log/allsky.log`. + Follow the instructions for "Reporting Issues" in the Allsky Documentation, then attach `/var/log/allsky.log`.   Attach `~/allsky/config/settings.json`, appending `.txt` to its name first.   If your problem is with an **Allsky Website**, also attach: \* `~/allsky/html/allsky/configuration.json` (local Website) - \* `~/allsky/config/remote_configuration.json` (remote Website) \ No newline at end of file + \* `~/allsky/config/remote_configuration.json` (remote Website) From a0e43e2a4ad20b321c46b16c91b2cec4f26cedc0 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 8 Dec 2024 21:47:19 -0600 Subject: [PATCH 050/108] Update ASI_functions.cpp: Fix misspellings --- src/ASI_functions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ASI_functions.cpp b/src/ASI_functions.cpp index c474a6488..2c8ef782a 100644 --- a/src/ASI_functions.cpp +++ b/src/ASI_functions.cpp @@ -337,17 +337,17 @@ ASI_CAMERA_INFO ASICameraInfoArray[] = 12, ASI_FALSE, ASI_FALSE }, - { "imx519", 0, "ArduCam 16 MP", 0, 3496, 4656, ASI_TRUE, + { "imx519", 0, "Arducam 16 MP", 0, 3496, 4656, ASI_TRUE, BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 1.22, ASI_FALSE, 10, ASI_FALSE, ASI_TRUE }, - { "arducam_64mp", 0, "ArduCam 64 MP", 0, 6944, 9152, ASI_TRUE, + { "arducam_64mp", 0, "Arducam 64 MP", 0, 6944, 9152, ASI_TRUE, BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 0.8, ASI_FALSE, 10, ASI_FALSE, ASI_TRUE }, - { "arducam-pivariety", 0, "ArduCam 462", 0, 1080, 1920, ASI_TRUE, + { "arducam-pivariety", 0, "Arducam 462", 0, 1080, 1920, ASI_TRUE, BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 2.9, ASI_FALSE, 10, ASI_FALSE, ASI_TRUE }, From f7dc10f49d4d8887cf3013b390cad0ecbb62820c Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:20:26 -0600 Subject: [PATCH 051/108] Update makeChanges.sh: tell prepare_local_website() to run postData It will run postData.sh, so remove it from this file --- scripts/makeChanges.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/makeChanges.sh b/scripts/makeChanges.sh index 9b6265d3b..740d8306e 100755 --- a/scripts/makeChanges.sh +++ b/scripts/makeChanges.sh @@ -621,8 +621,7 @@ do "uselocalwebsite") if [[ ${NEW_VALUE} == "true" ]]; then - prepare_local_website "" - "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles + prepare_local_website "" "postData" fi ;; From 7728a0e5eaf76a7679cf6cc4a1cf7ecf0fb5bd91 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:40:27 -0600 Subject: [PATCH 052/108] Update install.sh: tell prepare_local_website() to run postData.sh if needed --- install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 9f46f6528..959bfa0cd 100755 --- a/install.sh +++ b/install.sh @@ -2509,15 +2509,16 @@ restore_prior_files() else MSG="Your remote Website needs to be updated to this newest version." MSG+="\nIt is at version ${PRIOR_V}" - # This command will update the version. MSG+="\n\nRun: cd ~/allsky; ./remoteWebsiteInstall.sh" display_msg --log notice "${MSG}" fi else display_msg --log progress "${ITEM}: ${NOT_RESTORED}" - # Create a default file. +## FIX: TODO: why prepare the LOCAL website - the code above is for the REMOTE website. + # Create a default file prepare_local_website "" + fi # Do NOT restore options.json - it will be recreated. @@ -2584,7 +2585,7 @@ restore_prior_files() #### # If a prior local Website exists move its data to the new location. -# If using a remote website, copy it's config file. +# If using a remote website, copy its config file. restore_prior_website_files() { declare -n v="${FUNCNAME[0]}"; [[ ${v} == "true" ]] && return @@ -2707,11 +2708,11 @@ restore_prior_website_files() echo "When done, check in '${PRIOR_WEBSITE_DIR}' for any files" echo "you may have added; if there are any, store them in" echo -e "\n ${ALLSKY_WEBSITE_MYFILES_DIR}" - echo "then remove the old website: sudo rm -fr ${PRIOR_WEBSITE_DIR}" + echo "then remove the old Website: sudo rm -fr ${PRIOR_WEBSITE_DIR}" } >> "${POST_INSTALLATION_ACTIONS}" # Create a default file. - prepare_local_website "" + prepare_local_website "" "postData" else # NEW_STYLE_WEBSITE ITEM="${SPACE}${SPACE}${ALLSKY_WEBSITE_CONFIGURATION_NAME}" @@ -2733,6 +2734,9 @@ restore_prior_website_files() MSG="${SPACE}${SPACE}${SPACE}Already current @ version ${NEW_WEB_CONFIG_VERSION}" display_msg --logonly info "${MSG}" fi + + # Since the config file already exists, this will just run postData.sh: + prepare_local_website "" "postData" fi STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" ) From 45805bb250f9d164d70897bddb6a6ab80a2242ad Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:54:12 -0600 Subject: [PATCH 053/108] Update installUpgradeFunctions.sh: Run postData.sh if told to --- scripts/installUpgradeFunctions.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh index 5f3a5524a..6cbe32c74 100644 --- a/scripts/installUpgradeFunctions.sh +++ b/scripts/installUpgradeFunctions.sh @@ -618,6 +618,7 @@ function replace_website_placeholders() function prepare_local_website() { local FORCE="${1}" + local POST_DATA="${2}" display_msg --log progress "Creating default ${ALLSKY_WEBSITE_CONFIGURATION_NAME}." @@ -627,6 +628,16 @@ function prepare_local_website() fi replace_website_placeholders "local" "${ALLSKY_WEBSITE_CONFIGURATION_FILE}" + + if [[ ${POST_DATA} == "postData" && "$( settings ".uselocalwebsite" )" == "true" ]]; then + # --fromWebUI tells it to be mostly silent. + local MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles 2>&1 )" + if [[ $? -eq 0 ]]; then + display_msg --log progress "${MSG}" + else + display_msg --log warning "${MSG}" + fi + fi } From 5518b8b24a703d57cfe62324fcc8ec8ec189e124 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 01:09:03 -0600 Subject: [PATCH 054/108] Update Allsky.html: Add warning about camera being connected --- html/documentation/installations/Allsky.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html index e6cab0d9b..7ebd97318 100644 --- a/html/documentation/installations/Allsky.html +++ b/html/documentation/installations/Allsky.html @@ -28,7 +28,18 @@

      This page describes how to install and upgrade Allsky.

      -
      +
      +Your camera must be connected to the Pi prior to installation. +

      +If you have an RPi camera, run the following to make sure the camera can be seen by Allsky: +

      +libcamera-still --list-cameras
      +
      +If camera number 0 (the first camera) is n the list, you're good to go. +

      +
      + +

      We highly suggest installing the current version of Allsky on a clean SD card since a lot of files have changed and using a clean card will ensure a clutter-free environment with the most recent commands. @@ -36,7 +47,7 @@ See the instructions on how to image an SD card for use by Allsky. -

      +

      If a version of Allsky already exists

      From 6ed1b3a91013e6d8c4fc2a9e90fcbd269eaa562d Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 01:12:17 -0600 Subject: [PATCH 055/108] Update Allsky.html: Mention non-Raspberry Pi cameras --- html/documentation/installations/Allsky.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html index 7ebd97318..656d5a153 100644 --- a/html/documentation/installations/Allsky.html +++ b/html/documentation/installations/Allsky.html @@ -36,6 +36,9 @@ libcamera-still --list-cameras If camera number 0 (the first camera) is n the list, you're good to go. +
      +Note that some non-Raspberry Pi brand cameras may need special software installed and/or operating system +configuration changes - read the camera manual.

      From 5cdf446d8a4e65088c04e1006c09539c69734362 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:04:24 -0600 Subject: [PATCH 056/108] Update Allsky.html: correct typo --- html/documentation/installations/Allsky.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html index 656d5a153..554190709 100644 --- a/html/documentation/installations/Allsky.html +++ b/html/documentation/installations/Allsky.html @@ -35,7 +35,7 @@
       libcamera-still --list-cameras
       
      -If camera number 0 (the first camera) is n the list, you're good to go. +If camera number 0 (the first camera) is in the list, you're good to go.
      Note that some non-Raspberry Pi brand cameras may need special software installed and/or operating system configuration changes - read the camera manual. From cefafff933b284c5d0b01a1af4776c85d414386d Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:32:28 -0600 Subject: [PATCH 057/108] Update functions.sh: Correct check Unlike the "ZWOptical camera" string instead of "ZWO", "Planetary Camera" comes after the true model. --- scripts/functions.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 7948728ee..4eda42c7f 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -317,8 +317,8 @@ function get_connected_cameras_info() { if ($1 == "Bus" && $3 == "Device") { ZWO = $7; - if ((ZWO == "ZWOptical" && $8 == "company") || - (ZWO == "Planetary" && $8 == "Camera")) { + # Check for "ZWOptical company" instead of ZWO on some older cameras + if (ZWO == "ZWOptical" && $8 == "company") { model = $9; model_cont = 10; } else { @@ -327,7 +327,12 @@ function get_connected_cameras_info() } if (model != "") { # The model may have multiple tokens. - for (i=model_cont; i<= NF; i++) model = model " " $i + for (i=model_cont; i<= NF; i++) { + # Check for "ASI120 Planetary Camera" on some older cameras. + if ($i == "Planetary") + break; + model = model " " $i; + } printf("ZWO\t%d\t%s\n", num++, model); model = ""; # This camera was output } From 4fdac7e13eb76d3ab8d589cc61845a46ecd91c8f Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:23:25 -0600 Subject: [PATCH 058/108] Update index.html: Fix 2 broken links --- html/documentation/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/documentation/index.html b/html/documentation/index.html index e5d3a9315..76a6e83c0 100644 --- a/html/documentation/index.html +++ b/html/documentation/index.html @@ -26,8 +26,8 @@

      This documentation provides information for -installing, -configuring, +installing, +configuring, and running the Allsky software, including describing what various features like overlays From 2693d0d70d4895ddb304a10034bea14beeae9379 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:42:34 -0600 Subject: [PATCH 059/108] Update knownIssues.html: fix url --- html/documentation/knownIssues.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/knownIssues.html b/html/documentation/knownIssues.html index ab8700c42..2b986e026 100644 --- a/html/documentation/knownIssues.html +++ b/html/documentation/knownIssues.html @@ -44,7 +44,7 @@

      Image Capture

      RPi cameras don't support sensor temperature.
      : - See this workaround. + See this workaround.
      Future Plans: Will fix in the next major release for users running the Bullseye or Bookworm operating systems. From 50251a7ae136b1cafc50beb808a05954b5b48332 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 10 Dec 2024 22:05:32 +0000 Subject: [PATCH 060/108] #4048 Fix for pi 5 gpio access --- install.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 959bfa0cd..63e5accb9 100755 --- a/install.sh +++ b/install.sh @@ -3133,20 +3133,18 @@ install_Python() # gpiozero decodes the Pi revision number to calculate the Pi version so until the Pi 6 is # released this code will detect all future versions of the Pi 5 # - # NOTE: rpi-gpi and rpi-lgpio cannot co-exist but since blinka is not installing either we - # don't currently have to worry about removing rpi-gpio before installing rpi-lgpio - # local CMD="from gpiozero import Device" CMD+="\nDevice.ensure_pin_factory()" CMD+="\nprint(Device.pin_factory.board_info.model)" pimodel="$( echo -e "${CMD}" | python3 2>/dev/null )" # hide error since it only applies to Pi 5. - # if we are on the pi 5 then install lgpio, using the virtual environment which will always - # exist on the pi 5 + # if we are on the pi 5 then uninstall rpi.gpio, using the virtual environment which will always + # exist on the pi 5. lgpio is installed globally so will be used after rpi.gpio is removed + # Adatfruits blinka reinstalls rpi.gpio if [[ ${pimodel:0:1} == "5" ]]; then display_msg --log progress "Updating GPIO to lgpio" activate_python_venv - pip3 install rpi-lgpio > /dev/null 2>&1 + pip3 uninstall -y rpi.gpio > /dev/null 2>&1 fi STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" ) From f4a9ef1acf5762f742ff373a17bec115ae9e90a1 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:56:50 -0600 Subject: [PATCH 061/108] Update generateForDay.sh: remove thumbnail prior to generating timelapse Also, fix a minor bug with not doing timelapse if startrails fails. --- scripts/generateForDay.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh index 0e4f4f948..4eae661f7 100755 --- a/scripts/generateForDay.sh +++ b/scripts/generateForDay.sh @@ -289,7 +289,7 @@ if [[ ${DO_KEOGRAM} == "true" ]]; then DO_STARTRAILS="false" DO_TIMELAPSE="false" # -gt 90 means either no files or unable to read initial file, and - # keograms will have the same problem, so don't bother running. + # keograms and timelapse will have the same problem, so don't bother running. echo "Keogram creation unable to read files; will not run startrails or timelapse." fi @@ -353,11 +353,11 @@ if [[ ${DO_STARTRAILS} == "true" ]]; then ${STARTRAILS_EXTRA_PARAMETERS}" generate "Startrails, threshold=${BRIGHTNESS_THRESHOLD}" "startrails" "${CMD}" - if [[ $? -gt 90 && (${DO_KEOGRAM} == "true" || ${DO_TIMELAPSE} == "true") ]]; then - DO_STARTRAILS="false" + if [[ $? -gt 90 && ${DO_TIMELAPSE} == "true" ]]; then + DO_TIMELAPSE="false" # -gt 90 means either no files or unable to read initial file, and - # startrails will have the same problem, so don't bother running. - echo "Startrails creation unable to read files; will not run keogram or timelapse." + # timelapse will have the same problem, so don't bother running. + echo "Startrails creation unable to read files; will not run timelapse." fi else @@ -406,6 +406,7 @@ fi if [[ ${DO_TIMELAPSE} == "true" ]]; then VIDEO_FILE="allsky-${DATE}.mp4" + # Need a different name for the file so it's not mistaken for a regular image in the WebUI. THUMBNAIL_FILE="thumbnail-${DATE}.jpg" @@ -414,6 +415,9 @@ if [[ ${DO_TIMELAPSE} == "true" ]]; then TIMELAPSE_UPLOAD_THUMBNAIL="$( settings ".timelapseuploadthumbnail" )" if [[ ${TYPE} == "GENERATE" ]]; then + # If the thumbnail file exists it will used and produce errors, so delete it. + rm -f "${UPLOAD_THUMBNAIL}" + if [[ ${THUMBNAIL_ONLY} == "true" ]]; then if [[ -f ${UPLOAD_FILE} ]]; then RET=0 @@ -438,7 +442,6 @@ if [[ ${DO_TIMELAPSE} == "true" ]]; then RET=$? fi if [[ ${RET} -eq 0 && ${TIMELAPSE_UPLOAD_THUMBNAIL} == "true" && -s ${UPLOAD_FILE} ]]; then - rm -f "${UPLOAD_THUMBNAIL}" # Want the thumbnail to be near the start of the video, but not the first frame # since that can be a lousy frame. # If the video is less than 5 seconds, make_thumbnail won't work, so try again. From 87fb5f91696c60a0b0ec79a99e85bc566fc79d9e Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:12:38 -0600 Subject: [PATCH 062/108] Update RemoteServer.html: fix url --- html/documentation/installations/RemoteServer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/documentation/installations/RemoteServer.html b/html/documentation/installations/RemoteServer.html index 88a25e598..7c012e430 100644 --- a/html/documentation/installations/RemoteServer.html +++ b/html/documentation/installations/RemoteServer.html @@ -62,7 +62,7 @@

      Preparing the remote server

      of the WebUI's Allsky Settings page and fill in the settings. See the - + Allsky Settings page for a description of the settings.

      From 41c3e309701e0d627501c563ae759a79b35bc538 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 11 Dec 2024 20:19:14 +0000 Subject: [PATCH 063/108] 4048 Remove rpi.gpio on the pi 5 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 63e5accb9..821a5292c 100755 --- a/install.sh +++ b/install.sh @@ -3140,7 +3140,7 @@ install_Python() # if we are on the pi 5 then uninstall rpi.gpio, using the virtual environment which will always # exist on the pi 5. lgpio is installed globally so will be used after rpi.gpio is removed - # Adatfruits blinka reinstalls rpi.gpio + # Adafruits blinka reinstalls rpi.gpio so we need to ensure its removed if [[ ${pimodel:0:1} == "5" ]]; then display_msg --log progress "Updating GPIO to lgpio" activate_python_venv From 7856293503bec73e1ee0d4928da5c83b8c36303e Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:45:16 -0600 Subject: [PATCH 064/108] Update RemoteServer.html: warning about what page is about Fixes #4047 --- html/documentation/installations/RemoteServer.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/html/documentation/installations/RemoteServer.html b/html/documentation/installations/RemoteServer.html index 7c012e430..ca6b1b7e3 100644 --- a/html/documentation/installations/RemoteServer.html +++ b/html/documentation/installations/RemoteServer.html @@ -31,6 +31,14 @@ to accept uploads of the current Allsky image as well as startrails, keograms, and timelapse videos.

      + +
      +This page is for setting up a remote server, +which typically does not run an Allsky Website. +If you want to set up a remote Website, +click here. +
      +

      Why use a remote server?

      Since this server does NOT run the Allsky Website software you may wonder From 956d012633090a51438195bd6db3f298a44d5115 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:07:25 -0600 Subject: [PATCH 065/108] Update remoteWebsiteInstall.sh: add not about not removing images Fixes #4052 --- remoteWebsiteInstall.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 6115f5646..0fe7b2139 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -385,7 +385,9 @@ function display_welcome() 2) Upload the new remote Website code.\n\ 3) Upload the remote Website configuration file.\n\ 4) Enable the remote Website.\n\n\ - \ + \n\ + Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ +\ ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\ - Overwrite the old Allsky web files on the remote server.\n\ - Remove any old Allsky files from the remote server.\n\n\n\ From 619e929c15bc2824df7aab50dda56f9aee1e33c7 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:15:41 -0600 Subject: [PATCH 066/108] Update timelapse.sh: check for return code 137 Fixes #4028 For some reason, ffmpeg can be killed but we don't get a "Killed" message, but the return code is 137. Check for that. --- scripts/timelapse.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/timelapse.sh b/scripts/timelapse.sh index 7757a8770..e3087aafa 100755 --- a/scripts/timelapse.sh +++ b/scripts/timelapse.sh @@ -315,7 +315,6 @@ X="$( ffmpeg -y -f image2 \ ${EXTRA} \ "${OUTPUT_FILE}" 2>&1 )" RET=$? - # The "deprecated..." message is useless and only confuses users, so hide it. X="$( echo "${X}" | grep -E -v "deprecated pixel format used|Processed " )" [[ -n ${X} ]] && echo "${X}" >> "${TMP}" # a warning/error message @@ -327,6 +326,10 @@ if [[ ${RET} -ne -0 ]]; then if X="$( echo "${TMP}" | grep -E -i "Killed ffmpeg|malloc of size" )" ; then indent --spaces "${X}" echo -e "See the 'Troubleshooting -> Timelapse' documentation page for a fix.\n" + elif [[ ${RET} -eq 137 ]]; then + # Sometimes the process is killed but we don't get a Killed message. + indent --spaces "Killed ffmpeg\n${X}" + echo -e "See the 'Troubleshooting -> Timelapse' documentation page for a fix.\n" fi indent --spaces "Output: $( < "${TMP}" )" From 1040192736150a3227d64a422cbc19c9b4880f19 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:28:12 -0600 Subject: [PATCH 067/108] Update remoteWebsiteInstall.sh: Add -p to REMOTE_PORT earlier so it's always there. Fixes #4059 --- remoteWebsiteInstall.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 0fe7b2139..d3a065202 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -39,6 +39,7 @@ REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )" REMOTE_USER="$( settings ".REMOTEWEBSITE_USER" "${ALLSKY_ENV}" )" REMOTE_HOST="$( settings ".REMOTEWEBSITE_HOST" "${ALLSKY_ENV}" )" REMOTE_PORT="$( settings ".REMOTEWEBSITE_PORT" "${ALLSKY_ENV}" )" +[[ -n ${REMOTE_PORT} ]] && REMOTE_PORT="-p ${REMOTE_PORT}" REMOTE_PASSWORD="$( settings ".REMOTEWEBSITE_PASSWORD" "${ALLSKY_ENV}" )" REMOTE_DIR="$( settings ".remotewebsiteimagedir" "${SETTINGS_FILE}" )" REMOTE_PROTOCOL="$( settings ".remotewebsiteprotocol" "${SETTINGS_FILE}" )" @@ -612,8 +613,9 @@ function remove_remote_file() [[ -n ${REMOTE_DIR} ]] && CMDS="cd '${REMOTE_DIR}' ;" CMDS+=" rm -r '${FILENAME}' ; bye" + # shellcheck disable=SC2086 ERR="$( lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \ - "${REMOTE_PORT}" \ + ${REMOTE_PORT} \ "${REMOTE_PROTOCOL}://${REMOTE_HOST}" \ -e "${CMDS}" 2>&1 )" if [[ $? -eq 0 ]] ; then @@ -660,10 +662,6 @@ function upload_remote_website() local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG - if [[ -n ${REMOTE_PORT} ]]; then - REMOTE_PORT="-p ${REMOTE_PORT}" - fi - MSG="Starting upload to the remote Website" [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}" if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then From ba41c060c9592d5eddcc5e2020350732c51c44ee Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:50:44 -0600 Subject: [PATCH 068/108] Update imageSDcard.html: mention /opt/allsky --- .../explanations/imageSDcard.html | 75 +++++++++++-------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/html/documentation/explanations/imageSDcard.html b/html/documentation/explanations/imageSDcard.html index 42a7a35ba..9f36660fa 100644 --- a/html/documentation/explanations/imageSDcard.html +++ b/html/documentation/explanations/imageSDcard.html @@ -44,40 +44,49 @@

      1. Re-image an SD card but keep some files

      but keep your Allsky files.

      -If you have two SD cards, the process is straightforward: -

        -
      1. Image the second SD card using the - instructions below. -
      2. Plug the newly-imaged SD card into your Pi and turn it on. -
      3. Using an SD card-to-USB adapter, plug it into a USB port on your Pi - and copy whatever files you want from it to the main SD card. -
        - Copy the ~/allsky directory on the saved SD card - to ~/allsky-OLD on the main SD card. -
        -
      -

      -

      -If you only have one SD card, consider getting another one -and use the instructions above. -It's always good to have a spare SD card anyway in case the first one goes bad. -
      If you can't obtain a second card, do the following: -

        -
      1. Copy ~/allsky plus any other - files, images, etc. you want to keep from your SD card to a - USB drive, PC, Mac, or another device. -
      2. Image the SD card using the - instructions below. -
      3. Plug the newly-imaged SD card into your Pi and turn it on. -
      4. Restore your files to the SD card. -
        - Copy the saved ~/allsky directory to - ~/allsky-OLD on the new SD card. -
        -
      5. Install Allsky - and tell the installation you want to use the prior version of Allsky; - it will then restore your saved images, darks, and configuration files. +
          +
        1. If you have two SD cards, the process is straightforward: +
            +
          1. Image the second SD card using the + instructions below. +
          2. Plug the newly-imaged SD card into your Pi and turn it on. +
          3. Using an SD card-to-USB adapter, plug it into a USB port on your Pi and + copy the ~/allsky directory on the saved SD card + to ~/allsky-OLD on the new SD card. +
            If you have modules in the old card's /opt/allsky + directory, copy that directory to the new SD card using sudo. +
            Copy whatever other files you want from the old SD card to the new one. +
          + +
        2. If you only have one SD card, consider getting another one + and use the instructions above. + It's always good to have a spare SD card anyway in case the first one goes bad. +
          If you can't obtain a second card, do the following: +
            +
          1. Copy ~/allsky plus any other + files, images, etc. you want to keep from your SD card to a + USB drive, PC, Mac, or another device. +
            If you have modules in /opt/allsky, + copy that directory as well. + Suggestion: name its backup directory + opt-allsky, +
          2. Image the SD card using the + instructions below. +
          3. Plug the newly-imaged SD card into your Pi and turn it on. +
          4. Restore your files to the SD card. +
            + Copy the saved ~/allsky directory to + ~/allsky-OLD on the new SD card. +
            If you saved /opt/allsky, + copy that directory to the new SD card using sudo. +
        +Now +install Allsky +and tell the installation you want to use the prior version of Allsky; +it will then restore your saved images, darks, and configuration files. +You may want to leave your 2nd SD card or USB drive attached to the Pi in case you +missed some files.

        2. First install or "starting over"

        From 9b9e7d90cee2f45b23651e2e852c3cc0017ad2fc Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:23:07 -0600 Subject: [PATCH 069/108] Update remoteWebsiteInstall.sh: Add blank line for readability --- remoteWebsiteInstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index d3a065202..417fd5c14 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -388,7 +388,7 @@ function display_welcome() 4) Enable the remote Website.\n\n\ \n\ Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ -\ +\n\ ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\ - Overwrite the old Allsky web files on the remote server.\n\ - Remove any old Allsky files from the remote server.\n\n\n\ From cf793a56829e23a2c7ecd675daedba98a3afc592 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:32:34 -0600 Subject: [PATCH 070/108] Update remoteWebsiteInstall.sh: remove old "version" file --- remoteWebsiteInstall.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 417fd5c14..8827866c1 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -77,6 +77,7 @@ OLD_FILES_TO_REMOVE=( \ "getTime.php" \ "virtualsky.json" \ "README.md" \ + "version" \ "myImages") ############################################## functions From 0bde26ec8368d65f495f57222ac8ec0d8d4d99a7 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:54:15 -0600 Subject: [PATCH 071/108] Update install.sh: remove incorrect comment --- install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install.sh b/install.sh index 821a5292c..3efa4d002 100755 --- a/install.sh +++ b/install.sh @@ -2585,7 +2585,6 @@ restore_prior_files() #### # If a prior local Website exists move its data to the new location. -# If using a remote website, copy its config file. restore_prior_website_files() { declare -n v="${FUNCNAME[0]}"; [[ ${v} == "true" ]] && return From 655284f5e4de0ff51125d5d794b84a846b5933ba Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 14 Dec 2024 23:08:27 -0600 Subject: [PATCH 072/108] Update remoteWebsiteInstall.sh: Update version The AllskyVersion setting should always be updated whenever remoteWebsiteInstall.sh is run to keep it in sync with the main Allsky. --- remoteWebsiteInstall.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 8827866c1..23e710221 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -505,8 +505,7 @@ function update_old() # See 'pre_install_checks' for details on which configuration file is used. function create_website_config() { - local MSG="Creating configuration file from ${CONFIG_MESSAGE}" - display_msg --logonly info "${MSG}" + local MSG if [[ ${CONFIG_TO_USE} == "new" || ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then # Need a new config file so copy it from the repo and replace as many @@ -519,7 +518,10 @@ function create_website_config() MSG+=" from repo and updated placeholders." display_msg --logonly info "${MSG}" - elif [[ ${CONFIG_TO_USE} == "local" ]]; then + return + fi + + if [[ ${CONFIG_TO_USE} == "local" ]]; then # Using the remote config file on the Pi which may be new or old format. MSG="Using existing ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}" if update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ; then @@ -557,6 +559,9 @@ function create_website_config() display_aborted "${MSG}" "${ERR}" fi fi + + display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}" + update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" } # Check if a remote file, or array of files, exist. @@ -672,7 +677,7 @@ function upload_remote_website() # However, we must upload the index.php files. EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos" -# FIX: the --include doesn't work - the files aren't uploaded. +# ALEX: FIX: the --include doesn't work - the files aren't uploaded. # Do we need to do a second lftp mirror to upload them? EXCLUDE_FOLDERS+=" --include keograms/index.php" EXCLUDE_FOLDERS+=" --include startrails/index.php" From e67041432668c5813fc59d3fcd407d37ce93f202 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:44:26 -0600 Subject: [PATCH 073/108] Update remoteWebsiteInstall.sh: Rename some variables to better reflect their use --- remoteWebsiteInstall.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 23e710221..963363926 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -22,13 +22,13 @@ source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log" # Config variables -HAVE_NEW_CONFIG="false" +HAVE_LOCAL_CONFIG="false" HAVE_PRIOR_CONFIG="false" -HAVE_NEW_REMOTE_CONFIG="false" +HAVE_NEW_STYLE_REMOTE_CONFIG="false" HAVE_REALLY_OLD_REMOTE_CONFIG="false" CONFIG_TO_USE="" # which Website configuration file to use? CONFIG_MESSAGE="" -REMOTE_WEBSITE_EXISTS="false" +REMOTE_WEBSITE_IS_VALID="false" # Dialog size variables DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 )) @@ -232,7 +232,7 @@ function pre_install_checks() DT="FOUND" MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." display_msg --logonly info "${MSG}" - HAVE_NEW_CONFIG="true" + HAVE_LOCAL_CONFIG="true" ### FIX / TODO: Should this be used? # During Allsky upgrades, if the OLD directory exists users are asked if @@ -256,8 +256,8 @@ function pre_install_checks() DIALOG_TEXT+="\n2 - Checking for existing remote Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local INDENT=" " - REMOTE_WEBSITE_EXISTS="$( check_if_website_exists )" - if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then + REMOTE_WEBSITE_IS_VALID="$( check_if_website_exists )" + if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # If we didn't find a remote Website configuration file on the Pi, # it's "should be" an old-style Website since the user wasn't @@ -271,7 +271,7 @@ function pre_install_checks() display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}") if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then - HAVE_NEW_REMOTE_CONFIG="true" + HAVE_NEW_STYLE_REMOTE_CONFIG="true" DIALOG_TEXT+="Found." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" MSG="Found a current configuration file on the remote server." @@ -302,7 +302,7 @@ function pre_install_checks() DIALOG_TEXT+="NOT FOUND." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - if [[ ${HAVE_NEW_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then + if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then DIALOG_TEXT+="${DIALOG_RED}" DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists" DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found." @@ -313,8 +313,8 @@ function pre_install_checks() fi - if [[ ${HAVE_NEW_CONFIG} == "true" ]]; then - if [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then + if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then + if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then MSG="A remote configuration file was found but using the local version instead." else MSG="Using the local remote configuration file (no remote file found)." @@ -330,7 +330,7 @@ function pre_install_checks() CONFIG_TO_USE="prior" # it may be old or current format CONFIG_MESSAGE="the ${B}" - elif [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then + elif [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then MSG="Using new-style Website configuration file on the remote Website;" MSG+=" it will be downloaded and saved locally." display_msg --logonly info "${MSG}" @@ -670,7 +670,7 @@ function upload_remote_website() MSG="Starting upload to the remote Website" [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}" - if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then + if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # Don't upload images if the remote Website exists (we assume it already # has the images). From b5195769b4cd85c472606512968060b736a999c3 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:47:34 -0600 Subject: [PATCH 074/108] Update remoteWebsiteInstall.sh: Output msg if myImages exists Do NOT delete it because it probably contains files the user needs. --- remoteWebsiteInstall.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 963363926..8e82e9454 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -77,8 +77,8 @@ OLD_FILES_TO_REMOVE=( \ "getTime.php" \ "virtualsky.json" \ "README.md" \ - "version" \ - "myImages") + "version" ) +OLD_FILES_TO_WARN=( "myImages" ) ############################################## functions @@ -728,6 +728,22 @@ function upload_remote_website() remove_remote_file "${FILE_TO_DELETE}" "check" done + for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do + if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then + display_msg --logonly info "Old file '${FILE_TO_WARN}' exists." + if [[ ${FILE_TO_WARN} == "myImages" ]]; then +# TODO: move the files for the user + MSG="NOTE: move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles'," + MSG+=" then remove '${FILE_TO_WARN}'. It is no longer used." + else + MSG="NOTE: Please remove '${FILE_TO_WARN}' on the remote Website. It is no longer used." + fi + display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}" + else + display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist." + fi + done + display_msg --logonly info "Website upload complete" } From b07eb1494cd82a48b052255603169dda1886fbb6 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:50:05 -0600 Subject: [PATCH 075/108] Update remoteWebsiteInstall.sh: update comment for ALEX --- remoteWebsiteInstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 8e82e9454..43c22a33b 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -226,7 +226,6 @@ function pre_install_checks() DIALOG_TEXT+="\n1 - Checking for remote Website configuration file on Pi: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - if [[ -f ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then # 1a. DT="FOUND" @@ -234,11 +233,12 @@ function pre_install_checks() display_msg --logonly info "${MSG}" HAVE_LOCAL_CONFIG="true" -### FIX / TODO: Should this be used? +### FIX: ALEX: I don't think this "elif" part should be used. # During Allsky upgrades, if the OLD directory exists users are asked if # it should be used. If "yes", then the prior remote Website config file was # copied to the new Allsky, so 1a should match. # If the user answered "no", don't use OLD Allsky, we probably shouldn't either. +# HAVE_PRIOR_CONFIG should also be deleted. elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then # 1b. DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'" From 195937753c856e44aa6a8c015a58d9897af48ad2 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:59:17 -0600 Subject: [PATCH 076/108] Update remoteWebsiteInstall.sh: Shorter and more consistent messages --- remoteWebsiteInstall.sh | 68 +++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 43c22a33b..5051cf081 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -241,7 +241,7 @@ function pre_install_checks() # HAVE_PRIOR_CONFIG should also be deleted. elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then # 1b. - DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'" + DT="FOUND ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}." MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}." display_msg --logonly info "${MSG}" HAVE_PRIOR_CONFIG="true" @@ -263,7 +263,7 @@ function pre_install_checks() # it's "should be" an old-style Website since the user wasn't # using the WebUI to configure it. - DIALOG_TEXT+="FOUND." + DIALOG_TEXT+="WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" # 2a. @@ -272,13 +272,13 @@ function pre_install_checks() local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}") if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then HAVE_NEW_STYLE_REMOTE_CONFIG="true" - DIALOG_TEXT+="Found." + DIALOG_TEXT+="FOUND." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" MSG="Found a current configuration file on the remote server." display_msg --logonly info "${MSG}" else # 2b. - DIALOG_TEXT+="Not found." + DIALOG_TEXT+="NOT FOUND." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:" @@ -286,20 +286,20 @@ function pre_install_checks() local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}") if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then HAVE_REALLY_OLD_REMOTE_CONFIG="true" - DT="FOUND" + DT="FOUND." MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website." display_msg --logonly info "${MSG}" else # This "shouldn't" happen - the remote Website should have SOME type # of configuration file. - DT="NOT FOUND" + DT="NOT FOUND." fi - DIALOG_TEXT+="${DT}." + DIALOG_TEXT+="${DT}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" fi else # No remote Website found. - DIALOG_TEXT+="NOT FOUND." + DIALOG_TEXT+="NOT WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then @@ -315,9 +315,9 @@ function pre_install_checks() if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then - MSG="A remote configuration file was found but using the local version instead." + MSG="A new-style remote configuration file was found but using the local version instead." else - MSG="Using the local remote configuration file (no remote file found)." + MSG="Using the remote configuration file on the Pi (no remote file found)." fi display_msg --logonly info "${MSG}" CONFIG_TO_USE="local" # it may be old or current format @@ -345,9 +345,10 @@ function pre_install_checks() CONFIG_MESSAGE="a new" else - MSG="Unable to determine the configuration file to use. A new one will be created." + MSG="No configuration file found - a new one will be created." display_msg --logonly info "${MSG}" CONFIG_TO_USE="new" + CONFIG_MESSAGE="a new" fi DIALOG_TEXT+="\n * Checking ability to upload to it: " @@ -381,20 +382,17 @@ function display_welcome() if [[ ${AUTO_CONFIRM} == "false" ]]; then display_msg --logonly info "Displaying the welcome dialog." local DIALOG_TEXT="\n\ - This script will now:\n\n\ - \ - 1) Use ${CONFIG_MESSAGE} configuration file.\n\ +This script will now:\n\n\ + 1) Use ${CONFIG_MESSAGE} configuration file.\n\ 2) Upload the new remote Website code.\n\ 3) Upload the remote Website configuration file.\n\ - 4) Enable the remote Website.\n\n\ - \n\ - Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ + 4) Enable the remote Website.\n\ + 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ \n\ - ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\ + ${DIALOG_RED}NOTE: This will:${DIALOG_NORMAL}\n\ - Overwrite the old Allsky web files on the remote server.\n\ - Remove any old Allsky files from the remote server.\n\n\n\ ${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}" - if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then display_aborted "--user" "at the Welcome dialog" "" fi @@ -425,9 +423,6 @@ function display_aborted() DIALOG_PROMPT+="${DIALOG_UNDERLINE}Would you like to view the error message?${DIALOG_NORMAL}" if display_box "--yesno" "${DIALOG_INSTALL}" "${DIALOG_PROMPT}" ; then display_box "--msgbox" "${DIALOG_TITLE_LOG}" "${ERROR_MSG}" "--scrollbar" -if false; then - display_log_file "${DIALOG_TITLE_LOG}" "${DISPLAY_MSG_LOG}" -fi fi fi @@ -440,27 +435,28 @@ fi # Displays the completed dialog, used at the end of the installation process. function display_complete() { - local EXTRA_TEXT="" - local E=" Please use the WebUI's 'Editor' page to replace any '${NEED_TO_UPDATE}' with the correct values." + local EXTRA_TEXT E E2 + E="Use the WebUI's 'Editor' page to edit the" + E+=" '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)' file" + E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values." if [[ ${CONFIG_TO_USE} == "new" ]]; then - EXTRA_TEXT="\nA new configuration file was created for your remote Website." - EXTRA_TEXT+="${E}" + EXTRA_TEXT="A new configuration file was created." + EXTRA_TEXT+="\n ${E}${E2}" elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then - EXTRA_TEXT="\nYou have a very old remote Allsky Website so a new configuration file was created." - EXTRA_TEXT+="${E}" + EXTRA_TEXT="You had a very old remote Allsky Website so a new configuration file was created." + EXTRA_TEXT+="\n ${E}${E2}" + else + EXTRA_TEXT="${E} to change settings for your remote Website." fi - display_msg --logonly info "INSTALLATION COMPLETED.\n" - - local DIALOG_TEXT="\n\ - The installation of the remote Website is complete\n\ - and the remote Website should be working.\n\n\ - Please check it.\n\n\ - Use the WebUI's 'Editor' page to change settings for your Website.${EXTRA_TEXT}" + local DIALOG_TEXT="\n The installation of the remote Website is complete.\n\n Please check it." + DIALOG_TEXT+="\n\n ${EXTRA_TEXT}" display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}" clear # Gets rid of background color from last 'dialog' command. - display_msg info "\nEnjoy your remote Allsky Website!\n" + display_msg --log success "\nEnjoy your remote Allsky Website!\n\n${EXTRA_TEXT}" + + display_msg --logonly info "INSTALLATION COMPLETED.\n" } # Check connectivity to the remote Website by trying to upload a file to it. From de2f508a2b567b72188f15ef0a2766fcbfebaf6d Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 04:00:32 -0600 Subject: [PATCH 077/108] Update remoteWebsiteInstall.sh: rename function to better reflect what it checks --- remoteWebsiteInstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 5051cf081..fb6a1b93c 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -256,7 +256,7 @@ function pre_install_checks() DIALOG_TEXT+="\n2 - Checking for existing remote Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local INDENT=" " - REMOTE_WEBSITE_IS_VALID="$( check_if_website_exists )" + REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )" if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # If we didn't find a remote Website configuration file on the Pi, @@ -635,7 +635,7 @@ function remove_remote_file() # all of the ${WEBSITE_FILES} exist then assume we have a remote Website. # # Returns - echo "true" if it exists, else "false" -function check_if_website_exists() +function check_if_website_is_valid() { local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}") local WEBSITE_FILES=("index.php" "functions.php") From f42cc751807077ce307dec1be71565cbf68d7e5a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 04:23:51 -0600 Subject: [PATCH 078/108] Update remoteWebsiteInstall.sh: misc minor changes * Don't check if files exist before removing them (the check doesn't work for all files). * Misc. wording changes to messages. * Others --- remoteWebsiteInstall.sh | 94 ++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index fb6a1b93c..59e92d380 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -248,19 +248,19 @@ function pre_install_checks() else DT="NOT FOUND" - display_msg --logonly info "No local config files found." + display_msg --logonly info "No local config file found." fi DIALOG_TEXT+="${DT}." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - DIALOG_TEXT+="\n2 - Checking for existing remote Website: " + DIALOG_TEXT+="\n2 - Checking for working remote Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local INDENT=" " REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )" if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # If we didn't find a remote Website configuration file on the Pi, - # it's "should be" an old-style Website since the user wasn't + # it "should be" an old-style Website since the user wasn't # using the WebUI to configure it. DIALOG_TEXT+="WORKING." @@ -298,7 +298,7 @@ function pre_install_checks() display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" fi else - # No remote Website found. + # No working remote Website found. DIALOG_TEXT+="NOT WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" @@ -351,7 +351,7 @@ function pre_install_checks() CONFIG_MESSAGE="a new" fi - DIALOG_TEXT+="\n * Checking ability to upload to it: " + DIALOG_TEXT+="\n * Checking ability to upload to Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" display_msg --logonly info "Checking remote Website connectivity." local ERR="$( check_connectivity )" @@ -382,7 +382,7 @@ function display_welcome() if [[ ${AUTO_CONFIRM} == "false" ]]; then display_msg --logonly info "Displaying the welcome dialog." local DIALOG_TEXT="\n\ -This script will now:\n\n\ + This script will now:\n\n\ 1) Use ${CONFIG_MESSAGE} configuration file.\n\ 2) Upload the new remote Website code.\n\ 3) Upload the remote Website configuration file.\n\ @@ -427,7 +427,6 @@ function display_aborted() fi clear # Gets rid of background color from last 'dialog' command. - # Not needed: display_msg info "${ERROR_MSG}" exit 1 } @@ -540,24 +539,23 @@ function create_website_config() # Use the new remote config file since none were found locally. # Replace placeholders and convert it to the newest format. # Remember that the remote file name is different than what we store on the Pi. - if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_FILE}" 2>&1 )"; then + local FILE="${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}" + if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${FILE}" 2>&1 )"; then replace_website_placeholders "remote" update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" - MSG="Downloaded ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}," - MSG+=" to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." + MSG="Downloaded '${FILE}' to '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}'." display_msg --logonly info "${MSG}" else - # This "shouldn't" happen since we either already checked the file exists, + # This "shouldn't" happen since we either already checked that the file exists, # or we uploaded it. - MSG="Failed to download ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}." - MSG+=" Where did it go?" + MSG="Failed to download '${FILE}'. Where did it go?" display_aborted "${MSG}" "${ERR}" fi fi - display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}" update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}." } # Check if a remote file, or array of files, exist. @@ -566,6 +564,10 @@ function create_website_config() # ${3}... - the files # # Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist. + +# TODO: FIX: This doesn't work for "version" or "README.md" or probably any file whose +# type is unknown to the server. + function check_if_files_exist() { local URL="${1}" @@ -575,14 +577,14 @@ function check_if_files_exist() for FILE in "$@"; do url="${URL}/${FILE}" - HTTP_STATUS="$( curl -o /dev/null --head --silent --write-out "%{http_code}" "$url" )" + HTTP_STATUS="$( curl -o /dev/null --head --silent --location --write-out "%{http_code}" "$url" )" - local PRE_MSG="File ${FILE} ${url}" + local PRE_MSG="File '${FILE}'" if [[ ${HTTP_STATUS} == "200" ]] ; then show_debug_message "${PRE_MSG} exists on the remote server" RET_CODE=0 else - show_debug_message "${PRE_MSG} does not exists on the remote server" + show_debug_message "${PRE_MSG} does not exist on the remote server (HTTP_STATUS=${HTTP_STATUS})" if [[ ${AND_OR} == "and" ]]; then return 1 fi @@ -604,7 +606,6 @@ function remove_remote_file() if [[ ${CHECK} == "check" ]]; then if ! check_if_files_exist "${REMOTE_URL}" "or" "${FILENAME}" ; then - show_debug_message "===== not on server" return fi fi @@ -622,17 +623,20 @@ function remove_remote_file() -e "${CMDS}" 2>&1 )" if [[ $? -eq 0 ]] ; then MSG="Deleted remote file '${FILENAME}'" - else + elif [[ ! ${ERR} =~ "550" ]]; then # does not exist MSG="Unable to delete remote file '${FILENAME}': ${ERR}" + else + show_debug_message "'${FILENAME}' not on remote Website." + return fi display_msg --logonly info "${MSG}" } -# Check if a remote Website exists. -# The check is done by looking for the following files: -# If any of the ${CONFIG_FILES} files exist AND -# all of the ${WEBSITE_FILES} exist then assume we have a remote Website. +# Check if a valid remote Website exists. +# +# If any of the ${CONFIG_FILES} files exist AND +# all of the ${WEBSITE_FILES} exist then assume the remote Website is valid. # # Returns - echo "true" if it exists, else "false" function check_if_website_is_valid() @@ -640,15 +644,21 @@ function check_if_website_is_valid() local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}") local WEBSITE_FILES=("index.php" "functions.php") + display_msg --logonly info "Looking for a config file at ${REMOTE_URL}" if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then - show_debug_message "Found a remote Website config file" + local MSG=" Found a config file" if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then - display_msg --logonly info "Found a remote Allsky Website at ${REMOTE_URL}" + display_msg --logonly info "${MSG} and a valid Website." echo "true" return 0 + else + display_msg --logonly info "${MSG} but NOT a valid Website." fi + else + display_msg --logonly info " Did not find a config file; assuming invalid site" fi + echo "false" return 1 } @@ -669,7 +679,7 @@ function upload_remote_website() if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # Don't upload images if the remote Website exists (we assume it already - # has the images). + # has the images). "VALID" assumes "EXISTS". # However, we must upload the index.php files. EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos" @@ -679,6 +689,8 @@ function upload_remote_website() EXCLUDE_FOLDERS+=" --include startrails/index.php" EXCLUDE_FOLDERS+=" --include videos/index.php" MSG+=" (without videos, images, and their thumbnails)." + else + MSG+=" (including any videos, images, and their thumbnails)." fi display_msg --logonly info "${MSG}${EXTRA_TEXT}." @@ -721,7 +733,7 @@ function upload_remote_website() # Remove any old core files no longer required for FILE_TO_DELETE in "${OLD_FILES_TO_REMOVE[@]}"; do - remove_remote_file "${FILE_TO_DELETE}" "check" + remove_remote_file "${FILE_TO_DELETE}" "do not check" done for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do @@ -744,19 +756,31 @@ function upload_remote_website() } # Uploads the configuration file for the remote Website. -function upload_config_file() +function upload_remote_config_file() { - local MSG="\nUploading remote Allsky configuration file" + local MSG + + if [[ ! -f "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ]]; then + MSG="'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}' not found!" + display_msg --logonly info " ${MSG}" + display_aborted "at the configuration file upload" "${MSG}" + return 1 + fi + + MSG="\nUploading remote Allsky configuration file" display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}" display_msg --logonly info "Uploading Website configuration file." - local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web \ + local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web --silent \ "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_DIR}" \ - "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" 2>&1 )" + "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" "remoteWebsiteInstall" 2>&1 )" if [[ $? -eq 0 ]]; then - MSG="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} uploaded to" - MSG+="${REMOTE_DIR}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}" - show_debug_message "${MSG}" + local R="${REMOTE_DIR}" + [[ -n ${R} ]] && R+="/" + MSG="'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}' uploaded to" + MSG+=" '${R}${ALLSKY_WEBSITE_CONFIGURATION_NAME}'" + [[ ${DEBUG} == "true" && -n ${ERR} ]] && MSG+=" (${ERR})" + display_msg --logonly info "${MSG}" else display_msg --logonly info " Failed: ${ERR}" display_aborted "at the configuration file upload" "${ERR}" @@ -851,6 +875,6 @@ display_welcome create_website_config disable_remote_website upload_remote_website -upload_config_file +upload_remote_config_file enable_remote_website display_complete From 7fb7c5933b6c088eea0bbf138b2f4eb6e435924e Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 04:46:00 -0600 Subject: [PATCH 079/108] Update remoteWebsiteInstall.sh: shellcheck fixes --- remoteWebsiteInstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 59e92d380..a37b39bc0 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -104,7 +104,7 @@ function enter_yes_no() fi done - return ${RESULT} + return "${RESULT}" } # prompt the user to press any key. @@ -163,7 +163,7 @@ function display_box() else echo -e "${DIALOG_TEXT}" fi - return ${RET} + return "${RET}" fi # Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \ @@ -591,7 +591,7 @@ function check_if_files_exist() fi done - return ${RET_CODE} + return "${RET_CODE}" } # Deletes a file from the remote server. From dc866fedccf4d022c4262531dfed75e3201b0b88 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:37:53 -0600 Subject: [PATCH 080/108] Update variables.sh: Add disable SC2317 For some reason sourcing in variables.sh causes every subsequent line in every file to give SC2317 errors --- variables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.sh b/variables.sh index 10911885b..9214341c8 100644 --- a/variables.sh +++ b/variables.sh @@ -1,5 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034 # variable unused +# shellcheck disable=SC2034,SC2317 # variable unused, statement unreached # This file is source'd into other files to set some variables used by scripts. # This allows us to easily add and change directory names. From 09e98c5fdfeb04f5c573e06eac790af6f26db1af Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:44:40 -0600 Subject: [PATCH 081/108] Update ci_shellcheck.yml: Ignore SC2317 --- .github/workflows/ci_shellcheck.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml index 8da64c54a..17a21cf5c 100644 --- a/.github/workflows/ci_shellcheck.yml +++ b/.github/workflows/ci_shellcheck.yml @@ -17,15 +17,15 @@ jobs: # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job + # "steps" represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - # Runs a set of commands using the runners shell + # Runs a set of commands using the runner's shell - name: check bash files run: | - # check bash files (bash -n, shellchecki -x) + # check bash files (bash -n, shellcheck -x) err=0 for i in $(find . -maxdepth 2 -name '*.sh'); do echo "==================== $i" @@ -58,8 +58,9 @@ jobs: #SC2069: Something about the order of >&2 and > xxx #SC2024: similar to SC2069 #SC2269: This variable is assigned to itself + #SC2317: Command appears to be unreachable ###shellcheck -x -e SC1090 -e SC1091 -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1 - shellcheck -x -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1 + shellcheck -x -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 -e SC2317 $i || this_err=1 ;; esac if [ ${this_err} -eq 1 ]; then From a3b87bdfd8b3808f79938937c2afded4bc837b04 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:47:10 -0600 Subject: [PATCH 082/108] Update variables.sh: SC2317 ignored in yaml script not needed here --- variables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.sh b/variables.sh index 9214341c8..10911885b 100644 --- a/variables.sh +++ b/variables.sh @@ -1,5 +1,5 @@ #!/bin/bash -# shellcheck disable=SC2034,SC2317 # variable unused, statement unreached +# shellcheck disable=SC2034 # variable unused # This file is source'd into other files to set some variables used by scripts. # This allows us to easily add and change directory names. From ff1a30457ba8834c258dee8de6b770921e3d4fa1 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:54:34 -0600 Subject: [PATCH 083/108] Update generateForDay.sh: fix SC2086 --- scripts/generateForDay.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh index 4eae661f7..ebfcaea63 100755 --- a/scripts/generateForDay.sh +++ b/scripts/generateForDay.sh @@ -183,14 +183,14 @@ if [[ ${TYPE} == "GENERATE" ]]; then [[ -n ${DEBUG_ARG} ]] && echo "${ME}: Executing: ${CMD}" # shellcheck disable=SC2086 eval ${CMD} - RET=$? + local RET=$? if [[ ${RET} -ne 0 ]]; then echo -e "${RED}${ME}: Command Failed: ${CMD}${NC}" elif [[ ${SILENT} == "false" ]]; then echo -e "\tDone" fi - return ${RET} + return "${RET}" } else From 72d5f33815fbd3ba8ba46a3bf005dc83f4855361 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:57:04 -0600 Subject: [PATCH 084/108] Update postData.sh: SC2086 fix --- scripts/postData.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/postData.sh b/scripts/postData.sh index a6274ae6e..62ae3a110 100755 --- a/scripts/postData.sh +++ b/scripts/postData.sh @@ -83,7 +83,7 @@ while [[ $# -gt 0 ]]; do esac shift done -[[ ${RET} -ne 0 ]] && usage_and_exit ${RET} +[[ ${RET} -ne 0 ]] && usage_and_exit "${RET}" [[ ${HELP} == "true" ]] && usage_and_exit 0 From b5c1bcd612a44f3e3e7824ef183f49135c73d612 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 05:58:00 -0600 Subject: [PATCH 085/108] Update checkAllsky.sh: fix SC2086 --- scripts/checkAllsky.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh index b870c711c..a78f0b3a9 100755 --- a/scripts/checkAllsky.sh +++ b/scripts/checkAllsky.sh @@ -868,4 +868,4 @@ else fi fi -exit ${RET} +exit "${RET}" From 1a8e21b4a0b0cd8a75233b8987d11dde10a61d30 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:00:30 -0600 Subject: [PATCH 086/108] Update postToMap.sh: SC2086 fix --- scripts/postToMap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/postToMap.sh b/scripts/postToMap.sh index e33a5cc54..325d38608 100755 --- a/scripts/postToMap.sh +++ b/scripts/postToMap.sh @@ -73,7 +73,7 @@ function check_URL() else # Make sure it's a valid URL. Some servers don't return anything if the user agent is "curl". - local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout ${TIMEOUT} "${URL}" 2>&1 )" + local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout "${TIMEOUT}" "${URL}" 2>&1 )" local RET=$? if [[ ${DEBUG} == "true" ]]; then echo -e "\n${wDEBUG}" @@ -356,7 +356,7 @@ if [[ ${UPLOAD} == "true" ]]; then else echo -e "${ERROR_MSG_START}${E}${wNC}" fi - exit ${RETURN_CODE} + exit "${RETURN_CODE}" fi # Get the return string from the server. It's the last line of output. From e87e8879ce59920c15301b6f3cc0d79bef658fd9 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:01:32 -0600 Subject: [PATCH 087/108] Update testUpload.sh: SC2086 fix --- scripts/testUpload.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testUpload.sh b/scripts/testUpload.sh index b3965994d..9e1fc38e0 100755 --- a/scripts/testUpload.sh +++ b/scripts/testUpload.sh @@ -302,4 +302,4 @@ if [[ -s ${MSG_FILE} ]]; then fi rm -f "${MSG_FILE}" -exit ${RET} +exit "${RET}" From 1f2f57991b413f3781a8c5d2e755d152143ea12b Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:08:09 -0600 Subject: [PATCH 088/108] Update installUpgradeFunctions.sh: SC2086 fixes --- scripts/installUpgradeFunctions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh index 6cbe32c74..d7581df40 100644 --- a/scripts/installUpgradeFunctions.sh +++ b/scripts/installUpgradeFunctions.sh @@ -605,9 +605,9 @@ function replace_website_placeholders() config.camera "camera" "${CAMERA}" \ config.lens "lens" "${LENS}" \ config.computer "computer" "${COMPUTER}" \ - config.AllskyVersion "AllskyVersion" "${ALLSKY_VERSION}" \ - ${MINI_TLAPSE_DISPLAY} "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \ - ${MINI_TLAPSE_URL} "mini_url" "${MINI_TLAPSE_URL_VALUE}" + "${WEBSITE_ALLSKY_VERSION}" "AllskyVersion" "${ALLSKY_VERSION}" \ + "${MINI_TLAPSE_DISPLAY}" "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \ + "${MINI_TLAPSE_URL}" "mini_url" "${MINI_TLAPSE_URL_VALUE}" } From 91e6129ac9b67dac90dd24c8bbcfacad46de9a6c Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:10:01 -0600 Subject: [PATCH 089/108] Update saveImage.sh: SC2086 fix --- scripts/saveImage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/saveImage.sh b/scripts/saveImage.sh index 6b04b9557..f39025fe0 100755 --- a/scripts/saveImage.sh +++ b/scripts/saveImage.sh @@ -363,7 +363,7 @@ if [[ ${SAVE_IMAGE} == "true" ]]; then # Remove the oldest files if we haven't reached the limit. if [[ ${LEFT} -le 0 ]]; then KEEP=$((TIMELAPSE_MINI_IMAGES - TIMELAPSE_MINI_FREQUENCY)) - x="$( tail -${KEEP} "${MINI_TIMELAPSE_FILES}" )" + x="$( tail "-${KEEP}" "${MINI_TIMELAPSE_FILES}" )" echo -e "${x}" > "${MINI_TIMELAPSE_FILES}" if [[ ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then echo -en "${YELLOW}${ME}: Replaced ${TIMELAPSE_MINI_FREQUENCY} oldest, LEFT=$LEFT, KEEP=$KEEP" From bbc5b888513bb4d776c43dd2d3e3457d534cd443 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:12:26 -0600 Subject: [PATCH 090/108] Update remoteWebsiteInstall.sh: SC2086 fixes --- remoteWebsiteInstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 23e710221..660afd36d 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -104,7 +104,7 @@ function enter_yes_no() fi done - return ${RESULT} + return "${RESULT}" } # prompt the user to press any key. @@ -163,7 +163,7 @@ function display_box() else echo -e "${DIALOG_TEXT}" fi - return ${RET} + return "${RET}" fi # Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \ @@ -593,7 +593,7 @@ function check_if_files_exist() fi done - return ${RET_CODE} + return "${RET_CODE}" } # Deletes a file from the remote server. From e2d2787c789c1910b72bd051e6020b9f140ca93a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:16:03 -0600 Subject: [PATCH 091/108] Update ci_shellcheck.yml: update "paths" --- .github/workflows/ci_shellcheck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml index 17a21cf5c..f0e58657a 100644 --- a/.github/workflows/ci_shellcheck.yml +++ b/.github/workflows/ci_shellcheck.yml @@ -7,8 +7,8 @@ on: push: paths: - '*.sh' - - '*/*.sh' - - '*/*/*.sh' + - 'scripts/*.sh' + - 'scripts/utilities/*.sh' # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From 6308d0f21af288a68246b1b8bf8e91da1680c96b Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:20:51 -0600 Subject: [PATCH 092/108] Update ci_shellcheck.yml: go 3 levels --- .github/workflows/ci_shellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml index f0e58657a..9eab4c9fb 100644 --- a/.github/workflows/ci_shellcheck.yml +++ b/.github/workflows/ci_shellcheck.yml @@ -27,7 +27,7 @@ jobs: run: | # check bash files (bash -n, shellcheck -x) err=0 - for i in $(find . -maxdepth 2 -name '*.sh'); do + for i in $(find . -maxdepth 3 -name '*.sh'); do echo "==================== $i" bash -n $i if [ $? -ne 0 ]; then From d9ea172b747937a6b1e8de5383e55b735b866d23 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:23:02 -0600 Subject: [PATCH 093/108] Update allsky-config.sh: SC2086 fix --- scripts/utilities/allsky-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh index f102c7341..0aa76b5e1 100755 --- a/scripts/utilities/allsky-config.sh +++ b/scripts/utilities/allsky-config.sh @@ -268,7 +268,7 @@ function prompt() exit 2 else echo "${OPT}" - return ${RET} + return "${RET}" fi } From 27bdbf3641ee2d7f7480734ead5c048f3c038566 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:27:54 -0600 Subject: [PATCH 094/108] Update installSamba.sh: shellcheck fix --- scripts/utilities/installSamba.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/utilities/installSamba.sh b/scripts/utilities/installSamba.sh index ce8f82feb..3afdc87cd 100755 --- a/scripts/utilities/installSamba.sh +++ b/scripts/utilities/installSamba.sh @@ -75,6 +75,7 @@ echo echo -en "${BOLD}" echo "=============================================" echo -n "Press RETURN to continue with installation: " +# shellcheck disable=SC2034 read -r x echo -e "${NC}" From 8a3d5676d362d314b1f589a6711f93ba1a798b80 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 06:32:13 -0600 Subject: [PATCH 095/108] Update allsky-config.sh: shellcheck fixes --- scripts/utilities/allsky-config.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh index 0aa76b5e1..89574f55a 100755 --- a/scripts/utilities/allsky-config.sh +++ b/scripts/utilities/allsky-config.sh @@ -42,6 +42,7 @@ while [[ $# -gt 0 ]]; do *) CMD="${ARG}" shift + # shellcheck disable=SC2124 CMD_ARGS="${@}" break; ;; @@ -84,6 +85,7 @@ PATH="${PATH}:${ALLSKY_UTILITIES}" # Show all the supported cameras. function show_supported_cameras() { + # shellcheck disable=SC2124 local ARGS="${@}" #shellcheck disable=SC2086 @@ -98,7 +100,7 @@ function show_supported_cameras() ARGS="$( prompt "${PROMPT}" "${OPTS[@]}" )" fi - #shellcheck disable=SC2086 + # shellcheck disable=SC2086 show_supported_cameras.sh ${ARGS} } @@ -114,10 +116,13 @@ function show_connected_cameras() else local FORMAT="%-6s %-8s %s\n" echo + # shellcheck disable=SC2059 printf "${FORMAT}" "Type" "Number" "Model" + # shellcheck disable=SC2059 printf "${FORMAT}" "====" "======" "=====" echo -e "${CAMERAS}" | while read -r TYPE NUM MODEL do + # shellcheck disable=SC2059 printf "${FORMAT}" "${TYPE}" "${NUM}" "${MODEL}" done fi @@ -127,9 +132,10 @@ function show_connected_cameras() # Show all the currently connected cameras. function new_rpi_camera_info() { + # shellcheck disable=SC2124 local ARGS="${@}" # optional - #shellcheck disable=SC2086 + # shellcheck disable=SC2086 get_RPi_camera_info.sh ${ARGS} } @@ -232,6 +238,7 @@ function run_command() { COMMAND="${1}" shift + # shellcheck disable=SC2124 ARGUMENTS="${@}" if ! type "${COMMAND}" > /dev/null 2>&1 ; then echo -e "\n${RED}${ME}: Unknown command '${COMMAND}'.${NC}" >&2 @@ -294,7 +301,7 @@ if [[ -z ${CMD} ]]; then run_command "${COMMAND}" RET=$? - [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit ${RET} + [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit "${RET}" while true; do echo -e "\n\n" echo -e "${YELLOW}${BOLD}" From e2a29d75644b5e9f634c848f8436f786e1297718 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:05:45 -0600 Subject: [PATCH 096/108] Update installUpgradeFunctions.sh: fix comparison Fixes #4085 --- scripts/installUpgradeFunctions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh index d7581df40..3ee337277 100644 --- a/scripts/installUpgradeFunctions.sh +++ b/scripts/installUpgradeFunctions.sh @@ -500,11 +500,11 @@ function replace_website_placeholders() MINI_TLAPSE_URL_VALUE="" else MINI_TLAPSE_DISPLAY_VALUE="true" - if [[ ${DO_REMOTE_WEBSITE} == "true" ]]; then - MINI_TLAPSE_URL_VALUE="mini-timelapse.mp4" - else + if [[ ${TYPE} == "local" ]]; then #shellcheck disable=SC2153 MINI_TLAPSE_URL_VALUE="/${IMG_DIR}/mini-timelapse.mp4" + else + MINI_TLAPSE_URL_VALUE="mini-timelapse.mp4" fi fi else From 615574dfa323237fcd36b19f1b4b10e0374f23eb Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Fri, 20 Dec 2024 15:11:14 +0000 Subject: [PATCH 097/108] #4084 Fix for index.php files not being updated --- remoteWebsiteInstall.sh | 50 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index a37b39bc0..b16093512 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -90,19 +90,23 @@ function enter_yes_no() local RESULT=1 local ANSWER - while true; do - echo -e "${TEXT}" - read -r -p "Do you want to continue? (y/n): " ANSWER - ANSWER="${ANSWER,,}" # convert to lowercase - - if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then - return 0 - elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then - return 1 - else - echo -e "\nInvalid response. Please enter y/yes or n/no." - fi - done + if [[ ${AUTO_CONFIRM} == "false" ]]; then + while true; do + echo -e "${TEXT}" + read -r -p "Do you want to continue? (y/n): " ANSWER + ANSWER="${ANSWER,,}" # convert to lowercase + + if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then + return 0 + elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then + return 1 + else + echo -e "\nInvalid response. Please enter y/yes or n/no." + fi + done + else + return 0 + fi return "${RESULT}" } @@ -111,8 +115,10 @@ function enter_yes_no() # This function is only used when running in text (--text) mode. function press_any_key() { - echo -e "${1}\nPress any key to continue..." - read -r -n1 -s + if [[ ${AUTO_CONFIRM} == "false" ]]; then + echo -e "${1}\nPress any key to continue..." + read -r -n1 -s + fi } # Add a common heading to the dialog text. @@ -565,9 +571,6 @@ function create_website_config() # # Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist. -# TODO: FIX: This doesn't work for "version" or "README.md" or probably any file whose -# type is unknown to the server. - function check_if_files_exist() { local URL="${1}" @@ -672,7 +675,7 @@ function upload_remote_website() return fi - local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG + local EXTRA_TEXT="" EXCLUDE_FILES="" MSG MSG="Starting upload to the remote Website" [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}" @@ -681,13 +684,8 @@ function upload_remote_website() # Don't upload images if the remote Website exists (we assume it already # has the images). "VALID" assumes "EXISTS". # However, we must upload the index.php files. - EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos" + EXCLUDE_FILES="--exclude-glob=*.jpg --exclude-glob=*.mp4" -# ALEX: FIX: the --include doesn't work - the files aren't uploaded. -# Do we need to do a second lftp mirror to upload them? - EXCLUDE_FOLDERS+=" --include keograms/index.php" - EXCLUDE_FOLDERS+=" --include startrails/index.php" - EXCLUDE_FOLDERS+=" --include videos/index.php" MSG+=" (without videos, images, and their thumbnails)." else MSG+=" (including any videos, images, and their thumbnails)." @@ -709,7 +707,7 @@ function upload_remote_website() CMDS+="${NL}cd ." # for debugging fi CMDS+="${NL}mirror --reverse --no-perms --verbose --overwrite --ignore-time --transfer-all" - [[ -n ${EXCLUDE_FOLDERS} ]] && CMDS+=" ${EXCLUDE_FOLDERS}" + [[ -n ${EXCLUDE_FILES} ]] && CMDS+=" ${EXCLUDE_FILES}" CMDS+="${NL}bye" local TMP="${ALLSKY_TMP}/remote_upload.txt" From d171f715c113584091022f932c7a1f66b1d3f327 Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Fri, 20 Dec 2024 15:51:25 +0000 Subject: [PATCH 098/108] #4084 Fix for not using allsky-OLD configuration.json --- remoteWebsiteInstall.sh | 43 +++++++---------------------------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index b16093512..794c444ba 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -23,7 +23,6 @@ DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log" # Config variables HAVE_LOCAL_CONFIG="false" -HAVE_PRIOR_CONFIG="false" HAVE_NEW_STYLE_REMOTE_CONFIG="false" HAVE_REALLY_OLD_REMOTE_CONFIG="false" CONFIG_TO_USE="" # which Website configuration file to use? @@ -212,8 +211,8 @@ function display_log_file() # # 1a. If ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, use it. # -# 1b. If ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, -# copy it to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it. +# 1b. No longer used, assume upgrade of Allsky will copy the configuration file +# to the new installation # # 2a. If there's a remote Website with a ${ALLSKY_WEBSITE_CONFIGURATION_NAME} file, # save it locally as ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it. @@ -238,20 +237,6 @@ function pre_install_checks() MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." display_msg --logonly info "${MSG}" HAVE_LOCAL_CONFIG="true" - -### FIX: ALEX: I don't think this "elif" part should be used. -# During Allsky upgrades, if the OLD directory exists users are asked if -# it should be used. If "yes", then the prior remote Website config file was -# copied to the new Allsky, so 1a should match. -# If the user answered "no", don't use OLD Allsky, we probably shouldn't either. -# HAVE_PRIOR_CONFIG should also be deleted. - elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then - # 1b. - DT="FOUND ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}." - MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}." - display_msg --logonly info "${MSG}" - HAVE_PRIOR_CONFIG="true" - else DT="NOT FOUND" display_msg --logonly info "No local config file found." @@ -308,13 +293,17 @@ function pre_install_checks() DIALOG_TEXT+="NOT WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then + if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then DIALOG_TEXT+="${DIALOG_RED}" DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists" DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found." DIALOG_TEXT+="\n${INDENT}What is the configuration file for?" DIALOG_TEXT+="${DIALOG_NORMAL}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" + else + DIALOG_TEXT+="${DIALOG_RED}" + DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created." + DIALOG_TEXT+="${DIALOG_NORMAL}" fi fi @@ -329,13 +318,6 @@ function pre_install_checks() CONFIG_TO_USE="local" # it may be old or current format CONFIG_MESSAGE="the current remote" - elif [[ ${HAVE_PRIOR_CONFIG} == "true" ]]; then - local B="$( basename "${PRIOR_ALLSKY_DIR}" )" - MSG="Using the ${B} configuration file." - display_msg --logonly info "${MSG}" - CONFIG_TO_USE="prior" # it may be old or current format - CONFIG_MESSAGE="the ${B}" - elif [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then MSG="Using new-style Website configuration file on the remote Website;" MSG+=" it will be downloaded and saved locally." @@ -530,17 +512,6 @@ function create_website_config() fi display_msg --logonly info "${MSG}" - elif [[ ${CONFIG_TO_USE} == "prior" ]]; then - # Use the config file from the prior Allsky, replacing as many placeholders as we can. - # If the file is an older version, convert to the newest format. - cp "${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" - replace_website_placeholders "remote" - update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" - - MSG="Copied ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} from the" - MSG+=" $( basename "${PRIOR_ALLSKY_DIR}" ) directory and updated placeholders." - display_msg --logonly info "${MSG}" - elif [[ ${CONFIG_TO_USE} == "remoteNew" ]]; then # Use the new remote config file since none were found locally. # Replace placeholders and convert it to the newest format. From 5f816483506c5812da209258c8253d7092903e4b Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:02:50 -0600 Subject: [PATCH 099/108] Update remoteWebsiteInstall.sh: replace spaces with tabs To be consistent with everything else. --- remoteWebsiteInstall.sh | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 794c444ba..0fa27103d 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -89,23 +89,23 @@ function enter_yes_no() local RESULT=1 local ANSWER - if [[ ${AUTO_CONFIRM} == "false" ]]; then - while true; do - echo -e "${TEXT}" - read -r -p "Do you want to continue? (y/n): " ANSWER - ANSWER="${ANSWER,,}" # convert to lowercase - - if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then - return 0 - elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then - return 1 - else - echo -e "\nInvalid response. Please enter y/yes or n/no." - fi - done - else - return 0 - fi + if [[ ${AUTO_CONFIRM} == "false" ]]; then + while true; do + echo -e "${TEXT}" + read -r -p "Do you want to continue? (y/n): " ANSWER + ANSWER="${ANSWER,,}" # convert to lowercase + + if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then + return 0 + elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then + return 1 + else + echo -e "\nInvalid response. Please enter y/yes or n/no." + fi + done + else + return 0 + fi return "${RESULT}" } @@ -114,10 +114,10 @@ function enter_yes_no() # This function is only used when running in text (--text) mode. function press_any_key() { - if [[ ${AUTO_CONFIRM} == "false" ]]; then - echo -e "${1}\nPress any key to continue..." - read -r -n1 -s - fi + if [[ ${AUTO_CONFIRM} == "false" ]]; then + echo -e "${1}\nPress any key to continue..." + read -r -n1 -s + fi } # Add a common heading to the dialog text. @@ -300,10 +300,10 @@ function pre_install_checks() DIALOG_TEXT+="\n${INDENT}What is the configuration file for?" DIALOG_TEXT+="${DIALOG_NORMAL}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - else + else DIALOG_TEXT+="${DIALOG_RED}" DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created." - DIALOG_TEXT+="${DIALOG_NORMAL}" + DIALOG_TEXT+="${DIALOG_NORMAL}" fi fi From 0cef6d0ee87b1c03838b22d5b342c656beeb7098 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:39:04 -0600 Subject: [PATCH 100/108] Update remoteWebsiteInstall.sh: be more specific with excluded files only exclude ones in subdirectories. --- remoteWebsiteInstall.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 0fa27103d..235aef418 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -650,12 +650,17 @@ function upload_remote_website() MSG="Starting upload to the remote Website" [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}" + +# TODO: for == "false", should prompt user if they want the files uploaded. + if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # Don't upload images if the remote Website exists (we assume it already # has the images). "VALID" assumes "EXISTS". # However, we must upload the index.php files. - EXCLUDE_FILES="--exclude-glob=*.jpg --exclude-glob=*.mp4" + EXCLUDE_FILES="--exclude-glob=videos/*.mp4" + EXCLUDE_FILES+="--exclude-glob=keograms/*.jpg" + EXCLUDE_FILES+="--exclude-glob=startrails/*.jpg" MSG+=" (without videos, images, and their thumbnails)." else From 263e3b95e8dce2cc9e00deb9dc607f857264dd38 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:39:57 -0600 Subject: [PATCH 101/108] Update remoteWebsiteInstall.sh: run postData.sh And make debug statement more obvious. --- remoteWebsiteInstall.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 235aef418..49ea84bd9 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -555,10 +555,10 @@ function check_if_files_exist() local PRE_MSG="File '${FILE}'" if [[ ${HTTP_STATUS} == "200" ]] ; then - show_debug_message "${PRE_MSG} exists on the remote server" + show_debug_message "${PRE_MSG} EXISTS on the remote server" RET_CODE=0 else - show_debug_message "${PRE_MSG} does not exist on the remote server (HTTP_STATUS=${HTTP_STATUS})" + show_debug_message "${PRE_MSG} DOES NOT EXIST on the remote server (HTTP_STATUS=${HTTP_STATUS})" if [[ ${AND_OR} == "and" ]]; then return 1 fi @@ -804,6 +804,13 @@ function enable_remote_website() display_msg --logonly info "Remote Website enabled." } +function post_data() +{ + local MSG + MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --allfiles 2>&1 )" + display_msg --logonly info "${MSG}" +} + ############################################## main body OK="true" HELP="false" @@ -851,4 +858,5 @@ disable_remote_website upload_remote_website upload_remote_config_file enable_remote_website +post_data display_complete From 1c9bf400f3694f861d4fe6a16802f6aab2319a53 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 20 Dec 2024 23:17:53 -0600 Subject: [PATCH 102/108] Update remoteWebsiteInstall.sh: Fix excludes (add space) Also: * Add comment for future fix * Make final message to user easier to read. * Only update ALLSKY_VERSION if needed. * Ignore thumbnails * Shorten postData.sh output --- remoteWebsiteInstall.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 49ea84bd9..ff1843742 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -249,6 +249,9 @@ function pre_install_checks() local INDENT=" " REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )" if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then +# FIX: TODO: we only get here if there's SOME config file. +# check_if_website_is_valid() should set HAVE_NEW_STYLE_REMOTE_CONFIG and +# HAVE_REALLY_OLD_REMOTE_CONFIG so we don't do it again below. # If we didn't find a remote Website configuration file on the Pi, # it "should be" an old-style Website since the user wasn't @@ -424,7 +427,8 @@ function display_complete() { local EXTRA_TEXT E E2 E="Use the WebUI's 'Editor' page to edit the" - E+=" '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)' file" + E+="\n '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'" + E+="\n file" E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values." if [[ ${CONFIG_TO_USE} == "new" ]]; then EXTRA_TEXT="A new configuration file was created." @@ -531,8 +535,13 @@ function create_website_config() fi fi - update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" - display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}." + local VER="$( settings ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" )" + if [[ ${VER} == "${ALLSKY_VERSION}" ]]; then + display_msg --logonly info "'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}' already at ${ALLSKY_VERSION}." + else + update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" + display_msg --logonly info "Updated '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}' to ${ALLSKY_VERSION}." + fi } # Check if a remote file, or array of files, exist. @@ -659,9 +668,9 @@ function upload_remote_website() # has the images). "VALID" assumes "EXISTS". # However, we must upload the index.php files. EXCLUDE_FILES="--exclude-glob=videos/*.mp4" - EXCLUDE_FILES+="--exclude-glob=keograms/*.jpg" - EXCLUDE_FILES+="--exclude-glob=startrails/*.jpg" - + EXCLUDE_FILES+=" --exclude-glob=keograms/*.jpg" + EXCLUDE_FILES+=" --exclude-glob=startrails/*.jpg" + EXCLUDE_FILES+=" --exclude-glob=*/thumbnails/*.jpg" MSG+=" (without videos, images, and their thumbnails)." else MSG+=" (including any videos, images, and their thumbnails)." @@ -807,7 +816,8 @@ function enable_remote_website() function post_data() { local MSG - MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --allfiles 2>&1 )" + # --fromWebUI only displays summary. + MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles 2>&1 )" display_msg --logonly info "${MSG}" } From b518a953688923941ee327fa2f099cda11b2d1d7 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Fri, 20 Dec 2024 23:37:03 -0600 Subject: [PATCH 103/108] Update remoteWebsiteInstall.sh: Change myFiles dialog to msgbox so user sees it Also: * Added variables for indenting for consistency. --- remoteWebsiteInstall.sh | 55 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index ff1843742..7cac95076 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -32,6 +32,7 @@ REMOTE_WEBSITE_IS_VALID="false" # Dialog size variables DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 )) DIALOG_HEIGHT=25 +INDENT=" " # indent each line so it's easier to read # Remote connectivity variables REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )" @@ -246,7 +247,7 @@ function pre_install_checks() DIALOG_TEXT+="\n2 - Checking for working remote Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - local INDENT=" " + local SPACES="${INDENT}${INDENT}" REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )" if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then # FIX: TODO: we only get here if there's SOME config file. @@ -261,7 +262,7 @@ function pre_install_checks() display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" # 2a. - DIALOG_TEXT+="\n${INDENT}* Checking it for new-style configuration file: " + DIALOG_TEXT+="\n${SPACES}* Checking it for new-style configuration file: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}") if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then @@ -275,7 +276,7 @@ function pre_install_checks() DIALOG_TEXT+="NOT FOUND." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:" + DIALOG_TEXT+="\n${SPACES}* Checking it for old-style configuration file:" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}") if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then @@ -298,14 +299,14 @@ function pre_install_checks() if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then DIALOG_TEXT+="${DIALOG_RED}" - DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists" - DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found." - DIALOG_TEXT+="\n${INDENT}What is the configuration file for?" + DIALOG_TEXT+="\n${SPACES}WARNING: a remote configuration file exists" + DIALOG_TEXT+="\n${SPACES}but a remote Website wasn't found." + DIALOG_TEXT+="\n${SPACES}What is the configuration file for?" DIALOG_TEXT+="${DIALOG_NORMAL}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" else DIALOG_TEXT+="${DIALOG_RED}" - DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created." + DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found a new one will be created." DIALOG_TEXT+="${DIALOG_NORMAL}" fi @@ -342,7 +343,7 @@ function pre_install_checks() CONFIG_MESSAGE="a new" fi - DIALOG_TEXT+="\n * Checking ability to upload to Website: " + DIALOG_TEXT+="\n${SPACES} * Checking ability to upload to Website: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" display_msg --logonly info "Checking remote Website connectivity." local ERR="$( check_connectivity )" @@ -374,15 +375,15 @@ function display_welcome() display_msg --logonly info "Displaying the welcome dialog." local DIALOG_TEXT="\n\ This script will now:\n\n\ - 1) Use ${CONFIG_MESSAGE} configuration file.\n\ - 2) Upload the new remote Website code.\n\ - 3) Upload the remote Website configuration file.\n\ - 4) Enable the remote Website.\n\ - 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ +${INDENT} 1) Use ${CONFIG_MESSAGE} configuration file.\n\ +${INDENT} 2) Upload the new remote Website code.\n\ +${INDENT} 3) Upload the remote Website configuration file.\n\ +${INDENT} 4) Enable the remote Website.\n\ +${INDENT} 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\ \n\ ${DIALOG_RED}NOTE: This will:${DIALOG_NORMAL}\n\ - - Overwrite the old Allsky web files on the remote server.\n\ - - Remove any old Allsky files from the remote server.\n\n\n\ +${INDENT}- Overwrite the old Allsky web files on the remote server.\n\ +${INDENT}- Remove any old Allsky files from the remote server.\n\n\n\ ${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}" if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then display_aborted "--user" "at the Welcome dialog" "" @@ -427,21 +428,21 @@ function display_complete() { local EXTRA_TEXT E E2 E="Use the WebUI's 'Editor' page to edit the" - E+="\n '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'" - E+="\n file" + E+="\n${INDENT} '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'" + E+="\n${INDENT}file" E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values." if [[ ${CONFIG_TO_USE} == "new" ]]; then EXTRA_TEXT="A new configuration file was created." - EXTRA_TEXT+="\n ${E}${E2}" + EXTRA_TEXT+="\n${INDENT}${E}${E2}" elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then EXTRA_TEXT="You had a very old remote Allsky Website so a new configuration file was created." - EXTRA_TEXT+="\n ${E}${E2}" + EXTRA_TEXT+="\n${INDENT}${E}${E2}" else EXTRA_TEXT="${E} to change settings for your remote Website." fi - local DIALOG_TEXT="\n The installation of the remote Website is complete.\n\n Please check it." - DIALOG_TEXT+="\n\n ${EXTRA_TEXT}" + local DIALOG_TEXT="\n${INDENT}The installation of the remote Website is complete.\n\n${INDENT}Please check it." + DIALOG_TEXT+="\n\n${INDENT}${EXTRA_TEXT}" display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}" clear # Gets rid of background color from last 'dialog' command. @@ -721,15 +722,17 @@ function upload_remote_website() for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then - display_msg --logonly info "Old file '${FILE_TO_WARN}' exists." + display_msg --logonly info "Old file '${FILE_TO_WARN}' exists on server." + MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}" if [[ ${FILE_TO_WARN} == "myImages" ]]; then # TODO: move the files for the user - MSG="NOTE: move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles'," - MSG+=" then remove '${FILE_TO_WARN}'. It is no longer used." + MSG+="\n${INDENT}Move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles'," + MSG+="\n${INDENT}then remove '${FILE_TO_WARN}'." else - MSG="NOTE: Please remove '${FILE_TO_WARN}' on the remote Website. It is no longer used." + MSG+="\n${INDENT}Please remove '${FILE_TO_WARN}' on the remote Website." fi - display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}" + MSG+="\n${INDENT}It is no longer used." + display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}" else display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist." fi From 4deb36a679b326015be0011d1a8ff4b3fa75cd02 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 21 Dec 2024 00:06:52 -0600 Subject: [PATCH 104/108] Update remoteWebsiteInstall.sh: Don't check for config files twice. Also: * Change myFiles dialog to msgbox so user sees it * Added variables for indenting for consistency. * Improve message about no working Website. --- remoteWebsiteInstall.sh | 62 ++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index 7cac95076..c53054d7f 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -22,7 +22,7 @@ source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log" # Config variables -HAVE_LOCAL_CONFIG="false" +HAVE_LOCAL_REMOTE_CONFIG="false" HAVE_NEW_STYLE_REMOTE_CONFIG="false" HAVE_REALLY_OLD_REMOTE_CONFIG="false" CONFIG_TO_USE="" # which Website configuration file to use? @@ -237,7 +237,7 @@ function pre_install_checks() DT="FOUND" MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}." display_msg --logonly info "${MSG}" - HAVE_LOCAL_CONFIG="true" + HAVE_LOCAL_REMOTE_CONFIG="true" else DT="NOT FOUND" display_msg --logonly info "No local config file found." @@ -250,13 +250,7 @@ function pre_install_checks() local SPACES="${INDENT}${INDENT}" REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )" if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then -# FIX: TODO: we only get here if there's SOME config file. -# check_if_website_is_valid() should set HAVE_NEW_STYLE_REMOTE_CONFIG and -# HAVE_REALLY_OLD_REMOTE_CONFIG so we don't do it again below. - - # If we didn't find a remote Website configuration file on the Pi, - # it "should be" an old-style Website since the user wasn't - # using the WebUI to configure it. + # There is at least one config file. DIALOG_TEXT+="WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" @@ -264,13 +258,9 @@ function pre_install_checks() # 2a. DIALOG_TEXT+="\n${SPACES}* Checking it for new-style configuration file: " display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}") - if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then - HAVE_NEW_STYLE_REMOTE_CONFIG="true" + if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then DIALOG_TEXT+="FOUND." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - MSG="Found a current configuration file on the remote server." - display_msg --logonly info "${MSG}" else # 2b. DIALOG_TEXT+="NOT FOUND." @@ -278,16 +268,12 @@ function pre_install_checks() DIALOG_TEXT+="\n${SPACES}* Checking it for old-style configuration file:" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}") - if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then - HAVE_REALLY_OLD_REMOTE_CONFIG="true" + if [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]]; then DT="FOUND." - MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website." - display_msg --logonly info "${MSG}" else # This "shouldn't" happen - the remote Website should have SOME type # of configuration file. - DT="NOT FOUND." + DT="ERROR: NOT FOUND." fi DIALOG_TEXT+="${DT}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" @@ -297,16 +283,21 @@ function pre_install_checks() DIALOG_TEXT+="NOT WORKING." display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" - if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then + if [[ ${HAVE_LOCAL_REMOTE_CONFIG} == "true" ]]; then + # The remote's config file is on the Pi but the remote Website doesn't have a + # config file and/or the Website source files. + # This could happen if the user HAD a working remote Website but moved all the files to, + # for example, "allsky/OLD", before upgrading. DIALOG_TEXT+="${DIALOG_RED}" DIALOG_TEXT+="\n${SPACES}WARNING: a remote configuration file exists" - DIALOG_TEXT+="\n${SPACES}but a remote Website wasn't found." - DIALOG_TEXT+="\n${SPACES}What is the configuration file for?" + DIALOG_TEXT+="\n${SPACES}but a working remote Website wasn't found." + DIALOG_TEXT+="\n${SPACES}If you moved the remote Website before upgrading, ignore this message." + DIALOG_TEXT+="\n\n${SPACES}Either way, a new Website will be created." DIALOG_TEXT+="${DIALOG_NORMAL}" display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}" else DIALOG_TEXT+="${DIALOG_RED}" - DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found a new one will be created." + DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found so a new one will be created." DIALOG_TEXT+="${DIALOG_NORMAL}" fi @@ -625,12 +616,23 @@ function remove_remote_file() # Returns - echo "true" if it exists, else "false" function check_if_website_is_valid() { - local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}") + local FOUND="false" local WEBSITE_FILES=("index.php" "functions.php") - display_msg --logonly info "Looking for a config file at ${REMOTE_URL}" - if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then - local MSG=" Found a config file" + display_msg --logonly info "Looking for old and new config files at ${REMOTE_URL}" + if check_if_files_exist "${REMOTE_URL}" "or" "${OLD_CONFIG_NAME}" ; then + HAVE_REALLY_OLD_REMOTE_CONFIG="true" + FOUND="true" + fi + if check_if_files_exist "${REMOTE_URL}" "or" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" ; then + HAVE_NEW_STYLE_REMOTE_CONFIG="true" + FOUND="true" + fi + + if [[ ${FOUND} == "true" ]]; then + local MSG=" config files found:" + [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]] && MSG+=" ${OLD_CONFIG_NAME}" + [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]] && MSG+=" ${ALLSKY_WEBSITE_CONFIGURATION_NAME}" if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then display_msg --logonly info "${MSG} and a valid Website." @@ -640,7 +642,9 @@ function check_if_website_is_valid() display_msg --logonly info "${MSG} but NOT a valid Website." fi else - display_msg --logonly info " Did not find a config file; assuming invalid site" + # If the user just created the "allsky" directory on the Website but nothing else, + # we'll get here. + display_msg --logonly info " Did not find a config file; assuming new, unpopulated Website." fi echo "false" From d100ed4badb6b8a8cf9e94c7fbf71a28a9bcfc97 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 21 Dec 2024 00:20:43 -0600 Subject: [PATCH 105/108] Update remoteWebsiteInstall.sh: Simplify check for "myImages" Also, remove the ".git" directory. --- remoteWebsiteInstall.sh | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh index c53054d7f..f241d56f4 100755 --- a/remoteWebsiteInstall.sh +++ b/remoteWebsiteInstall.sh @@ -77,8 +77,8 @@ OLD_FILES_TO_REMOVE=( \ "getTime.php" \ "virtualsky.json" \ "README.md" \ - "version" ) -OLD_FILES_TO_WARN=( "myImages" ) + "version" \ + ".git/" ) ############################################## functions @@ -724,23 +724,20 @@ function upload_remote_website() remove_remote_file "${FILE_TO_DELETE}" "do not check" done - for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do - if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then - display_msg --logonly info "Old file '${FILE_TO_WARN}' exists on server." - MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}" - if [[ ${FILE_TO_WARN} == "myImages" ]]; then -# TODO: move the files for the user - MSG+="\n${INDENT}Move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles'," - MSG+="\n${INDENT}then remove '${FILE_TO_WARN}'." - else - MSG+="\n${INDENT}Please remove '${FILE_TO_WARN}' on the remote Website." - fi - MSG+="\n${INDENT}It is no longer used." - display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}" - else - display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist." - fi - done + local DIR="myImages" + if check_if_files_exist "${REMOTE_URL}" "or" "${DIR}" ; then + display_msg --logonly info "Old directory '${DIR}' exists on server." + + # It would be nice to move the files for the user, + # but almost no one has a "myImages" directory. + MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}" + MSG+="\n${INDENT}Move any files in '${DIR}' on the remote Website to" + MSG+="\n${INDENT}the 'myFiles' directory, then remove '${DIR}'." + MSG+="\n${INDENT}It is no longer used." + display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}" + else + display_msg --logonly info "Old file '${DIR}' does not exist." + fi display_msg --logonly info "Website upload complete" } From 53075b75939269e1331216e55204b543ff19ee81 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:34:36 -0600 Subject: [PATCH 106/108] Update public.php: remove spurious ); --- html/public.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/public.php b/html/public.php index 79ddd0132..0e54cc9ce 100644 --- a/html/public.php +++ b/html/public.php @@ -41,7 +41,7 @@ function getImage() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { console.log('broken image: ', err); } - }); + } }).finally(() => { // Use tail recursion to trigger the next invocation after `$delay` milliseconds setTimeout(function () { getImage(); }, ); From 5b262db9d2b307899a469addb02638a555ed135a Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:39:39 -0600 Subject: [PATCH 107/108] Update public.php: Add ; --- html/public.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/public.php b/html/public.php index 0e54cc9ce..8a6673258 100644 --- a/html/public.php +++ b/html/public.php @@ -46,7 +46,7 @@ function getImage() { // Use tail recursion to trigger the next invocation after `$delay` milliseconds setTimeout(function () { getImage(); }, ); }); - } + }; getImage(); From 26f6f0bce426d3045b817015bf697763c47cf48b Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Sat, 21 Dec 2024 21:41:01 +0000 Subject: [PATCH 108/108] Fix timed reload --- html/public.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html/public.php b/html/public.php index 8a6673258..5866713f9 100644 --- a/html/public.php +++ b/html/public.php @@ -41,11 +41,11 @@ function getImage() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { console.log('broken image: ', err); } - } - }).finally(() => { - // Use tail recursion to trigger the next invocation after `$delay` milliseconds - setTimeout(function () { getImage(); }, ); - }); + }).finally(() => { + // Use tail recursion to trigger the next invocation after `$delay` milliseconds + setTimeout(function () { getImage(); }, ); + } + ); }; getImage();