diff --git a/.dockerignore b/.dockerignore index cb7f017..0f5c25b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,9 @@ node_modules -.env -.git -.vscode -vendor -cache +/.env +/.git +/.vscode +/vendor +/cache/latte/* +!/cache/latte/.gitkeep +/cache/api/* +!/cache/api/.gitkeep diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8f0404f..2461754 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@v3.1.1 + uses: sigstore/cosign-installer@main with: - cosign-release: 'v2.1.1' + cosign-release: 'v2.0.0-rc.0' # Workaround: https://github.com/docker/build-push-action/issues/461 @@ -96,6 +96,7 @@ jobs: - name: Sign the published Docker image if: ${{ github.event_name != 'pull_request' }} env: - DIGEST: ${{ steps.build-and-push.outputs.digest }} - TAGS: ${{ steps.meta.outputs.tags }} - run: cosign sign --yes "${TAGS}@${DIGEST}" + 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 }} diff --git a/Dockerfile b/Dockerfile index 9c3a029..c5e5b81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,25 @@ -FROM trafex/php-nginx:3.1.0 - -# Add composer +FROM php:8.1-apache +WORKDIR /var/www/html 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 config -COPY ./misc/setup/docker/php.ini /etc/php81/conf.d/settings.ini +# Copy project to /var/www/html +COPY . . -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 +# 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 -# Copy source -COPY --chown=nobody . /var/www/html - -# Dependencies -RUN composer install --no-interaction --optimize-autoloader --no-dev --no-cache - -EXPOSE 8080 +EXPOSE 80 +CMD apachectl -D FOREGROUND diff --git a/app/Helpers/Wrappers.php b/app/Helpers/Wrappers.php index bd617bd..cd9a4e7 100644 --- a/app/Helpers/Wrappers.php +++ b/app/Helpers/Wrappers.php @@ -98,6 +98,12 @@ 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 90c8f2f..3c5d0a7 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pablouser1/proxitok", "description": "An alternative frontend for TikTok", - "version": "2.4.9.2", + "version": "2.4.9.1", "license": "AGPL-3.0-or-later", "type": "project", "authors": [ @@ -23,8 +23,8 @@ "ext-mbstring": "*", "latte/latte": "^2.11", "bramus/router": "^1.6", - "pablouser1/tikscraper": "^2.3", - "josegonzalez/dotenv": "^4.0" + "josegonzalez/dotenv": "dev-master", + "pablouser1/tikscraper": "^2.3" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index e81a484..405d55e 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": "f94f92790bfe52bdf38e6bd9ba80f40a", + "content-hash": "790ea9098323ef66c520cfe44b92b7d3", "packages": [ { "name": "bramus/router", @@ -99,16 +99,16 @@ }, { "name": "josegonzalez/dotenv", - "version": "4.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/josegonzalez/php-dotenv.git", - "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d" + "reference": "f6d2fb63610f98b7ae859031566228dbade1a79c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/josegonzalez/php-dotenv/zipball/e97dbd3db53508dcd536e73ec787a7f11458d41d", - "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d", + "url": "https://api.github.com/repos/josegonzalez/php-dotenv/zipball/f6d2fb63610f98b7ae859031566228dbade1a79c", + "reference": "f6d2fb63610f98b7ae859031566228dbade1a79c", "shasum": "" }, "require": { @@ -116,10 +116,11 @@ "php": ">=5.5.0" }, "require-dev": { - "php-coveralls/php-coveralls": "~2.0", - "php-mock/php-mock-phpunit": "~1.1||~2.0", - "squizlabs/php_codesniffer": "~2.9||~3.7" + "php-mock/php-mock-phpunit": "^1.1", + "satooshi/php-coveralls": "1.*", + "squizlabs/php_codesniffer": "2.*" }, + "default-branch": true, "type": "library", "autoload": { "psr-0": { @@ -150,9 +151,9 @@ ], "support": { "issues": "https://github.com/josegonzalez/php-dotenv/issues", - "source": "https://github.com/josegonzalez/php-dotenv/tree/4.0.0" + "source": "https://github.com/josegonzalez/php-dotenv/tree/master" }, - "time": "2023-05-29T22:49:26+00:00" + "time": "2019-07-07T21:21:39+00:00" }, { "name": "latte/latte", @@ -613,16 +614,16 @@ }, { "name": "symfony/process", - "version": "v5.4.24", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" + "reference": "4b850da0cc3a2a9181c1ed407adbca4733dc839b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", - "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", + "url": "https://api.github.com/repos/symfony/process/zipball/4b850da0cc3a2a9181c1ed407adbca4733dc839b", + "reference": "4b850da0cc3a2a9181c1ed407adbca4733dc839b", "shasum": "" }, "require": { @@ -655,7 +656,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.24" + "source": "https://github.com/symfony/process/tree/v5.4.22" }, "funding": [ { @@ -671,13 +672,15 @@ "type": "tidelift" } ], - "time": "2023-05-17T11:26:05+00:00" + "time": "2023-03-06T21:29:33+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "josegonzalez/dotenv": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docker-compose.yml b/docker-compose.yml index 53de68a..5503751 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,8 @@ services: web: container_name: proxitok-web image: ghcr.io/pablouser1/proxitok:master - # ports: - # - 8080:8080 + # ports: + # - 8080:80 environment: - LATTE_CACHE=/cache - API_CACHE=redis @@ -64,7 +64,6 @@ services: signer: container_name: proxitok-signer image: ghcr.io/pablouser1/signtok:master - init: true networks: - proxitok user: nobody diff --git a/misc/setup/docker/php.ini b/misc/setup/docker/php.ini deleted file mode 100644 index 3ae84f3..0000000 --- a/misc/setup/docker/php.ini +++ /dev/null @@ -1,4 +0,0 @@ -variables_order="EGPCS" -[Date] -date.timezone="UTC" -expose_php=Off diff --git a/templates/components/themes/default.latte b/templates/components/themes/default.latte index 9fc4499..a4e0390 100644 --- a/templates/components/themes/default.latte +++ b/templates/components/themes/default.latte @@ -8,13 +8,7 @@
- - {if $item->author->verified} - {include '../icon.latte', icon: 'check-o', text: $item->author->nickname} - {else} - {$item->author->nickname} - {/if} - + {$item->author->nickname} @{$item->author->uniqueId} @@ -40,9 +34,10 @@
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))} +
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)} {/block} {/embed}
{if $info->detail->verified} - {include '../components/icon.latte', icon: 'check-o', text: $info->detail->nickname} + {include '../components/icon.latte', icon: 'check-o', text: $info->detail->uniqueId} {else} - {$info->detail->nickname} + {$info->detail->uniqueId} {/if}
{include '../components/rss.latte'}