Compare commits
No commits in common. "db6c569345365086529ed0ef7abcd77c4006e13d" and "1b228a58c952b174df38499ed87b09fd9cde6b76" have entirely different histories.
db6c569345
...
1b228a58c9
@ -504,6 +504,8 @@ class Message extends FTNBase
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
$s = Setup::findOrFail(config('app.id'));
|
||||
|
||||
$return = pack(collect(self::HEADER)->pluck(1)->join(''),
|
||||
$this->mo->fftn->node_id, // Originating Node
|
||||
$this->mo->tftn->node_id, // Destination Node
|
||||
@ -527,7 +529,7 @@ class Message extends FTNBase
|
||||
$this->mo->kludges->put('TOPT',$this->mo->tftn->point_id);
|
||||
}
|
||||
|
||||
$this->mo->kludges->put($this->mo->isFlagSet(self::FLAG_LOCAL) ? 'PID:' : 'TID:',sprintf('%s %s',Setup::PRODUCT_NAME_SHORT,Setup::version()));
|
||||
$this->mo->kludges->put($this->mo->isFlagSet(self::FLAG_LOCAL) ? 'PID:' : 'TID:',sprintf('%s %s',Setup::PRODUCT_NAME_SHORT,$s->version));
|
||||
$this->mo->kludges->put('DBID:',$this->mo->id);
|
||||
|
||||
if ($this->mo instanceof Echomail)
|
||||
@ -559,7 +561,7 @@ class Message extends FTNBase
|
||||
$return .= sprintf("\x01Via %s @%s.UTC %s %s\r",
|
||||
$this->us->ftn3d,
|
||||
Carbon::now()->format('Ymd.His'),
|
||||
Setup::PRODUCT_NAME_SHORT,Setup::version());
|
||||
Setup::PRODUCT_NAME_SHORT,$s->version);
|
||||
|
||||
} else {
|
||||
// FTS-0004.001/FSC-0068.001 The message SEEN-BY lines
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Classes;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\File\{Receive,Send};
|
||||
@ -108,7 +107,7 @@ abstract class Protocol
|
||||
public const TCP_SPEED = 115200;
|
||||
|
||||
protected SocketClient $client; /* Our socket details */
|
||||
protected Setup $setup; /* Our setup */
|
||||
protected ?Setup $setup; /* Our setup */
|
||||
protected Node $node; /* The node we are communicating with */
|
||||
/** The list of files we are sending */
|
||||
protected Send $send;
|
||||
@ -135,9 +134,12 @@ abstract class Protocol
|
||||
|
||||
abstract protected function protocol_session(bool $force_queue=FALSE): int;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(Setup $o=NULL)
|
||||
{
|
||||
$this->setup = Config::get('setup');
|
||||
if ($o && ! $o->system->akas->count())
|
||||
throw new \Exception('We dont have any ACTIVE FTN addresses assigned');
|
||||
|
||||
$this->setup = $o;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,7 +318,7 @@ abstract class Protocol
|
||||
Log::debug(sprintf('%s:- Presenting limited AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
|
||||
|
||||
} else {
|
||||
$addresses = our_address();
|
||||
$addresses = $this->setup->system->akas;
|
||||
|
||||
Log::debug(sprintf('%s:- Presenting ALL our AKAs [%s]',self::LOGKEY,$addresses->pluck('ftn')->join(',')));
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ final class Binkp extends BaseProtocol
|
||||
$this->msgs(self::BPM_NUL,sprintf('NDL %d,TCP,BINKP',$this->client->speed));
|
||||
$this->msgs(self::BPM_NUL,sprintf('TIME %s',Carbon::now()->toRfc2822String()));
|
||||
$this->msgs(self::BPM_NUL,
|
||||
sprintf('VER %s-%s %s/%s',Setup::PRODUCT_NAME_SHORT,Setup::version(),self::PROT,self::VERSION));
|
||||
sprintf('VER %s-%s %s/%s',Setup::PRODUCT_NAME_SHORT,$this->setup->version,self::PROT,self::VERSION));
|
||||
|
||||
if ($this->originate) {
|
||||
$opt = $this->capGet(self::F_NOREL,self::O_WANT) ? ' NR' : '';
|
||||
@ -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->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
// Notification::route('netmail',$ao->system->uncommon()->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->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
// Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
|
||||
} else {
|
||||
$this->msgs(self::OK,'non-secure');
|
||||
|
@ -208,7 +208,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
$makedata .= sprintf('{%s}{%s}{%s}{%s}',
|
||||
Setup::product_id(),
|
||||
Setup::PRODUCT_NAME_SHORT,
|
||||
Setup::version(),
|
||||
$this->setup->version,
|
||||
'#000000' // Serial Numbers
|
||||
);
|
||||
|
||||
@ -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->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
// Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
|
||||
// @todo Lock Node AKAs
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Address;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Jobs\NodesNew as Job;
|
||||
use App\Models\Domain;
|
||||
|
||||
class NodesNew extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'nodes:new'
|
||||
.' {domain : Domain}'
|
||||
.' {--date= : From a specific date (default 1 since last Saturday)}'
|
||||
.' {--netmail= : Send a Netmail to FTN}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'List new nodes since last Saturday (or a specific date)';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$do = Domain::where('name',$this->argument('domain'))->singleOrFail();
|
||||
$ao = NULL;
|
||||
|
||||
if ($this->option('netmail')) {
|
||||
$ao = Address::findFTN($this->option('netmail'));
|
||||
|
||||
if (! $ao) {
|
||||
$this->error('Address not found: '.$this->option('netmail'));
|
||||
return self::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return Job::dispatchSync($do,$this->option('date') ? Carbon::parse($this->option('date')) : Carbon::parse('last saturday'),$ao);
|
||||
}
|
||||
}
|
@ -3,12 +3,12 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\{Binkp,DNS,EMSI};
|
||||
use App\Classes\Sock\Exception\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
use App\Models\Setup;
|
||||
|
||||
class ServerStart extends Command
|
||||
{
|
||||
@ -37,11 +37,7 @@ class ServerStart extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
Log::info(sprintf('%s:+ Server Starting (%d)',self::LOGKEY,getmypid()));
|
||||
|
||||
if (! our_address()->count())
|
||||
throw new \Exception('We dont have any ACTIVE FTN addresses assigned');
|
||||
|
||||
$o = Config::get('setup');
|
||||
$o = Setup::findOrFail(config('app.id'));
|
||||
|
||||
$start = collect();
|
||||
|
||||
|
@ -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.echomail_from']);
|
||||
$o->load(['zones.system','zones.domain','zones.addresses.nodes_hub','zones.addresses']);
|
||||
|
||||
return view('domain.view')
|
||||
->with('o',$o);
|
||||
|
@ -66,15 +66,7 @@ class SystemController extends Controller
|
||||
->with('saved',TRUE);
|
||||
}
|
||||
|
||||
$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']);
|
||||
$o->load(['addresses.zone.domain','addresses.system','sessions.domain','sessions.systems']);
|
||||
|
||||
return view('system.addedit')
|
||||
->with('action',$o->exists ? 'update_nn' : 'create')
|
||||
@ -619,12 +611,31 @@ 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;
|
||||
|
@ -5,7 +5,6 @@ namespace App\Http\Middleware;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
use App\Models\Setup;
|
||||
|
||||
@ -46,10 +45,8 @@ class AddUserToView
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
Config::set('setup',$x=Setup::find(config('app.id'))->load('system'));
|
||||
|
||||
$this->factory->share('user',$this->user);
|
||||
$this->factory->share('setup',$x);
|
||||
$this->factory->share('setup',Setup::find(config('app.id')));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ class AddressIdle implements ShouldQueue
|
||||
*/
|
||||
public function __construct(Domain $do,Address $ao=NULL)
|
||||
{
|
||||
$this->do = $do->withoutRelations();
|
||||
$this->ao = $ao?->withoutRelations();
|
||||
$this->do = $do;
|
||||
$this->ao = $ao;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,8 +104,8 @@ class AddressIdle implements ShouldQueue
|
||||
}
|
||||
|
||||
// Netmail Alert (to othernet network address)
|
||||
if ($ao->system->aka_unknown()->count()) {
|
||||
Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeDelistedNetmail($ao->withoutRelations()));
|
||||
if ($ao->system->uncommon()->count()) {
|
||||
Notification::route('netmail',$ao->system->uncommon()->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->aka_unknown()->count()) {
|
||||
Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||
if ($ao->system->uncommon()->count()) {
|
||||
Notification::route('netmail',$ao->system->uncommon()->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->aka_unknown()->count()) {
|
||||
Notification::route('netmail',$ao->system->aka_unknown()->first()->withoutRelations())->notify(new NodeMarkedHoldNetmail($ao->withoutRelations()));
|
||||
if ($ao->system->uncommon()->count()) {
|
||||
Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedHoldNetmail($ao->withoutRelations()));
|
||||
$contact = TRUE;
|
||||
}
|
||||
|
||||
@ -214,9 +214,21 @@ class AddressIdle implements ShouldQueue
|
||||
|
||||
$age = Carbon::now()->subDays($days)->endOfDay();
|
||||
|
||||
return Address::FTN()
|
||||
->ActiveFTN()
|
||||
->addSelect(['addresses.updated_at'])
|
||||
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)
|
||||
->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))
|
||||
@ -224,7 +236,9 @@ 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'])
|
||||
//->with(['system','zone.domain'])
|
||||
->ftnOrder()
|
||||
->with(['system','zone.domain'])
|
||||
->dontCache()
|
||||
->get();
|
||||
}
|
||||
}
|
@ -14,6 +14,13 @@ class AddressIdleDomain implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
|
@ -38,8 +38,8 @@ class AddressPoll implements ShouldQueue, ShouldBeUnique
|
||||
|
||||
public function __construct(Address $ao,Mailer $mo=NULL)
|
||||
{
|
||||
$this->ao = $ao->withoutRelations();
|
||||
$this->mo = $mo?->withoutRelations();
|
||||
$this->ao = $ao;
|
||||
$this->mo = $mo;
|
||||
|
||||
$this->onQueue(self::QUEUE);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class EchoareaImport implements ShouldQueue
|
||||
public function __construct(string $file,Domain $do,string $prefix='',bool $delete_recs=FALSE,bool $delete_file=FALSE)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->do = $do->withoutRelations();
|
||||
$this->do = $do;
|
||||
$this->prefix = $prefix ?: '';
|
||||
$this->delete_file = $delete_file;
|
||||
$this->delete_recs = $delete_recs;
|
||||
|
@ -36,7 +36,7 @@ class FileareaImport implements ShouldQueue
|
||||
public function __construct(string $file,Domain $do,string $prefix='',bool $delete_recs=FALSE,bool $delete_file=FALSE)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->do = $do->withoutRelations();
|
||||
$this->do = $do;
|
||||
$this->prefix = $prefix ?: '';
|
||||
$this->delete_file = $delete_file;
|
||||
$this->delete_recs = $delete_recs;
|
||||
|
@ -34,7 +34,7 @@ class MessageProcess implements ShouldQueue
|
||||
public function __construct(Echomail|Netmail $mo,bool $skipbot=FALSE)
|
||||
{
|
||||
// @todo We need to serialize this model here, because laravel has an error unserializing it (Model Not Found)
|
||||
$this->mo = utf8_encode(serialize($mo->withoutRelations()));
|
||||
$this->mo = utf8_encode(serialize($mo));
|
||||
$this->skipbot = $skipbot;
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
|
||||
use App\Models\{Address, Domain, System};
|
||||
use App\Notifications\Netmails\NodesNew as NotificationNodesNew;
|
||||
|
||||
class NodesNew implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
private const LOGKEY = 'JNN';
|
||||
|
||||
private ?Carbon $since; // New nodes since this date
|
||||
private Address $ao; // Domain we are processing
|
||||
private Domain $do; // Domain we are processing
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct(Domain $do,Carbon $since=NULL,Address $ao=NULL)
|
||||
{
|
||||
$this->do = $do->withoutRelations();
|
||||
$this->ao = $ao?->withoutRelations();
|
||||
$this->since = $since;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$since = ($this->since ?: Carbon::parse('last saturday'))->startOfDay();
|
||||
|
||||
$result = Address::FTN()
|
||||
->ActiveFTN()
|
||||
->join('systems',['systems.id'=>'addresses.system_id'])
|
||||
->join('system_zone',['system_zone.system_id'=>'systems.id','system_zone.zone_id'=>'zones.id'])
|
||||
->whereIn('zones.id',$this->do->zones->pluck('id'))
|
||||
->where('systems.active',TRUE)
|
||||
->where('systems.created_at','>=',$since)
|
||||
->get();
|
||||
|
||||
if ($result->count()) {
|
||||
Log::notice(sprintf('%s:- Sending new nodes since [%s] (%d)',self::LOGKEY,$since,$result->count()));
|
||||
|
||||
Notification::route('netmail',$this->ao->withoutRelations())
|
||||
->notify(new NotificationNodesNew(
|
||||
$since,
|
||||
$result,
|
||||
));
|
||||
|
||||
} else
|
||||
Log::notice(sprintf('%s:- No nodes since [%s]',self::LOGKEY,$since));
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ class PacketProcess implements ShouldQueue
|
||||
public function __construct(string $filename,System $so,bool $interactive=TRUE,Carbon $rcvd_time=NULL,bool $nobot=FALSE)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
$this->so = $so->withoutRelations();
|
||||
$this->so = $so;
|
||||
$this->interactive = $interactive;
|
||||
$this->rcvd_time = $rcvd_time ?: Carbon::now();
|
||||
$this->nobot = $nobot;
|
||||
|
@ -12,37 +12,37 @@ use App\Models\{Setup,User};
|
||||
|
||||
class TestEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/* User to send mail to */
|
||||
public User $user;
|
||||
/* Our setup object */
|
||||
public Setup $setup;
|
||||
/* User to send mail to */
|
||||
public User $user;
|
||||
/* Our setup object */
|
||||
public Setup $setup;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $o)
|
||||
{
|
||||
$this->user = $o;
|
||||
}
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $o)
|
||||
{
|
||||
$this->user = $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$this->setup = Setup::findOrFail(config('app.id'));
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$this->setup = Setup::findOrFail(config('app.id'));
|
||||
|
||||
return $this
|
||||
->markdown('mail.system.test_email')
|
||||
->subject('Just a test...')
|
||||
->with([
|
||||
'url'=>sprintf('https://%s',gethostname()),
|
||||
return $this
|
||||
->markdown('mail.system.test_email')
|
||||
->subject('Just a test...')
|
||||
->with([
|
||||
'url'=>'https://localhost',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,14 +395,16 @@ 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
|
||||
return $query->select($this->getTable().'.*')
|
||||
->join('zones',['zones.id'=>'addresses.zone_id'])
|
||||
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||
->where('zones.active',TRUE)
|
||||
->where('domains.active',TRUE)
|
||||
->active();
|
||||
->active()
|
||||
->FTNorder();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -414,21 +416,13 @@ class Address extends Model
|
||||
public function scopeFTN($query)
|
||||
{
|
||||
return $query
|
||||
->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')
|
||||
->select(['id','addresses.zone_id','host_id','node_id','point_id','system_id'])
|
||||
->with([
|
||||
'zone:zones.id,domain_id,zone_id,active',
|
||||
'zone.domain:domains.id,name,active,public',
|
||||
'zone:zones.id,domain_id,zone_id',
|
||||
'zone.domain:domains.id,name',
|
||||
]);
|
||||
}
|
||||
|
||||
/** @deprecated use FTN() */
|
||||
public function scopeFTNOrder($query)
|
||||
{
|
||||
return $query
|
||||
|
@ -71,6 +71,9 @@ class Setup extends Model
|
||||
case 'msgs_pkt':
|
||||
return Arr::get($this->options,$key,self::MAX_MSGS_PKT);
|
||||
|
||||
case 'version':
|
||||
return File::exists('VERSION') ? chop(File::get('VERSION')) : 'dev';
|
||||
|
||||
default:
|
||||
return parent::__get($key);
|
||||
}
|
||||
@ -110,16 +113,6 @@ class Setup extends Model
|
||||
return hexstr($c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Application version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function version(): string
|
||||
{
|
||||
return File::exists('VERSION') ? chop(File::get('VERSION')) : 'dev';
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
|
@ -48,39 +48,35 @@ class System extends Model
|
||||
$uo = Auth::user();
|
||||
|
||||
return $query
|
||||
->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))
|
||||
->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); })
|
||||
->orderBy('name');
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* All addresses assigned to a system, including addresses pending deletion
|
||||
* @return mixed
|
||||
*/
|
||||
public function addresses()
|
||||
{
|
||||
return $this->hasMany(Address::class)
|
||||
->FTN()
|
||||
->withTrashed();
|
||||
->withTrashed()
|
||||
->FTNorder();
|
||||
}
|
||||
|
||||
/**
|
||||
* System addresses that are active
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function akas()
|
||||
{
|
||||
return $this->hasMany(Address::class)
|
||||
->FTN()
|
||||
->ActiveFTN();
|
||||
->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');
|
||||
}
|
||||
|
||||
public function mailers()
|
||||
@ -140,14 +136,7 @@ class System extends Model
|
||||
*/
|
||||
public function zcs()
|
||||
{
|
||||
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',
|
||||
]);
|
||||
return $this->hasMany(Zone::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,58 +189,6 @@ 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.*')
|
||||
@ -313,13 +250,28 @@ 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
|
||||
{
|
||||
@ -337,7 +289,22 @@ class System extends Model
|
||||
{
|
||||
return Job::where('queue',AddressPoll::QUEUE)
|
||||
->get()
|
||||
->where(fn($item)=>$this->akas->pluck('id')->contains($item->command->address->id))
|
||||
->where(function($item) {
|
||||
return $this->akas->pluck('id')->search($item->command->address->id) !== FALSE; })
|
||||
->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))));
|
||||
}
|
||||
}
|
@ -75,14 +75,19 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
/* GENERAL METHODS */
|
||||
|
||||
public function addresses(): Collection
|
||||
public function addresses(Domain $o=NULL): 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()
|
||||
->FTN()
|
||||
->activeFTN()
|
||||
->with(['zone.domain'])
|
||||
->get();
|
||||
}
|
||||
|
||||
|
@ -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\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(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("\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");
|
||||
|
@ -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\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(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("\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");
|
||||
|
@ -1,104 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Netmails;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Notifications\Netmails;
|
||||
use App\Models\{Address,Netmail};
|
||||
use App\Traits\PageTemplate;
|
||||
|
||||
class NodesNew extends Netmails //implements ShouldQueue
|
||||
{
|
||||
use Queueable,PageTemplate;
|
||||
|
||||
private const LOGKEY = 'NNN';
|
||||
|
||||
private Carbon $since;
|
||||
private Collection $list;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*/
|
||||
public function __construct(Carbon $since,Collection $list)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->list = $list;
|
||||
$this->since = $since;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*/
|
||||
public function toNetmail(object $notifiable): Netmail
|
||||
{
|
||||
$o = $this->setupNetmail($notifiable);
|
||||
$ao = $notifiable->routeNotificationFor(static::via);
|
||||
|
||||
Log::info(sprintf('%s:+ Sending a NEW NODE LIST to [%s] at address [%s]',self::LOGKEY,$ao->system->sysop,$ao->ftn));
|
||||
|
||||
$o->subject = sprintf('Here is a list of new nodes on clrghouz since %s',$x=$this->since->format('Y-m-d'));
|
||||
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
|
||||
|
||||
// Message
|
||||
$msg = $this->page(FALSE,'new nodes');
|
||||
|
||||
$msg->addText(sprintf("Hi %s,\r\r",$ao->system->sysop))
|
||||
->addText(sprintf("The following new system have been defined on clrghouz since %s.\r\r",$x));
|
||||
|
||||
$this->list->loadMissing(['system']);
|
||||
|
||||
$space = str_repeat(' ',$this->list->pluck('ftn4d')->max(fn($item)=>strlen($item))+2);
|
||||
|
||||
$c = 0;
|
||||
foreach ($this->list as $oo) {
|
||||
if ($c++)
|
||||
$msg->addText("\r");
|
||||
|
||||
$msg->addText(sprintf("* %s - %s from %s.\r",$oo->ftn4D,$oo->system->sysop,$oo->system->location));
|
||||
|
||||
if ($oo->system->method) {
|
||||
switch ($oo->system->method) {
|
||||
case 23:
|
||||
$msg->addText(sprintf("%s - BBS is available TELNET [%s:%d]\r",$space,$oo->system->address,$oo->system->port));
|
||||
break;
|
||||
|
||||
case 22:
|
||||
$msg->addText(sprintf("%s - BBS is available SSH [%s:%d]\r",$space,$oo->system->address,$oo->system->port));
|
||||
break;
|
||||
|
||||
case 519:
|
||||
$msg->addText(sprintf("%s - BBS is available RLOGIN [%s:%d]\r",$space,$oo->system->address,$oo->system->port));
|
||||
break;
|
||||
|
||||
default:
|
||||
$msg->addText(sprintf("%s - No Details available for connecting to BBS\r",$space));
|
||||
}
|
||||
}
|
||||
|
||||
if ($oo->system->mailers->count()) {
|
||||
$msg->addText("\r");
|
||||
$msg->addText(sprintf("%s - Mail can be sent using:\r",$space));
|
||||
|
||||
foreach ($oo->system->mailers as $mo) {
|
||||
$msg->addText(sprintf("%s * %s [%s:%d]\r",$space,$mo->name,$oo->system->address,$mo->pivot->port));
|
||||
}
|
||||
|
||||
} else {
|
||||
$msg->addText(sprintf("%s - No mailer information provided, so will be PRIVATE\r",$space));
|
||||
}
|
||||
}
|
||||
|
||||
$o->msg = $msg->render();
|
||||
$o->set_tagline = 'All aboard!';
|
||||
|
||||
$o->save();
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
use App\Models\{Address,Domain,Setup};
|
||||
|
||||
@ -93,30 +93,33 @@ if (! function_exists('hexstr')) {
|
||||
*/
|
||||
function our_address(Domain|Address $o=NULL): Collection|Address|NULL
|
||||
{
|
||||
if (! Config::has('setup'))
|
||||
Config::set('setup',Setup::findOrFail(config('app.id')));
|
||||
$so = Cache::remember('so',5,function() {
|
||||
return Setup::findOrFail(config('app.id'));
|
||||
});
|
||||
|
||||
$so = Config::get('setup');
|
||||
$so->loadMissing([
|
||||
'system:id,name',
|
||||
'system.akas:addresses.id,addresses.zone_id,region_id,host_id,node_id,point_id,addresses.system_id,addresses.active,role',
|
||||
'system.akas.zone:id,domain_id,zone_id',
|
||||
'system.akas.zone.domain:id,name',
|
||||
]);
|
||||
$our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) {
|
||||
$so->load([
|
||||
'system:id,name',
|
||||
'system.akas:addresses.id,addresses.zone_id,region_id,host_id,node_id,point_id,addresses.system_id,addresses.active,role',
|
||||
'system.akas.zone:id,domain_id,zone_id',
|
||||
'system.akas.zone.domain:id,name',
|
||||
]);
|
||||
|
||||
return $so->system->akas;
|
||||
});
|
||||
|
||||
// If we dont have any addresses
|
||||
if ($so->system->akas->count() === 0)
|
||||
if ($our->count() === 0)
|
||||
return NULL;
|
||||
|
||||
// We havent asked for an address/domain, so we'll return them all.
|
||||
if (is_null($o))
|
||||
return $so->system->akas;
|
||||
return $our;
|
||||
|
||||
// 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 = $our
|
||||
->filter(fn($item)=>$item->zone->domain_id === $o->zone->domain_id)
|
||||
->sortBy('role_id');
|
||||
|
||||
@ -126,9 +129,8 @@ 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
|
||||
return $our
|
||||
->filter(fn($item)=>$item->zone->domain_id === $o->id)
|
||||
->sortBy('role_id');
|
||||
|
||||
|
@ -28,7 +28,9 @@ $user->load(['systems.akas.zone.domain.echoareas','systems.akas.echoareas']);
|
||||
@foreach($user
|
||||
->addresses()
|
||||
->diff(our_address())
|
||||
->filter(fn($item)=>($item->point_id === 0) && ($item->zone->domain->isManaged()))
|
||||
->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">
|
||||
|
@ -1,5 +1,5 @@
|
||||
@use(Illuminate\Mail\Markdown)
|
||||
<!-- $o=Domain::class -->
|
||||
@use(Illuminate\Mail\Markdown)
|
||||
|
||||
@extends('layouts.app')
|
||||
@section('htmlheader_title')
|
||||
@ -137,13 +137,12 @@
|
||||
<div id="collapse_systems" class="accordion-collapse collapse" aria-labelledby="systems" data-bs-parent="#accordion_homepage">
|
||||
<div class="accordion-body">
|
||||
<p>The following systems are members of this network.</p>
|
||||
<table class="table monotable w-100" id="system">
|
||||
<table class="table monotable" id="system">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>System</th>
|
||||
<th>Sysop</th>
|
||||
<th>Location</th>
|
||||
<th>Region</th>
|
||||
<th>Address</th>
|
||||
<th>Last Echomail</th>
|
||||
</tr>
|
||||
@ -156,7 +155,6 @@
|
||||
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
|
||||
<td>{{ $ao->system->sysop }}</td>
|
||||
<td>{{ $ao->system->location }}</td>
|
||||
<td>{{ $ao->region_id }}</td>
|
||||
<td>{{ $ao->ftn4d }}</td>
|
||||
<td>{{ $ao->echomail_from->count() ? $ao->echomail_from->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
|
||||
</tr>
|
||||
@ -281,18 +279,6 @@
|
||||
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
|
||||
|
@ -20,7 +20,7 @@
|
||||
@endif
|
||||
|
||||
@if($o->zcs->count())
|
||||
<p>This system is the ZC for the following zones: <strong class="highlight">{!! $o->zcs->map(fn($item)=>sprintf('%d@%s',$item->zone_id,$item->domain->name))->join('</strong>, <strong class="highlight">') !!} </strong></p>
|
||||
<p>This system is the ZC for the following zones: <strong class="highlight">{!! $o->zcs->sortBy('zone_id')->map(function($item) { return sprintf('%d@%s',$item->zone_id,$item->domain->name); })->join('</strong>, <strong class="highlight">') !!} </strong></p>
|
||||
@endif
|
||||
|
||||
@include('widgets.error')
|
||||
@ -123,7 +123,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->addresses as $oo)
|
||||
@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)
|
||||
<tr>
|
||||
<td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><data value="{{ $oo->id }}:{{ $oo->validated ? 1 : 0 }}" class="validated"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" @class(['bi','bi-activity'=>$oo->validated,'bi-radioactive'=>(! $oo->validated)])></i></data></span></td>
|
||||
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
@ -156,6 +156,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -320,7 +321,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->aka_common() as $ao)
|
||||
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
|
||||
<tr>
|
||||
<td>{{ $ao->ftn }}</td>
|
||||
<td>{{ $ao->netmailWaiting()->count() }}</td>
|
||||
@ -342,7 +343,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->aka_common() as $ao)
|
||||
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
|
||||
<tr>
|
||||
<td>{{ $ao->ftn }}</td>
|
||||
<td>{{ $ao->echomailWaiting()->count() }}</td>
|
||||
@ -364,7 +365,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->aka_common() as $ao)
|
||||
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
|
||||
<tr>
|
||||
<td>{{ $ao->ftn }}</td>
|
||||
<td>{{ $ao->filesWaiting()->count() }}</td>
|
||||
|
@ -1,84 +1,91 @@
|
||||
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
|
||||
@csrf
|
||||
@if(($x=\App\Models\Zone::active()
|
||||
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
|
||||
->orderBy('zone_id')
|
||||
->with(['domain'])
|
||||
->get())->count())
|
||||
|
||||
<div class="row pt-0">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<div class="row">
|
||||
<!-- Select Domain -->
|
||||
<div class="col-3">
|
||||
<label for="echoarea_domain_id" class="form-label">Network</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
|
||||
<option></option>
|
||||
@foreach($o->sessions as $zo)
|
||||
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('domain_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
|
||||
@csrf
|
||||
|
||||
<!-- Select Address -->
|
||||
<div class="col-3">
|
||||
<div class="d-none" id="echoarea_address-select">
|
||||
<label for="echoarea_address_id" class="form-label">Address</label>
|
||||
<div class="input-group">
|
||||
<div class="row pt-0">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<div class="row">
|
||||
<!-- Select Domain -->
|
||||
<div class="col-3">
|
||||
<label for="echoarea_domain_id" class="form-label">Network</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select" id="echoarea_address_id" name="address_id" required>
|
||||
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
|
||||
<option></option>
|
||||
@foreach($x as $zo)
|
||||
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('domain_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Summary of Addresses -->
|
||||
<div class="offset-3 col-3" id="echoarea-summary">
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Network</th>
|
||||
<th class="text-end">Areas</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- Select Address -->
|
||||
<div class="col-3">
|
||||
<div class="d-none" id="echoarea_address-select">
|
||||
<label for="echoarea_address_id" class="form-label">Address</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select" id="echoarea_address_id" name="address_id" required>
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
|
||||
<!-- Summary of Addresses -->
|
||||
<div class="offset-3 col-3" id="echoarea-summary">
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{ $oo->first()->domain->name }}</td>
|
||||
<td class="text-end">{{ $oo->count() }}</td>
|
||||
<th>Network</th>
|
||||
<th class="text-end">Areas</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</thead>
|
||||
|
||||
@if($errors->count())
|
||||
<div class="row">
|
||||
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
|
||||
There were errors with the submission.
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
<tbody>
|
||||
@foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->first()->domain->name }}</td>
|
||||
<td class="text-end">{{ $oo->count() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</ul>
|
||||
</span>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 d-none" id="echoarea-select"></div>
|
||||
@if($errors->count())
|
||||
<div class="row">
|
||||
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
|
||||
There were errors with the submission.
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 d-none" id="echoarea-select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript" src="{{ asset('plugin/checkboxes/jquery.checkboxes-1.2.2.min.js') }}"></script>
|
||||
|
@ -1,71 +1,78 @@
|
||||
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
|
||||
@csrf
|
||||
@if(($x=\App\Models\Zone::active()
|
||||
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
|
||||
->orderBy('zone_id')
|
||||
->with(['domain'])
|
||||
->get())->count())
|
||||
|
||||
<div class="row pt-0">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<div class="row">
|
||||
<!-- Select Domain -->
|
||||
<div class="col-3">
|
||||
<label for="domain_id" class="form-label">Network</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
|
||||
<option></option>
|
||||
@foreach($o->sessions as $zo)
|
||||
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('domain_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
|
||||
@csrf
|
||||
|
||||
<!-- Select Address -->
|
||||
<div class="col-3">
|
||||
<div class="d-none" id="filearea_address-select">
|
||||
<label for="filearea_address_id" class="form-label">Address</label>
|
||||
<div class="input-group">
|
||||
<div class="row pt-0">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<div class="row">
|
||||
<!-- Select Domain -->
|
||||
<div class="col-3">
|
||||
<label for="domain_id" class="form-label">Network</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select" id="filearea_address_id" name="address_id" required>
|
||||
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
|
||||
<option></option>
|
||||
@foreach($x as $zo)
|
||||
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('domain_id')
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Summary of Addresses -->
|
||||
<div class="offset-3 col-3" id="filearea-summary">
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Network</th>
|
||||
<th class="text-end">Areas</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- Select Address -->
|
||||
<div class="col-3">
|
||||
<div class="d-none" id="filearea_address-select">
|
||||
<label for="filearea_address_id" class="form-label">Address</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||
<select class="form-select" id="filearea_address_id" name="address_id" required>
|
||||
<option></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
|
||||
<!-- Summary of Addresses -->
|
||||
<div class="offset-3 col-3" id="filearea-summary">
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{{ $oo->first()->domain->name }}</td>
|
||||
<td class="text-end">{{ $oo->count() }}</td>
|
||||
<th>Network</th>
|
||||
<th class="text-end">Areas</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</thead>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 d-none" id="filearea-select"></div>
|
||||
<tbody>
|
||||
@foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->first()->domain->name }}</td>
|
||||
<td class="text-end">{{ $oo->count() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 d-none" id="filearea-select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
@endif
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript" src="{{ asset('plugin/checkboxes/jquery.checkboxes-1.2.2.min.js') }}"></script>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<div class="row pt-0">
|
||||
<div class="col-12">
|
||||
<div class="greyframe titledbox shadow0xb0">
|
||||
<h2 class="cap">@can($action,$o) @if($o->exists) Update @else Add @endif @endcan System</h2>
|
||||
<h2 class="cap">@can($action,$o) @if($o->exists) Update @else Add @endif @endif System</h2>
|
||||
|
||||
@include('system.widget.system')
|
||||
</div>
|
||||
|
@ -1,9 +1,15 @@
|
||||
@use(App\Models\Address)
|
||||
<!-- $o=System::class -->
|
||||
@php
|
||||
use App\Models\{Address,Zone};
|
||||
@endphp
|
||||
|
||||
<div class="row">
|
||||
<!-- Zone mail sent to, because we dont have session details for these addresses -->
|
||||
<!-- Zone mail sent to -->
|
||||
<div class="col-6">
|
||||
@if($o->aka_unknown()->count())
|
||||
@if(! $o->setup && ($x=Zone::active()
|
||||
->whereIn('id',$o->zones->pluck('id'))
|
||||
->whereNotIn('id',$o->sessions->pluck('id'))
|
||||
->get())->count())
|
||||
|
||||
<h4>This host's mail is sent to:</h4>
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
@ -14,17 +20,19 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($o->aka_unknown() as $ao)
|
||||
<tr>
|
||||
<td>{{ $ao->ftn }}</td>
|
||||
<td>
|
||||
@if ($xx=$ao->uplink())
|
||||
{{ $xx->ftn4d }}
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@foreach($x as $zo)
|
||||
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->ftn }}</td>
|
||||
<td>
|
||||
@if ($x=$oo->uplink())
|
||||
{{ $x->ftn4d }}
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@ -33,62 +41,28 @@
|
||||
|
||||
<!-- Systems this host collects for -->
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if($o->sessions->count())
|
||||
<h4>This host collects mail for the following systems:</h4>
|
||||
@if($o->sessions->count())
|
||||
<h4>This host collects mail for the following systems:</h4>
|
||||
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>AKA</th>
|
||||
<th>For Systems(s)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->sessions->sortBy('zone_id') as $zo)
|
||||
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
|
||||
<tr>
|
||||
<th>AKA</th>
|
||||
<th>Incl Systems(s)</th>
|
||||
<td>{{ $oo->ftn }}</td>
|
||||
<td>{!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('<br>') : 'None' !!}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->sessions->sortBy('zone_id') as $zo)
|
||||
@if($zo->pivot->default)
|
||||
<tr>
|
||||
<td>{!! $o->akas->filter(fn($item)=>$item->zone->domain_id === $zo->domain_id)->pluck('ftn')->join('<br>') !!}</td>
|
||||
<td>All <small>(not otherwise routed)</small></td>
|
||||
</tr>
|
||||
@else
|
||||
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->ftn }}</td>
|
||||
<td>{!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('<br>') : 'None' !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($o->aka_uncommon()->count())
|
||||
<div class="row">
|
||||
<div class="rol-12">
|
||||
<h4>This host's mail not known here:</h4>
|
||||
<table class="table monotable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>AKA</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($o->aka_uncommon() as $ao)
|
||||
<tr>
|
||||
<td>{{ $ao->ftn }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
@ -1,6 +1,8 @@
|
||||
@use(App\Classes\FTN\Packet)
|
||||
@use(App\Models\Mailer)
|
||||
@use(App\Models\User)
|
||||
@php
|
||||
use App\Classes\FTN\Packet;
|
||||
use App\Models\{Mailer,User};
|
||||
@endphp
|
||||
|
||||
<!-- $o=System::class -->
|
||||
<div class="row">
|
||||
<div class="col-xl-9 col-12">
|
||||
@ -18,7 +20,7 @@
|
||||
<select style="width: 80%;" class="form-select @error('users') is-invalid @enderror" id="users" name="users[]">
|
||||
<option value=""> </option>
|
||||
@foreach (User::orderBy('name')->active()->get() as $uo)
|
||||
<option value="{{ $uo->id }}" @selected(in_array($uo->id,old('users',$o->users->pluck('id')->toArray())))>{{ $uo->name }} <small>({{ $uo->email }})</small></option>
|
||||
<option value="{{ $uo->id }}" @if(in_array($uo->id,old('users',$o->users->pluck('id')->toArray())))selected @endif>{{ $uo->name }} <small>({{ $uo->email }})</small></option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@ -323,6 +325,8 @@
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@if(! is_null($o->pollmode))
|
||||
@ -434,6 +438,9 @@
|
||||
@else
|
||||
<input type="hidden" name="system_id" value="{{ $o->id }}">
|
||||
<span><small><strong>NOTE:</strong> You'll be able to update these details after registration is completed.</small></span>
|
||||
{{--
|
||||
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
|
||||
--}}
|
||||
@endcan
|
||||
@else
|
||||
<button type="submit" class="btn btn-success float-end" name="submit" value="create">Register</button>
|
||||
|
@ -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)
|
||||
<option value="{{ $oo->id }}" @if(old('id')===$oo->id)selected @endif>{{ $oo->name }}</option>
|
||||
@endforeach
|
||||
|
@ -133,8 +133,7 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
|
||||
->where('o','[0-9]+')
|
||||
->where('packet','[0-9a-zA-Z]+');
|
||||
|
||||
Route::view('user/system/register','user.system.register');
|
||||
Route::post('user/system/register',[SystemController::class,'register']);
|
||||
Route::match(['get','post'],'user/system/register',[SystemController::class,'register']);
|
||||
Route::match(['post'],'user/system/link',[SystemController::class,'system_link']);
|
||||
|
||||
/* ZONE PATHS */
|
||||
|
Loading…
Reference in New Issue
Block a user