diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a217311..b633689 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: push: branches: - main - - v3 + - typo3-v14 pull_request: permissions: contents: read @@ -35,6 +35,7 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" code-quality: name: "Code quality checks" runs-on: ubuntu-22.04 @@ -72,6 +73,7 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" unit-tests: name: "Unit tests" runs-on: ubuntu-22.04 @@ -112,15 +114,18 @@ jobs: fail-fast: false matrix: include: - - typo3-version: "^13.4" + - typo3-version: "^14.0" php-version: "8.2" composer-dependencies: highest - - typo3-version: "^13.4" + - typo3-version: "^14.0" php-version: "8.3" composer-dependencies: highest - - typo3-version: "^13.4" + - typo3-version: "^14.0" php-version: "8.4" composer-dependencies: highest + - typo3-version: "^14.0" + php-version: "8.5" + composer-dependencies: highest functional-tests: name: "Functional tests" runs-on: ubuntu-22.04 @@ -130,29 +135,32 @@ jobs: # rest matrix jobs be executed anyway. fail-fast: false matrix: - php: [ '8.2', '8.3', '8.4' ] + php: [ '8.2', '8.3', '8.4', '8.5' ] composerInstall: [ 'composerInstallHighest' ] steps: - name: Checkout uses: actions/checkout@v4 - name: Install testing system - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -s ${{ matrix.composerInstall }} + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s ${{ matrix.composerInstall }} - name: Functional Tests with mariadb (min) - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -i 10.4 -s functional + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -i 10.4 -s functional - name: Functional Tests with mariadb (max) - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mariadb -i 10.11 -s functional + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -i 10.11 -s functional + + - name: Functional Tests with mysql (min) + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -i 8.0 -s functional - - name: Functional Tests with mysql (min/max) - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d mysql -i 8.0 -s functional + - name: Functional Tests with mysql (max) + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -i 8.4 -s functional - name: Functional Tests with postgres (min) - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d postgres -i 10 -s functional + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -i 10 -s functional - name: Functional Tests with postgres (max) - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d postgres -i 16 -s functional + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -i 18 -s functional - name: Functional Tests with sqlite - run: Build/Scripts/runTests.sh -t 13 -p ${{ matrix.php }} -d sqlite -s functional \ No newline at end of file + run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d sqlite -s functional \ No newline at end of file diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index f63628a..dc72ec4 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -45,8 +45,8 @@ handleDbmsOptions() { echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 exit 1 fi - [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.2" - if ! [[ ${DBMS_VERSION} =~ ^(10.2|10.3|10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then + [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.11" + if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1|11.4|11.8)$ ]]; then echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2 echo >&2 echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 @@ -61,8 +61,8 @@ handleDbmsOptions() { echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 exit 1 fi - [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="5.5" - if ! [[ ${DBMS_VERSION} =~ ^(5.5|5.6|5.7|8.0)$ ]]; then + [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="8.4" + if ! [[ ${DBMS_VERSION} =~ ^(8.0|8.1|8.2|8.3|8.4|9.5)$ ]]; then echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2 echo >&2 echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 @@ -76,8 +76,8 @@ handleDbmsOptions() { echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 exit 1 fi - [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10" - if ! [[ ${DBMS_VERSION} =~ ^(10|11|12|13|14|15|16)$ ]]; then + [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="16" + if ! [[ ${DBMS_VERSION} =~ ^(10|11|12|13|14|15|16|17|18)$ ]]; then echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2 echo >&2 echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 @@ -151,7 +151,7 @@ restoreComposerFiles() { loadHelp() { # Load help text into $HELP - read -r -d '' HELP < + -t <13> Only with -s composerInstall|composerInstallMin|composerInstallMax Specifies the TYPO3 CORE Version to be used - - 11.5: use TYPO3 v11 (default) - - 12.4: use TYPO3 v12 - - 13.4: use TYPO3 v13 + - 13.4: use TYPO3 v13 (default) + - 14.0: use TYPO3 v14 - -p <7.4|8.0|8.1|8.2|8.3|8.4> + -p <8.2|8.3|8.4|8.5> Specifies the PHP minor version to be used - - 7.4: use PHP 7.4 (default) - - 8.0: use PHP 8.0 - - 8.1: use PHP 8.1 - 8.2: use PHP 8.2 - - 8.3: use PHP 8.3 + - 8.3: use PHP 8.3 (default) - 8.4: use PHP 8.4 + - 8.5: use PHP 8.5 -e "" Only with -s docsGenerate|functional|unit @@ -277,24 +274,24 @@ Options: Show this help. Examples: - # Run all core unit tests using PHP 7.4 + # Run all core unit tests using PHP 8.5 ./Build/Scripts/runTests.sh -s unit # Run all core units tests and enable xdebug (have a PhpStorm listening on port 9003!) ./Build/Scripts/runTests.sh -x -s unit - # Run unit tests in phpunit verbose mode with xdebug on PHP 8.1 and filter for test canRetrieveValueWithGP - ./Build/Scripts/runTests.sh -x -p 8.1 -- --filter 'classCanBeRegistered' + # Run unit tests in phpunit verbose mode with xdebug on PHP 8.3 and filter for test canRetrieveValueWithGP + ./Build/Scripts/runTests.sh -x -p 8.3 -- --filter 'classCanBeRegistered' # Run functional tests in phpunit with a filtered test method name in a specified file # example will currently execute two tests, both of which start with the search term ./Build/Scripts/runTests.sh -s functional -- --filter 'findRecordByImportSource' Tests/Functional/Repository/CategoryRepositoryTest.php - # Run functional tests on postgres with xdebug, php 8.1 and execute a restricted set of tests - ./Build/Scripts/runTests.sh -x -p 8.1 -s functional -d postgres -- Tests/Functional/Repository/CategoryRepositoryTest.php + # Run functional tests on postgres with xdebug, php 8.3 and execute a restricted set of tests + ./Build/Scripts/runTests.sh -x -p 8.3 -s functional -d postgres -- Tests/Functional/Repository/CategoryRepositoryTest.php - # Run functional tests on postgres 11 - ./Build/Scripts/runTests.sh -s functional -d postgres -i 11 + # Run functional tests on postgres 16 + ./Build/Scripts/runTests.sh -s functional -d postgres -i 16 EOF } @@ -313,17 +310,17 @@ ROOT_DIR="${PWD}" # Option defaults TEST_SUITE="" -TYPO3_VERSION="11" +TYPO3_VERSION="14" DBMS="sqlite" DBMS_VERSION="" -PHP_VERSION="8.1" +PHP_VERSION="8.3" PHP_XDEBUG_ON=0 PHP_XDEBUG_PORT=9003 EXTRA_TEST_OPTIONS="" CGLCHECK_DRY_RUN=0 DATABASE_DRIVER="" CONTAINER_BIN="" -COMPOSER_ROOT_VERSION="12.4.2" +COMPOSER_ROOT_VERSION="14.0.1" CONTAINER_INTERACTIVE="-it --init" HOST_UID=$(id -u) HOST_PID=$(id -g) @@ -363,7 +360,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(7.4|8.0|8.1|8.2|8.3|8.4)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3|8.4|8.5)$ ]]; then INVALID_OPTIONS+=("-p ${OPTARG}") fi ;; @@ -372,7 +369,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do ;; t) TYPO3_VERSION=${OPTARG} - if ! [[ ${TYPO3_VERSION} =~ ^(11|12|13)$ ]]; then + if ! [[ ${TYPO3_VERSION} =~ ^(14)$ ]]; then INVALID_OPTIONS+=("-t ${OPTARG}") fi ;; @@ -445,7 +442,7 @@ mkdir -p .cache mkdir -p .Build/public/typo3temp/var/tests IMAGE_PHP="ghcr.io/typo3/core-testing-$(echo "php${PHP_VERSION}" | sed -e 's/\.//'):latest" -IMAGE_ALPINE="docker.io/alpine:3.8" +IMAGE_ALPINE="docker.io/alpine:3.22" IMAGE_DOCS="ghcr.io/typo3-documentation/render-guides:latest" IMAGE_MARIADB="docker.io/mariadb:${DBMS_VERSION}" IMAGE_MYSQL="docker.io/mysql:${DBMS_VERSION}" @@ -510,17 +507,9 @@ case ${TEST_SUITE} in cleanComposer stashComposerFiles ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-highest-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/bash -c " - if [ ${TYPO3_VERSION} -eq 11 ]; then + if [ ${TYPO3_VERSION} -eq 14 ]; then composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^11.5.24 || exit 1 - fi - if [ ${TYPO3_VERSION} -eq 12 ]; then - composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^12.4.2 || exit 1 - fi - if [ ${TYPO3_VERSION} -eq 13 ]; then - composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^13.4 || exit 1 + typo3/cms-core:^14.0 || exit 1 fi composer update --no-progress --no-interaction || exit 1 composer show || exit 1 @@ -532,17 +521,9 @@ case ${TEST_SUITE} in cleanComposer stashComposerFiles ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-lowest-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/bash -c " - if [ ${TYPO3_VERSION} -eq 11 ]; then - composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^11.5.24 || exit 1 - fi - if [ ${TYPO3_VERSION} -eq 12 ]; then - composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^12.4.2 || exit 1 - fi - if [ ${TYPO3_VERSION} -eq 13 ]; then + if [ ${TYPO3_VERSION} -eq 14 ]; then composer require --no-ansi --no-interaction --no-progress --no-install \ - typo3/cms-core:^13.4 || exit 1 + typo3/cms-core:^14.0 || exit 1 fi composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest || exit 1 composer show || exit 1 @@ -582,7 +563,11 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; postgres) - ${CONTAINER_BIN} run --rm ${CI_PARAMS} --name postgres-func-${SUFFIX} --network ${NETWORK} -d -e POSTGRES_PASSWORD=funcp -e POSTGRES_USER=funcu --tmpfs /var/lib/postgresql/data:rw,noexec,nosuid ${IMAGE_POSTGRES} >/dev/null + POSTGRES_TMPFS="/var/lib/postgresql/data" + if [[ ${DBMS_VERSION} -eq 18 ]]; then + POSTGRES_TMPFS="/var/lib/postgresql" + fi + ${CONTAINER_BIN} run --rm ${CI_PARAMS} --name postgres-func-${SUFFIX} --network ${NETWORK} -d -e POSTGRES_PASSWORD=funcp -e POSTGRES_USER=funcu --tmpfs ${POSTGRES_TMPFS}:rw,noexec,nosuid ${IMAGE_POSTGRES} >/dev/null waitFor postgres-func-${SUFFIX} 5432 CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_pgsql -e typo3DatabaseName=bamboo -e typo3DatabaseUsername=funcu -e typo3DatabaseHost=postgres-func-${SUFFIX} -e typo3DatabasePassword=funcp" ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name functional-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}" diff --git a/Classes/Command/UpdateMetadataCommand.php b/Classes/Command/UpdateMetadataCommand.php index 8afab31..6733f39 100644 --- a/Classes/Command/UpdateMetadataCommand.php +++ b/Classes/Command/UpdateMetadataCommand.php @@ -6,6 +6,7 @@ use Ayacoo\Tiktok\Domain\Repository\FileRepository; use Ayacoo\Tiktok\Helper\TiktokHelper; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -19,6 +20,7 @@ use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; +#[AsCommand('tiktok:updateMetadata', 'Updates the Tiktok metadata')] class UpdateMetadataCommand extends Command { protected function configure(): void diff --git a/Classes/EventListener/ModifyIconForResourcePropertiesListener.php b/Classes/EventListener/ModifyIconForResourcePropertiesListener.php new file mode 100644 index 0000000..d9e1f10 --- /dev/null +++ b/Classes/EventListener/ModifyIconForResourcePropertiesListener.php @@ -0,0 +1,29 @@ +getResource(); + + if (!$resource instanceof File) { + return; + } + + if ($resource->getMimeType() === 'video/tiktok') { + $event->setIconIdentifier('mimetypes-media-image-tiktok'); + } + } +} diff --git a/Classes/Rendering/TiktokRenderer.php b/Classes/Rendering/TiktokRenderer.php index d313e5b..14180e6 100644 --- a/Classes/Rendering/TiktokRenderer.php +++ b/Classes/Rendering/TiktokRenderer.php @@ -15,7 +15,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException; +use TYPO3\CMS\Extbase\Configuration\Exception\NoServerRequestGivenException; /** * Tiktok renderer class @@ -110,7 +110,7 @@ protected function getPrivacySetting(): bool $privacy = (bool)$extSettings['privacy'] ?? false; } return $privacy; - } catch (InvalidConfigurationTypeException $e) { + } catch (NoServerRequestGivenException $e) { return false; } } diff --git a/Classes/Tca/DisplayCond/IsTiktok.php b/Classes/Tca/DisplayCond/IsTiktok.php new file mode 100644 index 0000000..1c0ffb7 --- /dev/null +++ b/Classes/Tca/DisplayCond/IsTiktok.php @@ -0,0 +1,21 @@ + $parameters + */ + public function match(array $parameters): bool + { + $record = $parameters['record'] ?? []; + if (!is_array($record)) { + return false; + } + + return (!empty($record['tiktok_html'] ?? '')); + } +} diff --git a/Configuration/ContentSecurityPolicies.php b/Configuration/ContentSecurityPolicies.php index 6fd37e3..c8b4a00 100644 --- a/Configuration/ContentSecurityPolicies.php +++ b/Configuration/ContentSecurityPolicies.php @@ -11,41 +11,60 @@ use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; use TYPO3\CMS\Core\Type\Map; -return Map::fromEntries([ - Scope::backend(), - - new MutationCollection( - // The csp extension is required for images in the PreviewRenderer when active - new Mutation( - MutationMode::Extend, - Directive::ImgSrc, - SourceScheme::data, - new UriValue('*.tiktokcdn.com'), - ), - // The csp extension is required for the IFrame in the info window - new Mutation( - MutationMode::Extend, - Directive::ScriptSrc, - SourceScheme::data, - new UriValue('*.tiktok.com'), - ), - new Mutation( - MutationMode::Extend, - Directive::ScriptSrc, - SourceScheme::data, - new UriValue('*.ttwstatic.com'), - ), - new Mutation( - MutationMode::Extend, - Directive::StyleSrc, - SourceScheme::data, - new UriValue('*.ttwstatic.com'), - ), - new Mutation( - MutationMode::Extend, - Directive::FrameSrc, - SourceScheme::data, - new UriValue('*.tiktok.com'), - ), +$mutationCollection = new MutationCollection( + // The csp extension is required for images in the PreviewRenderer when active + new Mutation( + MutationMode::Extend, + Directive::ImgSrc, + SourceScheme::data, + new UriValue('*.tiktokcdn.com'), + ), + // The csp extension is required for the IFrame in the info window + new Mutation( + MutationMode::Extend, + Directive::ConnectSrc, + SourceScheme::data, + new UriValue('*.tiktok.com'), + ), + new Mutation( + MutationMode::Extend, + Directive::ScriptSrc, + SourceScheme::data, + new UriValue('*.tiktok.com'), + ), + new Mutation( + MutationMode::Extend, + Directive::ScriptSrc, + SourceScheme::data, + new UriValue('*.ttwstatic.com'), ), -]); + new Mutation( + MutationMode::Extend, + Directive::StyleSrc, + SourceScheme::data, + new UriValue('*.ttwstatic.com'), + ), + new Mutation( + MutationMode::Extend, + Directive::FrameSrc, + SourceScheme::data, + new UriValue('*.tiktok.com'), + ), + new Mutation( + MutationMode::Extend, + Directive::StyleSrcElem, + SourceScheme::data, + new UriValue('*.ttwstatic.com'), + ), +); + +return Map::fromEntries( + [ + Scope::frontend(), + $mutationCollection + ], + [ + Scope::backend(), + $mutationCollection + ] +); diff --git a/Configuration/Icons.php b/Configuration/Icons.php index 5d91441..f02b831 100644 --- a/Configuration/Icons.php +++ b/Configuration/Icons.php @@ -1,8 +1,10 @@ [ - 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'provider' => SvgIconProvider::class, 'source' => 'EXT:tiktok/Resources/Public/Icons/Extension.svg', ], ]; diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 98bbfd9..98d2ed4 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -9,10 +9,3 @@ services: exclude: - '../Classes/Domain/Model/*' - '../Classes/Helper/*' - - Ayacoo\Tiktok\Command\UpdateMetadataCommand: - tags: - - name: 'console.command' - command: 'tiktok:updateMetadata' - description: 'Updates the Tiktok metadata' - schedulable: true diff --git a/Configuration/TCA/Overrides/sys_file_metadata.php b/Configuration/TCA/Overrides/sys_file_metadata.php new file mode 100644 index 0000000..f953708 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_file_metadata.php @@ -0,0 +1,64 @@ + [ + 'exclude' => true, + 'label' => 'LLL:EXT:tiktok/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tiktok_thumbnail', + 'config' => [ + 'type' => 'text', + 'dbType' => 'text', + 'cols' => 40, + 'rows' => 2, + 'readOnly' => true, + ], + 'displayCond' => 'USER:Ayacoo\\Tiktok\\Tca\\DisplayCond\\IsTiktok->match', + ], + 'tiktok_html' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:tiktok/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tiktok_html', + 'config' => [ + 'type' => 'text', + 'dbType' => 'text', + 'cols' => 40, + 'rows' => 4, + 'readOnly' => true, + ], + 'displayCond' => 'USER:Ayacoo\\Tiktok\\Tca\\DisplayCond\\IsTiktok->match', + ], + 'tiktok_author_url' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:tiktok/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tiktok_author_url', + 'config' => [ + 'type' => 'link', + 'allowedTypes' => ['url'], + 'default' => '', + 'readOnly' => true, + 'size' => 40, + ], + 'displayCond' => 'USER:Ayacoo\\Tiktok\\Tca\\DisplayCond\\IsTiktok->match', + ], + 'tiktok_username' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:tiktok/Resources/Private/Language/locallang_db.xlf:sys_file_metadata.tiktok_username', + 'config' => [ + 'type' => 'input', + 'size' => 40, + 'max' => 255, + 'default' => '', + 'readOnly' => true, + ], + 'displayCond' => 'USER:Ayacoo\\Tiktok\\Tca\\DisplayCond\\IsTiktok->match', + ], +]; + +ExtensionManagementUtility::addTCAcolumns('sys_file_metadata', $additionalColumns); +ExtensionManagementUtility::addToAllTCAtypes( + 'sys_file_metadata', + '--div--;LLL:EXT:tiktok/Resources/Private/Language/locallang_db.xlf:tab.tiktok, tiktok_thumbnail, tiktok_html, tiktok_author_url, tiktok_username' +); diff --git a/README.md b/README.md index 3cf23eb..84d7054 100644 --- a/README.md +++ b/README.md @@ -86,21 +86,13 @@ class TiktokOutputEventListener In the backend, the preview is used by TextMediaRenderer. For online media, this only displays the provider's icon, in this case tiktok. If you want to display the thumbnail, for example, you need your own renderer that overwrites -Textmedia. An example renderer is available in the project. Caution: This -overwrites all text media elements, so only use this renderer as a basis. +Textmedia. -You register a renderer in the TCA `Configuration/TCA/Overrides/tt_content.php` -with `$GLOBALS['TCA']['tt_content']['types']['textmedia']['previewRenderer'] = \Ayacoo\Tiktok\Rendering\TiktokPreviewRenderer::class;` - -Documentation: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/CustomBackendPreview.html +TBD Event listener ### 3.3 Content security policy -If CSP is activated in the backend, policies will be automatically added. -To do this, the file Configuration/ContentSecurityPolicies.php is used. - -If CSP is to be extended for the frontend, the configuration can be added -in a site package extension or in the global csp.yml +By default, CSP settings are added for the frontend and backend. These settings can be modified via YAML or events. Take a look at the current documentation: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentSecurityPolicy/Index.html @@ -111,9 +103,10 @@ https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentS | Tiktok | TYPO3 | PHP | Support / Development | |--------|-------------|-----------|--------------------------------------| -| 3.x | 13.x | 8.2 - 8.4 | features, bugfixes, security updates | +| 4.x | 14.x | 8.2 - 8.5 | features, bugfixes, security updates | +| 3.x | 13.x | 8.2 - 8.5 | bugfixes, security updates | | 2.x | 12.x | 8.1 - 8.4 | bugfixes, security updates | -| 1.x | 10.x - 11.x | 7.4 - 8.0 | bugfixes, security updates | +| 1.x | 10.x - 11.x | 7.4 - 8.0 | security updates | ### 4.2 Release Management diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf new file mode 100644 index 0000000..d6fac91 --- /dev/null +++ b/Resources/Private/Language/locallang_db.xlf @@ -0,0 +1,22 @@ + + + + + + TikTok + + + TikTok thumbnail + + + TikTok HTML + + + TikTok author URL + + + TikTok username + + + + diff --git a/Resources/Public/Icons/tiktok.svg b/Resources/Public/Icons/tiktok.svg deleted file mode 100644 index 8d06b15..0000000 --- a/Resources/Public/Icons/tiktok.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Tests/Unit/Tca/DisplayCond/IsTiktokTest.php b/Tests/Unit/Tca/DisplayCond/IsTiktokTest.php new file mode 100644 index 0000000..7444178 --- /dev/null +++ b/Tests/Unit/Tca/DisplayCond/IsTiktokTest.php @@ -0,0 +1,48 @@ +subject = new IsTiktok(); + } + + public function testReturnsFalseIfParametersAreEmpty(): void + { + self::assertFalse($this->subject->match([])); + } + + public function testReturnsFalseIfRecordIsNotArray(): void + { + $params = ['record' => 'not-an-array']; + self::assertFalse($this->subject->match($params)); + } + + public function testReturnsFalseIfTiktokHtmlIsMissing(): void + { + $params = ['record' => []]; + self::assertFalse($this->subject->match($params)); + } + + public function testReturnsFalseIfTiktokHtmlIsEmptyString(): void + { + $params = ['record' => ['tiktok_html' => '']]; + self::assertFalse($this->subject->match($params)); + } + + public function testReturnsTrueIfTiktokHtmlHasContent(): void + { + $params = ['record' => ['tiktok_html' => '
...
']]; + self::assertTrue($this->subject->match($params)); + } +} diff --git a/composer.json b/composer.json index 60b5bce..c21d318 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "ayacoo/tiktok", - "version": "3.0.1", + "version": "4.0.0", "type": "typo3-cms-extension", - "description": "Provides a Tiktok online media helper", + "description": "TikTok - Provides a TikTok online media helper", "homepage": "https://www.ayacoo.de", "authors": [ { @@ -14,23 +14,22 @@ "GPL-2.0-or-later" ], "require": { - "php": ">=8.2 < 8.5", - "typo3/cms-core": "^13.4" + "php": ">=8.2 < 8.6", + "typo3/cms-core": "^14.3" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.57.0", - "helmich/typo3-typoscript-lint": "^3.1.0", - "phpstan/extension-installer": "^1.3.1", - "phpstan/phpstan": "^1.11", - "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.2", - "phpunit/phpunit": "^11.0.3", - "saschaegerer/phpstan-typo3": "^1.10.0", - "squizlabs/php_codesniffer": "^3.8.1", + "friendsofphp/php-cs-fixer": "^3.91", + "helmich/typo3-typoscript-lint": "^3.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "^11.5.44", + "squizlabs/php_codesniffer": "^3.13", "symfony/console": "^7.0", "symfony/translation": "^7.0", "typo3/coding-standards": "^0.5.5", - "typo3/testing-framework": "^9.0" + "typo3/testing-framework": "^9.3" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 1ef45bb..53f4b5c 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,18 +1,18 @@ 'Tiktok online media helper', + 'title' => 'TikTok online media helper', 'category' => 'plugin', 'author' => 'Guido Schmechel', 'author_email' => 'info@ayacoo.de', 'state' => 'stable', 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '3.0.1', + 'version' => '4.0.0', 'constraints' => [ 'depends' => [ - 'php' => '8.2.0-8.4.99', - 'typo3' => '13.0.0-13.4.99', + 'php' => '8.2.0-8.5.99', + 'typo3' => '14.3.0-14.3.99', ], 'conflicts' => [ ], diff --git a/ext_localconf.php b/ext_localconf.php index c83b3ab..0837b0d 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -2,7 +2,6 @@ use Ayacoo\Tiktok\Helper\TiktokHelper; use Ayacoo\Tiktok\Rendering\TiktokRenderer; -use TYPO3\CMS\Core\Imaging\IconRegistry; use TYPO3\CMS\Core\Resource\Rendering\RendererRegistry; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -16,7 +15,4 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType'][$mediaFileExt] = 'video/' . $mediaFileExt; $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] .= ',' . $mediaFileExt; - - $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); - $iconRegistry->registerFileExtension($mediaFileExt, 'mimetypes-media-image-' . $mediaFileExt); })('tiktok'); diff --git a/ext_tables.sql b/ext_tables.sql deleted file mode 100644 index 5a9aee6..0000000 --- a/ext_tables.sql +++ /dev/null @@ -1,10 +0,0 @@ -# -# Table structure for table 'sys_file_metadata' -# -CREATE TABLE sys_file_metadata -( - tiktok_thumbnail text, - tiktok_html text, - tiktok_author_url varchar(2048) DEFAULT '', - tiktok_username varchar(255) DEFAULT '', -); diff --git a/tiktok.svg b/tiktok.svg deleted file mode 100644 index 8d06b15..0000000 --- a/tiktok.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file