From acfde97e79540981e4c7e70d0623de68605641aa Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 4 Jul 2021 21:47:23 +1000 Subject: [PATCH] Fix binkp remote closing connection, add/delete session details, menu item this system, minor CSS fixes, move system form editing to individual files --- app/Classes/Protocol.php | 2 + app/Classes/Sock/SocketClient.php | 11 +- app/Classes/Sock/SocketException.php | 2 + app/Http/Controllers/SystemController.php | 56 +- app/Http/Middleware/ActiveUser.php | 28 +- app/Models/Address.php | 8 +- app/Models/AddressZone.php | 10 - app/Models/System.php | 31 + app/Models/SystemZone.php | 20 + composer.json | 1 + composer.lock | 221 +++++- .../2021_07_02_143145_session_passwords.php | 28 + public/oldschool/css/main.css | 14 +- resources/views/domain/view.blade.php | 8 - .../views/layouts/partials/sidebar.blade.php | 6 + resources/views/system/addedit.blade.php | 669 ++---------------- resources/views/system/form-address.blade.php | 416 +++++++++++ resources/views/system/form-session.blade.php | 129 ++++ resources/views/system/form-system.blade.php | 181 +++++ resources/views/system/ours.blade.php | 93 +++ routes/web.php | 14 +- 21 files changed, 1293 insertions(+), 655 deletions(-) delete mode 100644 app/Models/AddressZone.php create mode 100644 app/Models/SystemZone.php create mode 100644 database/migrations/2021_07_02_143145_session_passwords.php create mode 100644 resources/views/system/form-address.blade.php create mode 100644 resources/views/system/form-session.blade.php create mode 100644 resources/views/system/form-system.blade.php create mode 100644 resources/views/system/ours.blade.php diff --git a/app/Classes/Protocol.php b/app/Classes/Protocol.php index e0b75f6..b233a71 100644 --- a/app/Classes/Protocol.php +++ b/app/Classes/Protocol.php @@ -107,6 +107,7 @@ abstract class Protocol switch ($key) { case 'ls_SkipGuard': /* double-skip protection on/off */ case 'rxOptions': /* Options from ZRINIT header */ + case 'socket_error': return $this->comms[$key] ?? 0; case 'ls_rxAttnStr': @@ -126,6 +127,7 @@ abstract class Protocol case 'ls_rxAttnStr': case 'ls_SkipGuard': case 'rxOptions': + case 'socket_error': $this->comms[$key] = $value; break; diff --git a/app/Classes/Sock/SocketClient.php b/app/Classes/Sock/SocketClient.php index 2ba8d14..9d23161 100644 --- a/app/Classes/Sock/SocketClient.php +++ b/app/Classes/Sock/SocketClient.php @@ -300,8 +300,15 @@ final class SocketClient { throw new SocketException($x=socket_last_error($this->connection),socket_strerror($x)); // If our buffer is null, see if we have any out of band data. - if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0)) - socket_recv($this->connection,$buf, $len,MSG_OOB); + // @todo We throw an errorexception when the socket is closed by the remote I think. + if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0)) { + try { + socket_recv($this->connection,$buf, $len,MSG_OOB); + + } catch (\Exception $e) { + throw new SocketException($x=socket_last_error($this->connection),socket_strerror($x)); + } + } return is_null($buf) ? '' : $buf; } diff --git a/app/Classes/Sock/SocketException.php b/app/Classes/Sock/SocketException.php index 6ea91df..a9b7d68 100644 --- a/app/Classes/Sock/SocketException.php +++ b/app/Classes/Sock/SocketException.php @@ -10,6 +10,7 @@ final class SocketException extends \Exception { public const CANT_CONNECT = 5; public const SOCKET_ERROR = 6; public const SOCKET_EAGAIN = 11; + public const SOCKET_READ = 22; private array $messages = [ self::CANT_CREATE_SOCKET => 'Can\'t create socket: "%s"', @@ -19,6 +20,7 @@ final class SocketException extends \Exception { self::CANT_CONNECT => 'Can\'t connect: "%s"', self::SOCKET_ERROR => 'Socket Error: "%s"', self::SOCKET_EAGAIN => 'Socket Resource Temporarily Unavailable - Try again', + self::SOCKET_READ => 'Unable to read from socket', ]; public function __construct(int $code,string $params=NULL) { diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 2680579..1300ddd 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use App\Models\{Address,System}; +use App\Models\{Address,System,Zone}; use App\Rules\{FidoInteger,TwoByteInteger}; class SystemController extends Controller @@ -24,6 +24,7 @@ class SystemController extends Controller */ public function add_address(Request $request,System $o) { + // @todo This should be admin of the zone $this->authorize('admin',$o); session()->flash('add_address',TRUE); @@ -182,6 +183,35 @@ class SystemController extends Controller return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id)); } + /** + * Add Session details + * + * @param Request $request + * @param System $o + * @return \Illuminate\Http\RedirectResponse + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function add_session(Request $request,System $o) + { + // @todo This should be admin of the zone + $this->authorize('admin',$o); + session()->flash('add_session',TRUE); + + $validate = $request->validate([ + 'zone_id' => 'required|exists:zones,id', + 'sespass' => 'required|string|min:4', + 'pktpass' => 'required|string|min:4|max:8', + 'ticpass' => 'required|string|min:4', + 'fixpass' => 'required|string|min:4', + ]); + + $zo = Zone::findOrFail($validate['zone_id']); + + $o->sessions()->attach($zo,$validate); + + return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id)); + } + /** * Add or edit a node */ @@ -225,6 +255,7 @@ class SystemController extends Controller */ public function del_address(Address $o) { + // @todo This should be admin of the zone $this->authorize('admin',$o); session()->flash('add_address',TRUE); @@ -236,6 +267,28 @@ class SystemController extends Controller return redirect()->to(sprintf('ftn/system/addedit/%d',$sid)); } + /** + * Delete address assigned to a host + * + * @param Address $o + * @return \Illuminate\Http\RedirectResponse + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function del_session(System $o,Zone $zo) + { + $this->authorize('admin',$zo); + session()->flash('add_session',TRUE); + + $o->sessions()->detach($zo); + + return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id)); + } + + public function ours() + { + return view('system.ours'); + } + /** * Suspend address assigned to a host * @@ -245,6 +298,7 @@ class SystemController extends Controller */ public function sus_address(Address $o) { + // @todo This should be admin of the zone $this->authorize('admin',$o); session()->flash('add_address',TRUE); diff --git a/app/Http/Middleware/ActiveUser.php b/app/Http/Middleware/ActiveUser.php index d333df1..62ea150 100644 --- a/app/Http/Middleware/ActiveUser.php +++ b/app/Http/Middleware/ActiveUser.php @@ -8,20 +8,20 @@ use Illuminate\Support\Facades\Auth; class ActiveUser { - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle(Request $request, Closure $next) - { - if (Auth::user()->exists && ! Auth::user()->active) { - Auth::logout(); - abort(403,'Your account is not active'); + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle(Request $request, Closure $next) + { + if (Auth::user()->exists && ! Auth::user()->active) { + Auth::logout(); + abort(403,'Your account is not active'); } - return $next($request); - } + return $next($request); + } } diff --git a/app/Models/Address.php b/app/Models/Address.php index f8a412e..956a84e 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -26,6 +26,12 @@ class Address extends Model /* RELATIONS */ + /** + * Find children dependant on this record + * + * @todo While this is finding children of hubs, we are not currently finding children of Hosts or Regions. + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ public function children() { return $this->belongsTo(self::class,'id','hub_id'); @@ -162,7 +168,7 @@ class Address extends Model static $session = NULL; if (is_null($session)) { - $session = (new AddressZone) + $session = (new SystemZone) ->where('zone_id',$this->zone_id) ->where('system_id',$this->system_id) ->single(); diff --git a/app/Models/AddressZone.php b/app/Models/AddressZone.php deleted file mode 100644 index dfacb0a..0000000 --- a/app/Models/AddressZone.php +++ /dev/null @@ -1,10 +0,0 @@ -orderBy('point_id'); } + /** + * Session Passwords for system + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function sessions() + { + return $this->belongsToMany(Zone::class) + ->withPivot(['sespass','pktpass','ticpass','fixpass','zt_ipv4','zt_ipv6']); + } + + /** + * If this system is configured as this host + * + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ + public function setup() + { + return $this->hasOne(Setup::class); + } + + /** + * Zones a system has addresses for + * + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + public function zones() + { + return $this->hasManyThrough(Zone::class,Address::class,'system_id','id','id','zone_id'); + } + /* GENERAL METHODS */ /** diff --git a/app/Models/SystemZone.php b/app/Models/SystemZone.php new file mode 100644 index 0000000..ca4b451 --- /dev/null +++ b/app/Models/SystemZone.php @@ -0,0 +1,20 @@ +belongsTo(System::class); + } + + public function zone() + { + return $this->belongsTo(Zone::class); + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index 4210a97..15bb3e4 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "repat/laravel-job-models": "^0.5.1" }, "require-dev": { + "barryvdh/laravel-debugbar": "^3.6", "barryvdh/laravel-ide-helper": "^2.10", "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index fba7fc8..af3f3c4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "375895896140ab8b282d257a18cc4a6d", + "content-hash": "cc549eaf378b58b95b4c809dd45553db", "packages": [ { "name": "asm89/stack-cors", @@ -5725,6 +5725,91 @@ } ], "packages-dev": [ + { + "name": "barryvdh/laravel-debugbar", + "version": "v3.6.2", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-debugbar.git", + "reference": "70b89754913fd89fef16d0170a91dbc2a5cd633a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/70b89754913fd89fef16d0170a91dbc2a5cd633a", + "reference": "70b89754913fd89fef16d0170a91dbc2a5cd633a", + "shasum": "" + }, + "require": { + "illuminate/routing": "^6|^7|^8", + "illuminate/session": "^6|^7|^8", + "illuminate/support": "^6|^7|^8", + "maximebf/debugbar": "^1.16.3", + "php": ">=7.2", + "symfony/debug": "^4.3|^5", + "symfony/finder": "^4.3|^5" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench-dusk": "^4|^5|^6", + "phpunit/phpunit": "^8.5|^9.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.5-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\Debugbar\\ServiceProvider" + ], + "aliases": { + "Debugbar": "Barryvdh\\Debugbar\\Facade" + } + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\Debugbar\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "PHP Debugbar integration for Laravel", + "keywords": [ + "debug", + "debugbar", + "laravel", + "profiler", + "webprofiler" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-debugbar/issues", + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.2" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2021-06-14T14:29:26+00:00" + }, { "name": "barryvdh/laravel-ide-helper", "version": "v2.10.0", @@ -7199,6 +7284,71 @@ }, "time": "2020-05-27T16:41:55+00:00" }, + { + "name": "maximebf/debugbar", + "version": "v1.16.5", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6d51ee9e94cff14412783785e79a4e7ef97b9d62", + "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62", + "shasum": "" + }, + "require": { + "php": "^7.1|^8", + "psr/log": "^1.0", + "symfony/var-dumper": "^2.6|^3|^4|^5" + }, + "require-dev": { + "phpunit/phpunit": "^7.5.20 || ^9.4.2" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog", + "predis/predis": "Redis storage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.16-dev" + } + }, + "autoload": { + "psr-4": { + "DebugBar\\": "src/DebugBar/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug", + "debugbar" + ], + "support": { + "issues": "https://github.com/maximebf/php-debugbar/issues", + "source": "https://github.com/maximebf/php-debugbar/tree/v1.16.5" + }, + "time": "2020-12-07T11:07:24+00:00" + }, { "name": "mockery/mockery", "version": "1.4.3", @@ -9268,6 +9418,75 @@ }, "time": "2020-07-07T18:42:57+00:00" }, + { + "name": "symfony/debug", + "version": "v4.4.25", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "a8d2d5c94438548bff9f998ca874e202bb29d07f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/a8d2d5c94438548bff9f998ca874e202bb29d07f", + "reference": "a8d2d5c94438548bff9f998ca874e202bb29d07f", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/log": "~1.0", + "symfony/polyfill-php80": "^1.15" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "^3.4|^4.0|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/debug/tree/v4.4.25" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-26T17:39:37+00:00" + }, { "name": "symfony/filesystem", "version": "v5.3.0", diff --git a/database/migrations/2021_07_02_143145_session_passwords.php b/database/migrations/2021_07_02_143145_session_passwords.php new file mode 100644 index 0000000..0923674 --- /dev/null +++ b/database/migrations/2021_07_02_143145_session_passwords.php @@ -0,0 +1,28 @@ + @append \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index e9a6ba7..e752665 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -8,6 +8,11 @@
Zones
+
+
System Admin
+
This Host Systems
+
+ @can('admin')
Users
@@ -16,6 +21,7 @@
@endcan @endauth +
Expore Networks
@foreach (\App\Models\Domain::active() diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 0b80329..919e61b 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -1,7 +1,3 @@ -@php - use App\Models\Setup; -@endphp - @extends('layouts.app') @section('htmlheader_title') @@ -10,213 +6,75 @@ @section('content') @if ($o->exists) -

{{ $o->name }}

+

{{ $o->name }}@if($o->setup) *@endif

+ @if($o->setup)* This Host@endif @endif
- @if ($o->exists)

System

-
+
- @endif -
- @csrf - -
-
-
-

@if($o->exists) Update @else Add @endif System

- -
-
- -
- - - - @error('name') - {{ $message }} - @else - A name is required. - @enderror - -
-
- -
- -
-
- active))checked @endif> - - - active))checked @endif> - -
-
-
- -
- -
- - - - @error('zt_id') - {{ $message }} - @enderror - -
-
-
- -
-
- -
- - - - @error('sysop') - {{ $message }} - @else - A Sysop's name is required. - @enderror - -
-
- -
- -
- - - - @error('location') - {{ $message }} - @else - System location is required. - @enderror - -
-
-
- -
-
-

