Compare commits
5 Commits
6e376100a5
...
5389739920
Author | SHA1 | Date | |
---|---|---|---|
5389739920 | |||
92f964f572 | |||
9abfd88e3d | |||
e9895aee45 | |||
79b180f453 |
@ -36,7 +36,7 @@ class DomainController extends Controller
|
||||
public function add_edit(DomainRequest $request,Domain $o)
|
||||
{
|
||||
if ($request->post()) {
|
||||
foreach (['name','dnsdomain','active','public','homepage','notes','flatten'] as $key)
|
||||
foreach (['name','dnsdomain','active','public','homepage','notes','flatten','accept_app'] as $key)
|
||||
$o->{$key} = $request->post($key);
|
||||
|
||||
$o->save();
|
||||
|
@ -626,6 +626,28 @@ class SystemController extends Controller
|
||||
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)
|
||||
{
|
||||
if ($request->post()) {
|
||||
|
@ -27,6 +27,7 @@ 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),
|
||||
'active' => 'required|boolean',
|
||||
'public' => 'required|boolean',
|
||||
'accept_app' => 'required|boolean',
|
||||
'flatten' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use App\Casts\CompressedString;
|
||||
use App\Traits\{QueryCacheableConfig,ScopeActive};
|
||||
use App\Traits\ScopeActive;
|
||||
|
||||
class Domain extends Model
|
||||
{
|
||||
use HasFactory,ScopeActive,QueryCacheableConfig;
|
||||
use HasFactory,ScopeActive;
|
||||
|
||||
private const CACHE_TIME = 3600;
|
||||
private const STATS_MONTHS = 6;
|
||||
@ -62,6 +62,15 @@ class Domain extends Model
|
||||
|
||||
/* 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
|
||||
{
|
||||
//0xFD2FB528
|
||||
@ -78,8 +87,7 @@ class Domain extends Model
|
||||
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
|
||||
->elseRaw("'all'");
|
||||
|
||||
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')])
|
||||
return Echoarea::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')
|
||||
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer')
|
||||
->where('domain_id',$this->id)
|
||||
@ -124,4 +132,23 @@ class Domain extends Model
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -4,13 +4,12 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Rennokki\QueryCache\Traits\QueryCacheable;
|
||||
|
||||
use App\Casts\CollectionOrNull;
|
||||
|
||||
class Dynamic extends Model
|
||||
{
|
||||
use SoftDeletes,QueryCacheable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
'arguments' => CollectionOrNull::class,
|
||||
|
@ -6,7 +6,6 @@ use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Rennokki\QueryCache\Traits\QueryCacheable;
|
||||
|
||||
use App\Traits\{AreaSecurity,ScopeActive};
|
||||
|
||||
@ -42,7 +41,7 @@ use App\Traits\{AreaSecurity,ScopeActive};
|
||||
*/
|
||||
class Echoarea extends Model
|
||||
{
|
||||
use SoftDeletes,ScopeActive,QueryCacheable,AreaSecurity;
|
||||
use SoftDeletes,ScopeActive,AreaSecurity;
|
||||
|
||||
private const CACHE_TIME = 3600;
|
||||
|
||||
@ -57,6 +56,12 @@ class Echoarea extends Model
|
||||
return $this->belongsToMany(Address::class);
|
||||
}
|
||||
|
||||
public function addresses_active()
|
||||
{
|
||||
return $this->belongsToMany(Address::class)
|
||||
->activeFTN();
|
||||
}
|
||||
|
||||
public function domain()
|
||||
{
|
||||
return $this->belongsTo(Domain::class);
|
||||
@ -72,8 +77,7 @@ class Echoarea extends Model
|
||||
|
||||
public function messages_count(int $period=NULL): int
|
||||
{
|
||||
$eo = Echomail::cacheFor(self::CACHE_TIME)
|
||||
->where('echoarea_id',$this->id);
|
||||
$eo = Echomail::where('echoarea_id',$this->id);
|
||||
|
||||
$dt = Carbon::now()->startOfday();
|
||||
|
||||
|
@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Rennokki\QueryCache\Traits\QueryCacheable;
|
||||
|
||||
use App\Casts\{CollectionOrNull,CompressedString};
|
||||
use App\Classes\FTN\Message;
|
||||
@ -17,7 +16,7 @@ use App\Traits\{EncodeUTF8,MsgID,ParseAddresses};
|
||||
|
||||
final class Echomail extends Model implements Packet
|
||||
{
|
||||
use SoftDeletes,EncodeUTF8,MsgID,QueryCacheable,ParseAddresses;
|
||||
use SoftDeletes,EncodeUTF8,MsgID,ParseAddresses;
|
||||
|
||||
private const LOGKEY = 'ME-';
|
||||
private Collection $set_seenby;
|
||||
|
@ -10,14 +10,13 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Rennokki\QueryCache\Traits\QueryCacheable;
|
||||
|
||||
use App\Casts\{CollectionOrNull,CompressedString};
|
||||
use App\Traits\EncodeUTF8;
|
||||
|
||||
class File extends Model
|
||||
{
|
||||
use SoftDeletes,EncodeUTF8,QueryCacheable;
|
||||
use SoftDeletes,EncodeUTF8;
|
||||
|
||||
private const LOGKEY = 'MF-';
|
||||
private bool $no_export = FALSE;
|
||||
|
@ -75,27 +75,21 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
/* GENERAL METHODS */
|
||||
|
||||
public function addresses(): Collection
|
||||
public function addresses(Domain $o=NULL): Collection
|
||||
{
|
||||
return Address::select('addresses.*')
|
||||
->join('systems',['systems.id'=>'addresses.system_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)
|
||||
->with(['zone.domain'])
|
||||
->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?
|
||||
*
|
||||
@ -128,6 +122,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
*/
|
||||
public function zc(): Collection
|
||||
{
|
||||
$this->load('systems.addresses');
|
||||
|
||||
return $this->systems->pluck('addresses')->flatten()->where('role',Address::NODE_ZC);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Traits\{QueryCacheableConfig,ScopeActive};
|
||||
use App\Traits\ScopeActive;
|
||||
|
||||
class Zone extends Model
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ trait AreaSecurity
|
||||
* @param int $sec
|
||||
* @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);
|
||||
}
|
||||
@ -24,7 +24,7 @@ trait AreaSecurity
|
||||
* @param int $sec
|
||||
* @return bool
|
||||
*/
|
||||
public function can_read(int $sec): bool
|
||||
public function can_read(?int $sec): bool
|
||||
{
|
||||
return $this->active && (($sec >= ($x=$this->getSecReadAttribute())) && $x);
|
||||
}
|
||||
@ -35,7 +35,7 @@ trait AreaSecurity
|
||||
* @param int $sec
|
||||
* @return bool
|
||||
*/
|
||||
public function can_write(int $sec): bool
|
||||
public function can_write(?int $sec): bool
|
||||
{
|
||||
return $this->active && (($sec >= ($x=$this->getSecWriteAttribute())) && $x);
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?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';
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
use App\Models\{Address,Domain,Setup};
|
||||
|
||||
@ -92,16 +93,15 @@ if (! function_exists('hexstr')) {
|
||||
*/
|
||||
function our_address(Domain|Address $o=NULL): Collection|Address|NULL
|
||||
{
|
||||
static $so = NULL;
|
||||
static $our = NULL;
|
||||
$so = Cache::remember('so',5,function() {
|
||||
return Setup::findOrFail(config('app.id'));
|
||||
});
|
||||
|
||||
if (! $so)
|
||||
$so = Setup::findOrFail(config('app.id'));
|
||||
|
||||
if (! $our) {
|
||||
$our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) {
|
||||
$so->load(['system.akas.zone.domain']);
|
||||
$our = $so->system->akas;
|
||||
}
|
||||
|
||||
return $so->system->akas;
|
||||
});
|
||||
|
||||
// If we dont have any addresses
|
||||
if ($our->count() === 0)
|
||||
|
@ -5,30 +5,29 @@
|
||||
"keywords": ["framework","laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1|8.2",
|
||||
"php": "^8.1|8.2|8.3",
|
||||
"ext-bz2": "*",
|
||||
"ext-pcntl": "*",
|
||||
"ext-sockets": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-zlib": "*",
|
||||
"ext-zstd": "*",
|
||||
"aglipanci/laravel-eloquent-case": "^2.0",
|
||||
"eduardokum/laravel-mail-auto-embed": "^2.0",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/ui": "^4.0",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"aglipanci/laravel-eloquent-case": "^3.0",
|
||||
"eduardokum/laravel-mail-auto-embed": "^2.11",
|
||||
"laravel/framework": "^11.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/ui": "^4.5",
|
||||
"league/flysystem-aws-s3-v3": "^3.27",
|
||||
"leenooks/passkey": "^0.1.0",
|
||||
"nunomaduro/laravel-console-summary": "^1.9",
|
||||
"rennokki/laravel-eloquent-query-cache": "^3.3",
|
||||
"repat/laravel-job-models": "^0.8",
|
||||
"romanzipp/laravel-queue-monitor": "^2.0"
|
||||
"nunomaduro/laravel-console-summary": "^1.12.1",
|
||||
"repat/laravel-job-models": "^0.9",
|
||||
"romanzipp/laravel-queue-monitor": "^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.6",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"spatie/laravel-ignition": "^2.1"
|
||||
},
|
||||
@ -51,10 +50,6 @@
|
||||
"passkey": {
|
||||
"type": "vcs",
|
||||
"url": "https://gitea.dege.au/laravel/passkey.git"
|
||||
},
|
||||
"laravel-console-summary": {
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/leenooks/laravel-console-summary"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
1853
composer.lock
generated
1853
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
<?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');
|
||||
});
|
||||
}
|
||||
};
|
@ -18,7 +18,7 @@
|
||||
<label for="name" class="form-label">Name</label>
|
||||
<div class="input-group has-validation">
|
||||
<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>
|
||||
<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">
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error('name')
|
||||
{{ $message }}
|
||||
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<label for="active" class="form-label">Active</label>
|
||||
<label class="form-label">Active</label>
|
||||
<div class="input-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>
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
<div class="col-2">
|
||||
@if ($o->zones->count() > 1)
|
||||
<label for="flatten" class="form-label">Flatten Zones <i class="bi bi-info-circle" title="Treat this domain as a 2D domain"></i></label>
|
||||
<label 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="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>
|
||||
@ -88,8 +88,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<label for="public" class="form-label">Public</label>
|
||||
<div class="col-2">
|
||||
<label class="form-label">Public</label>
|
||||
<div class="input-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>
|
||||
@ -101,6 +101,19 @@
|
||||
</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)
|
||||
<div class="col-4">
|
||||
<label for="name" class="form-label">Nodelist File Area</label>
|
||||
@ -117,7 +130,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label for="notes" class="form-label">Notes</label>
|
||||
<textarea class="form-control" rows=3 name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
|
||||
<textarea class="form-control" rows=3 id="notes" name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -156,6 +156,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Sign up -->
|
||||
@if ($o->can_accept_app)
|
||||
<div class="accordion-item">
|
||||
<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>
|
||||
@ -163,17 +164,33 @@
|
||||
|
||||
<div id="collapse_signup" class="accordion-collapse collapse" aria-labelledby="signup" data-bs-parent="#accordion_homepage">
|
||||
<div class="accordion-body">
|
||||
@guest
|
||||
To start an application to join this network please <a href="{{ url('login') }}">login</a>.
|
||||
@else
|
||||
@if($user->isMember($o))
|
||||
@else
|
||||
This website is not ready to take applications yet, check back soon!
|
||||
<p>Your system(s) <strong class="highlight">{!! $o->userHasSystemsNotInNet(Auth::user())->pluck('name')->join('</strong>, <strong class="highlight">') !!}</strong> can join this network.</p>
|
||||
<p>
|
||||
If you want to join it/them to this network, make sure:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<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
|
||||
@endguest
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -181,15 +198,8 @@
|
||||
|
||||
@section('page-css')
|
||||
@css('datatables')
|
||||
<style>
|
||||
div#collapse_about {
|
||||
min-height: 25em;
|
||||
}
|
||||
div#collapse_about .collapse{
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
@append
|
||||
|
||||
@section('page-scripts')
|
||||
@js('datatables')
|
||||
@js('highcharts')
|
||||
@ -253,6 +263,19 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@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', {
|
||||
|
@ -15,12 +15,10 @@
|
||||
</ul>
|
||||
</div>
|
||||
</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('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
|
||||
</ul>
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
<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)
|
||||
<tr>
|
||||
<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 @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>{{ $oo->active ? 'YES' : 'NO' }}</td>
|
||||
<td class="text-end">{{ $oo->security }}</td>
|
||||
<td>{{ $oo->role_name }}</td>
|
||||
@ -693,6 +693,54 @@
|
||||
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>
|
||||
@append
|
@ -297,6 +297,11 @@
|
||||
</span>
|
||||
</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>
|
||||
@endcan
|
||||
|
||||
@ -440,6 +445,57 @@
|
||||
$('#heartbeat_option').addClass('d-none');
|
||||
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>
|
||||
@append
|
@ -59,6 +59,10 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
|
||||
Route::match(['get','post'],'user/addedit/{o?}',[UserController::class,'add_edit'])
|
||||
->where('o','[0-9]+');
|
||||
|
||||
/* ADDRESS PATHS */
|
||||
Route::post('address/api/validated/{state}',[SystemController::class,'api_address_validated_toggle'])
|
||||
->whereIn('state',['on','off']);
|
||||
|
||||
/* DOMAIN PATHS */
|
||||
Route::view('domain','domain.home');
|
||||
Route::get('domain/api/hosts/{o}/{region}',[DomainController::class,'api_hosts'])
|
||||
@ -82,6 +86,8 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
|
||||
Route::view('system','system.home');
|
||||
Route::post('system/api/address/{o}',[SystemController::class,'api_address'])
|
||||
->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'])
|
||||
->where('o','[0-9]+');
|
||||
Route::get('system/api/address/orphan',[SystemController::class,'api_address_orphan']);
|
||||
|
@ -4,6 +4,7 @@ namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
use App\Models\{Address,Domain,Setup,System};
|
||||
@ -268,10 +269,12 @@ class RoutingTest extends TestCase
|
||||
|
||||
public function test_complex_rc_nc_hc_us()
|
||||
{
|
||||
Cache::forget('so');
|
||||
$setup = Setup::findOrFail(config('app.id'));
|
||||
$ao = Address::findFTN('100:10/0.0@a');
|
||||
$setup->system_id = $ao->system_id;
|
||||
$setup->save();
|
||||
$this->assertEquals('100:10/0.0@a',our_address($ao)?->ftn);
|
||||
|
||||
$this->session_rc();
|
||||
//$this->session_nc();
|
||||
@ -303,6 +306,7 @@ class RoutingTest extends TestCase
|
||||
|
||||
$ao = Address::findFTN('100:10/22.0@a');
|
||||
$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
|
||||
|
Loading…
Reference in New Issue
Block a user