Changed to using new Address Model, Implemented Setup, Some minor CSS changes
This commit is contained in:
@@ -16,22 +16,60 @@ use Illuminate\Support\Facades\File;
|
||||
*/
|
||||
class Setup extends Model
|
||||
{
|
||||
public const S_DOMAIN = 1<<1; // Users can create Domains
|
||||
public const S_SYSTEM = 1<<2; // Users can create Systems
|
||||
|
||||
public const BINKP_OPT_CHT = 1<<1; /* CHAT mode - not implemented */
|
||||
public const BINKP_OPT_CR = 1<<2; /* Crypt mode - not implemented */
|
||||
public const BINKP_OPT_MB = 1<<3; /* Multi-Batch mode */
|
||||
public const BINKP_OPT_MD = 1<<4; /* CRAM-MD5 mode */
|
||||
public const BINKP_OPT_ND = 1<<5; /* http://ftsc.org/docs/fsp-1027.001: No-dupes mode */
|
||||
public const BINKP_OPT_NDA = 1<<6; /* http://ftsc.org/docs/fsp-1027.001: Asymmetric ND mode */
|
||||
public const BINKP_OPT_NR = 1<<7; /* http://ftsc.org/docs/fsp-1027.001: Non-Reliable mode */
|
||||
public const BINKP_OPT_MPWD = 1<<8; /* Multi-Password mode - not implemented */
|
||||
|
||||
public const BINKP_PORT = 24554;
|
||||
public const BINKP_BIND = '0.0.0.0';
|
||||
public const EMSI_PORT = 60179;
|
||||
public const EMSI_BIND = self::BINKP_BIND;
|
||||
|
||||
public const O_BINKP = 1<<1; /* Listen for BINKD connections */
|
||||
public const O_EMSI = 1<<2; /* Listen for EMSI connections */
|
||||
public const O_HIDEAKA = 1<<3; /* Hide AKAs to different Zones */
|
||||
|
||||
// Our non model attributes and values
|
||||
private array $internal = [];
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function system()
|
||||
{
|
||||
return $this->belongsTo(System::class);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
public function getLocationAttribute()
|
||||
{
|
||||
return $this->system->location;
|
||||
}
|
||||
|
||||
public function getSysopAttribute()
|
||||
{
|
||||
return $this->system->sysop;
|
||||
}
|
||||
|
||||
public function getSystemNameAttribute()
|
||||
{
|
||||
return $this->system->name;
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
// @todo This should go in a config file in the config dir
|
||||
$this->opt_cht = 0; /* CHAT mode - not implemented*/
|
||||
$this->opt_cr = 0; /* Crypt mode - not implemented*/
|
||||
$this->opt_mb = 1; /* Multi-Batch mode */
|
||||
$this->opt_md = 0; /* CRAM-MD5 mode */
|
||||
$this->opt_nd = 0; /* http://ftsc.org/docs/fsp-1027.001: No-dupes mode */
|
||||
$this->opt_nda = 1; /* http://ftsc.org/docs/fsp-1027.001: Asymmetric ND mode */
|
||||
$this->opt_mpwd = 0; /* Multi-Password mode - not implemented */
|
||||
$this->opt_nr = 1; /* http://ftsc.org/docs/fsp-1027.001: Non-Reliable mode */
|
||||
$this->binkp_options = ['m','d','r','b'];
|
||||
|
||||
/* EMSI SETTINGS */
|
||||
@@ -43,32 +81,6 @@ class Setup extends Model
|
||||
$this->inbound = '/tmp';
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function nodes()
|
||||
{
|
||||
return $this->belongsToMany(Node::class);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
public function getLocationAttribute()
|
||||
{
|
||||
return $this->nodes->first()->location;
|
||||
}
|
||||
|
||||
public function getSysopAttribute()
|
||||
{
|
||||
return $this->nodes->first()->sysop;
|
||||
}
|
||||
|
||||
public function getSystemNameAttribute()
|
||||
{
|
||||
return $this->nodes->first()->system;
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -78,15 +90,15 @@ class Setup extends Model
|
||||
case 'binkp_options':
|
||||
case 'ignore_nrq':
|
||||
case 'inbound':
|
||||
case 'opt_nr':
|
||||
case 'opt_nr': // @todo - this keys are now in #binkp as bits
|
||||
case 'opt_nd':
|
||||
case 'opt_nda':
|
||||
case 'opt_md':
|
||||
case 'opt_cr':
|
||||
case 'opt_mb':
|
||||
case 'opt_cht':
|
||||
case 'opt_mpwd':
|
||||
case 'do_prevent':
|
||||
case 'options':
|
||||
return $this->internal[$key] ?? FALSE;
|
||||
|
||||
case 'version':
|
||||
@@ -113,13 +125,43 @@ class Setup extends Model
|
||||
case 'opt_cr':
|
||||
case 'opt_mb':
|
||||
case 'opt_cht':
|
||||
case 'opt_mpwd':
|
||||
case 'do_prevent':
|
||||
case 'options':
|
||||
$this->internal[$key] = $value;
|
||||
break;
|
||||
|
||||
default:
|
||||
parent::__get($key);
|
||||
parent::__set($key,$value);
|
||||
}
|
||||
}
|
||||
|
||||
public function binkpOptionClear(int $key): void
|
||||
{
|
||||
$this->binkp &= ~$key;
|
||||
}
|
||||
|
||||
public function binkpOptionGet(int $key): int
|
||||
{
|
||||
return ($this->binkp & $key);
|
||||
}
|
||||
|
||||
public function binkpOptionSet(int $key): void
|
||||
{
|
||||
$this->binkp |= $key;
|
||||
}
|
||||
|
||||
public function optionClear(int $key): void
|
||||
{
|
||||
$this->options &= ~$key;
|
||||
}
|
||||
|
||||
public function optionGet(int $key): int
|
||||
{
|
||||
return ($this->options & $key);
|
||||
}
|
||||
|
||||
public function optionSet(int $key): void
|
||||
{
|
||||
$this->options |= $key;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user