Improvements to finding idle nodes, last_session actually only shows the last time the remote polled us
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 47s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m53s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2024-09-15 22:00:40 +10:00
parent 832b496b0b
commit 4501443a43
17 changed files with 122 additions and 38 deletions

View File

@@ -44,7 +44,7 @@ class NodeDelisted extends Netmails //implements ShouldQueue
$msg = $this->page(TRUE,'delist');
$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(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_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now)))
->addText("\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));

View File

@@ -31,12 +31,11 @@ class NodeMarkedDown extends Netmails //implements ShouldQueue
public function toNetmail(object $notifiable): Netmail
{
$now = Carbon::now();
$o = $this->setupNetmail($notifiable);
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Sending a NODE MARKED DOWN NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
$o = $this->setupNetmail($notifiable);
$o->subject = sprintf('ACTION REQUIRED: Your system will be delisted on %s',$now->format('Y-m-d'));
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
@@ -44,7 +43,7 @@ class NodeMarkedDown extends Netmails //implements ShouldQueue
$msg = $this->page(TRUE,'down');
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->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_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
->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\r",number_format($this->ao->uncollected_netmail)))

View File

@@ -44,14 +44,14 @@ class NodeMarkedHold extends Netmails //implements ShouldQueue
$msg = $this->page(TRUE,'hold');
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->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_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
->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\r",number_format($this->ao->uncollected_netmail)))
->addText(sprintf("* %s Echomails\r",number_format($this->ao->uncollected_echomail)))
->addText(sprintf("* %s Files\r",number_format($this->ao->uncollected_files)))
->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_session->addDays(config('fido.idle.down'))->format('Y-m-d')))
->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");
$o->msg = $msg->render();

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Notifications\Netmails;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Message;
use App\Notifications\Netmails;
use App\Models\{Address,Netmail};
use App\Traits\PageTemplate;
class NodeStatusCleared extends Netmails //implements ShouldQueue
{
use Queueable,PageTemplate;
private const LOGKEY = 'NNM';
/**
* Create a new notification instance.
*/
public function __construct(private Address $ao)
{
parent::__construct();
}
/**
* Get the mail representation of the notification.
*/
public function toNetmail(object $notifiable): Netmail
{
$ao = $notifiable->routeNotificationFor(static::via);
Log::info(sprintf('%s:+ Sending a NODE DOWN|HOLD STATUS CLEARED NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
$o = $this->setupNetmail($notifiable);
$o->subject = 'Your HOLD or DOWN status has been cleared';
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
// Message
$msg = $this->page(TRUE,'reset');
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
->addText(sprintf("Good news! Your system's HOLD or DOWN status has been **cleared** for address %s, as you recently polled the hub.\r",$this->ao->ftn4d))
->addText("\r")
->addText("If you think you've received this netmail by mistake or need help, please let me know.\r");
$o->msg = $msg->render();
$o->set_tagline = 'All good to go now';
$o->save();
return $o;
}
}