diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index 95d661a..9388d3d 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -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, diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index 72193ab..3804b96 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -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 ); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1e556bf..45a0265 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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(); } diff --git a/app/Http/Requests/SetupRequest.php b/app/Http/Requests/SetupRequest.php index 70f43b2..5660bd9 100644 --- a/app/Http/Requests/SetupRequest.php +++ b/app/Http/Requests/SetupRequest.php @@ -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', ]; diff --git a/app/Models/Address.php b/app/Models/Address.php index 6927a04..4b77897 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -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)); diff --git a/app/Models/Setup.php b/app/Models/Setup.php index 0eecd5f..d8f248e 100644 --- a/app/Models/Setup.php +++ b/app/Models/Setup.php @@ -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 diff --git a/database/migrations/2023_06_29_071835_setup_server_options.php b/database/migrations/2023_06_29_071835_setup_server_options.php index 8bff901..c38e41c 100644 --- a/database/migrations/2023_06_29_071835_setup_server_options.php +++ b/database/migrations/2023_06_29_071835_setup_server_options.php @@ -13,6 +13,11 @@ return new class extends Migration { Schema::table('setups',function (Blueprint $table) { $table->jsonb('servers')->nullable(); + $table->dropColumn(['binkp','zmodem','permissions','protocols','options','emsi_protocols']); + }); + + Schema::table('setups',function (Blueprint $table) { + $table->jsonb('options')->nullable(); }); } @@ -21,8 +26,17 @@ return new class extends Migration */ public function down(): void { + Schema::table('setups',function (Blueprint $table) { + $table->dropColumn(['options']); + }); Schema::table('setups',function (Blueprint $table) { $table->dropColumn(['servers']); + $table->integer('binkp')->nullable(); + $table->integer('zmodem')->nullable(); + $table->integer('permissions')->nullable(); + $table->integer('protocols')->nullable(); + $table->integer('emsi_protocols')->nullable(); + $table->integer('options')->nullable(); }); } }; diff --git a/resources/views/setup.blade.php b/resources/views/setup.blade.php index 770e24a..cf02b6d 100644 --- a/resources/views/setup.blade.php +++ b/resources/views/setup.blade.php @@ -79,7 +79,7 @@ use App\Classes\Protocol\Binkp;

Site Permissions

- optionGet(Setup::O_HIDEAKA))) checked @endif> + optionGet(Setup::O_HIDEAKA,'options_options'))) checked @endif>
@@ -124,69 +124,62 @@ use App\Classes\Protocol\Binkp;
- optionGet(Setup::O_BINKP))) checked @endif> - + binkp_active)) checked @endif> +
- optionGet(Binkp::F_CHAT,'binkp_options'))) checked @endif disabled> - + optionGet(Binkp::F_CHAT,'binkp_options'))) checked @endif disabled> +
- optionGet(Binkp::F_COMP,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_COMP,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_MD,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_MD,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_MDFORCE,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_MDFORCE,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_CRYPT,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_CRYPT,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_MULTIBATCH,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_MULTIBATCH,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_MULTIPASS,'binkp_options'))) checked @endif disabled> - + optionGet(Binkp::F_MULTIPASS,'binkp_options'))) checked @endif disabled> +
- optionGet(Binkp::F_NODUPE,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_NODUPE,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_NODUPEA,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_NODUPEA,'binkp_options'))) checked @endif> +
- optionGet(Binkp::F_NOREL,'binkp_options'))) checked @endif> - + optionGet(Binkp::F_NOREL,'binkp_options'))) checked @endif> +

* Recommended Defaults

- - - - {{-- - $this->binkp_options = ['m','d','r','b']; - --}} -
@@ -216,7 +209,7 @@ use App\Classes\Protocol\Binkp;
- optionGet(Setup::O_EMSI))) checked @endif> + emsi_active)) checked @endif>
@@ -245,7 +238,7 @@ use App\Classes\Protocol\Binkp;
- optionGet(Setup::O_DNS))) checked @endif> + dns_active)) checked @endif>
@@ -260,7 +253,7 @@ use App\Classes\Protocol\Binkp;
- +