mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-28 22:41:13 -05:00
remove: hdvinnie/laravel-html-purifier in preparation for octane
This commit is contained in:
@@ -150,11 +150,6 @@ class ChatController extends Controller
|
||||
return response('error', 401);
|
||||
}
|
||||
|
||||
// Temp Fix For HTMLPurifier
|
||||
if ($message === '<') {
|
||||
return response('error', 401);
|
||||
}
|
||||
|
||||
$bots = cache()->remember('bots', 3600, fn () => Bot::where('active', '=', 1)->orderByDesc('position')->get());
|
||||
|
||||
$which = null;
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace App\Http\Resources;
|
||||
use App\Helpers\Bbcode;
|
||||
use hdvinnie\LaravelJoyPixels\LaravelJoyPixels;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use voku\helper\AntiXSS;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\Message
|
||||
@@ -34,13 +35,12 @@ class ChatMessageResource extends JsonResource
|
||||
{
|
||||
$emojiOne = app()->make(LaravelJoyPixels::class);
|
||||
|
||||
$logger = null;
|
||||
$bbcode = new Bbcode();
|
||||
|
||||
if ($this->user_id == 1) {
|
||||
$logger = $bbcode->parse('<div class="align-left"><div class="chatTriggers">'.$this->message.'</div></div>');
|
||||
$logger = $emojiOne->toImage($logger);
|
||||
$logger = str_replace('a href="/#', 'a trigger="bot" class="chatTrigger" href="/#', (string) $logger);
|
||||
$logger = str_replace('a href="/#', 'a trigger="bot" class="chatTrigger" href="/#', $logger);
|
||||
} else {
|
||||
$logger = $bbcode->parse('<div class="align-left">'.$this->message.'</div>');
|
||||
$logger = $emojiOne->toImage($logger);
|
||||
@@ -53,7 +53,7 @@ class ChatMessageResource extends JsonResource
|
||||
'user' => new ChatUserResource($this->whenLoaded('user')),
|
||||
'receiver' => new ChatUserResource($this->whenLoaded('receiver')),
|
||||
'chatroom' => new ChatRoomResource($this->whenLoaded('chatroom')),
|
||||
'message' => clean($logger),
|
||||
'message' => (new AntiXSS())->xss_clean($logger),
|
||||
'created_at' => $this->created_at->toIso8601String(),
|
||||
'updated_at' => $this->updated_at->toIso8601String(),
|
||||
];
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"doctrine/dbal": "^3.9.3",
|
||||
"gabrielelana/byte-units": "^0.5.0",
|
||||
"guzzlehttp/guzzle": "^7.9.2",
|
||||
"hdvinnie/laravel-html-purifier": "^v3.0.0",
|
||||
"hdvinnie/laravel-joypixel-emojis": "^v3.0.0",
|
||||
"hdvinnie/laravel-security-headers": "^v3.0.0",
|
||||
"intervention/image": "^2.7.2",
|
||||
|
||||
Generated
+1
-132
@@ -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": "895a01f2f75fc1b56e7e2a33b78b32dc",
|
||||
"content-hash": "488a8a8b1556689bd2798c3de8ad16bd",
|
||||
"packages": [
|
||||
{
|
||||
"name": "assada/laravel-achievements",
|
||||
@@ -1072,60 +1072,6 @@
|
||||
],
|
||||
"time": "2023-10-06T06:47:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ezyang/htmlpurifier",
|
||||
"version": "v4.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ezyang/htmlpurifier.git",
|
||||
"reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
|
||||
"reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"library/HTMLPurifier.composer.php"
|
||||
],
|
||||
"psr-0": {
|
||||
"HTMLPurifier": "library/"
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/library/HTMLPurifier/Language/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Edward Z. Yang",
|
||||
"email": "admin@htmlpurifier.org",
|
||||
"homepage": "http://ezyang.com"
|
||||
}
|
||||
],
|
||||
"description": "Standards compliant HTML filter written in PHP",
|
||||
"homepage": "http://htmlpurifier.org/",
|
||||
"keywords": [
|
||||
"html"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ezyang/htmlpurifier/issues",
|
||||
"source": "https://github.com/ezyang/htmlpurifier/tree/master"
|
||||
},
|
||||
"time": "2020-06-29T00:56:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/php-cors",
|
||||
"version": "v1.3.0",
|
||||
@@ -1726,83 +1672,6 @@
|
||||
],
|
||||
"time": "2023-12-03T19:50:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hdvinnie/laravel-html-purifier",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/HDVinnie/laravel-html-purifier.git",
|
||||
"reference": "bd41a3f8418aed12514ea307ad35cf64d15c76b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/HDVinnie/laravel-html-purifier/zipball/bd41a3f8418aed12514ea307ad35cf64d15c76b6",
|
||||
"reference": "bd41a3f8418aed12514ea307ad35cf64d15c76b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ezyang/htmlpurifier": "4.13.*",
|
||||
"illuminate/config": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
|
||||
"illuminate/filesystem": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
|
||||
"illuminate/support": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
|
||||
"php": "^7.2|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"graham-campbell/testbench": "^3.2|^5.5.1",
|
||||
"mockery/mockery": "^1.3.3",
|
||||
"phpunit/phpunit": "^8.0|^9.0"
|
||||
},
|
||||
"suggest": {
|
||||
"laravel/framework": "To test the Laravel bindings",
|
||||
"laravel/lumen-framework": "To test the Lumen bindings"
|
||||
},
|
||||
"type": "package",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"HDVinnie\\Purifier\\PurifierServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Purifier": "HDVinnie\\Purifier\\Facades\\Purifier"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"HDVinnie\\Purifier\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "HDVinnie",
|
||||
"email": "hdinnovations@protonmail.com",
|
||||
"homepage": "https://github.com/HDVinnie",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "An HTML Purifier for Laravel",
|
||||
"homepage": "https://github.com/HDVinnie/laravel-html-purifier",
|
||||
"keywords": [
|
||||
"HDVinnie",
|
||||
"Purifier",
|
||||
"html",
|
||||
"laravel",
|
||||
"security",
|
||||
"xss"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/HDVinnie/laravel-html-purifier/issues",
|
||||
"source": "https://github.com/HDVinnie/laravel-html-purifier/tree/v3.0.0"
|
||||
},
|
||||
"time": "2024-03-13T15:38:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hdvinnie/laravel-joypixel-emojis",
|
||||
"version": "v3.0.0",
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Ok, glad you are here
|
||||
* first we get a config instance, and set the settings
|
||||
* $config = HTMLPurifier_Config::createDefault();
|
||||
* $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
|
||||
* $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
|
||||
* if ( ! $this->config->get('purifier.finalize')) {
|
||||
* $config->autoFinalize = false;
|
||||
* }
|
||||
* $config->loadArray($this->getConfig());.
|
||||
*
|
||||
* You must NOT delete the default settings
|
||||
* anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
|
||||
*
|
||||
* @link http://htmlpurifier.org/live/configdoc/plain.html
|
||||
*/
|
||||
|
||||
return [
|
||||
'encoding' => 'UTF-8',
|
||||
'finalize' => true,
|
||||
'cachePath' => storage_path('app/purifier'),
|
||||
'cacheFileMode' => 0755,
|
||||
'settings' => [
|
||||
'default' => [
|
||||
'HTML.Doctype' => 'HTML 4.01 Transitional',
|
||||
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title|class],ul,ol,li,p[style|class],br,span[style|class],img[width|height|alt|src|class]',
|
||||
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
|
||||
'AutoFormat.AutoParagraph' => false,
|
||||
'AutoFormat.RemoveEmpty' => false,
|
||||
],
|
||||
'test' => [
|
||||
'Attr.EnableID' => 'true',
|
||||
],
|
||||
'youtube' => [
|
||||
'HTML.SafeIframe' => 'true',
|
||||
'URI.SafeIframeRegexp' => '%^(http://|https://|//)(www.youtube-nocookie.com/embed/)%',
|
||||
],
|
||||
'custom_definition' => [
|
||||
'id' => 'html5-definitions',
|
||||
'rev' => 1,
|
||||
'debug' => false,
|
||||
'elements' => [
|
||||
// http://developers.whatwg.org/sections.html
|
||||
['section', 'Block', 'Flow', 'Common'],
|
||||
['nav', 'Block', 'Flow', 'Common'],
|
||||
['article', 'Block', 'Flow', 'Common'],
|
||||
['aside', 'Block', 'Flow', 'Common'],
|
||||
['header', 'Block', 'Flow', 'Common'],
|
||||
['footer', 'Block', 'Flow', 'Common'],
|
||||
|
||||
// Content model actually excludes several tags, not modelled here
|
||||
['address', 'Block', 'Flow', 'Common'],
|
||||
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/grouping-content.html
|
||||
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
|
||||
['figcaption', 'Inline', 'Flow', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/the-video-element.html#the-video-element
|
||||
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
'width' => 'Length',
|
||||
'height' => 'Length',
|
||||
'poster' => 'URI',
|
||||
'preload' => 'Enum#auto,metadata,none',
|
||||
'controls' => 'Bool',
|
||||
]],
|
||||
['source', 'Block', 'Flow', 'Common', [
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
]],
|
||||
|
||||
// http://developers.whatwg.org/text-level-semantics.html
|
||||
['s', 'Inline', 'Inline', 'Common'],
|
||||
['var', 'Inline', 'Inline', 'Common'],
|
||||
['sub', 'Inline', 'Inline', 'Common'],
|
||||
['sup', 'Inline', 'Inline', 'Common'],
|
||||
['mark', 'Inline', 'Inline', 'Common'],
|
||||
['wbr', 'Inline', 'Empty', 'Core'],
|
||||
|
||||
// http://developers.whatwg.org/edits.html
|
||||
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
],
|
||||
'attributes' => [
|
||||
['iframe', 'allowfullscreen', 'Bool'],
|
||||
['table', 'height', 'Text'],
|
||||
['td', 'border', 'Text'],
|
||||
['th', 'border', 'Text'],
|
||||
['tr', 'width', 'Text'],
|
||||
['tr', 'height', 'Text'],
|
||||
['tr', 'border', 'Text'],
|
||||
],
|
||||
],
|
||||
'custom_attributes' => [
|
||||
['a', 'target', 'Enum#_blank,_self,_target,_top'],
|
||||
],
|
||||
'custom_elements' => [
|
||||
['u', 'Inline', 'Inline', 'Common'],
|
||||
],
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user