diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 661dfe4..6c368b9 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -11,7 +11,8 @@ use Illuminate\Support\Facades\Gate;
use App\Classes\File;
use App\Classes\FTN\Packet;
use App\Http\Requests\SetupRequest;
-use App\Models\{Address,Domain,Echomail,Netmail,Setup};
+use App\Models\File as FileModel;
+use App\Models\{Address,Domain,Echomail,Netmail,Setup,System};
class HomeController extends Controller
{
@@ -20,6 +21,27 @@ class HomeController extends Controller
return redirect(Auth::check() ? 'dashboard' : 'about');
}
+ public function file_contents(System $o,string $date)
+ {
+ $f = FileModel::select('files.*')
+ ->distinct()
+ ->leftJoin('file_seenby',['file_seenby.file_id'=>'files.id'])
+ ->where(function($query) use ($o,$date) {
+ return $query
+ ->where('created_at',$date)
+ ->whereIn('fftn_id',$o->addresses->pluck('id'));
+ })
+ ->Orwhere(function($query) use ($o,$date) {
+ return $query
+ ->where('sent_at',$date)
+ ->whereIn('address_id',$o->addresses->pluck('id'));
+ })
+ ->get();
+
+ return view('file')
+ ->with('f',$f);
+ }
+
public function network(Domain $o)
{
if (! $o->public && ! Gate::check('admin',$o))
@@ -31,12 +53,12 @@ class HomeController extends Controller
->with('o',$o);
}
- public function packet_contents(string $packet)
+ public function packet_contents(System $o,string $packet)
{
$nm = Netmail::select('netmails.*')
->distinct()
->leftJoin('netmail_path',['netmail_path.netmail_id'=>'netmails.id'])
- ->where(function($query) use ($packet) {
+ ->where(function($query) use ($o,$packet) {
return $query
->where('sent_pkt',$packet)
->orWhere('netmail_path.recv_pkt',$packet);
@@ -47,11 +69,17 @@ class HomeController extends Controller
->distinct()
->leftJoin('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id'])
->leftJoin('echomail_path',['echomail_path.echomail_id'=>'echomails.id'])
- ->where(function($query) use ($packet) {
+ ->where(function($query) use ($o,$packet) {
return $query
->where('sent_pkt',$packet)
- ->orWhere('recv_pkt',$packet);
+ ->whereIn('echomail_seenby.address_id',$o->addresses->pluck('id'));
})
+ ->orWhere(function($query) use ($o,$packet) {
+ return $query
+ ->where('recv_pkt',$packet)
+ ->whereIn('echomail_path.address_id',$o->addresses->pluck('id'));
+ })
+ ->with('echoarea')
->get();
return view('packet')
diff --git a/database/migrations/2023_07_19_132953_remove_recvpkt.php b/database/migrations/2023_07_19_132953_remove_recvpkt.php
new file mode 100644
index 0000000..f683c68
--- /dev/null
+++ b/database/migrations/2023_07_19_132953_remove_recvpkt.php
@@ -0,0 +1,26 @@
+dropColumn(['recv_pkt']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ abort(500,'Cant go back');
+ }
+};
diff --git a/resources/views/file.blade.php b/resources/views/file.blade.php
new file mode 100644
index 0000000..a4a7d96
--- /dev/null
+++ b/resources/views/file.blade.php
@@ -0,0 +1,24 @@
+@if($f->count())
+
+
+
+ Files |
+
+
+ Origin |
+ Name |
+ Date |
+
+
+
+
+ @foreach ($f as $oo)
+
+ {{ $oo->fftn->ftn }} |
+ {{ $oo->name }} |
+ {{ $oo->datetime }} |
+
+ @endforeach
+
+
+@endif
\ No newline at end of file
diff --git a/resources/views/packet.blade.php b/resources/views/packet.blade.php
index 2c14c24..83f3ab8 100644
--- a/resources/views/packet.blade.php
+++ b/resources/views/packet.blade.php
@@ -34,6 +34,7 @@
From |
MSGID |
+ Echoarea |
Date |
@@ -43,6 +44,7 @@
{{ $oo->fftn->ftn }} |
{{ $oo->msgid }} |
+ {{ $oo->echoarea->name }} |
{{ $oo->datetime }} |
@endforeach
diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php
index 742d4ac..4a29aea 100644
--- a/resources/views/system/addedit.blade.php
+++ b/resources/views/system/addedit.blade.php
@@ -417,8 +417,10 @@
The last Netmails sent (to you):
- @if(($x=\App\Models\Netmail::whereIn('sent_id',$o->addresses->pluck('id'))
+ @if(($x=\App\Models\Netmail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')])
+ ->whereIn('sent_id',$o->addresses->pluck('id'))
->whereNotNull('sent_at')
+ ->groupBy(['sent_pkt','sent_at'])
->orderBy('sent_at','DESC')
->limit(10)
->get())->count())
@@ -427,17 +429,17 @@
Packet |
- Count |
Sent |
+ Count |
- @foreach ($x->groupBy('sent_pkt') as $oo)
+ @foreach ($x as $oo)
- {{ $oo->first()->sent_pkt }} |
- {{ $oo->count() }} |
- {{ $oo->first()->sent_at }} |
+ {{ $oo->sent_pkt }} |
+ {{ $oo->sent_at }} |
+ {{ $oo->count }} |
@endforeach
@@ -450,29 +452,62 @@
The last Echomails sent (to you):
- @if(($x=\App\Models\Echomail::select(['echomails.id','echomail_seenby.sent_pkt','echomail_seenby.sent_at'])
+ @if(($x=\App\Models\Echomail::select(['sent_pkt','sent_at',DB::raw('count(*) AS count')])
->join('echomail_seenby',['echomail_seenby.echomail_id'=>'echomails.id'])
- ->whereNotNull('echomail_seenby.sent_at')
+ ->whereNotNull('sent_at')
->whereIn('address_id',$o->addresses->pluck('id'))
+ ->groupBy(['sent_pkt','sent_at'])
->orderBy('sent_at','DESC')
- ->orderBy('sent_pkt')
->limit(10)
->get())->count())
Packet |
- Count |
Sent |
+ Count |
- @foreach ($x->groupBy('sent_pkt') as $oo)
+ @foreach ($x as $oo)
- {{ $oo->first()->sent_pkt }} |
- {{ $oo->count() }} |
- {{ $oo->first()->sent_at }} |
+ {{ $oo->sent_pkt }} |
+ {{ $oo->sent_at }} |
+ {{ $oo->count }} |
+
+ @endforeach
+
+
+ @else
+
None
+ @endif
+
+
+
+ The last Files sent (to you):
+
+ @if(($x=\App\Models\File::select(['sent_at',DB::raw('count(*) AS count')])
+ ->join('file_seenby',['file_seenby.file_id'=>'files.id'])
+ ->whereNotNull('sent_at')
+ ->whereIn('address_id',$o->addresses->pluck('id'))
+ ->groupBy(['sent_at'])
+ ->orderBy('sent_at','DESC')
+ ->limit(10)
+ ->get())->count())
+
+
+
+ Session |
+ Count |
+
+
+
+
+ @foreach ($x as $oo)
+
+ {{ $oo->sent_at }} |
+ {{ $oo->count }} |
@endforeach
@@ -487,9 +522,10 @@
The last Netmails received (you sent):
- @if(($x=\App\Models\Netmail::select(['netmails.*','netmail_path.recv_pkt'])
+ @if(($x=\App\Models\Netmail::select(['recv_pkt','created_at',DB::raw('count(*) AS count')])
->join('netmail_path',['netmail_path.netmail_id'=>'netmails.id'])
->whereIn('address_id',$o->addresses->pluck('id'))
+ ->groupBy(['recv_pkt','created_at'])
->orderBy('created_at','DESC')
->limit(10)
->get())->count())
@@ -497,17 +533,17 @@
Packet |
- Count |
Received |
+ Count |
- @foreach ($x->groupBy('recv_pkt') as $oo)
+ @foreach ($x as $oo)
- {{ $oo->first()->recv_pkt }} |
- {{ $oo->count() }} |
- {{ $oo->first()->created_at }} |
+ {{ $oo->recv_pkt }} |
+ {{ $oo->created_at }} |
+ {{ $oo->count }} |
@endforeach
@@ -520,29 +556,60 @@
The last Echomails received (you sent):
- @if(($x=\App\Models\Echomail::select(['echomails.created_at','echomail_path.recv_pkt'])
+ @if(($x=\App\Models\Echomail::select(['recv_pkt','created_at',DB::raw('count(*) AS count')])
->join('echomail_path',['echomail_path.echomail_id'=>'echomails.id'])
- ->whereNotNull('echomail_path.recv_pkt')
+ ->whereNotNull('recv_pkt')
->whereIn('address_id',$o->addresses->pluck('id'))
+ ->groupBy(['recv_pkt','created_at'])
->orderBy('created_at','DESC')
- ->orderBy('recv_pkt')
->limit(10)
->get())->count())
Packet |
- Count |
Received |
+ Count |
- @foreach ($x->groupBy('recv_pkt') as $oo)
+ @foreach ($x as $oo)
- {{ $oo->first()->recv_pkt }} |
- {{ $oo->count() }} |
- {{ $oo->first()->created_at }} |
+ {{ $oo->recv_pkt }} |
+ {{ $oo->created_at }} |
+ {{ $oo->count }} |
+
+ @endforeach
+
+
+ @else
+
None
+ @endif
+
+
+
+ The last Files received (from you):
+
+ @if(($x=\App\Models\File::select(['created_at',DB::raw('count(*) AS count')])
+ ->whereIn('fftn_id',$o->addresses->pluck('id'))
+ ->groupBy(['created_at'])
+ ->orderBy('created_at','DESC')
+ ->limit(10)
+ ->get())->count())
+
+
+
+ Session |
+ Count |
+
+
+
+
+ @foreach ($x as $oo)
+
+ {{ $oo->created_at }} |
+ {{ $oo->count }} |
@endforeach
@@ -562,6 +629,7 @@
@include('widgets.modal_packet')
+ @include('widgets.modal_files')
@include('widgets.modal_purge')
@endsection
diff --git a/resources/views/widgets/modal_files.blade.php b/resources/views/widgets/modal_files.blade.php
new file mode 100644
index 0000000..6417566
--- /dev/null
+++ b/resources/views/widgets/modal_files.blade.php
@@ -0,0 +1,58 @@
+
+
+
+@section('page-scripts')
+
+@append
\ No newline at end of file
diff --git a/resources/views/widgets/modal_packet.blade.php b/resources/views/widgets/modal_packet.blade.php
index 1f49606..5e87b8b 100644
--- a/resources/views/widgets/modal_packet.blade.php
+++ b/resources/views/widgets/modal_packet.blade.php
@@ -1,3 +1,4 @@
+
@@ -34,18 +35,19 @@
data: {packet: e.target.innerText,_token: '{{csrf_token()}}'},
beforeSend: function() {
icon.toggleClass('d-none');
+ $('#packet-contents').find('div#modal-content').empty();
},
success: function(data) {
icon.toggleClass('d-none');
- $('div#modal-content').html(data);
+ $('#packet-contents').find('div#modal-content').html(data);
},
error: function(e) {
icon.toggleClass('d-none');
alert('That didnt work? Please try again....');
},
- url: '{{ url('packet/contents') }}/'+e.target.innerText,
+ url: '{{ url('packet/contents',['o'=>$o->id]) }}/'+e.target.innerText,
cache: false
})
diff --git a/routes/web.php b/routes/web.php
index b0a319a..5cc86b5 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -91,6 +91,9 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::match(['get','post'],'ftn/system/movaddress/{so}/{o}',[SystemController::class,'mov_address'])
->where('so','[0-9]+')
->where('o','[0-9]+');
+ Route::post('file/contents/{o}/{date}',[HomeController::class,'file_contents'])
+ ->where('o','[0-9]+')
+ ->where('date','[0-9:\-@]+');
Route::get('ftn/system/recaddress/{id}',[SystemController::class,'rec_address'])
->where('o','[0-9]+');
Route::get('ftn/system/puraddress/{id}',[SystemController::class,'pur_address'])
@@ -106,8 +109,9 @@ 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::post('packet/contents/{o}/{packet}',[HomeController::class,'packet_contents'])
+ ->where('o','[0-9]+')
+ ->where('packet','[0-9a-f]+');
Route::get('permissions',[HomeController::class,'permissions']);
Route::get('regions/{o}',[DomainController::class,'api_regions'])
->where('o','[0-9]+');