diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index 8605fca..57a5e8a 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -1290,7 +1290,7 @@ final class Binkp extends BaseProtocol Log::info(sprintf('%s:- SECURE',self::LOGKEY)); // @todo Since we have connected, if the node was marked down/hold reset that - // Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); + // Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); } return $this->binkp_hsdone(); @@ -1389,7 +1389,7 @@ final class Binkp extends BaseProtocol $this->msgs(self::BPM_OK,sprintf('%ssecure',$have_pwd ? '' : 'non-')); // @todo Since we have connected, if the node was marked down/hold reset that - // Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); + // Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); } else { $this->msgs(self::OK,'non-secure'); diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index c80292e..f2ca62e 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -1062,7 +1062,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface } // @todo Since we have connected, if the node was marked down/hold reset that - // Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); + // Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); // @todo Lock Node AKAs diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index d3e5254..96726f5 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -115,7 +115,7 @@ class DomainController extends Controller if (! $o->public && ! Gate::check('admin',$o)) abort(404); - $o->load(['zones.system','zones.domain','zones.addresses.nodes_hub','zones.addresses']); + $o->load(['zones.system','zones.domain','zones.addresses.nodes_hub','zones.addresses.echomail_from']); return view('domain.view') ->with('o',$o); diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 4934aa2..ce30eb4 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -66,7 +66,15 @@ class SystemController extends Controller ->with('saved',TRUE); } - $o->load(['addresses.zone.domain','addresses.system','sessions.domain','sessions.systems']); + $o->loadMissing([ + 'zcs', + // For 'ftn' to work + 'addresses.zone:id,zone_id,domain_id,active', + 'addresses.zone.domain:id,name,active', + // For 'role' + 'addresses.system:id,address', + ]); + //$o->load(['sessions.domain','sessions.systems']); return view('system.addedit') ->with('action',$o->exists ? 'update_nn' : 'create') @@ -611,31 +619,12 @@ class SystemController extends Controller */ public function register(SystemRegisterRequest $request) { - // Step 1, show the user a form to select an existing defined system - if ($request->isMethod('GET')) - return view('user.system.register'); - if ($request->action === 'register' && $request->name && is_numeric($request->name)) return view('user.system.widget.register_confirm') ->with('o',System::findOrFail($request->name)); $o = System::findOrNew(is_numeric($request->system_id) ? $request->system_id : NULL); - // If the system exists, and we are 'register', we'll start the address claim process - if ($o->exists && $request->action === 'Link') { - $validate = Setup::findOrFail(config('app.id'))->system->inMyZones($o->addresses); - - // If we have addresses, we'll trigger the routed netmail - if ($validate->count()) { - Notification::route('netmail',$x=$validate->first())->notify(new AddressLink(Auth::user())); - AddressPoll::dispatch($x)->delay(15); - } - - return view('user.system.widget.register_send') - ->with('validate',$validate) - ->with('o',$o); - } - // If the system doesnt exist, we'll create it if (! $o->exist) { $o->sysop = Auth::user()->name; diff --git a/app/Jobs/AddressIdle.php b/app/Jobs/AddressIdle.php index 74538ea..b2cb3a6 100644 --- a/app/Jobs/AddressIdle.php +++ b/app/Jobs/AddressIdle.php @@ -104,8 +104,8 @@ class AddressIdle implements ShouldQueue } // Netmail Alert (to othernet network address) - if ($ao->system->uncommon()->count()) { - Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeDelistedNetmail($ao->withoutRelations())); + if ($ao->system->aka_unknown()->count()) { + Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeDelistedNetmail($ao->withoutRelations())); $contact = TRUE; } @@ -140,8 +140,8 @@ class AddressIdle implements ShouldQueue } // Netmail Alert (to othernet network address) - if ($ao->system->uncommon()->count()) { - Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); + if ($ao->system->aka_unknown()->count()) { + Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations())); $contact = TRUE; } @@ -188,8 +188,8 @@ class AddressIdle implements ShouldQueue } // Netmail Alert (to othernet network address) - if ($ao->system->uncommon()->count()) { - Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedHoldNetmail($ao->withoutRelations())); + if ($ao->system->aka_unknown()->count()) { + Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedHoldNetmail($ao->withoutRelations())); $contact = TRUE; } @@ -214,21 +214,9 @@ class AddressIdle implements ShouldQueue $age = Carbon::now()->subDays($days)->endOfDay(); - return Address::select([ - 'addresses.id', - 'system_id', - 'zone_id', - 'region_id', - 'host_id', - 'node_id', - 'point_id', - 'addresses.active', - 'hub_id', - 'role', - 'addresses.updated_at', - ]) - ->activeFTN() - ->where('systems.active',TRUE) + return Address::FTN() + ->ActiveFTN() + ->addSelect(['addresses.updated_at']) ->where(fn($query)=>$query->where('point_id',0)->orWhereNull('point_id')) ->whereIn('addresses.id',our_nodes($do)->pluck('id')) ->when($ao,fn($query)=>$query->where('addresses.id',$ao->id)) @@ -236,9 +224,7 @@ class AddressIdle implements ShouldQueue ->whereRaw(sprintf('((role IS NULL) OR (role=0) OR ((role & %d) > 0))',$flags)) ->whereRaw(sprintf('((role IS NULL) OR ((role & %d) = 0))',Address::NODE_KEEP)) ->join('systems',['systems.id'=>'addresses.system_id']) - ->ftnOrder() - ->with(['system','zone.domain']) - ->dontCache() + //->with(['system','zone.domain']) ->get(); } } \ No newline at end of file diff --git a/app/Models/Address.php b/app/Models/Address.php index 032d5c1..17c923b 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -395,16 +395,14 @@ class Address extends Model * * @param $query * @return mixed + * @note zones and domains needs to be joined in the base call, or use FTN() */ public function scopeActiveFTN($query) { - return $query->select($this->getTable().'.*') - ->join('zones',['zones.id'=>'addresses.zone_id']) - ->join('domains',['domains.id'=>'zones.domain_id']) + return $query ->where('zones.active',TRUE) ->where('domains.active',TRUE) - ->active() - ->FTNorder(); + ->active(); } /** @@ -416,13 +414,21 @@ class Address extends Model public function scopeFTN($query) { return $query - ->select(['id','addresses.zone_id','host_id','node_id','point_id','system_id']) + ->select(['addresses.id','region_id','host_id','node_id','point_id','addresses.zone_id','addresses.active','role','security','addresses.system_id','addresses.active','validated']) + ->join('zones',['zones.id'=>'addresses.zone_id']) + ->join('domains',['domains.id'=>'zones.domain_id']) + ->orderBy('domains.name') + ->orderBy('region_id') + ->orderBy('host_id') + ->orderBy('node_id') + ->orderBy('point_id') ->with([ - 'zone:zones.id,domain_id,zone_id', - 'zone.domain:domains.id,name', + 'zone:zones.id,domain_id,zone_id,active', + 'zone.domain:domains.id,name,active,public', ]); } + /** @deprecated use FTN() */ public function scopeFTNOrder($query) { return $query diff --git a/app/Models/System.php b/app/Models/System.php index 12f80a0..abc7dbc 100644 --- a/app/Models/System.php +++ b/app/Models/System.php @@ -48,35 +48,39 @@ class System extends Model $uo = Auth::user(); return $query - ->when($uo && ! $uo->isAdmin(),function($query) use ($uo) { - return $query->whereIn('id',$uo->systems->pluck('id')) - ->orWhere($this->getTable().'.active',TRUE); - },function($query) { $query->where($this->getTable().'.active',TRUE); }) + ->when( + $uo && ! $uo->isAdmin(), + fn($query)=> + $query + ->whereIn('id',$uo->systems->pluck('id')) + ->orWhere($this->getTable().'.active',TRUE), + fn($query)=>$query->where($this->getTable().'.active',TRUE)) ->orderBy('name'); } /* RELATIONS */ + /** + * All addresses assigned to a system, including addresses pending deletion + * @return mixed + */ public function addresses() { return $this->hasMany(Address::class) - ->withTrashed() - ->FTNorder(); + ->FTN() + ->withTrashed(); } + /** + * System addresses that are active + * + * @return mixed + */ public function akas() { return $this->hasMany(Address::class) - ->select('addresses.*') - ->join('zones',['zones.id'=>'addresses.zone_id']) - ->join('domains',['domains.id'=>'zones.domain_id']) - ->where('addresses.active',TRUE) - ->where('zones.active',TRUE) - ->where('domains.active',TRUE) - ->orderBy('domains.name') - ->with(['zone.domain']) - ->FTNorder() - ->orderBy('role','ASC'); + ->FTN() + ->ActiveFTN(); } public function mailers() @@ -136,7 +140,14 @@ class System extends Model */ public function zcs() { - return $this->hasMany(Zone::class); + return $this->hasMany(Zone::class) + ->select(['zones.id','zone_id','domain_id','system_id','zones.active']) + ->join('domains',['domains.id'=>'zones.domain_id']) + ->orderBy('domains.name') + ->orderBy('zone_id') + ->with([ + 'domain:id,name,active', + ]); } /** @@ -189,6 +200,58 @@ class System extends Model /* METHODS */ + /** + * Return the ACTIVE addresses that are common with our addresses + * + * @return Collection + * @throws \Exception + */ + public function aka_common(): Collection + { + $our = our_address()->pluck('zone.domain_id')->unique(); + + // Return our akas, filter with our_addresses() + return $this->akas->filter(fn($item)=>$our->contains($item->zone->domain_id)); + } + + /** + * Return the ACTIVE addresses that we auth with + * + * @return Collection + * @throws \Exception + */ + public function aka_known(): Collection + { + return $this->aka_common() + ->filter(fn($item)=>$this->sessions->contains($item->zone_id)); + } + + /** + * Return the ACTIVE addresses in the same networks as us, but dont auth here + * + * @return Collection + * @throws \Exception + */ + public function aka_unknown(): Collection + { + return $this->aka_common() + ->filter(fn($item)=>! $this->sessions->contains($item->zone_id)); + } + + /** + * Return the AKAs that are in networks not common with us + * + * @return Collection + * @throws \Exception + */ + public function aka_uncommon(): Collection + { + $our = our_address()->pluck('zone.domain_id')->unique(); + + // Return our akas, filter with our_addresses() + return $this->akas->filter(fn($item)=>! $our->contains($item->zone->domain_id)); + } + public function echoareas() { return Echoarea::select('echoareas.*') @@ -250,28 +313,13 @@ class System extends Model : $akas; } - /** - * Parse the addresses and return which ones are in my zones - * - * @param \Illuminate\Database\Eloquent\Collection $addresses - * @param int $type - * @return Collection - */ - public function inMyZones(Collection $addresses,int $type=(Address::NODE_HC|Address::NODE_NN|Address::NODE_POINT)): Collection - { - $myzones = $this->addresses->pluck('zone_id')->unique(); - - return $addresses->filter(function($item) use ($myzones,$type) { - return ($item->role & $type) && ($myzones->search($item->zone_id) !== FALSE); - }); - } - /** * Return the packet that this system uses * * @param Address $ao * @param string|null $password * @return Packet + * @throws \Exception */ public function packet(Address $ao,string $password=NULL): Packet { @@ -289,22 +337,7 @@ class System extends Model { return Job::where('queue',AddressPoll::QUEUE) ->get() - ->where(function($item) { - return $this->akas->pluck('id')->search($item->command->address->id) !== FALSE; }) + ->where(fn($item)=>$this->akas->pluck('id')->contains($item->command->address->id)) ->last(); } - - /** - * Return other addresses that are not collected here, but are on the same network as us. - * - * @return \Illuminate\Database\Eloquent\Collection - * @throws \Exception - */ - public function uncommon(): Collection - { - $our = our_address(); - - return $this->akas - ->filter(fn($item)=>(($x=$item->parent()) && (! $our->contains($x)) && ($our->pluck('zone.domain_id')->contains($item->zone->domain_id)))); - } } \ No newline at end of file diff --git a/app/Models/User.php b/app/Models/User.php index 0df3cf5..f1fd1d6 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -75,19 +75,14 @@ class User extends Authenticatable implements MustVerifyEmail /* GENERAL METHODS */ - public function addresses(Domain $o=NULL): Collection + public function addresses(): Collection { return Address::select('addresses.*') ->join('systems',['systems.id'=>'addresses.system_id']) ->join('system_user',['system_user.system_id'=>'systems.id']) - ->when(! is_null($o),function($query) use ($o) { - return $query - ->join('zones',['zones.id'=>'addresses.zone_id']) - ->where('zones.domain_id',$o->id); - }) ->where('system_user.user_id',$this->id) - ->activeFTN() - ->with(['zone.domain']) + ->ActiveFTN() + ->FTN() ->get(); } diff --git a/app/Notifications/Netmails/NodeMarkedDown.php b/app/Notifications/Netmails/NodeMarkedDown.php index f6a6240..9d16cac 100644 --- a/app/Notifications/Netmails/NodeMarkedDown.php +++ b/app/Notifications/Netmails/NodeMarkedDown.php @@ -46,9 +46,9 @@ class NodeMarkedDown extends Netmails //implements ShouldQueue ->addText(sprintf("Your system has been marked **DOWN**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now))) ->addText("\r") ->addText("You have (waiting for collection):\r") - ->addText(sprintf('* %s Netmails',number_format($this->ao->netmailWaiting()->count()))) - ->addText(sprintf('* %s Echomails',number_format($this->ao->echomailWaiting()->count()))) - ->addText(sprintf('* %s Files',number_format($this->ao->filesWaiting()->count()))) + ->addText(sprintf("* %s Netmails\r",number_format($this->ao->netmailWaiting()->count()))) + ->addText(sprintf("* %s Echomails\r",number_format($this->ao->echomailWaiting()->count()))) + ->addText(sprintf("* %s Files\r",number_format($this->ao->filesWaiting()->count()))) ->addText("\r") ->addText(sprintf("Your system will automatically be **DE-LISTED** if your system hasnt polled to collected your mail/file(s) by **%s**\r\r",$now->addDays(7)->format('Y-m-d'))) ->addText("If you think you've received this netmail by mistake or need help, please let me know.\r"); diff --git a/app/Notifications/Netmails/NodeMarkedHold.php b/app/Notifications/Netmails/NodeMarkedHold.php index 7ed1e5c..f1ad715 100644 --- a/app/Notifications/Netmails/NodeMarkedHold.php +++ b/app/Notifications/Netmails/NodeMarkedHold.php @@ -47,9 +47,9 @@ class NodeMarkedHold extends Netmails //implements ShouldQueue ->addText(sprintf("Your system has been marked **HOLD**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now))) ->addText("\r") ->addText("You have (waiting for collection):\r") - ->addText(sprintf('* %s Netmails',number_format($this->ao->netmailWaiting()->count()))) - ->addText(sprintf('* %s Echomails',number_format($this->ao->echomailWaiting()->count()))) - ->addText(sprintf('* %s Files',number_format($this->ao->filesWaiting()->count()))) + ->addText(sprintf("* %s Netmails\r",number_format($this->ao->netmailWaiting()->count()))) + ->addText(sprintf("* %s Echomails\r",number_format($this->ao->echomailWaiting()->count()))) + ->addText(sprintf("* %s Files\r",number_format($this->ao->filesWaiting()->count()))) ->addText("\r") ->addText(sprintf("To clear this status, all you need to do make sure your system polls and collects mail by **%s**\r\r",($this->ao->system->last_seen ?: Carbon::now())->addDays(config('fido.idle.down'))->format('Y-m-d'))) ->addText("If you think you've received this netmail by mistake or need help, please let me know.\r"); diff --git a/app/helpers.php b/app/helpers.php index 948b8ca..aedc087 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -114,6 +114,7 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL // We are requesting a list of addresses for a Domain, or a specific Address, and we have more than 1 switch (get_class($o)) { + // Looking for addresses in the same domain, and if fido.strict, addresses that have a higher role (ie: uplink) case Address::class: $filter = $so->system->akas ->filter(fn($item)=>$item->zone->domain_id === $o->zone->domain_id) @@ -125,6 +126,7 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL return $filter->count() ? $filter->last()->unsetRelation('nodes_hub') : NULL; + // Addresses in this domain case Domain::class: return $so->system->akas ->filter(fn($item)=>$item->zone->domain_id === $o->id) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 79144f2..b5a0b15 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -28,9 +28,7 @@ $user->load(['systems.akas.zone.domain.echoareas','systems.akas.echoareas']); @foreach($user ->addresses() ->diff(our_address()) - ->filter(fn($item)=>($item->point_id === 0)) - ->filter(function($item) { return $item->zone->domain->active && $item->zone->domain->public && $item->zone->domain->isManaged(); }) - ->sortBy('zone.domain.name') + ->filter(fn($item)=>($item->point_id === 0) && ($item->zone->domain->isManaged())) ->groupBy('zone.domain.name') as $list)
diff --git a/resources/views/domain/view.blade.php b/resources/views/domain/view.blade.php index 814c8c2..5d31822 100644 --- a/resources/views/domain/view.blade.php +++ b/resources/views/domain/view.blade.php @@ -1,5 +1,5 @@ - @use(Illuminate\Mail\Markdown) + @extends('layouts.app') @section('htmlheader_title') @@ -137,12 +137,13 @@

