Enable full setup on the setup form

This commit is contained in:
2023-07-05 22:42:59 +10:00
parent 6f298d778f
commit c3d4c1fc31
8 changed files with 89 additions and 88 deletions

View File

@@ -179,9 +179,9 @@ final class Binkp extends BaseProtocol
$this->msgs(self::BPM_NUL,sprintf('OPT CRAM-MD5-%s',md5($random_key)));
}
$this->msgs(self::BPM_NUL,sprintf('SYS %s',$this->setup->system_name));
$this->msgs(self::BPM_NUL,sprintf('ZYZ %s',$this->setup->sysop));
$this->msgs(self::BPM_NUL,sprintf('LOC %s',$this->setup->location));
$this->msgs(self::BPM_NUL,sprintf('SYS %s',$this->setup->system->name));
$this->msgs(self::BPM_NUL,sprintf('ZYZ %s',$this->setup->system->sysop));
$this->msgs(self::BPM_NUL,sprintf('LOC %s',$this->setup->system->location));
$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,

View File

@@ -209,9 +209,9 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// System Details
$makedata .= sprintf('{IDENT}{[%s][%s][%s][-Unpublished-][38400][%s]}',
$this->setup->system_name,
$this->setup->location,
$this->setup->sysop,
$this->setup->system->name,
$this->setup->system->location,
$this->setup->system->sysop,
'XA' // Nodelist Flags
);

View File

@@ -157,25 +157,39 @@ class HomeController extends Controller
$o = Setup::findOrNew(config('app.id'));
if ($request->post()) {
if (! $o->exists) {
if (! $o->exists)
$o->id = config('app.id');
$o->zmodem = 0;
$o->emsi_protocols = 0;
$o->protocols = 0;
$o->permissions = 0;
}
$servers = collect();
$options = collect();
$binkp = collect();
$binkp->put('options',collect($request->post('binkp'))->sum());
$binkp->put('port',$request->post('binkp_port'));
$binkp->put('bind',$request->post('binkp_bind'));
$servers->put('binkp',$binkp);
$x = collect();
$x->put('options',collect($request->post('binkp'))->sum());
$x->put('port',$request->post('binkp_port'));
$x->put('bind',$request->post('binkp_bind'));
$x->put('active',(bool)$request->post('binkp_active'));
$servers->put('binkp',$x);
$x = collect();
$x->put('options',collect($request->post('emsi'))->sum());
$x->put('port',$request->post('emsi_port'));
$x->put('bind',$request->post('emsi_bind'));
$x->put('active',(bool)$request->post('emsi_active'));
$servers->put('emsi',$x);
$x = collect();
$x->put('options',collect($request->post('dns'))->sum());
$x->put('port',$request->post('dns_port'));
$x->put('bind',$request->post('dns_bind'));
$x->put('active',(bool)$request->post('dns_active'));
$servers->put('dns',$x);
$options->put('options',collect($request->post('options'))->sum());
$options->put('msgs_pkt',$request->post('msgs_pkt'));
$o->options = collect($request->post('options'))->sum();
$o->system_id = $request->post('system_id');
$o->servers = $servers;
$o->options = $options;
$o->system_id = $request->post('system_id');
$o->save();
}

View File

@@ -22,12 +22,13 @@ class SetupRequest extends FormRequest
'system_id' => 'required|exists:systems,id',
'binkp' => 'nullable|array',
'binkp.*' => 'nullable|numeric',
//'dns' => 'required|array',
'dns' => 'nullable|array',
'dns.*' => 'nullable|numeric',
//'emsi' => 'required|array',
'emsi' => 'nullable|array',
'emsi.*' => 'nullable|numeric',
'*_bind' => 'required|ip',
'*_port' => 'required|numeric',
'*_active' => 'nullable|accepted',
'options' => 'nullable|array',
'options.*' => 'nullable|numeric',
];

View File

@@ -582,8 +582,8 @@ class Address extends Model
// Limit to max messages
Log::info(sprintf('%s:= Got [%d] echomails for [%s] for sending',self::LOGKEY,$x->count(),$this->ftn));
if ($x->count() > $s->max_msgs_pkt) {
$x = $x->take($s->max_msgs_pkt);
if ($x->count() > $s->msgs_pkt) {
$x = $x->take($s->msgs_pkt);
Log::alert(sprintf('%s:= Only sending [%d] echomails for [%s]',self::LOGKEY,$x->count(),$this->ftn));
}
@@ -678,7 +678,7 @@ class Address extends Model
$c = 0;
foreach ($msgs as $oo) {
// Only bundle up to max messages
if (++$c > $s->max_msgs_pkt)
if (++$c > $s->msgs_pkt)
break;
$o->addMail($oo->packet($this));

View File

@@ -41,6 +41,7 @@ class Setup extends Model
private array $internal = [];
protected $casts = [
'options' => 'array',
'servers' => 'array',
];
@@ -51,7 +52,6 @@ class Setup extends Model
/* EMSI SETTINGS */
$this->do_prevent = 1; /* EMSI - send an immediate EMSI_INQ on connect */
$this->ignore_nrq = 0;
$this->options = 0; /* EMSI - our capabilities */
}
/**
@@ -72,18 +72,23 @@ class Setup extends Model
case 'emsi_port':
return Arr::get($this->servers,str_replace('_','.',$key),DNS::PORT);
case 'options_options':
return Arr::get($this->options,'options');
case 'binkp_active':
case 'dns_active':
case 'emsi_active':
case 'binkp_options':
case 'dns_options':
case 'emsi_options':
return Arr::get($this->servers,'binkp.options');
return Arr::get($this->servers,str_replace('_','.',$key));
case 'binkp_settings':
case 'ignore_nrq':
case 'do_prevent':
return $this->internal[$key] ?? FALSE;
case 'max_msgs_pkt':
return self::MAX_MSGS_PKT;
case 'msgs_pkt':
return Arr::get($this->options,$key,self::MAX_MSGS_PKT);
case 'version':
return File::exists('VERSION') ? chop(File::get('VERSION')) : 'dev';
@@ -110,16 +115,7 @@ class Setup extends Model
case 'emsi_options':
return Arr::set($this->servers,str_replace('_','.',$key),$value);
case 'binkp_settings':
case 'ignore_nrq':
case 'opt_nr':
case 'opt_nd':
case 'opt_nda':
case 'opt_md':
case 'opt_cr':
case 'opt_mb':
case 'opt_cht':
case 'opt_mpwd':
case 'do_prevent':
$this->internal[$key] = $value;
break;
@@ -153,23 +149,6 @@ class Setup extends Model
return $this->belongsTo(System::class);
}
/* ATTRIBUTES */
public function getLocationAttribute()
{
return $this->system->location;
}
public function getSysopAttribute()
{
return $this->system->sysop;
}
public function getSystemNameAttribute()
{
return $this->system->name;
}
/* METHODS */
public function optionClear(int $key,$index='options'): void