Mailer Details

- -
-
- -
- - -
-
- -
- -
- - - - - @error('mailer_address') - {{ $message }} - @enderror - @error('mailer_port') - {{ $message }} - @enderror - -
-
-
-
-
- -
-
-

BBS Details

- -
-
- -
- - -
-
- -
- -
- - - - - @error('address') - {{ $message }} - @enderror - @error('port') - {{ $message }} - @enderror - -
-
-
-
-
- -
-
- - -
-
- -
-
- Cancel - @can('admin',$o) - - @endcan -
-
-
-
-
-
- @if ($o->exists) + @include('system.form-system')
- @endif - @if($o->exists) - -
- + @if(! $o->setup) + +
+ -
-
- TBA +
+
+ @if ($o->sessions->count()) + + + + + + + + + + + + + + + + + + + @foreach ($o->sessions->sortBy('zone_id') as $oo) + + + + + + + + + @endforeach + +
 Passwords 
ZoneSessionPacketTICAreafix 
{{ $oo->zone_id }}@{{ $oo->domain->name }}{{ $oo->pivot->sespass }}{{ $oo->pivot->pktpass }}{{ $oo->pivot->ticpass }}{{ $oo->pivot->fixpass }} + {{-- + + --}} + +
+ @else +

No session details exist

+ @endif + + @include('system.form-session') +
-
+ @endif
@@ -319,431 +177,18 @@ @endif @can('admin',$o) -
- - @csrf + @include('system.form-address') -
-
-
-