The following systems are members of this network.

- +
+ @@ -155,6 +156,7 @@ + @@ -279,6 +281,18 @@ searching: true, ordering: true, order: [], + rowGroup: { + dataSrc: [3], + startRender: function(rows,group) { + return 'Region '+group; + } + }, + columnDefs: [ + { + targets: [3], + visible: false, + }, + ], conditionalPaging: { style: 'fade', speed: 500 // optional diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index b5d11ee..bb2e599 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -20,7 +20,7 @@ @endif @if($o->zcs->count()) -

This system is the ZC for the following zones: {!! $o->zcs->sortBy('zone_id')->map(function($item) { return sprintf('%d@%s',$item->zone_id,$item->domain->name); })->join(', ') !!}

+

This system is the ZC for the following zones: {!! $o->zcs->map(fn($item)=>sprintf('%d@%s',$item->zone_id,$item->domain->name))->join(', ') !!}

@endif @include('widgets.error') @@ -123,7 +123,7 @@ - @foreach ($o->addresses->sortBy(function($item) { return sprintf('%04x%04x%04x%04x%04x',$item->zone->zone_id,$item->region_id,$item->host_id,$item->node_id,$item->point_id); }) as $oo) + @foreach ($o->addresses as $oo) @@ -156,7 +156,6 @@
System Sysop LocationRegion Address Last Echomail
{{ $ao->system->full_name($ao) }} @auth@if($ao->is_hosted){{ $ao->is_default ? '**' : '*' }}@elseif($ao->system->setup)+@endif[{{ $ao->system_id }}]@endauth {{ $ao->system->sysop }} {{ $ao->system->location }}{{ $ao->region_id }} {{ $ao->ftn4d }} {{ $ao->echomail_from->count() ? $ao->echomail_from->first()->datetime->format('Y-m-d H:i') : '-' }}
trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}$oo->validated,'bi-radioactive'=>(! $oo->validated)])> {{ $oo->active ? 'YES' : 'NO' }}
@endif -
@@ -321,7 +320,7 @@ - @foreach ($o->addresses->sortBy('zone.zone_id') as $ao) + @foreach ($o->aka_common() as $ao) {{ $ao->ftn }} {{ $ao->netmailWaiting()->count() }} @@ -343,7 +342,7 @@ - @foreach ($o->addresses->sortBy('zone.zone_id') as $ao) + @foreach ($o->aka_common() as $ao) {{ $ao->ftn }} {{ $ao->echomailWaiting()->count() }} @@ -365,7 +364,7 @@ - @foreach ($o->addresses->sortBy('zone.zone_id') as $ao) + @foreach ($o->aka_common() as $ao) {{ $ao->ftn }} {{ $ao->filesWaiting()->count() }} diff --git a/resources/views/system/widget/form-echoarea.blade.php b/resources/views/system/widget/form-echoarea.blade.php index cc584f8..6049729 100644 --- a/resources/views/system/widget/form-echoarea.blade.php +++ b/resources/views/system/widget/form-echoarea.blade.php @@ -1,91 +1,84 @@ -@if(($x=\App\Models\Zone::active() - ->whereIn('id',$o->sessions->pluck('pivot.zone_id')) - ->orderBy('zone_id') - ->with(['domain']) - ->get())->count()) +
+ @csrf - - @csrf - -
-
-
-
- -
- -
- - - - @error('domain_id') - {{ $message }} - @enderror - -
-
- - -
-
- -
- - -
-
-
- - -
- - - - - - - - - - @foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo) - - - - +
+
+
+
+ +
+ +
+ +
-
NetworkAreas
{{ $oo->first()->domain->name }}{{ $oo->count() }}
-
-
- - @if($errors->count()) -
- - There were errors with the submission. -
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
+ + + @error('domain_id') + {{ $message }} + @enderror
- @endif - -
-
+ + +
+
+ +
+ + +
+
+
+ + +
+ + + + + + + + + + @foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo) + + + + + @endforeach + +
NetworkAreas
{{ $oo->first()->domain->name }}{{ $oo->count() }}
+
+
+ + @if($errors->count()) +
+ + There were errors with the submission. +
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+
+ @endif + +
+
-
-@endif +
+ @section('page-scripts') diff --git a/resources/views/system/widget/form-filearea.blade.php b/resources/views/system/widget/form-filearea.blade.php index eeeb70b..f75a6c2 100644 --- a/resources/views/system/widget/form-filearea.blade.php +++ b/resources/views/system/widget/form-filearea.blade.php @@ -1,78 +1,71 @@ -@if(($x=\App\Models\Zone::active() - ->whereIn('id',$o->sessions->pluck('pivot.zone_id')) - ->orderBy('zone_id') - ->with(['domain']) - ->get())->count()) +
+ @csrf - - @csrf - -
-
-
-
- -
- -
- - - - @error('domain_id') - {{ $message }} - @enderror - -
-
- - -
-
- -
- - -
-
-
- - -
- - - - - - - - - - @foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo) - - - - +
+
+
+
+ +
+ +
+ +
-
NetworkAreas
{{ $oo->first()->domain->name }}{{ $oo->count() }}
+ + + @error('domain_id') + {{ $message }} + @enderror +
-
-
+ +
+
+ +
+ + +
+
+ + +
+ + + + + + + + + + @foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo) + + + + + @endforeach + +
NetworkAreas
{{ $oo->first()->domain->name }}{{ $oo->count() }}
+
+
+ +
+
- -@endif +
+ @section('page-scripts') diff --git a/resources/views/system/widget/form-system.blade.php b/resources/views/system/widget/form-system.blade.php index 49e1d20..5ba9618 100644 --- a/resources/views/system/widget/form-system.blade.php +++ b/resources/views/system/widget/form-system.blade.php @@ -6,7 +6,7 @@
-

