diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 3eb0e9c..8559643 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -22,11 +22,11 @@ class Packet extends FTNBase implements \Iterator, \Countable private const BLOCKSIZE = 1024; protected const PACKED_MSG_LEAD = "\02\00"; - private const PACKET_TYPES = [ - FTNBase\Packet\FSC45::class, - FTNBase\Packet\FSC48::class, - FTNBase\Packet\FSC39::class, - FTNBase\Packet\FTS1::class, + public const PACKET_TYPES = [ + '2.2' => FTNBase\Packet\FSC45::class, + '2+' => FTNBase\Packet\FSC48::class, + '2e' => FTNBase\Packet\FSC39::class, + '2.0' => FTNBase\Packet\FTS1::class, ]; protected array $header; // Packet Header diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 01bd09c..7674229 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -276,7 +276,7 @@ class SystemController extends Controller $this->authorize('update',$o); if ($request->post()) { - foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','mailer_type','mailer_address','mailer_port','zt_id'] as $key) + foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','mailer_type','mailer_address','mailer_port','zt_id','pkt_type'] as $key) $o->{$key} = $request->post($key); $o->save(); diff --git a/app/Http/Requests/SystemRegister.php b/app/Http/Requests/SystemRegister.php index 82aea87..3733ddf 100644 --- a/app/Http/Requests/SystemRegister.php +++ b/app/Http/Requests/SystemRegister.php @@ -5,7 +5,9 @@ namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Request; use Illuminate\Support\Facades\Gate; +use Illuminate\Validation\Rule; +use App\Classes\FTN\Packet; use App\Models\System; class SystemRegister extends FormRequest @@ -48,7 +50,6 @@ class SystemRegister extends FormRequest ], ($this->so->exists || ($request->action !== 'create')) ? [ 'location' => 'required|min:3', - 'sysop' => 'required|min:3', 'phone' => 'nullable|regex:/^([0-9-]+)$/', 'address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', @@ -58,6 +59,7 @@ class SystemRegister extends FormRequest 'mailer_address' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', 'mailer_port' => 'nullable|digits_between:2,5', 'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($this->so->exists ? $this->so->id : 0), + 'pkt_type' => ['required',Rule::in(array_keys(Packet::PACKET_TYPES))], ] : [], $this->so->exists ? [ 'active' => 'required|boolean', diff --git a/app/Models/Address.php b/app/Models/Address.php index 85ba9ef..5750b7e 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -650,8 +650,9 @@ class Address extends Model if (! $ao) return NULL; - // @todo make packet type configurable by each system - $o = new Packet\FSC48; + // Get packet type + $type = collect(Packet::PACKET_TYPES)->get($this->system->pkt_type ?: config('app.default_pkt')); + $o = new $type; $o->addressHeader($ao,$this); // $oo = Netmail/Echomail Model diff --git a/config/app.php b/config/app.php index fb260e7..aa05c62 100644 --- a/config/app.php +++ b/config/app.php @@ -20,6 +20,7 @@ return [ // Number of messages in a packet that will result in them being queued for processing 'queue_msgs' => env('FIDO_QUEUE_MSGS', 50), + 'default_pkt' => env('FIDO_DEFAULT_PACKET', '2+'), /* |-------------------------------------------------------------------------- @@ -242,4 +243,4 @@ return [ ], -]; \ No newline at end of file +]; diff --git a/database/migrations/2023_06_23_170537_unique_filenames.php b/database/migrations/2023_06_23_170537_unique_filenames.php index ce5645a..339ed91 100644 --- a/database/migrations/2023_06_23_170537_unique_filenames.php +++ b/database/migrations/2023_06_23_170537_unique_filenames.php @@ -29,6 +29,8 @@ return new class extends Migration */ public function down() { - // + Schema::table('files',function (Blueprint $table) { + $table->dropUnique(['filearea_id','name']); + }); } }; diff --git a/database/migrations/2023_06_26_185441_node_packet_type.php b/database/migrations/2023_06_26_185441_node_packet_type.php new file mode 100644 index 0000000..194414f --- /dev/null +++ b/database/migrations/2023_06_26_185441_node_packet_type.php @@ -0,0 +1,28 @@ +string('pkt_type')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('systems',function (Blueprint $table) { + $table->dropColumn(['pkt_type']); + }); + } +}; diff --git a/resources/views/system/widget/form-system.blade.php b/resources/views/system/widget/form-system.blade.php index 76a04f3..35a4e61 100644 --- a/resources/views/system/widget/form-system.blade.php +++ b/resources/views/system/widget/form-system.blade.php @@ -151,6 +151,24 @@ + +