diff --git a/.package/4.2.1.txt b/.package/4.2.1.txt deleted file mode 100644 index bbdc9ef..0000000 --- a/.package/4.2.1.txt +++ /dev/null @@ -1,14 +0,0 @@ -Chevereto 4.2.1 (2024-11-04) - -- 🐬 Added MySQL compatibility for Tags -- 🏷️ Tag input added to uploader form -- 🕷️ Increased Project Arachnid Shield timeout -- 📱 Mobile listing now displays checkbox -- ✅ API now supports use_file_date parameter -- 🐞 Fixed bug in API route -- 🐞 Fixed bug in API URL upload -- 🐞 Fixed bug in homepage as Explore -- 🐞 Fixed bug in Pages (free edition) -- 🐞 Fixed bug with non-functioning analytics and comment code -- 🐞 Fixed bug with non-functioning Banners -- 🐞 Fixed TypeError in Image class diff --git a/.package/4.2.2.txt b/.package/4.2.2.txt new file mode 100644 index 0000000..a260d62 --- /dev/null +++ b/.package/4.2.2.txt @@ -0,0 +1,13 @@ +Chevereto 4.2.2 (2024-11-07) + +- 💅 Added flag icon to NSFW uploader +- ✅ Added fault-tolerant env variables +- ✅ Added session_start fail-safe for false positives +- 🐬 Fixed MySQL 5 index compatibility +- 🐞 Fixed bug affecting Disqus integration +- 🐞 Fixed bug affecting manual update query generation +- 🐞 Fixed bug affecting NSFW flagging +- 🐞 Fixed bug when using user_profile_view=album +- 🐞 Fixed bug with not working Open Graph for video +- 🐞 Fixed bug with outdated google/apiclient dependency +- 🐞 Fixed bug with unresponsive /dashboard diff --git a/app/composer.lock b/app/composer.lock index c8c6e50..9ca9328 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -1190,16 +1190,16 @@ }, { "name": "chevere/throwable-handler", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/chevere/throwable-handler.git", - "reference": "4b476df67ddb4fa5d49aca75a91787b4dc2c0b82" + "reference": "5c4373b6b1d511340694ff9efe83a3c70f1a0fe7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/chevere/throwable-handler/zipball/4b476df67ddb4fa5d49aca75a91787b4dc2c0b82", - "reference": "4b476df67ddb4fa5d49aca75a91787b4dc2c0b82", + "url": "https://api.github.com/repos/chevere/throwable-handler/zipball/5c4373b6b1d511340694ff9efe83a3c70f1a0fe7", + "reference": "5c4373b6b1d511340694ff9efe83a3c70f1a0fe7", "shasum": "" }, "require": { @@ -1237,9 +1237,9 @@ "homepage": "https://chevere.org", "support": { "issues": "https://github.com/chevere/throwable-handler/issues", - "source": "https://github.com/chevere/throwable-handler/tree/1.0.2" + "source": "https://github.com/chevere/throwable-handler/tree/1.0.3" }, - "time": "2024-06-21T15:41:35+00:00" + "time": "2024-11-06T20:01:15+00:00" }, { "name": "chevere/trace", @@ -5031,16 +5031,16 @@ }, { "name": "symfony/cache", - "version": "v5.4.45", + "version": "v5.4.46", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "12b03e3cc5c6fd495e56b2b9e7aca777f8608721" + "reference": "0fe08ee32cec2748fbfea10c52d3ee02049e0f6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/12b03e3cc5c6fd495e56b2b9e7aca777f8608721", - "reference": "12b03e3cc5c6fd495e56b2b9e7aca777f8608721", + "url": "https://api.github.com/repos/symfony/cache/zipball/0fe08ee32cec2748fbfea10c52d3ee02049e0f6b", + "reference": "0fe08ee32cec2748fbfea10c52d3ee02049e0f6b", "shasum": "" }, "require": { @@ -5108,7 +5108,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.45" + "source": "https://github.com/symfony/cache/tree/v5.4.46" }, "funding": [ { @@ -5124,7 +5124,7 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:37:00+00:00" + "time": "2024-11-04T11:43:55+00:00" }, { "name": "symfony/cache-contracts", @@ -5207,16 +5207,16 @@ }, { "name": "symfony/console", - "version": "v6.4.13", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f793dd5a7d9ae9923e35d0503d08ba734cec1d79" + "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f793dd5a7d9ae9923e35d0503d08ba734cec1d79", - "reference": "f793dd5a7d9ae9923e35d0503d08ba734cec1d79", + "url": "https://api.github.com/repos/symfony/console/zipball/897c2441ed4eec8a8a2c37b943427d24dba3f26b", + "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b", "shasum": "" }, "require": { @@ -5281,7 +5281,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.13" + "source": "https://github.com/symfony/console/tree/v6.4.14" }, "funding": [ { @@ -5297,7 +5297,7 @@ "type": "tidelift" } ], - "time": "2024-10-09T08:40:40+00:00" + "time": "2024-11-05T15:34:40+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5842,16 +5842,16 @@ }, { "name": "symfony/process", - "version": "v6.4.13", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "1f9f59b46880201629df3bd950fc5ae8c55b960f" + "reference": "25214adbb0996d18112548de20c281be9f27279f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1f9f59b46880201629df3bd950fc5ae8c55b960f", - "reference": "1f9f59b46880201629df3bd950fc5ae8c55b960f", + "url": "https://api.github.com/repos/symfony/process/zipball/25214adbb0996d18112548de20c281be9f27279f", + "reference": "25214adbb0996d18112548de20c281be9f27279f", "shasum": "" }, "require": { @@ -5883,7 +5883,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.13" + "source": "https://github.com/symfony/process/tree/v6.4.14" }, "funding": [ { @@ -5899,7 +5899,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:18:03+00:00" + "time": "2024-11-06T09:25:01+00:00" }, { "name": "symfony/service-contracts", @@ -6072,16 +6072,16 @@ }, { "name": "symfony/var-dumper", - "version": "v6.4.13", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2acb151474ed8cb43624e3f41a0bf7c4c8ce4f41" + "reference": "93c09246038178717a9c14b809ea8151ffcf7091" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2acb151474ed8cb43624e3f41a0bf7c4c8ce4f41", - "reference": "2acb151474ed8cb43624e3f41a0bf7c4c8ce4f41", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/93c09246038178717a9c14b809ea8151ffcf7091", + "reference": "93c09246038178717a9c14b809ea8151ffcf7091", "shasum": "" }, "require": { @@ -6137,7 +6137,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.13" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.14" }, "funding": [ { @@ -6153,7 +6153,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:18:03+00:00" + "time": "2024-11-05T15:34:40+00:00" }, { "name": "symfony/var-exporter", @@ -6445,16 +6445,16 @@ }, { "name": "xrdebug/php", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/xrdebug/php.git", - "reference": "19e6a81dc40164fda6a80febe1417c01673c3b80" + "reference": "0ef77144e845c384c5866f689a57eb2e12033f70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/xrdebug/php/zipball/19e6a81dc40164fda6a80febe1417c01673c3b80", - "reference": "19e6a81dc40164fda6a80febe1417c01673c3b80", + "url": "https://api.github.com/repos/xrdebug/php/zipball/0ef77144e845c384c5866f689a57eb2e12033f70", + "reference": "0ef77144e845c384c5866f689a57eb2e12033f70", "shasum": "" }, "require": { @@ -6463,7 +6463,7 @@ "chevere/standard": "^1.0.1", "chevere/throwable-handler": "^1.0.2", "chevere/trace": "^2.0.0", - "chevere/var-dump": "^2.0.0", + "chevere/var-dump": "^2.0.1", "ext-curl": "*", "ext-json": "*", "php": "^8.1", @@ -6506,9 +6506,9 @@ ], "support": { "issues": "https://github.com/xrdebug/php/issues", - "source": "https://github.com/xrdebug/php/tree/2.0.2" + "source": "https://github.com/xrdebug/php/tree/2.0.4" }, - "time": "2024-06-23T14:05:32+00:00" + "time": "2024-11-06T20:05:28+00:00" }, { "name": "xrdebug/xrdebug", @@ -6830,16 +6830,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.7", + "version": "1.12.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6a60a4d66142b8156c9da923f1972657bc4748c", + "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c", "shasum": "" }, "require": { @@ -6884,7 +6884,7 @@ "type": "github" } ], - "time": "2024-10-18T11:12:07+00:00" + "time": "2024-11-06T19:06:49+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/app/legacy/install/installer.php b/app/legacy/install/installer.php index caa0ec8..fb28258 100644 --- a/app/legacy/install/installer.php +++ b/app/legacy/install/installer.php @@ -86,6 +86,7 @@ $db_array = [ ]; $error = false; $db_conn_error = "Can't connect to the target database. The server replied with this:
%s

Please fix your MySQL info."; +$installed_version = cheveretoVersionInstalled(); $settings_updates = [ '3.0.0' => [ 'analytics_code' => '', @@ -632,7 +633,9 @@ $settings_updates = [ 'arachnid_api_password' => '', ], '4.2.1' => null, + '4.2.2' => null, ]; + /** * The following settings are for enabling backwards compatibility * It is recommended to use a proper storage device when possible! @@ -640,21 +643,23 @@ $settings_updates = [ * You can configure both asset/external storage from the admin dashboard. */ if ((bool) env()['CHEVERETO_ENABLE_LOCAL_STORAGE']) { - // Legacy application stores assets relative to root - // target -> /content/images/... + // Reflect a path under /images/ which is the default persistent storage mounted path for zero config + // target -> /images/_assets/content/images... $asset_storage_default = [ 'asset_storage_api_id' => '8', - 'asset_storage_bucket' => PATH_PUBLIC, - 'asset_storage_url' => URL_APP_PUBLIC_STATIC, + 'asset_storage_bucket' => PATH_PUBLIC . 'images/_assets/', + 'asset_storage_url' => env()['CHEVERETO_HOSTNAME_PATH'] . 'images/_assets/', ]; - if (env()['CHEVERETO_SERVICING'] === 'docker') { - // Reflect a path under /images/ which is the default persistent storage mounted path for zero config - // target -> /images/_assets/content/images... - $asset_storage_default = [ - 'asset_storage_api_id' => '8', - 'asset_storage_bucket' => PATH_PUBLIC . 'images/_assets/', - 'asset_storage_url' => URL_APP_PUBLIC_STATIC . 'images/_assets/', - ]; + if ($installed_version !== '') { + // Legacy application stores assets relative to root + // target -> /content/images/... + if (env()['CHEVERETO_SERVICING'] === 'server') { + $asset_storage_default = [ + 'asset_storage_api_id' => '8', + 'asset_storage_bucket' => PATH_PUBLIC, + 'asset_storage_url' => env()['CHEVERETO_HOSTNAME_PATH'], + ]; + } } $settings_updates['4.2.0'] = array_merge($settings_updates['4.2.0'], $asset_storage_default); } @@ -780,7 +785,6 @@ if (hasEnvDbInfo()) { $doing = 'ready'; } $fulltext_engine = 'InnoDB'; -$installed_version = cheveretoVersionInstalled(); $maintenance = getSetting('maintenance'); if (isset($cheveretoFreeMap[$installed_version])) { $installed_version = $cheveretoFreeMap[$installed_version]; @@ -1034,7 +1038,7 @@ if ($installed_version !== '' && empty($paramsCheck)) { ], 'login_secret' => [ 'op' => 'MODIFY', - 'type' => $isUtf8mb4 ? 'mediumtext' : 'text', //3.13.0 + 'type' => 'text', 'prop' => "DEFAULT NULL COMMENT 'The secret part'", ], ], @@ -1048,12 +1052,12 @@ if ($installed_version !== '' && empty($paramsCheck)) { 'settings' => [ 'setting_value' => [ 'op' => 'MODIFY', - 'type' => $isUtf8mb4 ? 'mediumtext' : 'text', //3.13.0 + 'type' => 'text', //3.13.0 'prop' => null, ], 'setting_default' => [ 'op' => 'MODIFY', - 'type' => $isUtf8mb4 ? 'mediumtext' : 'text', //3.13.0 + 'type' => 'text', //3.13.0 'prop' => null, ], ], @@ -1088,7 +1092,7 @@ if ($installed_version !== '' && empty($paramsCheck)) { 'images' => [ 'image_original_exifdata' => [ 'op' => 'MODIFY', - 'type' => 'longtext', + 'type' => 'text', 'prop' => null, ], 'image_storage' => [ @@ -1256,12 +1260,12 @@ if ($installed_version !== '' && empty($paramsCheck)) { 'storages' => [ 'storage_key' => [ 'op' => 'MODIFY', - 'type' => $isUtf8mb4 ? 'mediumtext' : 'text', //3.13.0 + 'type' => 'text', //3.13.0 'prop' => null, ], 'storage_secret' => [ 'op' => 'MODIFY', - 'type' => $isUtf8mb4 ? 'mediumtext' : 'text', //3.13.0 + 'type' => 'text', //3.13.0 'prop' => null, ], ], @@ -1829,7 +1833,7 @@ if ($installed_version !== '' && empty($paramsCheck)) { 'pages' => [ 'page_code' => [ 'op' => 'MODIFY', - 'type' => 'mediumtext', + 'type' => 'text', 'prop' => null, ], ], @@ -2406,7 +2410,7 @@ EOT; ADD `image_source_md5` varchar(32) DEFAULT NULL, ADD `image_storage_mode` enum('datefolder','direct','old') NOT NULL DEFAULT 'datefolder', ADD `image_original_filename` text NOT NULL, - ADD `image_original_exifdata` longtext, + ADD `image_original_exifdata` text, ADD `image_views` bigint(32) NOT NULL DEFAULT '0', ADD `image_category_id` bigint(32) DEFAULT NULL, ADD `image_chain` tinyint(128) NOT NULL, diff --git a/app/legacy/load/app.php b/app/legacy/load/app.php index 8bf9371..987231e 100644 --- a/app/legacy/load/app.php +++ b/app/legacy/load/app.php @@ -9,5 +9,5 @@ * file that was distributed with this source code. */ -const APP_VERSION = '4.2.1'; +const APP_VERSION = '4.2.2'; const APP_VERSION_AKA = 'regio'; diff --git a/app/legacy/routes/json.php b/app/legacy/routes/json.php index 9af7b71..b8e008c 100644 --- a/app/legacy/routes/json.php +++ b/app/legacy/routes/json.php @@ -993,7 +993,7 @@ return function (Handler $handler) { throw new Exception('Invalid request', 403); } $query_field = 'nsfw'; - $prop = $editing['nsfw'] ?? 0; + $prop = (int) ($editing['nsfw'] ?? 0); $prop = intval($prop === 1); $message = 'Content flag changed'; diff --git a/app/legacy/routes/user.php b/app/legacy/routes/user.php index 929539a..b1ab712 100644 --- a/app/legacy/routes/user.php +++ b/app/legacy/routes/user.php @@ -239,8 +239,7 @@ return function (Handler $handler) { } $handler::setCond('show_follow_button', $show_follow_button); $base_user_url = $user['url']; - $type = $userHome; - $current_view = $type; + $current_view = $userHome; $tools = false; foreach ($user_views as $k => $v) { $handler::setCond('user_' . $k, (bool) $v['current']); @@ -251,6 +250,10 @@ return function (Handler $handler) { } } } + $type = match ($current_view) { + 'files' => 'images', + default => $current_view + }; $currentKey = 0; $safe_html_user = safe_html($user); $sub_tabs = []; @@ -468,7 +471,9 @@ return function (Handler $handler) { $output_tpl = 'user/' . $tpl; if ($user_views['search']['current']) { $type = $user['search']['type']; - $where = $user['search']['type'] === 'images' ? 'WHERE image_user_id=:user_id AND MATCH(image_name, image_title, image_description, image_original_filename) AGAINST (:q)' : 'WHERE album_user_id=:user_id AND MATCH(album_name, album_description) AGAINST (:q)'; + $where = $user['search']['type'] === 'images' + ? 'WHERE image_user_id=:user_id AND MATCH(image_name, image_title, image_description, image_original_filename) AGAINST (:q)' + : 'WHERE album_user_id=:user_id AND MATCH(album_name, album_description) AGAINST (:q)'; } $show_user_items_editor = Login::isLoggedUser(); if ($type === 'albums') { diff --git a/app/schemas/mysql-5/tags.sql b/app/schemas/mysql-5/tags.sql index dc90c10..de2c74f 100644 --- a/app/schemas/mysql-5/tags.sql +++ b/app/schemas/mysql-5/tags.sql @@ -11,7 +11,7 @@ CREATE TABLE `%table_prefix%tags` ( UNIQUE KEY `tag_name` (`tag_name`) USING BTREE, KEY `tag_user_id` (`tag_user_id`), KEY `tag_date_gmt` (`tag_date_gmt`), - KEY `tag_files` (`tag_files`),˝ + KEY `tag_files` (`tag_files`), KEY `tag_views` (`tag_views`), KEY `tag_user_id_date_gmt` (`tag_user_id`,`tag_date_gmt`), KEY `tag_user_id_files` (`tag_user_id`,`tag_files`), diff --git a/app/src/Legacy/Classes/Storage.php b/app/src/Legacy/Classes/Storage.php index 2f38ab8..e4bca9a 100644 --- a/app/src/Legacy/Classes/Storage.php +++ b/app/src/Legacy/Classes/Storage.php @@ -19,6 +19,7 @@ use function Chevereto\Encryption\decryptValues; use function Chevereto\Encryption\encryptValues; use function Chevereto\Encryption\hasEncryption; use function Chevereto\Legacy\assertMaxCount; +use function Chevereto\Legacy\cheveretoVersionInstalled; use function Chevereto\Legacy\G\add_ending_slash; use function Chevereto\Legacy\G\array_filter_array; use function Chevereto\Legacy\G\check_value; @@ -60,8 +61,12 @@ class Storage public static function get(array $values = [], array $sort = [], int $limit = null): array { - if (! isset($values['deleted_at'])) { - $values['deleted_at'] = null; + $valueOperators = [ + 'type_chain' => '&', + ]; + if (version_compare(cheveretoVersionInstalled(), '4.2.0', '>=')) { + $values['deleted_at'] = $values['deleted_at'] ?? null; + $valueOperators['deleted_at'] = 'IS'; } $get = DB::get( [ @@ -75,10 +80,7 @@ class Storage $sort, $limit, PDO::FETCH_ASSOC, - [ - 'type_chain' => '&', - 'deleted_at' => 'IS', - ] + $valueOperators ); if (isset($get[0]) && is_array($get[0])) { foreach ($get as $k => $v) { diff --git a/app/src/Legacy/G/functions-render.php b/app/src/Legacy/G/functions-render.php index 3364dc1..e99d105 100644 --- a/app/src/Legacy/G/functions-render.php +++ b/app/src/Legacy/G/functions-render.php @@ -19,6 +19,27 @@ use function Chevereto\Legacy\headersNoCache; * --------------------------------------------------------------------- */ +/** + * @deprecate + */ +function include_theme_file($filename, $args = []) +{ + $file = PATH_PUBLIC_LEGACY_THEME . $filename; + $override = PATH_PUBLIC_LEGACY_THEME . 'overrides/' . $filename; + if (! file_exists($file)) { + $file .= '.php'; + $override .= '.php'; + } + if (file_exists($override)) { + $file = $override; + } + if (file_exists($file)) { + $GLOBALS['theme_include_args'] = $args; + require $file; + unset($GLOBALS['theme_include_args']); + } +} + function get_theme_php_file(string $filename): string { $filename = str_replace_last('.php', '', $filename) . '.php'; diff --git a/app/src/Legacy/functions-render.php b/app/src/Legacy/functions-render.php index 89865af..8cadbd7 100644 --- a/app/src/Legacy/functions-render.php +++ b/app/src/Legacy/functions-render.php @@ -1102,6 +1102,9 @@ function getComments(): string var disqus_config = function() { this.page.url = "%page_url"; this.page.identifier = "%page_id"; + this.language = "%language_code"; + this.page.remote_auth_s3 = "%auth"; + this.page.api_key = "%api_key"; }; (function() { var d = document, s = d.createElement("script"); @@ -1109,14 +1112,9 @@ var disqus_config = function() { s.setAttribute("data-timestamp", +new Date()); (d.head || d.body).appendChild(s); })(); -var disqus_config = function () { - this.language = "%language_code"; - this.page.remote_auth_s3 = "%auth"; - this.page.api_key = "%api_key"; -}; ', [ - '%page_url' => get_current_url(), + '%page_url' => Handler::var('canonical') ?? get_current_url(removeQs: ['lang'], public: true), '%page_id' => str_replace_first(get_route_path(), get_route_name(), get_route_path(true)), // image.ID '%shortname' => getSetting('disqus_shortname'), '%language_code' => get_language_used()['base'], diff --git a/app/src/Legacy/functions.php b/app/src/Legacy/functions.php index 8e83989..049826b 100644 --- a/app/src/Legacy/functions.php +++ b/app/src/Legacy/functions.php @@ -264,11 +264,15 @@ function get_chv_default_setting(string $value = '', bool $safe = false): mixed function getStorages(): array|bool { + $where = []; + if (version_compare(cheveretoVersionInstalled(), '4.2.0', '>=')) { + $where = [ + 'deleted_at' => null, + ]; + } $storages = DB::get( table: 'storages', - where: [ - 'deleted_at' => null, - ], + where: $where, ); if ($storages) { foreach ($storages as $k => $v) { @@ -1164,6 +1168,7 @@ function loaderHandler( $envVar['CHEVERETO_XRDEBUG_HOST'] = 'host.docker.internal'; } } + $envVar = array_map('strval', $envVar); new EnvVar($envVar); new ServerVar(array_merge($envDefault, $env, $_server)); new CookieVar($_cookie); diff --git a/content/legacy/themes/Peafowl/head.php b/content/legacy/themes/Peafowl/head.php index 8a28741..dc1b724 100644 --- a/content/legacy/themes/Peafowl/head.php +++ b/content/legacy/themes/Peafowl/head.php @@ -80,7 +80,7 @@ foreach ($links as $rel => $href) { } $open_graph = [ 'type' => 'website', - 'url' => get_current_url(true, ['lang']), + 'url' => $links['canonical'] ?? get_current_url(safe: true, removeQs: ['lang'], public: true), 'title' => getSetting('website_doctitle', true), 'image' => getSetting('homepage_cover_images')[0]['url'] ?? '', 'site_name' => Handler::var('safe_html_website_name'), @@ -91,17 +91,26 @@ foreach ($links as $rel => $href) { } switch (true) { case Handler::var('image') !== null and is_route('image'): + $open_graph_key = match(Handler::var('image')['type']) { + 'video' => 'video', + default => 'image', + }; + $open_graph_type = match($open_graph_key) { + 'video' => 'video.other', + default => 'article', + }; $open_graph_extend = [ - 'type' => 'article', + 'type' => $open_graph_type, 'title' => Handler::var('pre_doctitle'), - // 'description' => _var('image')['description'], - 'image' => Handler::var('image')['url'], - 'image:width' => Handler::var('image')['width'], - 'image:height' => Handler::var('image')['height'], + 'image' => Handler::var('image')['display_url'], + $open_graph_key => Handler::var('image')['url'], + $open_graph_key . ':width' => Handler::var('image')['width'], + $open_graph_key . ':height' => Handler::var('image')['height'], + $open_graph_key . ':type' => Handler::var('image')['mime'], ]; if (Handler::var('image')['is_animated'] && Handler::var('image')['size'] < get_bytes('8 MB') - ) { + ) { $open_graph_extend['type'] = 'video.other'; $open_graph_extend['url'] = Handler::var('image')['url']; } @@ -134,7 +143,6 @@ foreach ($links as $rel => $href) { case Handler::var('album') !== null and is_route('album'): $open_graph_extend = [ 'title' => Handler::var('album')['name'], - // 'description' => _var('album')['description'], ]; break; diff --git a/content/legacy/themes/Peafowl/snippets/anywhere_upload.php b/content/legacy/themes/Peafowl/snippets/anywhere_upload.php index 6e1f62c..497c0ae 100644 --- a/content/legacy/themes/Peafowl/snippets/anywhere_upload.php +++ b/content/legacy/themes/Peafowl/snippets/anywhere_upload.php @@ -228,7 +228,7 @@ if (Login::isLoggedUser()) { -
+
diff --git a/content/legacy/themes/Peafowl/snippets/form_image.php b/content/legacy/themes/Peafowl/snippets/form_image.php index 14b3f81..b939b71 100644 --- a/content/legacy/themes/Peafowl/snippets/form_image.php +++ b/content/legacy/themes/Peafowl/snippets/form_image.php @@ -42,7 +42,7 @@ if (!defined('ACCESS') || !ACCESS) { if (!Handler::cond('allowed_nsfw_flagging')) { echo ' disabled'; } -?>> +?>>