Assign New address

- -
- -
- -
- - - - @error('zone_id') - {{ $message }} - @else - Please select the Zone for the node's address. - @enderror - -
-
- - -
- -
- - - - @error('region_id') - {{ $message }} - @else - Please make a choice. - @enderror - -
-
- - -
- -
- - - - @error('host_id') - {{ $message }} - @enderror - -
-
- - -
- -
- - - - @error('hub_id') - {{ $message }} - @enderror - -
-
-
- -
- -
- -
- - - . - - - @error('node_id') - {{ $message }} - @enderror - @error('point_id') - {{ $message }} - @enderror - -
-
- - -
- -
- - - /0.0 - - @error('region_id_new') - {{ $message }} - @else - The region number is required. - @enderror - -
-
- - -
- -
- - - / - - .0 - - @error('host_id_new') - {{ $message }} - @else - The host address is required. - @enderror - @error('node_id_new') - {{ $message }} - @else - The node address is required. - @enderror - -
-
- - -
- -
-
- hub))checked @endif> - - - hub))checked @endif> - -
-
-
-
- -
-
- Cancel -
- - - @if($errors->count()) - - There were errors with the submission. - - @endif - - - @can('admin',$o) -
- -
- @endcan -
-
-
-
-
@else This system does not currently belong to any Fido networks. You'll need to ask an admin to assign addresses. @endcan
+ @else + @include('system.form-system') @endif
@include('widgets.modal_delete') -@endsection - -@section('page-scripts') - -@append \ No newline at end of file +@endsection \ No newline at end of file diff --git a/resources/views/system/form-address.blade.php b/resources/views/system/form-address.blade.php new file mode 100644 index 0000000..c95ae0c --- /dev/null +++ b/resources/views/system/form-address.blade.php @@ -0,0 +1,416 @@ +
+ + @csrf + +
+
+
+

