Show users hub connection details for their domains
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 36s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m43s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-24 11:04:25 +10:00
parent a687b5fd1c
commit 86c27a3f17
4 changed files with 117 additions and 4 deletions

View File

@ -10,7 +10,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use App\Classes\File;
use App\Classes\FTN\{Message,Packet};
use App\Classes\FTN\Packet;
use App\Http\Requests\SetupRequest;
use App\Models\File as FileModel;
use App\Models\{Address,Echomail,Netmail,Setup,System};
@ -235,6 +235,12 @@ class HomeController extends Controller
->with('o',$o);
}
/**
* Return a list of unsent items
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application
* @see \App\Jobs\AddressIdle:class
*/
public function status()
{
$date = Carbon::now()->yesterday()->endOfday();
@ -262,7 +268,7 @@ class HomeController extends Controller
->union(Address::UncollectedFilesTotal()
->where('files.created_at','<',$this->yesterdayEOD())
),'a')
->where('systems.active',true)
->where('systems.active',TRUE)
->where('addresses.active',TRUE)
->where('zones.active',TRUE)
->where('domains.active',TRUE)

View File

@ -86,6 +86,7 @@ class User extends Authenticatable implements MustVerifyEmail
->where('zones.domain_id',$o->id);
})
->where('system_user.user_id',$this->id)
->activeFTN()
->with(['zone.domain'])
->get();
}

View File

@ -131,6 +131,36 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL
}
}
function our_hostname(Address $o): string
{
$our = our_address($o->domain)->first();
switch ($our->role_id) {
case Address::NODE_ZC:
$domain = collect(explode('.',gethostname()))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id));
break;
case Address::NODE_NC:
$domain = collect(explode('.',gethostname()))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id))
->prepend(sprintf('n%d',$our->host_id));
break;
case Address::NODE_HC:
$domain = collect(explode('.',gethostname()))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id))
->prepend(sprintf('n%d',$our->host_id))
->prepend(sprintf('f%d',$our->node_id));
break;
default:
$domain = collect(explode('.',gethostname()));
}
return $domain->join('.');
}
/**
* Return a list of nodes that collect mail directly from us
*

View File

@ -3,7 +3,12 @@
Dashboard
@endsection
@php($user->load(['systems.akas.zone.domain.echoareas','systems.akas.echoareas']))
@php
use App\Classes\Protocol\Binkp;
use App\Models\Setup;
$user->load(['systems.akas.zone.domain.echoareas','systems.akas.echoareas']);
$setup = Setup::findOrFail(config('app.id'));
@endphp
@section('content')
<h1>{{ $user->name }}</h1>
@ -11,8 +16,79 @@
@if($user->systems->count())
<div class="row">
<div class="col-7">
<div class="row">
<div class="col-12">
<div id="network_messages"></div>
</div>
</div>
<div class="row pt-2">
<div class="col-12">
<h2>Hub Details for your nets</h2>
<div class="accordion" id="accordion_details">
@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')
->groupBy('zone.domain.name') as $list)
<!-- {{ $x=$list->first()->domain->name }} -->
<div class="accordion-item">
<h3 class="accordion-header">
<span class="accordion-button" id="hd_{{ $x }}" data-bs-toggle="collapse" data-bs-target="#collapse_{{ $x }}" aria-expanded="true" aria-controls="collapse_{{ $x }}">{{ $x }}</span>
</h3>
<div id="collapse_{{ $x }}" class="accordion-collapse {{ ($loop->index) ? 'collapse' : 'show' }}" aria-labelledby="{{ $x }}" data-bs-parent="#accordion_details">
<div class="accordion-body">
<p>For your addresses in this domain: <strong class="highlight">{!! $list->pluck('ftn')->join('</strong>, <strong class="highlight">') !!}</strong>, you'll need to use the following details:</p>
<br>
<table class="table monotable">
<tbody>
<tr>
<td>
Hub FTN Address
</td>
<th>
<span style="color: cyan;">{{ our_address($list->first())->ftn4d }}</span>
</th>
</tr>
<tr>
<td>
Hub FTN Domain
</td>
<th>
<span style="color: cyan;">{{ $x }}</span>
</th>
</tr>
<tr>
<td>
Hub Internet Address
</td>
<th>
<span style="color: cyan;">{{ our_hostname($list->first()) }}</span>
</th>
</tr>
<tr>
<td>
Hub Internet Ports
</td>
<td>
BINKP: <span style="color: cyan;">{{ $setup->binkp_port }}</span> MD5 Mode: <span style="color: cyan;">{{$setup->optionGet(Binkp::F_MD,'binkp_options') ? 'YES' : 'NO' }}</span><br>
EMSI: <span style="color: cyan;">{{ $setup->emsi_port }}</span> Protocol: <span style="color: cyan;">Zmodem</span><br>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
<!-- System Addresses -->
<div class="col-5">