From 8c769d89d4e86ab4d216217a810abf23e16f6454 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Mon, 12 Jun 2023 15:08:02 +0200 Subject: [PATCH 1/9] Fixed isAd crash --- app/Helpers/Wrappers.php | 6 ----- composer.json | 2 +- composer.lock | 30 +++++++++++------------ templates/components/themes/default.latte | 1 - 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/app/Helpers/Wrappers.php b/app/Helpers/Wrappers.php index cd9a4e7..bd617bd 100644 --- a/app/Helpers/Wrappers.php +++ b/app/Helpers/Wrappers.php @@ -98,12 +98,6 @@ class Wrappers { // Add URLs to video descriptions // TODO: Make it work with unicode characters such as emojis $latte->addFunction('render_desc', function (string $desc, array $textExtras = []): string { - $bytesCount = strlen($desc); - $charsCount = mb_strlen($desc); - // Skip urlify for now if there is a special char like an emoji to avoid issues - if ($bytesCount !== $charsCount) { - return $desc; - } $sanitizedDesc = htmlspecialchars($desc); $out = $sanitizedDesc; foreach ($textExtras as $extra) { diff --git a/composer.json b/composer.json index 3c5d0a7..2aed83f 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pablouser1/proxitok", "description": "An alternative frontend for TikTok", - "version": "2.4.9.1", + "version": "2.4.9.2", "license": "AGPL-3.0-or-later", "type": "project", "authors": [ diff --git a/composer.lock b/composer.lock index 405d55e..1c6e522 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "790ea9098323ef66c520cfe44b92b7d3", + "content-hash": "92c34c828c921f4e49b6dc6ab9bf3d8b", "packages": [ { "name": "bramus/router", @@ -103,12 +103,12 @@ "source": { "type": "git", "url": "https://github.com/josegonzalez/php-dotenv.git", - "reference": "f6d2fb63610f98b7ae859031566228dbade1a79c" + "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/josegonzalez/php-dotenv/zipball/f6d2fb63610f98b7ae859031566228dbade1a79c", - "reference": "f6d2fb63610f98b7ae859031566228dbade1a79c", + "url": "https://api.github.com/repos/josegonzalez/php-dotenv/zipball/e97dbd3db53508dcd536e73ec787a7f11458d41d", + "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d", "shasum": "" }, "require": { @@ -116,9 +116,9 @@ "php": ">=5.5.0" }, "require-dev": { - "php-mock/php-mock-phpunit": "^1.1", - "satooshi/php-coveralls": "1.*", - "squizlabs/php_codesniffer": "2.*" + "php-coveralls/php-coveralls": "~2.0", + "php-mock/php-mock-phpunit": "~1.1||~2.0", + "squizlabs/php_codesniffer": "~2.9||~3.7" }, "default-branch": true, "type": "library", @@ -151,9 +151,9 @@ ], "support": { "issues": "https://github.com/josegonzalez/php-dotenv/issues", - "source": "https://github.com/josegonzalez/php-dotenv/tree/master" + "source": "https://github.com/josegonzalez/php-dotenv/tree/4.0.0" }, - "time": "2019-07-07T21:21:39+00:00" + "time": "2023-05-29T22:49:26+00:00" }, { "name": "latte/latte", @@ -614,16 +614,16 @@ }, { "name": "symfony/process", - "version": "v5.4.22", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "4b850da0cc3a2a9181c1ed407adbca4733dc839b" + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4b850da0cc3a2a9181c1ed407adbca4733dc839b", - "reference": "4b850da0cc3a2a9181c1ed407adbca4733dc839b", + "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", "shasum": "" }, "require": { @@ -656,7 +656,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.22" + "source": "https://github.com/symfony/process/tree/v5.4.24" }, "funding": [ { @@ -672,7 +672,7 @@ "type": "tidelift" } ], - "time": "2023-03-06T21:29:33+00:00" + "time": "2023-05-17T11:26:05+00:00" } ], "packages-dev": [], diff --git a/templates/components/themes/default.latte b/templates/components/themes/default.latte index a4e0390..72e9a36 100644 --- a/templates/components/themes/default.latte +++ b/templates/components/themes/default.latte @@ -34,7 +34,6 @@
{embed '../details.latte', title: "Details"} {block content} -

Is Ad: {bool_to_str($item->isAd)}

Can duet: {bool_to_str($item->duetEnabled)}

Can stitch (add this video to other ones): {bool_to_str($item->stitchEnabled)}

Can be shared: {bool_to_str($item->shareEnabled)} From 4a59dab75c0094f3f4de7e4040f18372406e683c Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Mon, 12 Jun 2023 15:20:42 +0200 Subject: [PATCH 2/9] Docker updated to PHP8.2 --- Dockerfile | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5e5b81..8b7094e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-apache +FROM php:8.2-apache WORKDIR /var/www/html COPY --from=composer /usr/bin/composer /usr/bin/composer RUN apt update -y && apt upgrade -y \ diff --git a/docker-compose.yml b/docker-compose.yml index ae98621..b26d855 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: web: container_name: proxitok-web - image: ghcr.io/pablouser1/proxitok:master + build: . ports: - 8080:80 environment: From 629da5f357fe1530210e9674ce3274f005bac398 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Mon, 12 Jun 2023 15:20:51 +0200 Subject: [PATCH 3/9] Fixed more crashing issues --- templates/components/themes/default.latte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/components/themes/default.latte b/templates/components/themes/default.latte index 72e9a36..a347189 100644 --- a/templates/components/themes/default.latte +++ b/templates/components/themes/default.latte @@ -34,9 +34,9 @@

{embed '../details.latte', title: "Details"} {block content} -

Can duet: {bool_to_str($item->duetEnabled)}

-

Can stitch (add this video to other ones): {bool_to_str($item->stitchEnabled)}

-

Can be shared: {bool_to_str($item->shareEnabled)} +

Can duet: {bool_to_str(isset($item->duetEnabled) ? $item->duetEnabled : boolval($item->duetDisplay))}

+

Can stitch (add this video to other ones): {bool_to_str(isset($item->stitchEnabled) ? $item->stitchEnabled : boolval($item->stitchDisplay))}

+

Can be shared: {bool_to_str(isset($item->shareEnabled) ? $item->shareEnabled : boolval($item->shareDisplay))} {/block} {/embed}

From 34623c8e430e2ed8404c0c81a9f1494393b331aa Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Mon, 12 Jun 2023 18:57:05 +0200 Subject: [PATCH 4/9] hotfix --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b26d855..ae98621 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: web: container_name: proxitok-web - build: . + image: ghcr.io/pablouser1/proxitok:master ports: - 8080:80 environment: From 15fdd41cadea07c03eca2f1df8799736bd5d5d5c Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Tue, 4 Jul 2023 16:39:53 +0200 Subject: [PATCH 5/9] small changes to UI --- templates/components/themes/default.latte | 8 +++++++- templates/views/user.latte | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/components/themes/default.latte b/templates/components/themes/default.latte index a347189..9fc4499 100644 --- a/templates/components/themes/default.latte +++ b/templates/components/themes/default.latte @@ -8,7 +8,13 @@

- {$item->author->nickname} + + {if $item->author->verified} + {include '../icon.latte', icon: 'check-o', text: $item->author->nickname} + {else} + {$item->author->nickname} + {/if} + @{$item->author->uniqueId} diff --git a/templates/views/user.latte b/templates/views/user.latte index 9f01839..ab868e6 100644 --- a/templates/views/user.latte +++ b/templates/views/user.latte @@ -12,9 +12,9 @@

{if $info->detail->verified} - {include '../components/icon.latte', icon: 'check-o', text: $info->detail->uniqueId} + {include '../components/icon.latte', icon: 'check-o', text: $info->detail->nickname} {else} - {$info->detail->uniqueId} + {$info->detail->nickname} {/if}

{include '../components/rss.latte'}

From 4f906ef80162bb2f7714e14d4ad5db0c22b5f12d Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Wed, 26 Jul 2023 21:41:37 +0200 Subject: [PATCH 6/9] new docker image --- .dockerignore | 13 +++++-------- Dockerfile | 39 ++++++++++++++++++--------------------- composer.json | 4 ++-- composer.lock | 9 +++------ docker-compose.yml | 2 +- misc/setup/docker/php.ini | 4 ++++ 6 files changed, 33 insertions(+), 38 deletions(-) create mode 100644 misc/setup/docker/php.ini diff --git a/.dockerignore b/.dockerignore index 0f5c25b..cb7f017 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,6 @@ node_modules -/.env -/.git -/.vscode -/vendor -/cache/latte/* -!/cache/latte/.gitkeep -/cache/api/* -!/cache/api/.gitkeep +.env +.git +.vscode +vendor +cache diff --git a/Dockerfile b/Dockerfile index 8b7094e..73a7f39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,22 @@ -FROM php:8.2-apache -WORKDIR /var/www/html +FROM trafex/php-nginx:latest + +# Add composer COPY --from=composer /usr/bin/composer /usr/bin/composer -RUN apt update -y && apt upgrade -y \ - && apt install -y --no-install-recommends libzip-dev \ - && pecl install redis zip \ - && docker-php-ext-enable redis zip \ - && a2enmod rewrite headers \ - && mkdir /cache \ - && chown -R www-data:www-data /cache \ - && rm -rf /var/www/html/* -# Copy project to /var/www/html -COPY . . +# Copy config +COPY ./misc/setup/docker/php.ini /etc/php81/conf.d/settings.ini -# Run composer and clean -RUN composer update --no-cache \ - && composer install --no-interaction --optimize-autoloader --no-dev --no-cache \ - && apt autoclean -y \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /usr/bin/composer +USER root +# Create cache folder +RUN mkdir /cache && chown -R nobody:nogroup /cache +# Install deps +RUN apk add --no-cache php81-redis php81-zip php81-tokenizer +USER nobody -EXPOSE 80 -CMD apachectl -D FOREGROUND +# Copy source +COPY --chown=nobody . /var/www/html + +# Dependencies +RUN composer install --no-interaction --optimize-autoloader --no-dev --no-cache + +EXPOSE 8080 diff --git a/composer.json b/composer.json index 2aed83f..90c8f2f 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ "ext-mbstring": "*", "latte/latte": "^2.11", "bramus/router": "^1.6", - "josegonzalez/dotenv": "dev-master", - "pablouser1/tikscraper": "^2.3" + "pablouser1/tikscraper": "^2.3", + "josegonzalez/dotenv": "^4.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 1c6e522..e81a484 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "92c34c828c921f4e49b6dc6ab9bf3d8b", + "content-hash": "f94f92790bfe52bdf38e6bd9ba80f40a", "packages": [ { "name": "bramus/router", @@ -99,7 +99,7 @@ }, { "name": "josegonzalez/dotenv", - "version": "dev-master", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/josegonzalez/php-dotenv.git", @@ -120,7 +120,6 @@ "php-mock/php-mock-phpunit": "~1.1||~2.0", "squizlabs/php_codesniffer": "~2.9||~3.7" }, - "default-branch": true, "type": "library", "autoload": { "psr-0": { @@ -678,9 +677,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "josegonzalez/dotenv": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docker-compose.yml b/docker-compose.yml index ae98621..935b2de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: proxitok-web image: ghcr.io/pablouser1/proxitok:master ports: - - 8080:80 + - 8080:8080 environment: - LATTE_CACHE=/cache - API_CACHE=redis diff --git a/misc/setup/docker/php.ini b/misc/setup/docker/php.ini new file mode 100644 index 0000000..3ae84f3 --- /dev/null +++ b/misc/setup/docker/php.ini @@ -0,0 +1,4 @@ +variables_order="EGPCS" +[Date] +date.timezone="UTC" +expose_php=Off From 5ba084dae18524d40ec259e3e20547689fd13686 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Wed, 26 Jul 2023 21:51:32 +0200 Subject: [PATCH 7/9] bump cosign and pin php-nginx version --- .github/workflows/docker-publish.yml | 4 ++-- Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 2461754..e44e707 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -42,9 +42,9 @@ jobs: # https://github.com/sigstore/cosign-installer - name: Install cosign if: github.event_name != 'pull_request' - uses: sigstore/cosign-installer@main + uses: sigstore/cosign-installer@v3.1.1 with: - cosign-release: 'v2.0.0-rc.0' + cosign-release: 'v2.1.1' # Workaround: https://github.com/docker/build-push-action/issues/461 diff --git a/Dockerfile b/Dockerfile index 73a7f39..9c3a029 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM trafex/php-nginx:latest +FROM trafex/php-nginx:3.1.0 # Add composer COPY --from=composer /usr/bin/composer /usr/bin/composer From 923d42c6c142eedc2eba73eaf3e79a4283692d70 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Wed, 26 Jul 2023 21:56:42 +0200 Subject: [PATCH 8/9] auto yes --- .github/workflows/docker-publish.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e44e707..8f0404f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -96,7 +96,6 @@ jobs: - name: Sign the published Docker image if: ${{ github.event_name != 'pull_request' }} env: - COSIGN_EXPERIMENTAL: "true" - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + TAGS: ${{ steps.meta.outputs.tags }} + run: cosign sign --yes "${TAGS}@${DIGEST}" From 9d9207b05e87b67d6255ca897771da34a7053f20 Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Wed, 26 Jul 2023 22:21:06 +0200 Subject: [PATCH 9/9] shut down signer (way) faster --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 935b2de..827eb9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,7 @@ services: signer: container_name: proxitok-signer image: ghcr.io/pablouser1/signtok:master + init: true networks: - proxitok user: nobody