Compare commits

...

2 Commits

Author SHA1 Message Date
545c022930 Fix page rendering when a leftbox is rendered 2024-09-08 21:24:14 +10:00
856ac5ffe0 Fixes for DE-LIST notifications 2024-09-08 21:24:14 +10:00
6 changed files with 16 additions and 12 deletions
app
Classes
Jobs
Models
Notifications
resources/views

View File

@ -332,13 +332,13 @@ class Page
$subtext = substr($this->text,$current_pos,$space_pos);
}
// If the reset of the string will fit on the current line
} elseif ($text_length-$current_pos < static::MSG_WIDTH-$buffer) {
// If the rest of the string will fit on the current line
} elseif ($text_length-$current_pos < static::MSG_WIDTH-$this->x-$buffer) {
$subtext = substr($this->text,$current_pos);
// Get the next lines worth of chars, breaking on a space
} else {
$subtext = $this->text_substr(substr($this->text,$current_pos),static::MSG_WIDTH-$buffer);
$subtext = $this->text_substr(substr($this->text,$current_pos),static::MSG_WIDTH-$this->x-$buffer);
// Include the text up to the last space
if (substr($this->text,$current_pos+strlen($subtext),1) !== ' ')

View File

@ -51,8 +51,8 @@ class AddressIdle implements ShouldQueue
// Delist DOWN nodes
foreach ($this->old($this->do,config('fido.idle.delist'),Address::NODE_DOWN,$this->ao) as $ao) {
// Only delist system that has been marked down
// Only mark delist them if its been 7 days since they were marked DOWN
if ((! $ao->is_down) || ($ao->updated_at->isPast(Carbon::now()->subWeek())))
// Only mark delist them if its been 14 days since they were marked DOWN
if ((! $ao->is_down) || ($ao->updated_at->greaterThan(Carbon::now()->subWeeks(2))))
continue;
Log::info(sprintf('%s:- Delisting [%s], not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.delist')));
@ -130,8 +130,9 @@ class AddressIdle implements ShouldQueue
$result->push($ao);
}
// @todo Make sure we only process addresses that we are responsible for, eg: 1/999 shouldnt have been processed even though 3/999 as eligible (and they are were connected to the same system)
// Mark nodes as HOLD
foreach ($this->old($this->do,config('fido.idle.hold'),0,$this->ao) as $ao) {
foreach ($this->old($this->do,config('fido.idle.hold'),Address::NODE_ALL,$this->ao) as $ao) {
// Ignore any systems that are a Discoverd System
if ($ao->system->name === System::default) {
Log::alert(sprintf('%s:! Ignoring HOLD for discovered System [%s]',self::LOGKEY,$ao->ftn));

View File

@ -228,7 +228,7 @@ class Address extends Model
})
->orWhere('host_id',$ftn['n']);
})
->with(['system:id,active,name,address,pkt_msgs'])
->with(['system:id,active,name,address,pkt_msgs,last_session'])
->first();
// Check and see if we are a flattened domain, our address might be available with a different zone.

View File

@ -58,7 +58,7 @@ class AbsentNodes extends Echomails
$msg->addText("The following nodes have had their status changed, because they are absent from the network.\r\r");
// Nodes marked HOLD - will be marked down ...
if (($x=$this->aos->filter(fn($item)=>$item->role & Address::NODE_HOLD))->count()) {
if (($x=$this->aos->filter(fn($item)=>$item->active && ($item->role & Address::NODE_HOLD)))->count()) {
$msg->addText("The following nodes have been marked HOLD:\r");
foreach ($x as $ao)
@ -68,7 +68,7 @@ class AbsentNodes extends Echomails
}
// Nodes marked DOWN - will be delisted on...
if (($x=$this->aos->filter(fn($item)=>$item->role & Address::NODE_DOWN))->count()) {
if (($x=$this->aos->filter(fn($item)=>$item->active && ($item->role & Address::NODE_DOWN)))->count()) {
$msg->addText("The following nodes have been marked DOWN:\r");
foreach ($x as $ao)

View File

@ -35,9 +35,9 @@ class NodeDelisted extends Netmails //implements ShouldQueue
$o = $this->setupNetmail($notifiable);
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Sending a NODE MARKED HOLD for address [%s]',self::LOGKEY,$ao->ftn));
Log::info(sprintf('%s:+ Sending a NODE DE-LISTED for address [%s]',self::LOGKEY,$ao->ftn));
$o->subject = sprintf('Your system has been DE-LISTED from %s',$x=$ao->zone->domain->name);
$o->subject = sprintf('Your system has been DE-LISTED from %s',$x=$this->ao->zone->domain->name);
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
// Message
@ -46,7 +46,7 @@ class NodeDelisted extends Netmails //implements ShouldQueue
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->addText(sprintf("Your system has been marked **DE-LISTED**, 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_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
->addText("\r")
->addText("If you think this was a mistake, please let me know.\r")
->addText("If you think this was a mistake, please let me know.\r\r")
->addText(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
$o->msg = $msg->render();

View File

@ -180,6 +180,9 @@
@if (($x=$o->uplink()) && ($x->id !== $o->id))
<br><small>[via <a href="{{ url('system/addedit',$x->system_id) }}">{{ $x->ftn4d }}</a>]</small>
@endif
@if($o->is_down || $o->is_hold)
<br><div class="btn btn-sm btn-secondary p-1 m-0"><small>@if($o->is_down)DOWN @elseif($o->is_hold)HOLD @else? @endif</small></div>
@endif
</td>
<td>{{ $o->ftn4d }}</td>
<td class="text-end">{{ number_format($o->uncollected_echomail ?? 0) }}</td>