From 64725ecce70ea228c0dff34a488d73c7c4dd9820 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 1 Jul 2021 21:46:45 -0600 Subject: [PATCH 1/2] Add diagnostics to error page and admin dashboard --- app/Http/Controllers/AdminController.php | 25 ++++ .../views/admin/diagnostics/home.blade.php | 111 ++++++++++++++++++ .../views/admin/partial/sidenav.blade.php | 14 +++ resources/views/errors/500.blade.php | 40 ++++++- routes/web.php | 3 + 5 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 resources/views/admin/diagnostics/home.blade.php diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index a55a48c1a..0bf49da89 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -440,4 +440,29 @@ class AdminController extends Controller $redirect = $news->published_at ? $news->permalink() : $news->editUrl(); return redirect($redirect); } + + public function diagnosticsHome(Request $request) + { + return view('admin.diagnostics.home'); + } + + public function diagnosticsDecrypt(Request $request) + { + $this->validate($request, [ + 'payload' => 'required' + ]); + + $key = 'exception_report:'; + $decrypted = decrypt($request->input('payload')); + + if(!starts_with($decrypted, $key)) { + abort(403, 'Can only decrypt error diagnostics'); + } + + $res = [ + 'decrypted' => substr($decrypted, strlen($key)) + ]; + + return response()->json($res); + } } diff --git a/resources/views/admin/diagnostics/home.blade.php b/resources/views/admin/diagnostics/home.blade.php new file mode 100644 index 000000000..d4031b442 --- /dev/null +++ b/resources/views/admin/diagnostics/home.blade.php @@ -0,0 +1,111 @@ +@extends('admin.partial.template') + +@include('admin.settings.sidebar') + +@section('section') +
+

Diagnostics

+

Instance diagnostics

+
+ +
+

+ Information + Copy +

+ +
+
+
+
+ + +

The payload is from the "Something went wrong" page, anyone can copy the payload for you to decrypt.
Contents are encrypted due to potential sensitive information.

+
+
+ + +
+
+ +
+
+
+@endsection + +@push('scripts') + + +@endpush diff --git a/resources/views/admin/partial/sidenav.blade.php b/resources/views/admin/partial/sidenav.blade.php index 85ba069c7..88b291eb5 100644 --- a/resources/views/admin/partial/sidenav.blade.php +++ b/resources/views/admin/partial/sidenav.blade.php @@ -64,6 +64,13 @@ + + + +