From 23db88108de69cfb9b69123ca4167771f9bfbec4 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:14:53 -0600 Subject: [PATCH 01/14] Patch 6 (#3) * Code clean-up with the audio controller. Remove the unitended declaration of global variables. * Refactor audio_controller in object namespace style. Backward compatibility is kept. * Fixes #138: changing audio speed was partially broken. * Replaces calls to global audio functions by the new object. Removes the undocumented audio functions. * Avoid unnecessary function return type. * Fixes "text_id is unkown" on text opening. * Fixes warning on step 2 of feed wizard (related to #129) * Reorders functions to be in logical declaration order. * Code cleaning. * Refactoring jq_feedwizard as object namespace. * Synctactic sugar on jq_feedwizard.js. * Adds an helper object to avoid one-line JS. * Prettyfies JS code. * Isolates JS code in feed wizard step 3. * Use json_encode to avoid PHP incursion in JS code. Code prettyfying. * Beautify JS and avoid calls to deprecated functions. * Fixes JS errors on feeds: xPath was not set, and it was sometimes leave step 2. * Beautifies demo DB as the users has the right to see what they install. * Fix: the demo database was unreadable since last commit. restore_file is much better at parsing SQL. * Stop reading demo on errors, syntactic suger. * Better detection of file end not read. * Changes WoStatusChange to a value that doesn't need configuration change (#78). * Implementes #148: removes dead feeds from demo database. * Fixes a bug introduced in a previous commit. Signalled by @ProgramComputer. * Fixes #151: click delete on a language deletes the language. * Multi-image docker * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * future php platforms * less vulnerabilities for larger size * Lwt is accessed at /lwt/ https://hugofara.github.io/lwt/docs/info.html#install --------- Co-authored-by: HugoFara --- .github/workflows/docker-image.yml | 4 ++++ Dockerfile | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index bf1452c15..887247c06 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,8 +22,12 @@ jobs: platform: - linux/amd64 - linux/386 + - linux/arm/v5 - linux/arm/v7 - linux/arm64 + - linux/mips64le + - linux/ppc64le + - linux/s390x steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index 83ae33445..5d6c71d6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-apache-buster +FROM php:8.1-apache-bullseye # creating config file php.ini RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \ @@ -6,7 +6,7 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \ RUN docker-php-ext-install pdo pdo_mysql mysqli -COPY . /var/www/html/ +COPY . /var/www/html/lwt # creating connect.inc.php ARG DB_HOSTNAME=db From 5a0a8657c1f5847526a7500376c35a7395a20138 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:30:30 -0600 Subject: [PATCH 02/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 887247c06..5cee3f132 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -50,14 +50,21 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker images - uses: docker/build-push-action@v3 - with: - context: . - push: true - platforms: ${{ matrix.platform }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + # - name: Build and push Docker images + # uses: docker/build-push-action@v3 + # with: + # context: . + # push: true + # platforms: ${{ matrix.platform }} + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + - name: Build and push container image + run: | + # Build and Publish container image + docker buildx build --push \ + --tag ${{ steps.meta.outputs.tags }} \ + --label${{ steps.meta.outputs.labels }} \ + --platform {{ matrix.platform }} . - name: Build Docker images uses: docker/build-push-action@v3 with: From 71f371723752c87e5f0b9e9814d83b8bb8c2d890 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:31:40 -0600 Subject: [PATCH 03/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 5cee3f132..53f09a17b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -63,7 +63,7 @@ jobs: # Build and Publish container image docker buildx build --push \ --tag ${{ steps.meta.outputs.tags }} \ - --label${{ steps.meta.outputs.labels }} \ + --label ${{ steps.meta.outputs.labels}} \ --platform {{ matrix.platform }} . - name: Build Docker images uses: docker/build-push-action@v3 From 70880f139512aea8f940e9a15bd185decb34cff9 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:39:22 -0600 Subject: [PATCH 04/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 53f09a17b..887247c06 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -50,21 +50,14 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # - name: Build and push Docker images - # uses: docker/build-push-action@v3 - # with: - # context: . - # push: true - # platforms: ${{ matrix.platform }} - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} - - name: Build and push container image - run: | - # Build and Publish container image - docker buildx build --push \ - --tag ${{ steps.meta.outputs.tags }} \ - --label ${{ steps.meta.outputs.labels}} \ - --platform {{ matrix.platform }} . + - name: Build and push Docker images + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: ${{ matrix.platform }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Build Docker images uses: docker/build-push-action@v3 with: From 9f4b863710abbf3d8b184962b2447ccac9b80f47 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:44:07 -0600 Subject: [PATCH 05/14] Patch 6 (#4) * Code clean-up with the audio controller. Remove the unitended declaration of global variables. * Refactor audio_controller in object namespace style. Backward compatibility is kept. * Fixes #138: changing audio speed was partially broken. * Replaces calls to global audio functions by the new object. Removes the undocumented audio functions. * Avoid unnecessary function return type. * Fixes "text_id is unkown" on text opening. * Fixes warning on step 2 of feed wizard (related to #129) * Reorders functions to be in logical declaration order. * Code cleaning. * Refactoring jq_feedwizard as object namespace. * Synctactic sugar on jq_feedwizard.js. * Adds an helper object to avoid one-line JS. * Prettyfies JS code. * Isolates JS code in feed wizard step 3. * Use json_encode to avoid PHP incursion in JS code. Code prettyfying. * Beautify JS and avoid calls to deprecated functions. * Fixes JS errors on feeds: xPath was not set, and it was sometimes leave step 2. * Beautifies demo DB as the users has the right to see what they install. * Fix: the demo database was unreadable since last commit. restore_file is much better at parsing SQL. * Stop reading demo on errors, syntactic suger. * Better detection of file end not read. * Changes WoStatusChange to a value that doesn't need configuration change (#78). * Implementes #148: removes dead feeds from demo database. * Fixes a bug introduced in a previous commit. Signalled by @ProgramComputer. * Fixes #151: click delete on a language deletes the language. * Multi-image docker * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * Update docker-image.yml * future php platforms * less vulnerabilities for larger size * Lwt is accessed at /lwt/ https://hugofara.github.io/lwt/docs/info.html#install * Update Dockerfile --------- Co-authored-by: HugoFara --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5d6c71d6c..093c817ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ ARG DB_HOSTNAME=db ARG DB_USER=root ARG DB_PASSWORD=root ARG DB_DATABASE=learning-with-texts -RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/connect.inc.php +RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php From 6ea0848664dccd21fcf85a98bc4c5483ab1e8d7f Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 09:03:26 -0600 Subject: [PATCH 06/14] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 093c817ad..91a0a67d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,5 @@ ARG DB_HOSTNAME=db ARG DB_USER=root ARG DB_PASSWORD=root ARG DB_DATABASE=learning-with-texts +RUN echo "ServerName $DB_HOSTNAME" >> /etc/apache2/apache2.conf RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php From 03d9cf3be7840c0119c10cf0941ec7d824a98a2c Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 09:24:06 -0600 Subject: [PATCH 07/14] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 91a0a67d7..093c817ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,5 +13,4 @@ ARG DB_HOSTNAME=db ARG DB_USER=root ARG DB_PASSWORD=root ARG DB_DATABASE=learning-with-texts -RUN echo "ServerName $DB_HOSTNAME" >> /etc/apache2/apache2.conf RUN printf '' "$DB_HOSTNAME" "$DB_USER" "$DB_PASSWORD" "$DB_DATABASE" > /var/www/html/lwt/connect.inc.php From 55c23e077736a98051eb63718b6cd4075d939049 Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 10:06:49 -0600 Subject: [PATCH 08/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 887247c06..cb0477daf 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,15 +19,7 @@ jobs: strategy: fail-fast: false matrix: - platform: - - linux/amd64 - - linux/386 - - linux/arm/v5 - - linux/arm/v7 - - linux/arm64 - - linux/mips64le - - linux/ppc64le - - linux/s390x + platform: [linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x] steps: - name: Checkout repository uses: actions/checkout@v3 From 2081cd34f358456851f8e6494fd9e68075c4ef8f Mon Sep 17 00:00:00 2001 From: Paul <22284856+ProgramComputer@users.noreply.github.com> Date: Sat, 30 Dec 2023 10:24:53 -0600 Subject: [PATCH 09/14] Update docker-image.yml --- .github/workflows/docker-image.yml | 58 ++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index cb0477daf..f87c47cd6 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -13,13 +13,21 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: + build-and-upload-image: permissions: write-all runs-on: ubuntu-latest strategy: fail-fast: false matrix: - platform: [linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x] + platform: #change platform here and below if changed + - linux/amd64 + - linux/386 + - linux/arm/v5 + - linux/arm/v7 + - linux/arm64 + - linux/mips64le + - linux/ppc64le + - linux/s390x steps: - name: Checkout repository uses: actions/checkout@v3 @@ -41,15 +49,6 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker images - uses: docker/build-push-action@v3 - with: - context: . - push: true - platforms: ${{ matrix.platform }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - name: Build Docker images uses: docker/build-push-action@v3 with: @@ -67,3 +66,40 @@ jobs: file: /tmp/image.tar asset_name: ${{ github.ref_name }}-${{ matrix.platform }} tag: ${{ github.ref }} + build-and-push-image: + permissions: write-all + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker images + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 5e16b48ca097d1c691d86721deb5cef4a906dd3e Mon Sep 17 00:00:00 2001 From: ProgramComputer <22284856+ProgramComputer@users.noreply.github.com> Date: Sun, 31 Dec 2023 04:00:28 +0000 Subject: [PATCH 10/14] test no matrix --- .github/workflows/docker-image.yml | 59 ++++-------------------------- 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f87c47cd6..9ed908adf 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -13,21 +13,11 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-upload-image: + build-and-push-image: permissions: write-all runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - platform: #change platform here and below if changed - - linux/amd64 - - linux/386 - - linux/arm/v5 - - linux/arm/v7 - - linux/arm64 - - linux/mips64le - - linux/ppc64le - - linux/s390x steps: - name: Checkout repository uses: actions/checkout@v3 @@ -43,7 +33,11 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4 @@ -53,53 +47,14 @@ jobs: uses: docker/build-push-action@v3 with: context: . - platforms: ${{ matrix.platform }} + platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} outputs: type=oci,dest=/tmp/image.tar - if: ${{ github.event_name == 'release'}} - name: Upload binaries to release - if: ${{ github.event_name == 'release'}} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{secrets.GITHUB_TOKEN }} file: /tmp/image.tar asset_name: ${{ github.ref_name }}-${{ matrix.platform }} tag: ${{ github.ref }} - build-and-push-image: - permissions: write-all - runs-on: ubuntu-latest - strategy: - fail-fast: false - - steps: - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker images - uses: docker/build-push-action@v3 - with: - context: . - push: true - platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} From 6405662f9c2a89f748c48c7748cfe649e6e41fe0 Mon Sep 17 00:00:00 2001 From: ProgramComputer <22284856+ProgramComputer@users.noreply.github.com> Date: Sun, 31 Dec 2023 04:03:24 +0000 Subject: [PATCH 11/14] remove line --- .github/workflows/docker-image.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 9ed908adf..e12084fa7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -25,8 +25,7 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry uses: docker/login-action@v2 with: From 52c4970966c67cd2db33aedc53aa81a9a72f7cf4 Mon Sep 17 00:00:00 2001 From: ProgramComputer <22284856+ProgramComputer@users.noreply.github.com> Date: Sun, 31 Dec 2023 04:04:23 +0000 Subject: [PATCH 12/14] use once --- .github/workflows/docker-image.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e12084fa7..2a4d09393 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -37,11 +37,6 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build Docker images uses: docker/build-push-action@v3 with: From e56212fbe347bf668f1e311c57614e1882ded5ef Mon Sep 17 00:00:00 2001 From: ProgramComputer <22284856+ProgramComputer@users.noreply.github.com> Date: Sun, 31 Dec 2023 04:10:38 +0000 Subject: [PATCH 13/14] push is true --- .github/workflows/docker-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 2a4d09393..5fb3e9cb5 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -41,6 +41,7 @@ jobs: uses: docker/build-push-action@v3 with: context: . + push: true platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 38be41a20f034b91ec4b2add8d484cf90f909868 Mon Sep 17 00:00:00 2001 From: ProgramComputer <22284856+ProgramComputer@users.noreply.github.com> Date: Sun, 31 Dec 2023 04:13:17 +0000 Subject: [PATCH 14/14] no oci --- .github/workflows/docker-image.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 5fb3e9cb5..4f33787ab 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -37,6 +37,14 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker images + uses: docker/build-push-action@v3 + with: + context: . + push: true + platforms: linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64,linux/mips64le,linux/ppc64le,linux/s390x + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Build Docker images uses: docker/build-push-action@v3 with: