diff --git a/app/Classes/FileReceive.php b/app/Classes/FileReceive.php deleted file mode 100644 index 9e8f351..0000000 --- a/app/Classes/FileReceive.php +++ /dev/null @@ -1,20 +0,0 @@ -argument('file')); - - $this->info(sprintf('Packet: %s has %s messages. Addr: %s->%s (Date: %s)', - $pkt->filename, - $pkt->messages->count(), - $pkt->pktsrc, - $pkt->pktdst, - $pkt->date - )); - - foreach ($pkt->messages as $o) - { - $this->warn(sprintf('-- From: %s(%s)->%s(%s), Type: %s, Size: %d', - $o->from, - $o->fqfa, - $o->to, - $o->fqda, - $o->type, - strlen($o->message) - )); - - if ($o->unknown->count()) - $this->error(sprintf('?? %s Unknown headers',$o->unknown->count())); - } - - if ($this->option('detail')) - dd($o); - - if ($this->option('dump')) - echo $pkt->dump(); - } -} \ No newline at end of file diff --git a/app/Console/Commands/ImportPacket.php b/app/Console/Commands/ImportPacket.php deleted file mode 100644 index 6599ea2..0000000 --- a/app/Console/Commands/ImportPacket.php +++ /dev/null @@ -1,157 +0,0 @@ -argument('file')); - - foreach ($pkt->messages as $o) - { - $o->date->setTimezone(($o->tzutc >= 0 ? '+' : '').substr_replace($o->tzutc,':',2,0)); - - switch ($o->type) - { - case 'echomail': - // See if we already have this message. - $oo = Echomail::firstOrNew([ - 'date'=>$o->date, - 'from_ftn'=>$this->get_node(['z'=>$o->fz,'n'=>$o->fn,'f'=>$o->ff,'p'=>$o->fp])->id, - 'msgid'=>$o->msgid, - ]); - - if (md5(utf8_decode($eo->message)) == md5($o->message)) - { - $this->warn(sprintf('Duplicate message: %s@%s with id: %s',$o->from,$o->fqfa,$o->msgid)); - break 2; - } - - break; - - case 'netmail': - // See if we already have this message. - $oo = Netmail::firstOrNew([ - 'date'=>$o->date, - 'from_ftn'=>$this->get_node(['z'=>$o->fz,'n'=>$o->fn,'f'=>$o->ff,'p'=>$o->fp])->id, - 'msgid'=>$o->msgid, - ]); - - $oo->to_ftn = $this->get_node(['z'=>$o->tz,'n'=>$o->tn,'f'=>$o->tf,'p'=>$o->tp])->id; - - break; - - default: - abort(500,'Unknown type: '.$o->type); - } - - if (md5(utf8_decode($oo->message)) == md5($o->message)) - { - $this->warn(sprintf('Duplicate message: %s@%s with id: %s',$o->from,$o->fqfa,$o->msgid)); - if (! $this->option('force')) - continue; - } - - $oo->pkt_from = $this->get_node(['z'=>$pkt->sz,'n'=>$pkt->sn,'f'=>$pkt->sf,'p'=>$pkt->sp])->id; - $oo->pkt_to = $this->get_node(['z'=>$pkt->dz,'n'=>$pkt->dn,'f'=>$pkt->df,'p'=>$pkt->dp])->id; - $oo->pkt = $pkt->filename; - $oo->pkt_date = $pkt->date; - $oo->flags = $o->flags; - $oo->cost = $o->cost; - $oo->from_user = utf8_encode($o->from); - $oo->to_user = utf8_encode($o->to); - $oo->subject = utf8_encode($o->subject); - $oo->tz = $o->tzutc; - $oo->replyid = $o->replyid; - $oo->message = utf8_encode($o->message); - $oo->origin = utf8_encode($o->origin); - $oo->save(); - - foreach ($o->kludge as $k=>$v) - { - $oo->kludges()->attach($k,['value'=>json_encode($v)]); - } - - foreach ($o->unknown as $v) - { - $oo->kludges()->attach('UNKNOWN',['value'=>json_encode($v)]); - } - - // Finish off the import - switch($o->type) { - case 'echomail': - foreach ($o->seenby as $v) - { - foreach ($this->parse_nodes(Zone::findOrFail($pkt->sz),$v) as $no) - { - $oo->seenbys()->attach($no->id); - } - } - - $seq = 0; - foreach ($o->path as $v) - { - foreach ($this->parse_nodes(Zone::findOrFail($pkt->sz),$v) as $no) - { - $oo->paths()->attach($no->id,['sequence'=>$seq++]); - } - } - - break; - - case 'netmail': - $seq = 0; - - foreach ($o->via as $v) - { - $data = preg_split('/\s/',$v); - $ftno = $this->get_node(ftn_address_split($data[0])); - unset($data[0]); - - $oo->paths()->attach($ftno->id,['sequence'=>$seq++,'value'=>json_encode($data)]); - } - - break; - } - } - } -} diff --git a/app/Http/Controllers/NodeController.php b/app/Http/Controllers/NodeController.php deleted file mode 100644 index f6dcda5..0000000 --- a/app/Http/Controllers/NodeController.php +++ /dev/null @@ -1,46 +0,0 @@ -middleware('auth'); - } - - /** - * Add or edit a node - */ - public function add_edit(Request $request,Node $o) - { - if ($request->post()) { - foreach ([ - 'zone_id','host_id','node_id','point_id', - 'system','sysop','location','email', - 'address','port','notes','software_id','protocol_id', - 'sespass','pktpass','ticpass','fixpass' - ] as $key) - $o->{$key} = $request->post($key); - - foreach(['is_zc','is_rc','is_hub','is_host','active'] as $key) - $o->{$key} = $request->post($key,FALSE); - - $o->save(); - - return redirect()->action([self::class,'home']); - } - - return view('node.addedit') - ->with('o',$o); - } - - public function home() - { - return view('node.home'); - } -} diff --git a/app/Models/Flag.php b/app/Models/Flag.php deleted file mode 100644 index bb4b444..0000000 --- a/app/Models/Flag.php +++ /dev/null @@ -1,10 +0,0 @@ -'boolean', - 'is_rc'=>'boolean', - 'is_hub'=>'boolean', - 'is_host'=>'boolean', - ]; - - protected $fillable = ['zone_id','host_id','node_id','point_id']; - - /* SCOPES */ - - public function scopeHost() - { - // @todo - } - - /* RELATIONS */ - - /** - * Node nodelist flags - * - * @return BelongsToMany - */ - public function flags() - { - return $this->belongsToMany(Flag::class); - } - - public function zone() - { - return $this->belongsTo(Zone::class); - } - - /* ATTRIBUTES */ - - /** - * Render the node name in full 5D - * - * @return string - */ - public function getFTNAttribute() - { - return $this->zone_id - ? sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->host_id,$this->node_id,$this->point_id,$this->zone->domain->name) - : '-'; - } - - /** - * Get this nodes uplink - */ - public function getUplinkAttribute() - { - // @todo Need to work this out properly - return static::where('zone_id','10')->where('host_id',1)->where('node_id',0)->where('point_id',0)->first(); - } - - /* METHODS */ - - /** - * Find a record in the DB for a node string, eg: 10:1/1.0 - * - * @param string $ftn - * @return Node|null - * @throws Exception - */ - public static function findFTN(string $ftn): ?self - { - $matches = []; - - // @todo domain can have more chars. - if (! preg_match('#^([0-9]+):([0-9]+)/([0-9]+)(.([0-9]+))?(@([a-z]{0,8}))?$#',strtolower($ftn),$matches)) - throw new Exception('Invalid FTN: '.$ftn); - - // Check our numbers are correct. - foreach ([1,2,3] as $i) { - if (! $matches[$i] || ($matches[$i] > 0xffff)) - throw new Exception('Invalid FTN: '.$ftn); - } - if (isset($matches[5]) AND $matches[5] > 0xffff) - throw new Exception('Invalid FTN: '.$ftn); - - return (new self)->active() - ->select('nodes.*') - ->where('zones.zone_id',$matches[1]) - ->where(function($query) use ($matches) { - $query->where('hub_id',$matches[2]) - ->orWhere('host_id',$matches[2]); - }) - ->join('zones',['zones.id'=>'nodes.zone_id']) - ->join('domains',['domains.id'=>'zones.domain_id']) - ->where('zones.active',TRUE) - ->where('node_id',$matches[3]) - ->where('point_id',(isset($matches[5]) AND $matches[5]) ? $matches[5] : 0) - ->when(isset($matches[7]),function($query) use ($matches) { - $query->where('domains.name',$matches[7]); - }) - ->when((! isset($matches[7]) OR ! $matches[7]),function($query) { - $query->where('domains.default',TRUE); - }) - ->single(); - } - - public function hasFlag($relation,$model): bool - { - return (bool) $this->{$relation}() - ->wherePivot($model->getForeignKey(),$model->{$model->getKeyName()}) - ->count(); - } -} \ No newline at end of file diff --git a/app/Models/Path.php b/app/Models/Path.php deleted file mode 100644 index 2d70c7b..0000000 --- a/app/Models/Path.php +++ /dev/null @@ -1,10 +0,0 @@ -push($this->get_node(['z'=>$zo->id,'n'=>$net,'f'=>$node,'p'=>0],$create)); - } - - return $result; - } -} \ No newline at end of file diff --git a/database/migrations/2021_12_24_101812_drop_node.php b/database/migrations/2021_12_24_101812_drop_node.php new file mode 100644 index 0000000..7a62571 --- /dev/null +++ b/database/migrations/2021_12_24_101812_drop_node.php @@ -0,0 +1,42 @@ + - */ - -Vue.component('example-component', require('./components/ExampleComponent.vue')); - -// const files = require.context('./', true, /\.vue$/i) - -// files.keys().map(key => { -// return Vue.component(_.last(key.split('/')).split('.')[0], files(key)) -// }) - -/** - * Next, we will create a fresh Vue application instance and attach it to - * the page. Then, you may begin adding components to this application - * or customize the JavaScript scaffolding to fit your unique needs. - */ - -const app = new Vue({ - el: '#app' -}); diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js deleted file mode 100644 index 6922577..0000000 --- a/resources/js/bootstrap.js +++ /dev/null @@ -1,28 +0,0 @@ -window._ = require('lodash'); - -/** - * We'll load the axios HTTP library which allows us to easily issue requests - * to our Laravel back-end. This library automatically handles sending the - * CSRF token as a header based on the value of the "XSRF" token cookie. - */ - -window.axios = require('axios'); - -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; - -/** - * Echo exposes an expressive API for subscribing to channels and listening - * for events that are broadcast by Laravel. Echo and event broadcasting - * allows your team to easily build robust real-time web applications. - */ - -// import Echo from 'laravel-echo'; - -// window.Pusher = require('pusher-js'); - -// window.Echo = new Echo({ -// broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// forceTLS: true -// }); diff --git a/resources/js/components/ExampleComponent.vue b/resources/js/components/ExampleComponent.vue deleted file mode 100644 index 2805329..0000000 --- a/resources/js/components/ExampleComponent.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/resources/sass/_variables.scss b/resources/sass/_variables.scss deleted file mode 100644 index 6799fc4..0000000 --- a/resources/sass/_variables.scss +++ /dev/null @@ -1,20 +0,0 @@ - -// Body -$body-bg: #f8fafc; - -// Typography -$font-family-sans-serif: "Nunito", sans-serif; -$font-size-base: 0.9rem; -$line-height-base: 1.6; - -// Colors -$blue: #3490dc; -$indigo: #6574cd; -$purple: #9561e2; -$pink: #f66D9b; -$red: #e3342f; -$orange: #f6993f; -$yellow: #ffed4a; -$green: #38c172; -$teal: #4dc0b5; -$cyan: #6cb2eb; diff --git a/resources/sass/app.scss b/resources/sass/app.scss deleted file mode 100644 index f42e798..0000000 --- a/resources/sass/app.scss +++ /dev/null @@ -1,14 +0,0 @@ - -// Fonts -@import url('https://fonts.googleapis.com/css?family=Nunito'); - -// Variables -@import 'variables'; - -// Bootstrap -@import '~bootstrap/scss/bootstrap'; - -.navbar-laravel { - background-color: #fff; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); -} diff --git a/resources/views/node/addedit.blade.php b/resources/views/node/addedit.blade.php deleted file mode 100644 index 8ff6906..0000000 --- a/resources/views/node/addedit.blade.php +++ /dev/null @@ -1,166 +0,0 @@ -@extends('layouts.app') - -@section('htmlheader_title') - @if($o->exists) Update @else Add @endif Node -@endsection - -@section('main-content') -
-

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

-
- {{ csrf_field() }} - -
-
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- - is_rc)checked @endif> -
-
- - is_regis_rcion)checked @endif> -
-
- - is_hub)checked @endif> -
-
- - is_host)checked @endif> -
- -
- - active)checked @endif> -
-
-
- -
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- @foreach (\App\Models\Protocol::cursor() as $oo) -
- protocol_id==$oo->id)checked @endif> - -
- @endforeach -
- -
-
- - -
- -
- - -
- -
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
- - -
- -
-
- - Cancel -
-
-
-
-
-
-
-@endsection diff --git a/resources/views/node/home.blade.php b/resources/views/node/home.blade.php deleted file mode 100644 index 86fa303..0000000 --- a/resources/views/node/home.blade.php +++ /dev/null @@ -1,49 +0,0 @@ -@extends('layouts.app') - -@section('main-content') -
-
- - - - - - - - - - - - - - - - - @foreach (\App\Models\Node::with(['zone'])->cursor() as $oo) - - - - - - - - - @endforeach - -
IDDomainNodeActiveSystemSysop
Add New Node
{{ $oo->id }}@if ($oo->zone_id){{ $oo->zone->name }}@else - @endif{{ $oo->ftn }}{{ $oo->active ? 'YES' : 'NO' }}{{ $oo->system }}{{ $oo->sysop }}
-
-
-@endsection - -@section('page-scripts') - -@append diff --git a/routes/web.php b/routes/web.php index 052d9de..393a4e3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,10 +35,6 @@ Route::middleware(['verified','activeuser'])->group(function () { Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit']) ->where('o','[0-9]+'); - Route::get('ftn/node',[NodeController::class,'home']); - Route::match(['get','post'],'ftn/node/addedit/{o?}',[NodeController::class,'add_edit']) - ->where('o','[0-9]+'); - Route::get('ftn/system',[SystemController::class,'home']); Route::match(['get','post'],'ftn/system/addedit/{o?}',[SystemController::class,'add_edit']) ->where('o','[0-9]+'); diff --git a/tests/Feature/SiteAdminTest.php b/tests/Feature/SiteAdminTest.php index 4b43565..c7a1d15 100644 --- a/tests/Feature/SiteAdminTest.php +++ b/tests/Feature/SiteAdminTest.php @@ -23,8 +23,6 @@ class SiteAdminTest extends TestCase $this->get('ftn/domain') ->assertRedirect('login'); - $this->get('ftn/node') - ->assertRedirect('login'); $this->get('ftn/zone') ->assertRedirect('login'); @@ -55,8 +53,6 @@ class SiteAdminTest extends TestCase $this->get('ftn/domain') ->assertRedirect('email/verify'); - $this->get('ftn/node') - ->assertRedirect('email/verify'); $this->get('ftn/zone') ->assertRedirect('email/verify');