@can($action,$o) @if($o->exists) Update @else Add @endif @endif System

+

@can($action,$o) @if($o->exists) Update @else Add @endif @endcan System

@include('system.widget.system')
diff --git a/resources/views/system/widget/routing.blade.php b/resources/views/system/widget/routing.blade.php index 3c42fd4..0972120 100644 --- a/resources/views/system/widget/routing.blade.php +++ b/resources/views/system/widget/routing.blade.php @@ -1,15 +1,9 @@ -@php - use App\Models\{Address,Zone}; -@endphp - +@use(App\Models\Address) +
- +
- @if(! $o->setup && ($x=Zone::active() - ->whereIn('id',$o->zones->pluck('id')) - ->whereNotIn('id',$o->sessions->pluck('id')) - ->get())->count()) - + @if($o->aka_unknown()->count())

This host's mail is sent to:

@@ -20,19 +14,17 @@ - @foreach($x as $zo) - @foreach ($o->match($zo,Address::NODE_ALL) as $oo) - - - - - @endforeach + @foreach($o->aka_unknown() as $ao) + + + + @endforeach
{{ $oo->ftn }} - @if ($x=$oo->uplink()) - {{ $x->ftn4d }} - @else - None - @endif -
{{ $ao->ftn }} + @if ($xx=$ao->uplink()) + {{ $xx->ftn4d }} + @else + None + @endif +
@@ -41,28 +33,62 @@
- @if($o->sessions->count()) -

