Move fido configuation items into fido namespace. If keeping packets move them into a date aligned subdir
This commit is contained in:
parent
22c8b3df74
commit
2ae24b9955
app
Classes
Http/Requests
Jobs
Models
config
resources/views/system
@ -860,6 +860,8 @@ class Message extends FTNBase
|
|||||||
$this->point['dst'] = $t;
|
$this->point['dst'] = $t;
|
||||||
|
|
||||||
// <SOH>Via <FTN Address> @YYYYMMDD.HHMMSS[.Precise][.Time Zone] <Program Name> <Version> [Serial Number]<CR>
|
// <SOH>Via <FTN Address> @YYYYMMDD.HHMMSS[.Precise][.Time Zone] <Program Name> <Version> [Serial Number]<CR>
|
||||||
|
// @todo The via line is still showing in the main message? https://clrghouz.bbs.dege.au/netmail/view/707
|
||||||
|
// @todo Need to make sure that the CRC doesnt include this
|
||||||
elseif ($t = $this->kludge('Via ',$kl))
|
elseif ($t = $this->kludge('Via ',$kl))
|
||||||
$this->via->push($t);
|
$this->via->push($t);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ final class Item extends Receive
|
|||||||
case 'stor_name':
|
case 'stor_name':
|
||||||
return sprintf('%04X-%s',$this->ao->id,$this->recvas);
|
return sprintf('%04X-%s',$this->ao->id,$this->recvas);
|
||||||
case 'rel_name':
|
case 'rel_name':
|
||||||
return sprintf('%s/%s',config('app.fido'),$this->stor_name);
|
return sprintf('%s/%s',config('fido.dir'),$this->stor_name);
|
||||||
case 'full_name':
|
case 'full_name':
|
||||||
return Storage::disk(self::LOCATION)->path($this->rel_name);
|
return Storage::disk(self::LOCATION)->path($this->rel_name);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class Receive extends Base
|
|||||||
case self::IS_PKT:
|
case self::IS_PKT:
|
||||||
try {
|
try {
|
||||||
// If packet is greater than a size, lets queue it
|
// If packet is greater than a size, lets queue it
|
||||||
if ($this->receiving->size > config('app.queue_size',0)) {
|
if ($this->receiving->size > config('fido.queue_size',0)) {
|
||||||
Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size',self::LOGKEY,$this->receiving->full_name,$this->receiving->size));
|
Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size',self::LOGKEY,$this->receiving->full_name,$this->receiving->size));
|
||||||
PacketProcess::dispatch($this->receiving,$this->ao,$rcvd_time);
|
PacketProcess::dispatch($this->receiving,$this->ao,$rcvd_time);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class AreafixRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'to' => [
|
'to' => [
|
||||||
'required',
|
'required',
|
||||||
Rule::in(config('app.areafilefix')),
|
Rule::in(config('fido.areafilefix')),
|
||||||
],
|
],
|
||||||
'fftn_id' => [
|
'fftn_id' => [
|
||||||
'required',
|
'required',
|
||||||
|
@ -179,11 +179,11 @@ class MessageProcess implements ShouldQueue
|
|||||||
$processed = TRUE;
|
$processed = TRUE;
|
||||||
|
|
||||||
// Dont send an advisement to an areabot
|
// Dont send an advisement to an areabot
|
||||||
if (! in_array(strtolower($this->msg->user_from),config('app.areabots')))
|
if (! in_array(strtolower($this->msg->user_from),config('fido.areabots')))
|
||||||
Notification::route('netmail',$this->msg->fftn_o)->notify(new NetmailForward($this->msg,$ao));
|
Notification::route('netmail',$this->msg->fftn_o)->notify(new NetmailForward($this->msg,$ao));
|
||||||
|
|
||||||
// We'll ignore messages from *fix users
|
// We'll ignore messages from *fix users
|
||||||
} elseif (in_array(strtolower($this->msg->user_from),config('app.areabots'))) {
|
} elseif (in_array(strtolower($this->msg->user_from),config('fido.areabots'))) {
|
||||||
$o->flags |= Message::FLAG_RECD;
|
$o->flags |= Message::FLAG_RECD;
|
||||||
$o->save();
|
$o->save();
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ use Illuminate\Queue\SerializesModels;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use League\Flysystem\UnableToMoveFile;
|
||||||
|
|
||||||
use App\Classes\File;
|
use App\Classes\File;
|
||||||
use App\Classes\File\Item;
|
use App\Classes\File\Item;
|
||||||
@ -54,6 +56,8 @@ class PacketProcess implements ShouldQueue
|
|||||||
{
|
{
|
||||||
Log::info(sprintf('%s:- Processing mail %s [%s]',self::LOGKEY,$this->file->whatType() === Item::IS_PKT ? 'PACKET' : 'ARCHIVE',$this->file->nameas));
|
Log::info(sprintf('%s:- Processing mail %s [%s]',self::LOGKEY,$this->file->whatType() === Item::IS_PKT ? 'PACKET' : 'ARCHIVE',$this->file->nameas));
|
||||||
|
|
||||||
|
$fs = Storage::disk(config('fido.local_disk'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$f = new File($this->file->full_name);
|
$f = new File($this->file->full_name);
|
||||||
$processed = FALSE;
|
$processed = FALSE;
|
||||||
@ -79,7 +83,7 @@ class PacketProcess implements ShouldQueue
|
|||||||
Log::info(sprintf('%s:- Packet has [%d] messages',self::LOGKEY,$pkt->count()));
|
Log::info(sprintf('%s:- Packet has [%d] messages',self::LOGKEY,$pkt->count()));
|
||||||
|
|
||||||
// Queue messages if there are too many in the packet.
|
// Queue messages if there are too many in the packet.
|
||||||
if ($queue = ($pkt->count() > config('app.queue_msgs')))
|
if ($queue = ($pkt->count() > config('fido.queue_msgs')))
|
||||||
Log::info(sprintf('%s:- Messages will be sent to the queue for processing',self::LOGKEY));
|
Log::info(sprintf('%s:- Messages will be sent to the queue for processing',self::LOGKEY));
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -124,10 +128,34 @@ class PacketProcess implements ShouldQueue
|
|||||||
if (! $processed) {
|
if (! $processed) {
|
||||||
Log::alert(sprintf('%s:- Not deleting packet [%s], it doesnt seem to be processed?',self::LOGKEY,$this->file->nameas));
|
Log::alert(sprintf('%s:- Not deleting packet [%s], it doesnt seem to be processed?',self::LOGKEY,$this->file->nameas));
|
||||||
|
|
||||||
|
} else {
|
||||||
// If we want to keep the packet, we could do that logic here
|
// If we want to keep the packet, we could do that logic here
|
||||||
} elseif (! config('app.packet_keep')) {
|
if (config('fido.packet_keep')) {
|
||||||
Log::debug(sprintf('%s:- Deleting processed packet [%s]',self::LOGKEY,$this->file->full_name));
|
$now = Carbon::now()->format('Ymd');
|
||||||
unlink($this->file->full_name);
|
$dir = sprintf('%s/%s',config('fido.dir'),$now);
|
||||||
|
Log::debug(sprintf('%s:- Moving processed packet [%s] to [%s]',self::LOGKEY,$this->file->rel_name,$dir));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($fs->makeDirectory($dir)) {
|
||||||
|
$fs->move($this->file->rel_name,$x=sprintf('%s/%s',$dir,$this->file->stor_name));
|
||||||
|
Log::info(sprintf('%s:- Moved processed packet [%s] to [%s]',self::LOGKEY,$this->file->rel_name,$x));
|
||||||
|
|
||||||
|
} else
|
||||||
|
Log::error(sprintf('%s:! Unable to create dir [%s]',self::LOGKEY,$dir));
|
||||||
|
|
||||||
|
} catch (UnableToMoveFile $e) {
|
||||||
|
Log::error(sprintf('%s:! Unable to move packet [%s] to [%s] (%s)',self::LOGKEY,$this->file->full_name,$dir,$e->getMessage()));
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error(sprintf('%s:! Failed moving packet [%s] to [%s] (%s)',self::LOGKEY,$this->file->full_name,$dir,$e->getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::debug(sprintf('%s:- Deleting processed packet [%s]',self::LOGKEY,$this->file->full_name));
|
||||||
|
|
||||||
|
// @todo Change this to use Storage::disk()
|
||||||
|
unlink($this->file->full_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InvalidPacketException $e) {
|
} catch (InvalidPacketException $e) {
|
||||||
|
@ -92,6 +92,7 @@ class Address extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find children dependent on this record
|
* Find children dependent on this record
|
||||||
|
* @todo If bosses are defined here, and points, then mail to a point goes to it's boss
|
||||||
*/
|
*/
|
||||||
public function children()
|
public function children()
|
||||||
{
|
{
|
||||||
@ -232,6 +233,7 @@ class Address extends Model
|
|||||||
*
|
*
|
||||||
* @return Address|null
|
* @return Address|null
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
* @todo Dont include points in this
|
||||||
*/
|
*/
|
||||||
public function parent(): ?Address
|
public function parent(): ?Address
|
||||||
{
|
{
|
||||||
@ -386,7 +388,7 @@ class Address extends Model
|
|||||||
*
|
*
|
||||||
* @param string $address
|
* @param string $address
|
||||||
* @param System $so
|
* @param System $so
|
||||||
* @return self
|
* @return Address|null
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function createFTN(string $address,System $so): ?self
|
public static function createFTN(string $address,System $so): ?self
|
||||||
@ -478,8 +480,6 @@ class Address extends Model
|
|||||||
* Find a record in the DB for a node string, eg: 10:1/1.0
|
* Find a record in the DB for a node string, eg: 10:1/1.0
|
||||||
*
|
*
|
||||||
* @param string $address
|
* @param string $address
|
||||||
* @param bool $create
|
|
||||||
* @param System|null $so
|
|
||||||
* @param bool $trashed
|
* @param bool $trashed
|
||||||
* @return Address|null
|
* @return Address|null
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -554,6 +554,7 @@ class Address extends Model
|
|||||||
* @param Domain $do
|
* @param Domain $do
|
||||||
* @param int $host
|
* @param int $host
|
||||||
* @param int $node
|
* @param int $node
|
||||||
|
* @param int $point
|
||||||
* @param bool $trashed
|
* @param bool $trashed
|
||||||
* @return self|null
|
* @return self|null
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -770,7 +771,7 @@ class Address extends Model
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Get packet type
|
// Get packet type
|
||||||
$type = collect(Packet::PACKET_TYPES)->get($this->system->pkt_type ?: config('app.default_pkt'));
|
$type = collect(Packet::PACKET_TYPES)->get($this->system->pkt_type ?: config('fido.packet_default'));
|
||||||
$o = new $type;
|
$o = new $type;
|
||||||
$o->addressHeader($ao,$this,$passwd);
|
$o->addressHeader($ao,$this,$passwd);
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ class File extends Model
|
|||||||
|
|
||||||
private const LOGKEY = 'MF-';
|
private const LOGKEY = 'MF-';
|
||||||
private bool $no_export = FALSE;
|
private bool $no_export = FALSE;
|
||||||
|
public string $prefix = '';
|
||||||
|
public string $replaces = '';
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'kludges' => CollectionOrNull::class,
|
'kludges' => CollectionOrNull::class,
|
||||||
@ -162,11 +164,31 @@ class File extends Model
|
|||||||
|
|
||||||
/* ATTRIBUTES */
|
/* ATTRIBUTES */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the relative path to Storage::disk() in the store
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getFullStoragePathAttribute(): string
|
public function getFullStoragePathAttribute(): string
|
||||||
{
|
{
|
||||||
return sprintf('%04X/%s',$this->filearea_id,$this->name);
|
return sprintf('%04X/%s',$this->filearea_id,$this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the relative path to Storage::disk() in the inbound;
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getRelNameAttribute(): string
|
||||||
|
{
|
||||||
|
return sprintf('%s/%s',config('fido.dir'),$this->prefix_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrefixNameAttribute(): string
|
||||||
|
{
|
||||||
|
return sprintf('%s%s',$this->prefix ? $this->prefix.'-' : '',$this->name);
|
||||||
|
}
|
||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
public function jsonSerialize(): array
|
public function jsonSerialize(): array
|
||||||
|
@ -15,16 +15,6 @@ return [
|
|||||||
|
|
||||||
'name' => env('APP_NAME', 'Laravel'),
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
'id' => env('APP_SETUP_ID', 1),
|
'id' => env('APP_SETUP_ID', 1),
|
||||||
'fido' => env('FIDO_DIR', 'fido'),
|
|
||||||
'packet_keep' => env('FIDO_PACKET_KEEP', FALSE),
|
|
||||||
|
|
||||||
// Size of packet before we decide to queue it for processing
|
|
||||||
'queue_size' => env('FIDO_QUEUE_SIZE', 1000000),
|
|
||||||
// Number of messages in a packet that will result in them being queued for processing
|
|
||||||
'queue_msgs' => env('FIDO_QUEUE_MSGS', 50),
|
|
||||||
'default_pkt' => env('FIDO_DEFAULT_PACKET', '2+'),
|
|
||||||
'areafilefix' => ['areafix','filefix'],
|
|
||||||
'areabots' => array_merge(['sbbsecho'],['areafix','filefix']),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
28
config/fido.php
Normal file
28
config/fido.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
// When sending areafix/filefix messages, validate to addresses
|
||||||
|
'areafilefix' => ['areafix','filefix','rexfix','areamgr'],
|
||||||
|
|
||||||
|
// Determine if incoming messages are from bots
|
||||||
|
'areabots' => array_merge(['sbbsecho'],['areafix','filefix','rexfix','areamgr']),
|
||||||
|
|
||||||
|
// Directory to use for any data we want to store locally
|
||||||
|
'dir' => env('FIDO_DIR', 'fido'),
|
||||||
|
|
||||||
|
// Our Storage::disk() for locally stored data
|
||||||
|
'local_disk' => env('FIDO_LOCAL_DIR','local'),
|
||||||
|
|
||||||
|
// Default packet to use if a user hasnt defined a packet format for their BBS
|
||||||
|
'packet_default' => env('FIDO_DEFAULT_PACKET', '2+'),
|
||||||
|
|
||||||
|
// Do we keep packets after processing, if so we'll store them in a data formatted dir yyyymmdd
|
||||||
|
'packet_keep' => env('FIDO_PACKET_KEEP', FALSE),
|
||||||
|
|
||||||
|
// Size of packet before we decide to queue it for processing
|
||||||
|
'queue_size' => env('FIDO_QUEUE_SIZE', 1000000),
|
||||||
|
|
||||||
|
// Number of messages in a packet that will result in them being queued for processing
|
||||||
|
'queue_msgs' => env('FIDO_QUEUE_MSGS', 50),
|
||||||
|
|
||||||
|
];
|
@ -33,7 +33,7 @@ return [
|
|||||||
'local' => [
|
'local' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app'),
|
'root' => storage_path('app'),
|
||||||
'throw' => false,
|
'throw' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'public' => [
|
'public' => [
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
||||||
<select class="form-select @error('to') is-invalid @enderror" id="to" name="to">
|
<select class="form-select @error('to') is-invalid @enderror" id="to" name="to">
|
||||||
@foreach (config('app.areafilefix') as $name)
|
@foreach (config('fido.areafilefix') as $name)
|
||||||
<option value="{{ $name }}" @if(old('to' === $name ))selected @endif>{{ $name }}</option>
|
<option value="{{ $name }}" @if(old('to' === $name ))selected @endif>{{ $name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
@ -194,7 +194,7 @@
|
|||||||
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
|
||||||
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)readonly @endcannot>
|
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)readonly @endcannot>
|
||||||
@foreach (\App\Classes\FTN\Packet::PACKET_TYPES as $type => $class)
|
@foreach (\App\Classes\FTN\Packet::PACKET_TYPES as $type => $class)
|
||||||
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('app.default_pkt')) === $type)selected @endif>{{ $type }}</option>
|
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('fido.packet_default')) === $type)selected @endif>{{ $type }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
|
Loading…
Reference in New Issue
Block a user