Assign New address

+ +
+ +
+ +
+ + + + @error('zone_id') + {{ $message }} + @else + Please select the Zone for the node's address. + @enderror + +
+
+ + +
+ +
+ + + + @error('region_id') + {{ $message }} + @else + Please make a choice. + @enderror + +
+
+ + +
+ +
+ + + + @error('host_id') + {{ $message }} + @enderror + +
+
+ + +
+ +
+ + + + @error('hub_id') + {{ $message }} + @enderror + +
+
+
+ +
+ +
+ +
+ + + . + + + @error('node_id') + {{ $message }} + @enderror + @error('point_id') + {{ $message }} + @enderror + +
+
+ + +
+ +
+ + + /0.0 + + @error('region_id_new') + {{ $message }} + @else + The region number is required. + @enderror + +
+
+ + +
+ +
+ + + / + + .0 + + @error('host_id_new') + {{ $message }} + @else + The host address is required. + @enderror + @error('node_id_new') + {{ $message }} + @else + The node address is required. + @enderror + +
+
+ + +
+ +
+
+ hub))checked @endif> + + + hub))checked @endif> + +
+
+
+
+ +
+
+ Cancel +
+ + + @if($errors->count()) + + There were errors with the submission. + + @endif + + + @can('admin',$o) +
+ +
+ @endcan +
+
+
+
+
+ +@section('page-scripts') + +@append \ No newline at end of file diff --git a/resources/views/system/form-session.blade.php b/resources/views/system/form-session.blade.php new file mode 100644 index 0000000..b6eba7e --- /dev/null +++ b/resources/views/system/form-session.blade.php @@ -0,0 +1,129 @@ +@if(($x=\App\Models\Zone::active() + ->whereIn('id',$o->zones->pluck('id')) + ->whereNotIn('id',$o->sessions->pluck('id')) + ->with(['domain']) + ->get())->count()) + +
+ +
+ @csrf + +
+
+
+

