Compare commits

..

No commits in common. "53897399203626822f7dab1e4b218130dd5839ac" and "6e376100a587437d503394acce5b3e0fa6ea1ead" have entirely different histories.

23 changed files with 1032 additions and 1242 deletions

View File

@ -36,7 +36,7 @@ class DomainController extends Controller
public function add_edit(DomainRequest $request,Domain $o) public function add_edit(DomainRequest $request,Domain $o)
{ {
if ($request->post()) { if ($request->post()) {
foreach (['name','dnsdomain','active','public','homepage','notes','flatten','accept_app'] as $key) foreach (['name','dnsdomain','active','public','homepage','notes','flatten'] as $key)
$o->{$key} = $request->post($key); $o->{$key} = $request->post($key);
$o->save(); $o->save();

View File

@ -626,28 +626,6 @@ class SystemController extends Controller
return $result; return $result;
} }
public function api_address_validated_toggle(Request $request,string $state): array
{
$o = Address::findOrFail($request->id);
$o->validated = $state === 'off' ? FALSE : TRUE;
$o->save();
Log::debug(sprintf('%s:- Address Validated set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF'));
return ['validated'=>$o->validated];
}
public function api_autohold_toggle(Request $request,string $state): array
{
$o = System::findOrFail($request->id);
$o->autohold = $state === 'off' ? FALSE : TRUE;
$o->save();
Log::debug(sprintf('%s:- Autohold set to [%s]',self::LOGKEY,$o->autohold ? 'ON' : 'OFF'));
return ['autohold'=>$o->autohold];
}
public function areafix(AreafixRequest $request,System $o,Zone $zo) public function areafix(AreafixRequest $request,System $o,Zone $zo)
{ {
if ($request->post()) { if ($request->post()) {

View File

@ -27,7 +27,6 @@ class DomainRequest extends FormRequest
'dnsdomain' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i|unique:domains,dnsdomain,'.($o->exists ? $o->id : NULL), 'dnsdomain' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i|unique:domains,dnsdomain,'.($o->exists ? $o->id : NULL),
'active' => 'required|boolean', 'active' => 'required|boolean',
'public' => 'required|boolean', 'public' => 'required|boolean',
'accept_app' => 'required|boolean',
'flatten' => 'nullable|boolean', 'flatten' => 'nullable|boolean',
]; ];
} }

View File

@ -12,11 +12,11 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Casts\CompressedString; use App\Casts\CompressedString;
use App\Traits\ScopeActive; use App\Traits\{QueryCacheableConfig,ScopeActive};
class Domain extends Model class Domain extends Model
{ {
use HasFactory,ScopeActive; use HasFactory,ScopeActive,QueryCacheableConfig;
private const CACHE_TIME = 3600; private const CACHE_TIME = 3600;
private const STATS_MONTHS = 6; private const STATS_MONTHS = 6;
@ -62,15 +62,6 @@ class Domain extends Model
/* ATTRIBUTES */ /* ATTRIBUTES */
public function getCanAcceptAppAttribute(): bool
{
return our_address($this)->count()
&& $this->active
&& $this->accept_app
&& Auth::id()
&& $this->userHasSystemsNotInNet(Auth::user())->count();
}
public function getHomePageAttribute(?string $value): string public function getHomePageAttribute(?string $value): string
{ {
//0xFD2FB528 //0xFD2FB528
@ -87,7 +78,8 @@ class Domain extends Model
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'") ->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
->elseRaw("'all'"); ->elseRaw("'all'");
return Echoarea::select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('max(datetime) as last_message')]) return Echoarea::cacheFor(self::CACHE_TIME)
->select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('max(datetime) as last_message')])
->selectRaw($case->toRaw().' AS stats') ->selectRaw($case->toRaw().' AS stats')
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer') ->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer')
->where('domain_id',$this->id) ->where('domain_id',$this->id)
@ -132,23 +124,4 @@ class Domain extends Model
{ {
return our_address($this)->count() > 0; return our_address($this)->count() > 0;
} }
/**
* Work out which of the users systems are not in this domain
*
* @param User $o
* @return Collection
*/
public function userHasSystemsNotInNet(User $o): Collection
{
$o->load('systems.akas.zone');
$result = collect();
foreach ($o->systems->filter(function($item) { return $item->active; }) as $so) {
if (! $so->akas->pluck('zone')->unique('domain_id')->pluck('domain_id')->contains($this->id))
$result->push($so);
}
return $result;
}
} }

