Fix last packet transfers shown, added file transfers

This commit is contained in:
2023-07-19 15:16:25 +10:00
parent f4fc6c24a4
commit 39605af693
8 changed files with 249 additions and 37 deletions

View File

@@ -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')