This host collects mail for the following systems:

+
+
+ @if($o->sessions->count()) +

This host collects mail for the following systems:

- - - - - - - - - - @foreach ($o->sessions->sortBy('zone_id') as $zo) - @foreach ($o->match($zo,Address::NODE_ALL) as $oo) +
AKAFor Systems(s)
+ - - + + - @endforeach - @endforeach - -
{{ $oo->ftn }}{!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('
') : 'None' !!}
AKAIncl Systems(s)
+ + + + @foreach ($o->sessions->sortBy('zone_id') as $zo) + @if($zo->pivot->default) + + {!! $o->akas->filter(fn($item)=>$item->zone->domain_id === $zo->domain_id)->pluck('ftn')->join('
') !!} + All (not otherwise routed) + + @else + @foreach ($o->match($zo,Address::NODE_ALL) as $oo) + + {{ $oo->ftn }} + {!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('
') : 'None' !!} + + @endforeach + @endif + @endforeach + + + @endif +
+
+ + @if($o->aka_uncommon()->count()) +
+
+

This host's mail not known here:

+ + + + + + + + + @foreach($o->aka_uncommon() as $ao) + + + + @endforeach + +
AKA
{{ $ao->ftn }}
+
+
@endif
\ No newline at end of file diff --git a/resources/views/system/widget/system.blade.php b/resources/views/system/widget/system.blade.php index f3f6e51..59433a3 100644 --- a/resources/views/system/widget/system.blade.php +++ b/resources/views/system/widget/system.blade.php @@ -1,8 +1,6 @@ -@php -use App\Classes\FTN\Packet; -use App\Models\{Mailer,User}; -@endphp - +@use(App\Classes\FTN\Packet) +@use(App\Models\Mailer) +@use(App\Models\User)
@@ -20,7 +18,7 @@ use App\Models\{Mailer,User}; @@ -325,8 +323,6 @@ use App\Models\{Mailer,User};
@endcan - -
@if(! is_null($o->pollmode)) @@ -438,9 +434,6 @@ use App\Models\{Mailer,User}; @else NOTE: You'll be able to update these details after registration is completed. - {{-- - - --}} @endcan @else diff --git a/resources/views/user/system/register.blade.php b/resources/views/user/system/register.blade.php index ed9a547..b8906d4 100644 --- a/resources/views/user/system/register.blade.php +++ b/resources/views/user/system/register.blade.php @@ -29,7 +29,7 @@ use App\Models\System; @foreach (System::select(['systems.id','systems.name']) ->active() ->where('id','<>',$setup->system_id) - ->whereRaw('id NOT IN (SELECT system_id FROM system_user)') + ->whereRaw('id NOT IN (SELECT system_id FROM "system_user")') ->cursor() as $oo) @endforeach diff --git a/routes/web.php b/routes/web.php index e8d8d74..a4f81b1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -133,7 +133,8 @@ Route::middleware(['auth','verified','activeuser'])->group(function () { ->where('o','[0-9]+') ->where('packet','[0-9a-zA-Z]+'); - Route::match(['get','post'],'user/system/register',[SystemController::class,'register']); + Route::view('user/system/register','user.system.register'); + Route::post('user/system/register',[SystemController::class,'register']); Route::match(['post'],'user/system/link',[SystemController::class,'system_link']); /* ZONE PATHS */