View File

@ -4,12 +4,13 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Rennokki\QueryCache\Traits\QueryCacheable;
use App\Casts\CollectionOrNull; use App\Casts\CollectionOrNull;
class Dynamic extends Model class Dynamic extends Model
{ {
use SoftDeletes; use SoftDeletes,QueryCacheable;
protected $casts = [ protected $casts = [
'arguments' => CollectionOrNull::class, 'arguments' => CollectionOrNull::class,

View File

@ -6,6 +6,7 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Rennokki\QueryCache\Traits\QueryCacheable;
use App\Traits\{AreaSecurity,ScopeActive}; use App\Traits\{AreaSecurity,ScopeActive};
@ -41,7 +42,7 @@ use App\Traits\{AreaSecurity,ScopeActive};
*/ */
class Echoarea extends Model class Echoarea extends Model
{ {
use SoftDeletes,ScopeActive,AreaSecurity; use SoftDeletes,ScopeActive,QueryCacheable,AreaSecurity;
private const CACHE_TIME = 3600; private const CACHE_TIME = 3600;
@ -56,12 +57,6 @@ class Echoarea extends Model
return $this->belongsToMany(Address::class); return $this->belongsToMany(Address::class);
} }
public function addresses_active()
{
return $this->belongsToMany(Address::class)
->activeFTN();
}
public function domain() public function domain()
{ {
return $this->belongsTo(Domain::class); return $this->belongsTo(Domain::class);
@ -77,7 +72,8 @@ class Echoarea extends Model
public function messages_count(int $period=NULL): int public function messages_count(int $period=NULL): int
{ {
$eo = Echomail::where('echoarea_id',$this->id); $eo = Echomail::cacheFor(self::CACHE_TIME)
->where('echoarea_id',$this->id);
$dt = Carbon::now()->startOfday(); $dt = Carbon::now()->startOfday();

View File

@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Rennokki\QueryCache\Traits\QueryCacheable;
use App\Casts\{CollectionOrNull,CompressedString}; use App\Casts\{CollectionOrNull,CompressedString};
use App\Classes\FTN\Message; use App\Classes\FTN\Message;
@ -16,7 +17,7 @@ use App\Traits\{EncodeUTF8,MsgID,ParseAddresses};
final class Echomail extends Model implements Packet final class Echomail extends Model implements Packet
{ {
use SoftDeletes,EncodeUTF8,MsgID,ParseAddresses; use SoftDeletes,EncodeUTF8,MsgID,QueryCacheable,ParseAddresses;
private const LOGKEY = 'ME-'; private const LOGKEY = 'ME-';
private Collection $set_seenby; private Collection $set_seenby;

View File

@ -10,13 +10,14 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Rennokki\QueryCache\Traits\QueryCacheable;
use App\Casts\{CollectionOrNull,CompressedString}; use App\Casts\{CollectionOrNull,CompressedString};
use App\Traits\EncodeUTF8; use App\Traits\EncodeUTF8;
class File extends Model class File extends Model
{ {
use SoftDeletes,EncodeUTF8; use SoftDeletes,EncodeUTF8,QueryCacheable;
private const LOGKEY = 'MF-'; private const LOGKEY = 'MF-';
private bool $no_export = FALSE; private bool $no_export = FALSE;

View File

@ -75,21 +75,27 @@ class User extends Authenticatable implements MustVerifyEmail
/* GENERAL METHODS */ /* GENERAL METHODS */
public function addresses(Domain $o=NULL): Collection public function addresses(): Collection
{ {
return Address::select('addresses.*') return Address::select('addresses.*')
->join('systems',['systems.id'=>'addresses.system_id']) ->join('systems',['systems.id'=>'addresses.system_id'])
->join('system_user',['system_user.system_id'=>'systems.id']) ->join('system_user',['system_user.system_id'=>'systems.id'])
->when(! is_null($o),function($query) use ($o) {
return $query
->join('zones',['zones.id'=>'addresses.zone_id'])
->where('zones.domain_id',$o->id);
})
->where('system_user.user_id',$this->id) ->where('system_user.user_id',$this->id)
->with(['zone.domain']) ->with(['zone.domain'])
->get(); ->get();
} }
/**
* See if the user is already a member of the chosen network
*
* @param Domain $o
* @return bool
*/
public function isMember(Domain $o): bool
{
return FALSE;
}
/** /**
* Is this user a ZC of a domain? * Is this user a ZC of a domain?
* *
@ -122,8 +128,6 @@ class User extends Authenticatable implements MustVerifyEmail
*/ */
public function zc(): Collection public function zc(): Collection
{ {
$this->load('systems.addresses');
return $this->systems->pluck('addresses')->flatten()->where('role',Address::NODE_ZC); return $this->systems->pluck('addresses')->flatten()->where('role',Address::NODE_ZC);
} }
} }

View File

@ -4,7 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\Traits\ScopeActive; use App\Traits\{QueryCacheableConfig,ScopeActive};
class Zone extends Model class Zone extends Model
{ {

View File

@ -13,7 +13,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_access(?int $sec): bool public function can_access(int $sec): bool
{ {
return $this->can_read($sec) || $this->can_write($sec); return $this->can_read($sec) || $this->can_write($sec);
} }
@ -24,7 +24,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_read(?int $sec): bool public function can_read(int $sec): bool
{ {
return $this->active && (($sec >= ($x=$this->getSecReadAttribute())) && $x); return $this->active && (($sec >= ($x=$this->getSecReadAttribute())) && $x);
} }
@ -35,7 +35,7 @@ trait AreaSecurity
* @param int $sec * @param int $sec
* @return bool * @return bool
*/ */
public function can_write(?int $sec): bool public function can_write(int $sec): bool
{ {
return $this->active && (($sec >= ($x=$this->getSecWriteAttribute())) && $x); return $this->active && (($sec >= ($x=$this->getSecWriteAttribute())) && $x);
} }

View File

@ -0,0 +1,17 @@
<?php
/**
* Set defaults of QueryCacheable
*/
namespace App\Traits;
use Rennokki\QueryCache\Traits\QueryCacheable;
trait QueryCacheableConfig
{
use QueryCacheable;
public $cacheFor = 900; // cache time, in seconds
protected static $flushCacheOnUpdate = TRUE;
public $cacheDriver = 'memcached';
}

View File

@ -2,7 +2,6 @@
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use App\Models\{Address,Domain,Setup}; use App\Models\{Address,Domain,Setup};
@ -93,15 +92,16 @@ if (! function_exists('hexstr')) {
*/ */
function our_address(Domain|Address $o=NULL): Collection|Address|NULL function our_address(Domain|Address $o=NULL): Collection|Address|NULL
{ {
$so = Cache::remember('so',5,function() { static $so = NULL;
return Setup::findOrFail(config('app.id')); static $our = NULL;
});
$our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) { if (! $so)
$so = Setup::findOrFail(config('app.id'));
if (! $our) {
$so->load(['system.akas.zone.domain']); $so->load(['system.akas.zone.domain']);
$our = $so->system->akas;
return $so->system->akas; }
});
// If we dont have any addresses // If we dont have any addresses
if ($our->count() === 0) if ($our->count() === 0)

View File

@ -5,29 +5,30 @@
"keywords": ["framework","laravel"], "keywords": ["framework","laravel"],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.1|8.2|8.3", "php": "^8.1|8.2",
"ext-bz2": "*", "ext-bz2": "*",
"ext-pcntl": "*", "ext-pcntl": "*",
"ext-sockets": "*", "ext-sockets": "*",
"ext-zip": "*", "ext-zip": "*",
"ext-zlib": "*", "ext-zlib": "*",
"ext-zstd": "*", "ext-zstd": "*",
"aglipanci/laravel-eloquent-case": "^3.0", "aglipanci/laravel-eloquent-case": "^2.0",
"eduardokum/laravel-mail-auto-embed": "^2.11", "eduardokum/laravel-mail-auto-embed": "^2.0",
"laravel/framework": "^11.0", "laravel/framework": "^10.0",
"laravel/sanctum": "^4.0", "laravel/sanctum": "^3.2",
"laravel/ui": "^4.5", "laravel/ui": "^4.0",
"league/flysystem-aws-s3-v3": "^3.27", "league/flysystem-aws-s3-v3": "^3.0",
"leenooks/passkey": "^0.1.0", "leenooks/passkey": "^0.1.0",
"nunomaduro/laravel-console-summary": "^1.12.1", "nunomaduro/laravel-console-summary": "^1.9",
"repat/laravel-job-models": "^0.9", "rennokki/laravel-eloquent-query-cache": "^3.3",
"romanzipp/laravel-queue-monitor": "^5.0" "repat/laravel-job-models": "^0.8",
"romanzipp/laravel-queue-monitor": "^2.0"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-debugbar": "^3.6", "barryvdh/laravel-debugbar": "^3.6",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^8.1", "nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0", "phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.1" "spatie/laravel-ignition": "^2.1"
}, },
@ -50,6 +51,10 @@
"passkey": { "passkey": {
"type": "vcs", "type": "vcs",
"url": "https://gitea.dege.au/laravel/passkey.git" "url": "https://gitea.dege.au/laravel/passkey.git"
},
"laravel-console-summary": {
"type": "vcs",
"url": "https://github.com/leenooks/laravel-console-summary"
} }
}, },
"scripts": { "scripts": {

1857
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('domains', function (Blueprint $table) {
$table->boolean('accept_app')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('domains', function (Blueprint $table) {
$table->dropColumn('accept_app');
});
}
};

View File

@ -18,7 +18,7 @@
<label for="name" class="form-label">Name</label> <label for="name" class="form-label">Name</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span> <span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('admin',$o)disabled @endcannot autofocus autocomplete="off"> <input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('admin',$o)disabled @endcannot autofocus>
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
@error('name') @error('name')
{{ $message }} {{ $message }}
@ -30,7 +30,7 @@
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="form-label">Active</label> <label for="active" class="form-label">Active</label>
<div class="input-group"> <div class="input-group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('active',$o->active))checked @endif> <input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('active',$o->active))checked @endif>
@ -44,7 +44,7 @@
<div class="col-2"> <div class="col-2">
@if ($o->zones->count() > 1) @if ($o->zones->count() > 1)
<label class="form-label">Flatten Zones <i class="bi bi-info-circle" title="Treat this domain as a 2D domain"></i></label> <label for="flatten" class="form-label">Flatten Zones <i class="bi bi-info-circle" title="Treat this domain as a 2D domain"></i></label>
<div class="input-group"> <div class="input-group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<input type="radio" class="btn-check" name="flatten" id="flatten_yes" value="1" required @if(old('flatten',$o->flatten))checked @endif> <input type="radio" class="btn-check" name="flatten" id="flatten_yes" value="1" required @if(old('flatten',$o->flatten))checked @endif>
@ -88,8 +88,8 @@
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-4">
<label class="form-label">Public</label> <label for="public" class="form-label">Public</label>
<div class="input-group"> <div class="input-group">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<input type="radio" class="btn-check" name="public" id="public_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('public',$o->public))checked @endif> <input type="radio" class="btn-check" name="public" id="public_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('public',$o->public))checked @endif>
@ -101,19 +101,6 @@
</div> </div>
</div> </div>
<div class="col-2">
<label class="form-label">Applications</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="accept_app" id="accept_app_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-success" for="accept_app_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="accept_app" id="accept_app_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('accept_app',$o->accept_app))checked @endif>
<label class="btn btn-outline-danger" for="accept_app_no">No</label>
</div>
</div>
</div>
@if ($o->nodelist_filename) @if ($o->nodelist_filename)
<div class="col-4"> <div class="col-4">
<label for="name" class="form-label">Nodelist File Area</label> <label for="name" class="form-label">Nodelist File Area</label>
@ -130,7 +117,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<label for="notes" class="form-label">Notes</label> <label for="notes" class="form-label">Notes</label>
<textarea class="form-control" rows=3 id="notes" name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea> <textarea class="form-control" rows=3 name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
</div> </div>
</div> </div>
</div> </div>

View File

@ -156,7 +156,6 @@
</div> </div>
<!-- Sign up --> <!-- Sign up -->
@if ($o->can_accept_app)
<div class="accordion-item"> <div class="accordion-item">
<h3 class="accordion-header"> <h3 class="accordion-header">
<span class="accordion-button collapsed" id="signup" data-bs-toggle="collapse" data-bs-target="#collapse_signup" aria-expanded="false" aria-controls="collapse_signup">Join Network</span> <span class="accordion-button collapsed" id="signup" data-bs-toggle="collapse" data-bs-target="#collapse_signup" aria-expanded="false" aria-controls="collapse_signup">Join Network</span>
@ -164,33 +163,17 @@
<div id="collapse_signup" class="accordion-collapse collapse" aria-labelledby="signup" data-bs-parent="#accordion_homepage"> <div id="collapse_signup" class="accordion-collapse collapse" aria-labelledby="signup" data-bs-parent="#accordion_homepage">
<div class="accordion-body"> <div class="accordion-body">
<p>Your system(s) <strong class="highlight">{!! $o->userHasSystemsNotInNet(Auth::user())->pluck('name')->join('</strong>, <strong class="highlight">') !!}</strong> can join this network.</p> @guest
<p> To start an application to join this network please <a href="{{ url('login') }}">login</a>.
If you want to join it/them to this network, make sure: @else
</p> @if($user->isMember($o))
@else
<ul> This website is not ready to take applications yet, check back soon!
<li>it is online and can accept mailer calls</li>
<li>you have the <strong class="highlight">BBS Internet Hostname</strong> configured with the correct hostname</li>
<li>you have selected either <strong class="highlight">BINKP</strong> or <strong class="highlight">EMSI</strong> in the mailer settings, with the correct TCP port</li>
</ul>
<p>Here's what will happen next</p>
<ul>
<li>You complete the application form (see the button below)</li>
<li>We'll poll your system to make sure it is connectable</li>
<li>Your applicaiton will then be forwarded to the <strong class="highlight">ZC</strong> of the domain</li>
<li>You'll hear back from your assigned hub to configure your system with your assigned FTN address</li>
<li>Configure your system, subscribe to file and echo areas</li>
<li>Enjoy!</li>
</ul>
<button class="btn btn-success">Lets Do It</button>
</div>
</div>
</div>
@endif @endif
@endguest
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -198,8 +181,15 @@
@section('page-css') @section('page-css')
@css('datatables') @css('datatables')
<style>
div#collapse_about {
min-height: 25em;
}
div#collapse_about .collapse{
min-height: 0;
}
</style>
@append @append
@section('page-scripts') @section('page-scripts')
@js('datatables') @js('datatables')
@js('highcharts') @js('highcharts')
@ -263,19 +253,6 @@
} }
} }
}); });
@if ($o->can_accept_app)
$('#join_top').on('click',function(item) {
$('.accordion-collapse').each(function(){
if ($(this).hasClass('show')) {
$(this).toggle();
}
});
$('#collapse_signup').toggle();
return false;
});
@endif
}); });
Highcharts.chart('network_traffic', { Highcharts.chart('network_traffic', {

View File

@ -15,10 +15,12 @@
</ul> </ul>
</div> </div>
</li> </li>
@if(preg_match('#^domain/#',request()->path()) && $o->can_accept_app)
<li><a href="{{ url('join') }}" id="join_top" class="@if(preg_match('#^join#',request()->path()))thispage @endif"><span>Join</span></a></li>
@else
<li><a href="{{ url('status') }}" class="@if(preg_match('#^status#',request()->path()))thispage disabled @endif"><span>Status</span></a></li> <li><a href="{{ url('status') }}" class="@if(preg_match('#^status#',request()->path()))thispage disabled @endif"><span>Status</span></a></li>
{{--
<li><a href="{{ url('help') }}" class="@if(preg_match('#^help#',request()->path()))thispage @endif disabled"><span>Help</span></a></li>
--}}
@if(preg_match('#^/network/#',request()->path()))
<li><a href="{{ url('join') }}" class="@if(preg_match('#^join#',request()->path()))thispage @endif"><span>Join</span></a></li>
@endif @endif
</ul> </ul>

View File

@ -118,7 +118,7 @@
<tbody> <tbody>
@foreach ($o->addresses->sortBy(function($item) { return sprintf('%04x%04x%04x%04x%04x',$item->zone->zone_id,$item->region_id,$item->host_id,$item->node_id,$item->point_id); }) as $oo) @foreach ($o->addresses->sortBy(function($item) { return sprintf('%04x%04x%04x%04x%04x',$item->zone->zone_id,$item->region_id,$item->host_id,$item->node_id,$item->point_id); }) as $oo)
<tr> <tr>
<td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><data value="{{ $oo->id }}:{{ $oo->validated ? 1 : 0 }}" class="validated"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" @class(['bi','bi-activity'=>$oo->validated,'bi-radioactive'=>(! $oo->validated)])></i></data></span></td> <td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" class="bi @if($oo->validated)bi-activity @else bi-radioactive @endif"></i></span></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td> <td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td class="text-end">{{ $oo->security }}</td> <td class="text-end">{{ $oo->security }}</td>
<td>{{ $oo->role_name }}</td> <td>{{ $oo->role_name }}</td>
@ -693,54 +693,6 @@
cache: false cache: false
}) })
}); });
$('data.validated').on('click',function(item) {
that = $(this);
var values = item.delegateTarget.value.split(':');
var icon = that.find('i');
if (values[1] === '1') {
$.ajax({
url: '/address/api/validated/off',
type: 'POST',
dataType: 'json',
data : {id: values[0]},
beforeSend: function() {
that.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
that.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-activity')
.addClass('bi-radioactive');
that.attr('value',values[0]+':'+0);
},
cache: false
});
} else {
$.ajax({
url: '/address/api/validated/on',
type: 'POST',
dataType: 'json',
data : {id: values[0]},
beforeSend: function() {
that.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
that.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-radioactive')
.addClass('bi-activity');
that.attr('value',values[0]+':'+1);
},
cache: false
});
}
});
}); });
</script> </script>
@append @append