Setup Session Details

+ +
+ +
+ +
+ + + + @error('zone_id') + {{ $message }} + @else + Please select the Zone for the node's address. + @enderror + +
+
+ +
+
+
+ + +
+ + + + @error('sespass') + {{ $message }} + @else + Session Password required. + @enderror + +
+
+ +
+ + +
+ + + + @error('pktpass') + {{ $message }} + @enderror + +
+
+
+ +
+
+ + +
+ + + + @error('fixpass') + {{ $message }} + @else + Areafix password required. + @enderror + +
+
+ +
+ + +
+ + + + @error('ticpass') + {{ $message }} + @enderror + +
+
+
+
+ +
+
+ Cancel +
+ + + @if($errors->count()) + + There were errors with the submission. + + @endif + + + @can('admin',$o) +
+ +
+ @endcan +
+
+
+
+
+
+@endif \ No newline at end of file diff --git a/resources/views/system/form-system.blade.php b/resources/views/system/form-system.blade.php new file mode 100644 index 0000000..186eb11 --- /dev/null +++ b/resources/views/system/form-system.blade.php @@ -0,0 +1,181 @@ +@php + use App\Models\Setup; +@endphp + +
+ @csrf + +
+
+
+

@if($o->exists) Update @else Add @endif System

+ +
+
+ +
+ + + + @error('name') + {{ $message }} + @else + A name is required. + @enderror + +
+
+ +
+ +
+
+ active))checked @endif> + + + active))checked @endif> + +
+
+
+ +
+ +
+ + + + @error('zt_id') + {{ $message }} + @enderror + +
+
+
+ +
+
+ +
+ + + + @error('sysop') + {{ $message }} + @else + A Sysop's name is required. + @enderror + +
+
+ +
+ +
+ + + + @error('location') + {{ $message }} + @else + System location is required. + @enderror + +
+
+
+ +
+
+

