From 066154f310a8e21f029808070f009fdade7ab483 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 17 Jul 2021 17:15:00 +1000 Subject: [PATCH] Minor debug packet cosmetic changes, Remove database/ items in docker build, Node address validation changes --- .gitlab-docker-x86_64.yml | 2 +- app/Classes/FTN/Message.php | 39 +++++++++++-------- app/Http/Controllers/HomeController.php | 6 +-- app/Http/Controllers/SystemController.php | 3 +- public/oldschool/css/main.css | 3 ++ resources/views/pkt/debug.blade.php | 46 ++++++++++++----------- 6 files changed, 57 insertions(+), 42 deletions(-) diff --git a/.gitlab-docker-x86_64.yml b/.gitlab-docker-x86_64.yml index 45ad3a9..55bc345 100644 --- a/.gitlab-docker-x86_64.yml +++ b/.gitlab-docker-x86_64.yml @@ -27,7 +27,7 @@ docker: - if [ -f init ]; then chmod 500 init; fi - ([ -z "$REFRESH" ] && docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG}) || echo "true" - echo -n ${CI_COMMIT_SHORT_SHA} > VERSION - - rm -rf vendor/ + - rm -rf vendor/ database/schema database/seeders database/factories - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . - docker push ${CI_REGISTRY_IMAGE}:${VERSION} - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} diff --git a/app/Classes/FTN/Message.php b/app/Classes/FTN/Message.php index 927e249..317c09d 100644 --- a/app/Classes/FTN/Message.php +++ b/app/Classes/FTN/Message.php @@ -249,10 +249,11 @@ class Message extends FTNBase case 'date': return Carbon::createFromFormat('d M y H:i:s O', - sprintf('%s %s',chop(Arr::get($this->header,$key)),(is_null($x=$this->kludge->get('tzutc')) || ($x < 0)) ? $x : '+'.$x)); + sprintf('%s %s',chop(Arr::get($this->header,$key)),(! is_null($x=$this->kludge->get('tzutc')) && ($x < 0)) ? $x : '+'.($x ?: '0000'))); case 'flags': - case 'cost': return Arr::get($this->header,$key); + case 'cost': + return Arr::get($this->header,$key); case 'message': case 'subject': @@ -461,24 +462,32 @@ class Message extends FTNBase * s - this bit is supported by SEAdog only * + - this bit is not zeroed before packeting */ - /* - public function flags(int $flags): array + public function flags(): Collection { - return [ - 'private' => $this->isFlagSet($flags,self::FLAG_PRIVATE), - 'crash' => $this->isFlagSet($flags,self::FLAG_CRASH), - 'recd' => $this->isFlagSet($flags,self::FLAG_RECD), - 'sent' => $this->isFlagSet($flags,self::FLAG_SENT), - 'killsent' => $this->isFlagSet($flags,self::FLAG_KILLSENT), - 'local' => $this->isFlagSet($flags,self::FLAG_LOCAL), - ]; + return collect([ + 'private' => $this->isFlagSet(self::FLAG_PRIVATE), + 'crash' => $this->isFlagSet(self::FLAG_CRASH), + 'recd' => $this->isFlagSet(self::FLAG_RECD), + 'sent' => $this->isFlagSet(self::FLAG_SENT), + 'fileattach' => $this->isFlagSet(self::FLAG_FILEATTACH), + 'intransit' => $this->isFlagSet(self::FLAG_INTRANSIT), + 'orphan' => $this->isFlagSet(self::FLAG_ORPHAN), + 'killsent' => $this->isFlagSet(self::FLAG_KILLSENT), + 'local' => $this->isFlagSet(self::FLAG_LOCAL), + 'hold' => $this->isFlagSet(self::FLAG_HOLD), + 'unused-10' => $this->isFlagSet(self::FLAG_UNUSED_10), + 'filereq' => $this->isFlagSet(self::FLAG_FREQ), + 'receipt-req' => $this->isFlagSet(self::FLAG_RETRECEIPT), + 'receipt' => $this->isFlagSet(self::FLAG_ISRETRECEIPT), + 'audit' => $this->isFlagSet(self::FLAG_AUDITREQ), + 'fileupdate' => $this->isFlagSet(self::FLAG_FILEUPDATEREQ), + ]); } - private function isFlagSet($value,$flag): bool + private function isFlagSet($flag): bool { - return (($value & $flag) == $flag); + return ($this->flags & $flag); } - */ /** * Process the data after the ORIGIN diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 156645f..dde70bf 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -87,11 +87,11 @@ class HomeController extends Controller ->rightjoin('systems',['systems.id'=>'addresses.system_id']) ->when($zone_id || $host_id || $node_id,function($query) use ($zone_id,$host_id,$node_id) { return $query - ->when($zone_id,function($q,$zone_id) { return $q->where('zones.zone_id','ilike','%'.$zone_id.'%'); }) + ->when($zone_id,function($q,$zone_id) { return $q->where('zones.zone_id',$zone_id); }) ->where(function($q) use ($host_id) { return $q - ->when($host_id,function($q,$host_id) { return $q->where('region_id','ilike','%'.$host_id.'%'); }) - ->when($host_id,function($q,$host_id) { return $q->orWhere('host_id','ilike','%'.$host_id.'%'); }); + ->when($host_id,function($q,$host_id) { return $q->where('region_id',$host_id); }) + ->when($host_id,function($q,$host_id) { return $q->orWhere('host_id',$host_id); }); }) ->when($node_id,function($q,$node_id) { return $q->where('node_id','ilike','%'.$node_id.'%'); }); }) diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 4cfd4a5..649166d 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -144,8 +144,7 @@ class SystemController extends Controller return $query ->where('host_id',$request->post('host_id')) ->where('node_id',$value) - ->where('point_id',0) - ->where('role',DomainController::NODE_RC); + ->where('point_id',0); }); if ($o->count()) { diff --git a/public/oldschool/css/main.css b/public/oldschool/css/main.css index 820770b..c5316f6 100644 --- a/public/oldschool/css/main.css +++ b/public/oldschool/css/main.css @@ -543,6 +543,9 @@ pre code { word-wrap:break-word; text-indent:initial } +pre.highlight { + color: #eee; +} .row { text-align: left; diff --git a/resources/views/pkt/debug.blade.php b/resources/views/pkt/debug.blade.php index 7a48035..c5ea74f 100644 --- a/resources/views/pkt/debug.blade.php +++ b/resources/views/pkt/debug.blade.php @@ -78,58 +78,62 @@ @endif
-
- DATE: {{ $msg->date }} +
+ DATE: {{ $msg->date }} +
+
+ FLAGS: {{ $msg->flags()->filter()->keys()->join(',') }}
- FROM: {{ $msg->user_from }} ({{ $msg->fftn }}) + FROM: {{ $msg->user_from }} ({{ $msg->fftn }})
- TO: {{ $msg->user_to }} ({{ $msg->tftn }}) + TO: {{ $msg->user_to }} ({{ $msg->tftn }})
- SUBJECT: {{ $msg->subject }} + SUBJECT: {{ $msg->subject }}
-
{!! \App\Classes\FTN\Message::tr($msg->message) !!}
+
{!! \App\Classes\FTN\Message::tr($msg->message) !!}
-
-
- SEENBY:
{!! join('
',$msg->seenby->toArray()) !!} -
-
- -
-
- PATH:
{!! join('
',$msg->path->toArray()) !!} -
-
- @if($msg->isNetmail())
- VIA:
{!! join('
',$msg->via->toArray()) !!} + VIA:
{!! join('
',$msg->via->toArray()) !!} +
+
+ @else +
+
+ SEENBY:
{!! join('
',$msg->seenby->toArray()) !!} +
+
+ +
+
+ PATH:
{!! join('
',$msg->path->toArray()) !!}
@endif +
KLUDGES:
- @foreach ($msg->kludge as $k => $v) - {{ $k }} {{ $v }}
+ @foreach ($msg->kludge->sort(function($v,$k) { return $k; })->reverse() as $k => $v) + {{ $k }} {{ $v }}
@endforeach