From a8f76aec319150e8f2485232fa443d58b14199fd Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 16 Jul 2023 00:41:36 +1000 Subject: [PATCH] Show packet contents for nodes --- app/Http/Controllers/HomeController.php | 28 ++++++++++ resources/views/packet.blade.php | 51 +++++++++++++++++ resources/views/system/addedit.blade.php | 9 +-- .../views/widgets/modal_packet.blade.php | 56 +++++++++++++++++++ routes/web.php | 2 + 5 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 resources/views/packet.blade.php create mode 100644 resources/views/widgets/modal_packet.blade.php diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 45a0265..661dfe4 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -31,6 +31,34 @@ class HomeController extends Controller ->with('o',$o); } + public function packet_contents(string $packet) + { + $nm = Netmail::select('netmails.*') + ->distinct() + ->leftJoin('netmail_path',['netmail_path.netmail_id'=>'netmails.id']) + ->where(function($query) use ($packet) { + return $query + ->where('sent_pkt',$packet) + ->orWhere('netmail_path.recv_pkt',$packet); + }) + ->get(); + + $em = Echomail::select('echomails.*') + ->distinct() + ->leftJoin('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id']) + ->leftJoin('echomail_path',['echomail_path.echomail_id'=>'echomails.id']) + ->where(function($query) use ($packet) { + return $query + ->where('sent_pkt',$packet) + ->orWhere('recv_pkt',$packet); + }) + ->get(); + + return view('packet') + ->with('nm',$nm) + ->with('em',$em); + } + /** * Render a view that summarises the users permissions */ diff --git a/resources/views/packet.blade.php b/resources/views/packet.blade.php new file mode 100644 index 0000000..2c14c24 --- /dev/null +++ b/resources/views/packet.blade.php @@ -0,0 +1,51 @@ +@if($nm->count()) + + + + + + + + + + + + + + + @foreach ($nm as $oo) + + + + + + + @endforeach + +
Netmails
FromToMSGIDDate
{{ $oo->fftn->ftn }}{{ $oo->tftn->ftn }}{{ $oo->msgid }}{{ $oo->datetime }}
+@endif + +@if($em->count()) + + + + + + + + + + + + + + @foreach ($em as $oo) + + + + + + @endforeach + +
Echomails
FromMSGIDDate
{{ $oo->fftn->ftn }}{{ $oo->msgid }}{{ $oo->datetime }}
+@endif \ No newline at end of file diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 5777cba..742d4ac 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -435,7 +435,7 @@ @foreach ($x->groupBy('sent_pkt') as $oo) - {{ $oo->first()->sent_pkt }} + {{ $oo->first()->sent_pkt }} {{ $oo->count() }} {{ $oo->first()->sent_at }} @@ -470,7 +470,7 @@ @foreach ($x->groupBy('sent_pkt') as $oo) - {{ $oo->first()->sent_pkt }} + {{ $oo->first()->sent_pkt }} {{ $oo->count() }} {{ $oo->first()->sent_at }} @@ -505,7 +505,7 @@ @foreach ($x->groupBy('recv_pkt') as $oo) - {{ $oo->first()->recv_pkt }} + {{ $oo->first()->recv_pkt }} {{ $oo->count() }} {{ $oo->first()->created_at }} @@ -540,7 +540,7 @@ @foreach ($x->groupBy('recv_pkt') as $oo) - {{ $oo->first()->recv_pkt }} + {{ $oo->first()->recv_pkt }} {{ $oo->count() }} {{ $oo->first()->created_at }} @@ -561,6 +561,7 @@ @endif + @include('widgets.modal_packet') @include('widgets.modal_purge') @endsection diff --git a/resources/views/widgets/modal_packet.blade.php b/resources/views/widgets/modal_packet.blade.php new file mode 100644 index 0000000..1f49606 --- /dev/null +++ b/resources/views/widgets/modal_packet.blade.php @@ -0,0 +1,56 @@ + + +@section('page-scripts') + +@append \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index c6ebac7..b0a319a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -106,6 +106,8 @@ Route::middleware(['auth','verified','activeuser'])->group(function () { Route::get('hubs/{o}/{host}',[DomainController::class,'api_hubs']) ->where('o','[0-9]+'); Route::match(['get','post'],'link',[UserController::class,'link']); + Route::post('packet/contents/{o}',[HomeController::class,'packet_contents']) + ->where('o','[0-9a-f]+'); Route::get('permissions',[HomeController::class,'permissions']); Route::get('regions/{o}',[DomainController::class,'api_regions']) ->where('o','[0-9]+');