Mailer Details

+ +
+
+ +
+ + +
+
+ +
+ +
+ + + + + @error('mailer_address') + {{ $message }} + @enderror + @error('mailer_port') + {{ $message }} + @enderror + +
+
+
+
+
+ +
+
+

BBS Details

+ +
+
+ +
+ + +
+
+ +
+ +
+ + + + + @error('address') + {{ $message }} + @enderror + @error('port') + {{ $message }} + @enderror + +
+
+
+
+
+ +
+
+ + +
+
+ +
+
+ Cancel + @can('admin',$o) + + @endcan +
+
+
+
+
+
\ No newline at end of file diff --git a/resources/views/system/ours.blade.php b/resources/views/system/ours.blade.php new file mode 100644 index 0000000..371ea0d --- /dev/null +++ b/resources/views/system/ours.blade.php @@ -0,0 +1,93 @@ +@extends('layouts.app') +@section('htmlheader_title') + Systems +@endsection + +@section('content') +
+
+

Our Systems

+ + @if (\App\Models\System::count() == 0) +

There are no systems configured here.

+ @else +

These BBS systems are configured here.

+ + + + + + + + + + + + + + + + + @foreach (\App\Models\SystemZone::select('*')->with(['system','zone.domain'])->get() as $oo) + + + + + + + + + + + @endforeach + +
DomainIDSystemSysopLocationConnectAddressZeroTier ID
{{ $oo->zone->domain->name }}{{ $oo->system_id }}{{ $oo->system->name }}{{ $oo->system->sysop }}{{ $oo->system->location }} + @switch($oo->system->method) + @case(23)Telnet@break + @case(22)SSH@break + @case(519)SSH@break + @default No details + @endswitch + {{ join(',',$oo->system->addresses->where('zone_id',$oo->zone_id)->pluck('ftn')->toArray()) }}{{ $oo->system->zt_id }}
+ @endif +
+
+@endsection + +@section('page-scripts') + + + + + + + + +@append diff --git a/routes/web.php b/routes/web.php index 2dd44fc..052d9de 100644 --- a/routes/web.php +++ b/routes/web.php @@ -42,11 +42,19 @@ Route::middleware(['verified','activeuser'])->group(function () { Route::get('ftn/system',[SystemController::class,'home']); Route::match(['get','post'],'ftn/system/addedit/{o?}',[SystemController::class,'add_edit']) ->where('o','[0-9]+'); - Route::post('ftn/system/addaddress/{o?}',[SystemController::class,'add_address']) + + Route::get('ftn/our_systems',[SystemController::class,'ours']); + + Route::post('ftn/system/addaddress/{o}',[SystemController::class,'add_address']) ->where('o','[0-9]+'); - Route::get('ftn/system/deladdress/{o?}',[SystemController::class,'del_address']) + Route::post('ftn/system/addsession/{o}',[SystemController::class,'add_session']) ->where('o','[0-9]+'); - Route::get('ftn/system/susaddress/{o?}',[SystemController::class,'sus_address']) + Route::get('ftn/system/deladdress/{o}',[SystemController::class,'del_address']) + ->where('o','[0-9]+'); + Route::get('ftn/system/delsession/{o}/{zo}',[SystemController::class,'del_session']) + ->where('o','[0-9]+') + ->where('zo','[0-9]+'); + Route::get('ftn/system/susaddress/{o}',[SystemController::class,'sus_address']) ->where('o','[0-9]+'); Route::get('ftn/zone',[ZoneController::class,'home']);