WIP: Added avif images support 🌄 (#1660)

* WIP: Added avif images support

* Update CHANGELOG.md

* Update admin_ranks.php
This commit is contained in:
Roman Kelesidis 2024-10-19 11:25:29 +07:00 committed by GitHub
parent 04e1adf4ba
commit 0587f7a035
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 12 additions and 8 deletions

View file

@ -7,6 +7,7 @@
- Release 2.4.5 🦕 ([belomaxorka](https://github.com/belomaxorka)) - Release 2.4.5 🦕 ([belomaxorka](https://github.com/belomaxorka))
- [CLI] TorrentPier installer ☕️ [\#1576](https://github.com/torrentpier/torrentpier/pull/1576), [\#1582](https://github.com/torrentpier/torrentpier/pull/1582), [\#1585](https://github.com/torrentpier/torrentpier/pull/1585), [\#1591](https://github.com/torrentpier/torrentpier/pull/1591) ([belomaxorka](https://github.com/belomaxorka)) - [CLI] TorrentPier installer ☕️ [\#1576](https://github.com/torrentpier/torrentpier/pull/1576), [\#1582](https://github.com/torrentpier/torrentpier/pull/1582), [\#1585](https://github.com/torrentpier/torrentpier/pull/1585), [\#1591](https://github.com/torrentpier/torrentpier/pull/1591) ([belomaxorka](https://github.com/belomaxorka))
- Added avif images support 🌄 [\#1660](https://github.com/torrentpier/torrentpier/pull/1660) ([belomaxorka](https://github.com/belomaxorka))
- Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka)) - Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka))
- Added robots meta-tag support 🤖 [\#1587](https://github.com/torrentpier/torrentpier/pull/1587) ([belomaxorka](https://github.com/belomaxorka)) - Added robots meta-tag support 🤖 [\#1587](https://github.com/torrentpier/torrentpier/pull/1587) ([belomaxorka](https://github.com/belomaxorka))
- Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624), [\#1628](https://github.com/torrentpier/torrentpier/pull/1628) ([belomaxorka](https://github.com/belomaxorka)) - Added [TorrServer](https://github.com/YouROK/TorrServer) instance support! 🎞 [\#1603](https://github.com/torrentpier/torrentpier/pull/1603), [\#1623](https://github.com/torrentpier/torrentpier/pull/1623), [\#1624](https://github.com/torrentpier/torrentpier/pull/1624), [\#1628](https://github.com/torrentpier/torrentpier/pull/1628) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -83,7 +83,7 @@ if ($mode != '') {
// The rank image has to be a jpg, gif or png // The rank image has to be a jpg, gif or png
// //
if ($rank_image != '') { if ($rank_image != '') {
if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.ico)$/is', $rank_image)) { if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp|\.avif\.ico)$/is', $rank_image)) {
$rank_image = ''; $rank_image = '';
} }
} }

View file

@ -701,6 +701,7 @@ VALUES ('1', 'gif', ''),
('1', 'jpeg', ''), ('1', 'jpeg', ''),
('1', 'jpg', ''), ('1', 'jpg', ''),
('1', 'webp', ''), ('1', 'webp', ''),
('1', 'avif', ''),
('1', 'bmp', ''), ('1', 'bmp', ''),
('2', 'gtar', ''), ('2', 'gtar', ''),
('2', 'gz', ''), ('2', 'gz', ''),

View file

@ -613,7 +613,8 @@ $bb_cfg['file_id_ext'] = [
9 => 'zip', 9 => 'zip',
10 => '7z', 10 => '7z',
11 => 'bmp', 11 => 'bmp',
12 => 'webp' 12 => 'webp',
13 => 'avif'
]; ];
// Attachments // Attachments
@ -627,7 +628,7 @@ $bb_cfg['gen_forums_allowed_ext'] = ['zip', 'rar']; // TODO: For regular section
// Avatars // Avatars
$bb_cfg['avatars'] = [ $bb_cfg['avatars'] = [
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp'], // Allowed file extensions (after changing, do the same for $bb_cfg['file_id_ext']) 'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp', 'avif'], // Allowed file extensions (after changing, do the same for $bb_cfg['file_id_ext'])
'bot_avatar' => '/gallery/bot.gif', // The bot's avatar 'bot_avatar' => '/gallery/bot.gif', // The bot's avatar
'max_size' => 100 * 1024, // Avatar's allowed dimensions 'max_size' => 100 * 1024, // Avatar's allowed dimensions
'max_height' => 100, // Avatar height in px 'max_height' => 100, // Avatar height in px
@ -640,7 +641,7 @@ $bb_cfg['avatars'] = [
// Group avatars // Group avatars
$bb_cfg['group_avatars'] = [ $bb_cfg['group_avatars'] = [
'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp'], // Allowed file extensions (add the same for $bb_cfg['file_id_ext']) 'allowed_ext' => ['gif', 'jpg', 'png', 'bmp', 'webp', 'avif'], // Allowed file extensions (add the same for $bb_cfg['file_id_ext'])
'max_size' => 300 * 1024, // max avatar size in bytes 'max_size' => 300 * 1024, // max avatar size in bytes
'max_height' => 300, // Avatar height in px 'max_height' => 300, // Avatar height in px
'max_width' => 300, // Avatar weight in px 'max_width' => 300, // Avatar weight in px

View file

@ -78,7 +78,7 @@ class BBCode
private function init_replacements(): void private function init_replacements(): void
{ {
$tpl = $this->tpl; $tpl = $this->tpl;
$img_exp = '(https?:)?//[^\s\?&;=\#\"<>]+?\.(jpg|jpeg|gif|png|bmp|webp)([a-z0-9/?&%;][^\[\]]*)?'; $img_exp = '(https?:)?//[^\s\?&;=\#\"<>]+?\.(jpg|jpeg|gif|png|bmp|webp|avif)([a-z0-9/?&%;][^\[\]]*)?';
$email_exp = '[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+'; $email_exp = '[a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+';
$this->preg = [ $this->preg = [

View file

@ -86,7 +86,8 @@ class Upload
IMAGETYPE_JPEG => 'jpg', IMAGETYPE_JPEG => 'jpg',
IMAGETYPE_PNG => 'png', IMAGETYPE_PNG => 'png',
IMAGETYPE_BMP => 'bmp', IMAGETYPE_BMP => 'bmp',
IMAGETYPE_WEBP => 'webp' IMAGETYPE_WEBP => 'webp',
IMAGETYPE_AVIF => 'avif'
]; ];
/** /**

View file

@ -374,8 +374,8 @@ var TPL = {
reg: { reg: {
num : /^\d+$/, num : /^\d+$/,
URL : /^https?:\/\/[\w\#$%&~/.\-;:=?@\[\]+]+$/i, URL : /^https?:\/\/[\w\#$%&~/.\-;:=?@\[\]+]+$/i,
img : /^https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp)$/i, img : /^https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp|avif)$/i,
img_tag : /(https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp)(?!\[|\]|\.))/ig img_tag : /(https?:\/\/[^\s\?&;:=\#\"<>]+\.(jpg|jpeg|gif|png|bmp|webp|avif)(?!\[|\]|\.))/ig
}, },
// построение сообщения на основе данных из формы // построение сообщения на основе данных из формы