View File

@ -297,11 +297,6 @@
</span> </span>
</div> </div>
</div> </div>
<div class="col-6">
<label for="passkey" class="form-label">Auto Hold</label>
<button id="autohold" @class(['btn','btn-danger'=>$o->autohold,'btn-success'=>(! $o->autohold)])><i @class(['bi-toggle-on'=>$o->autohold,'bi-toggle-off'=>(! $o->autohold)])></i></button>
</div>
</div> </div>
@endcan @endcan
@ -445,57 +440,6 @@
$('#heartbeat_option').addClass('d-none'); $('#heartbeat_option').addClass('d-none');
console.log('hold'); console.log('hold');
}) })
$("#autohold").on('click',function(item) {
var that = $(this)
var icon = that.find('i');
if (icon.hasClass('bi-toggle-on')) {
$.ajax({
url: '/system/api/autohold/off',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-on')
.addClass('bi-toggle-off')
that.removeClass('btn-danger')
.addClass('btn-success')
},
cache: false
});
} else {
$.ajax({
url: '/system/api/autohold/on',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-off')
.addClass('bi-toggle-on');
that.removeClass('btn-success')
.addClass('btn-danger')
},
cache: false
});
}
return false;
})
}) })
</script> </script>
@append @append

View File

@ -59,10 +59,6 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::match(['get','post'],'user/addedit/{o?}',[UserController::class,'add_edit']) Route::match(['get','post'],'user/addedit/{o?}',[UserController::class,'add_edit'])
->where('o','[0-9]+'); ->where('o','[0-9]+');
/* ADDRESS PATHS */
Route::post('address/api/validated/{state}',[SystemController::class,'api_address_validated_toggle'])
->whereIn('state',['on','off']);
/* DOMAIN PATHS */ /* DOMAIN PATHS */
Route::view('domain','domain.home'); Route::view('domain','domain.home');
Route::get('domain/api/hosts/{o}/{region}',[DomainController::class,'api_hosts']) Route::get('domain/api/hosts/{o}/{region}',[DomainController::class,'api_hosts'])
@ -86,8 +82,6 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::view('system','system.home'); Route::view('system','system.home');
Route::post('system/api/address/{o}',[SystemController::class,'api_address']) Route::post('system/api/address/{o}',[SystemController::class,'api_address'])
->where('o','[0-9]+'); ->where('o','[0-9]+');
Route::post('system/api/autohold/{state}',[SystemController::class,'api_autohold_toggle'])
->whereIn('state',['on','off']);
Route::get('system/api/address/get/{o}',[SystemController::class,'api_address_get']) Route::get('system/api/address/get/{o}',[SystemController::class,'api_address_get'])
->where('o','[0-9]+'); ->where('o','[0-9]+');
Route::get('system/api/address/orphan',[SystemController::class,'api_address_orphan']); Route::get('system/api/address/orphan',[SystemController::class,'api_address_orphan']);

