diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 6030e36d..018eccaf 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -85,3 +85,4 @@ with: name: updater.bin path: ${{ github.workspace }}/updater.bin + diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index e4378981..7f892325 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -9,20 +9,24 @@ on: - develop jobs: check_flasher: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Check flasher with proof-html - uses: anishathalye/proof-html@v2 - with: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Copy JS to the flasher + # This step is required to copy the JS file to the flasher directory to check it with proof-html + run: | + cp -f ${{ github.workspace }}/deploy/web_server/jaam_v2.js ${{ github.workspace }}/flasher/jaam_v2.js + - name: Check flasher with proof-html + uses: anishathalye/proof-html@v2 + with: directory: ${{ github.workspace }}/flasher run_black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run Black in the check mode - uses: psf/black@stable - with: - options: "--check --verbose --line-length 120 --diff --color --target-version py312" - src: ${{ github.workspace }}/deploy - version: "~= 24.0" \ No newline at end of file + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Black in the check mode + uses: psf/black@stable + with: + options: "--check --verbose --line-length 120 --diff --color --target-version py312" + src: ${{ github.workspace }}/deploy + version: "~= 24.0" \ No newline at end of file diff --git a/.github/workflows/upload-pages/action.yml b/.github/workflows/upload-pages/action.yml index 5853a054..09fa2318 100644 --- a/.github/workflows/upload-pages/action.yml +++ b/.github/workflows/upload-pages/action.yml @@ -30,6 +30,7 @@ runs: run: | sed -i 's/>Встановити JAAM [0-9.]*>Встановити JAAM ${{ inputs.version }}' ${{ github.workspace }}/flasher/index.html sed -i 's/"version": ".*",/"version": "${{ inputs.version }}",/' ${{ github.workspace }}/flasher/manifest.json + sed -i 's/fetchReleaseNotes('\''[0-9]\{1,\}\.[0-9]\{1,\}'\'')/fetchReleaseNotes('\''${{ inputs.version }}'\''/' ${{ github.workspace }}/flasher/index.html - name: Copy beta bin to flasher if: ${{ inputs.beta_binary_path != '' }} shell: bash @@ -41,6 +42,7 @@ runs: run: | sed -i 's/>Встановити JAAM [0-9.]* Beta [0-9]*>Встановити JAAM ${{ inputs.version }} Beta ${{ inputs.beta_build }}' ${{ github.workspace }}/flasher/index.html sed -i 's/"version": ".*",/"version": "${{ inputs.version }}-b${{ inputs.beta_build }}",/' ${{ github.workspace }}/flasher/manifest-beta.json + sed -i 's/fetchReleaseNotes('\''[0-9]\{1,\}\.[0-9]\{1,\}-b[0-9]\{1,\}'\'')/fetchReleaseNotes('\''${{ inputs.version }}-b${{ inputs.beta_build }}'\''/' ${{ github.workspace }}/flasher/index.html - name: Copy lite bin to flasher if: ${{ inputs.lite_binary_path != '' }} shell: bash @@ -52,6 +54,9 @@ runs: run: | sed -i 's/>Встановити JAAM [0-9.]* Lite>Встановити JAAM ${{ inputs.version }} Lite' ${{ github.workspace }}/flasher/index.html sed -i 's/"version": ".*",/"version": "${{ inputs.version }}",/' ${{ github.workspace }}/flasher/manifest-lite.json + - name: Copy JS to the flasher + run: | + cp -f ${{ github.workspace }}/deploy/web_server/jaam_v2.js ${{ github.workspace }}/flasher/jaam_v2.js - name: Setup Pages uses: actions/configure-pages@v4 - name: Upload artifact diff --git a/deploy/web_server/Dockerfile b/deploy/web_server/Dockerfile index 7a57c8fb..2f9eade1 100644 --- a/deploy/web_server/Dockerfile +++ b/deploy/web_server/Dockerfile @@ -3,6 +3,7 @@ ENV TZ="Europe/Kyiv" COPY web_server.py . COPY jaam_v1.css . COPY jaam_v1.js . +COPY jaam_v2.js . RUN --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \ python -m pip install --no-cache-dir -r /tmp/requirements.txt CMD python web_server.py \ No newline at end of file diff --git a/deploy/web_server/jaam_v1.js b/deploy/web_server/jaam_v1.js index a7c9ee68..5fdefa16 100644 --- a/deploy/web_server/jaam_v1.js +++ b/deploy/web_server/jaam_v1.js @@ -113,4 +113,4 @@ const urlParams = new URLSearchParams(window.location.search); $('input[name=alert_off_time]').prop('disabled', selectedOption == 0); $('input[name=explosion_time]').prop('disabled', selectedOption == 0); $('input[name=alert_blink_time]').prop('disabled', selectedOption != 2); - }); \ No newline at end of file + }); diff --git a/deploy/web_server/jaam_v2.js b/deploy/web_server/jaam_v2.js new file mode 100644 index 00000000..8446c0b4 --- /dev/null +++ b/deploy/web_server/jaam_v2.js @@ -0,0 +1,25 @@ +async function fetchReleaseNotes(version) { + // Get the version from the input parameter if provided, otherwise from the HTML element's data attribute + const releaseNotesElement = document.getElementById("release-notes"); + version = version || releaseNotesElement.getAttribute("data-version"); + + // Construct the API URL dynamically using the version + const apiUrl = `https://api.github.com/repos/J-A-A-M/ukraine_alarm_map/releases/tags/${version}`; + + try { + const response = await fetch(apiUrl); + + if (!response.ok) { + throw new Error(`Failed to fetch release notes: ${response.statusText}`); + } + + const data = await response.json(); + const releaseNotes = data.body; + + // Format the release notes using the https://github.com/markedjs/marked library and display them in the element + releaseNotesElement.innerHTML = marked.parse(releaseNotes); + + } catch (error) { + releaseNotesElement.textContent = `Error: ${error.message}`; + } +} diff --git a/firmware/src/JaamFirmware.cpp b/firmware/src/JaamFirmware.cpp index f71b58c3..4d094b19 100644 --- a/firmware/src/JaamFirmware.cpp +++ b/firmware/src/JaamFirmware.cpp @@ -468,10 +468,10 @@ int getNightModeType() { bool needToPlaySound(SoundType type) { #if BUZZER_ENABLED if (isBuzzerEnabled()) { - + // do not play any sound before websocket connection if (!isFirstDataFetchCompleted) return false; - + // ignore mute on alert if (SoundType::ALERT_ON == type && settings.sound_on_alert && settings.ignore_mute_on_alert) return true; @@ -1810,7 +1810,7 @@ void addCard(AsyncResponseStream* response, const char* title, V value, const ch void addHeader(AsyncResponseStream* response) { response->println(""); - response->println(""); + response->println(""); response->println("
"); response->println(""); response->println(""); @@ -1858,17 +1858,25 @@ void addHeader(AsyncResponseStream* response) { response->println("'>"); response->println(""); response->println(""); - response->println("Якщо ви не обрали порт через те, що не бачили ваш пристрій у списку, спробуйте наступні @@ -173,6 +181,8 @@