diff --git a/app/Http/Controllers/PluginController.php b/app/Http/Controllers/PluginController.php index 34948429..bfb19540 100644 --- a/app/Http/Controllers/PluginController.php +++ b/app/Http/Controllers/PluginController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Services\Plugin; use App\Services\PluginManager; use Illuminate\Http\Request; +use Parsedown; class PluginController extends Controller { @@ -38,7 +39,8 @@ class PluginController extends Controller $title = $plugin->title; $path = $plugin->getPath().'/'.$readmePath; - $content = resolve('parsedown')->text(file_get_contents($path)); + $parsedown = new Parsedown(); + $content = $parsedown->text(file_get_contents($path)); return view('admin.plugin.readme', compact('content', 'title')); } diff --git a/app/Http/Controllers/SkinlibController.php b/app/Http/Controllers/SkinlibController.php index 257d1925..10ee6d3c 100644 --- a/app/Http/Controllers/SkinlibController.php +++ b/app/Http/Controllers/SkinlibController.php @@ -10,6 +10,7 @@ use Auth; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Option; +use Parsedown; use Session; use Storage; use View; @@ -210,6 +211,8 @@ class SkinlibController extends Controller ]; $grid = $filter->apply('grid:skinlib.upload', $grid); + $parsedown = new Parsedown(); + return view('skinlib.upload') ->with('grid', $grid) ->with('extra', [ @@ -223,7 +226,7 @@ class SkinlibController extends Controller 'scorePublic' => intval(option('score_per_storage')), 'scorePrivate' => intval(option('private_score_per_storage')), 'award' => intval(option('score_award_per_texture')), - 'contentPolicy' => app('parsedown')->text(option_localized('content_policy')), + 'contentPolicy' => $parsedown->text(option_localized('content_policy')), ]); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 6169a444..faf786d4 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -14,6 +14,7 @@ use Carbon\Carbon; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Http\Request; use Mail; +use Parsedown; use Session; use URL; use View; @@ -63,6 +64,8 @@ class UserController extends Controller ]; $grid = $filter->apply('grid:user.index', $grid); + $parsedown = new Parsedown(); + return view('user.index')->with([ 'statistics' => [ 'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')), @@ -74,7 +77,7 @@ class UserController extends Controller 'player' => option('score_per_player'), 'closet' => option('score_per_closet_item'), ], - 'announcement' => app('parsedown')->text(option_localized('announcement')), + 'announcement' => $parsedown->text(option_localized('announcement')), 'grid' => $grid, 'extra' => ['unverified' => option('require_verification') && !$user->verified], ]); @@ -391,9 +394,11 @@ class UserController extends Controller }); $notification->markAsRead(); + $parsedown = new Parsedown(); + return [ 'title' => $notification->data['title'], - 'content' => app('parsedown')->text($notification->data['content']), + 'content' => $parsedown->text($notification->data['content']), 'time' => $notification->created_at->toDateTimeString(), ]; } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f7392bc0..725c5f2a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -21,7 +21,6 @@ class AppServiceProvider extends ServiceProvider $this->app->singleton('cipher', 'App\Services\Cipher\\'.config('secure.cipher')); $this->app->singleton(\App\Services\Option::class); $this->app->alias(\App\Services\Option::class, 'options'); - $this->app->singleton('parsedown', \Parsedown::class); $this->app->singleton(\App\Services\Webpack::class); $this->app->singleton(\App\Services\Filter::class); $this->app->singleton('oauth.providers', function () { diff --git a/tests/HttpTest/ControllersTest/UserControllerTest.php b/tests/HttpTest/ControllersTest/UserControllerTest.php index 4a273255..8d9e60ea 100644 --- a/tests/HttpTest/ControllersTest/UserControllerTest.php +++ b/tests/HttpTest/ControllersTest/UserControllerTest.php @@ -611,7 +611,7 @@ class UserControllerTest extends TestCase ->get('/user/notifications/'.$notification->id) ->assertJson([ 'title' => $notification->data['title'], - 'content' => app('parsedown')->text($notification->data['content']), + 'content' => (new Parsedown())->text($notification->data['content']), 'time' => $notification->created_at->toDateTimeString(), ]); $notification->refresh();