View File

@ -4,7 +4,6 @@ namespace Tests\Feature;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Cache;
use Tests\TestCase; use Tests\TestCase;
use App\Models\{Address,Domain,Setup,System}; use App\Models\{Address,Domain,Setup,System};
@ -269,12 +268,10 @@ class RoutingTest extends TestCase
public function test_complex_rc_nc_hc_us() public function test_complex_rc_nc_hc_us()
{ {
Cache::forget('so');
$setup = Setup::findOrFail(config('app.id')); $setup = Setup::findOrFail(config('app.id'));
$ao = Address::findFTN('100:10/0.0@a'); $ao = Address::findFTN('100:10/0.0@a');
$setup->system_id = $ao->system_id; $setup->system_id = $ao->system_id;
$setup->save(); $setup->save();
$this->assertEquals('100:10/0.0@a',our_address($ao)?->ftn);
$this->session_rc(); $this->session_rc();
//$this->session_nc(); //$this->session_nc();
@ -306,7 +303,6 @@ class RoutingTest extends TestCase
$ao = Address::findFTN('100:10/22.0@a'); $ao = Address::findFTN('100:10/22.0@a');
$this->assertEquals('100:10/20.0@a',$ao->parent()->ftn); $this->assertEquals('100:10/20.0@a',$ao->parent()->ftn);
Cache::forget('so');
} }
// A points parent is the node, if we have traffic for a point and we have session details for the node // A points parent is the node, if we have traffic for a point and we have session details for the node