feat: Prepare Zemailnator for Dokploy deployment
- Add highly optimized Dockerfile with Nginx and PHP-FPM 8.4 - Add docker-compose.yml configured with Redis and MariaDB 10.11 - Implement entrypoint.sh and supervisord.conf for background workers - Refactor legacy IMAP scripts into scheduled Artisan Commands - Secure app by removing old routes with hardcoded basic auth credentials - Configure email attachments to use Laravel Storage instead of insecure public/tmp
This commit is contained in:
@@ -13,7 +13,6 @@ use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Inerba\DbConfig\AbstractPageSettings;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
|
||||
|
||||
class ImapSettings extends AbstractPageSettings
|
||||
{
|
||||
@@ -145,7 +144,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
$fields = ['host', 'port', 'username', 'password', 'encryption', 'validate_cert', 'protocol'];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$key = $sectionName . '.' . $field;
|
||||
$key = $sectionName.'.'.$field;
|
||||
|
||||
// Try different data structure approaches
|
||||
$value = null;
|
||||
@@ -186,8 +185,8 @@ class ImapSettings extends AbstractPageSettings
|
||||
return [
|
||||
'section' => ucfirst($sectionName),
|
||||
'success' => false,
|
||||
'message' => "Missing required fields: " . $missingFields->join(', '),
|
||||
'details' => null
|
||||
'message' => 'Missing required fields: '.$missingFields->join(', '),
|
||||
'details' => null,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -198,7 +197,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
'section' => ucfirst($sectionName),
|
||||
'success' => false,
|
||||
'message' => 'IMAP extension is not loaded in your web server. Please check your Herd PHP configuration or restart your server.',
|
||||
'details' => null
|
||||
'details' => null,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -210,7 +209,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
'password' => $config['password'],
|
||||
'encryption' => $config['encryption'] ?? 'none',
|
||||
'validate_cert' => $config['validate_cert'] ?? false,
|
||||
'protocol' => $config['protocol'] ?? 'imap'
|
||||
'protocol' => $config['protocol'] ?? 'imap',
|
||||
];
|
||||
|
||||
// Test connection using the existing ZEmail::connectMailBox method
|
||||
@@ -224,8 +223,8 @@ class ImapSettings extends AbstractPageSettings
|
||||
'host' => $config['host'],
|
||||
'port' => $config['port'],
|
||||
'encryption' => $config['encryption'] ?? 'none',
|
||||
'protocol' => $config['protocol'] ?? 'imap'
|
||||
]
|
||||
'protocol' => $config['protocol'] ?? 'imap',
|
||||
],
|
||||
];
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -244,13 +243,12 @@ class ImapSettings extends AbstractPageSettings
|
||||
'host' => $config['host'] ?? null,
|
||||
'port' => $config['port'] ?? null,
|
||||
'encryption' => $config['encryption'] ?? 'none',
|
||||
'protocol' => $config['protocol'] ?? 'imap'
|
||||
]
|
||||
'protocol' => $config['protocol'] ?? 'imap',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send appropriate notification based on test results.
|
||||
*/
|
||||
@@ -294,6 +292,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
$details[] = "{$result['section']}: {$result['details']['messages']} messages";
|
||||
}
|
||||
}
|
||||
|
||||
return implode(' | ', $details);
|
||||
}
|
||||
|
||||
@@ -306,6 +305,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
foreach ($results as $result) {
|
||||
$details[] = "{$result['section']}: {$result['message']}";
|
||||
}
|
||||
|
||||
return implode(' | ', $details);
|
||||
}
|
||||
|
||||
@@ -319,6 +319,7 @@ class ImapSettings extends AbstractPageSettings
|
||||
$status = $result['success'] ? '✅' : '❌';
|
||||
$details[] = "{$status} {$result['section']}";
|
||||
}
|
||||
|
||||
return implode(' | ', $details);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use UnitEnum;
|
||||
|
||||
class ImpersonationLogViewer extends Page implements HasForms, HasTable
|
||||
@@ -132,10 +131,10 @@ class ImpersonationLogViewer extends Page implements HasForms, HasTable
|
||||
TextColumn::make('duration_in_minutes')
|
||||
->label('Duration')
|
||||
->formatStateUsing(function ($record) {
|
||||
return match(true) {
|
||||
!$record->duration_in_minutes => 'Active',
|
||||
return match (true) {
|
||||
! $record->duration_in_minutes => 'Active',
|
||||
$record->duration_in_minutes < 60 => "{$record->duration_in_minutes}m",
|
||||
default => round($record->duration_in_minutes / 60, 1) . 'h',
|
||||
default => round($record->duration_in_minutes / 60, 1).'h',
|
||||
};
|
||||
})
|
||||
->sortable()
|
||||
@@ -324,7 +323,7 @@ class ImpersonationLogViewer extends Page implements HasForms, HasTable
|
||||
->latest('start_time')
|
||||
->get();
|
||||
|
||||
$filename = 'impersonation_logs_' . now()->format('Y_m_d_H_i_s') . '.csv';
|
||||
$filename = 'impersonation_logs_'.now()->format('Y_m_d_H_i_s').'.csv';
|
||||
|
||||
// Create a temporary file
|
||||
$handle = fopen('php://temp', 'r+');
|
||||
@@ -376,7 +375,7 @@ class ImpersonationLogViewer extends Page implements HasForms, HasTable
|
||||
$filename,
|
||||
[
|
||||
'Content-Type' => 'text/csv',
|
||||
'Content-Disposition' => 'attachment; filename="' . $filename . '"',
|
||||
'Content-Disposition' => 'attachment; filename="'.$filename.'"',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user