WIP notifications and other refactors (#88)

* WIP notifications and other refactors
- refactor notification channels
- send notifications on events related to the servers and sites
- delete server log files on server deletion
- add telegram notification channel
- add new icons
- cache configs and icons on installation and updates
- new navbar for dark mode and settings

* discord channel

* build assets

* pint
This commit is contained in:
Saeed Vaziry
2024-01-07 09:54:08 +01:00
committed by GitHub
parent f06b8f7d20
commit e997d0deea
72 changed files with 1153 additions and 480 deletions

View File

@ -2,11 +2,10 @@
namespace App\Notifications;
use App\Contracts\Notification;
use App\Models\Server;
use Illuminate\Notifications\Messages\MailMessage;
class ServerInstallationSucceed implements Notification
class ServerInstallationSucceed extends AbstractNotification
{
protected Server $server;
@ -20,14 +19,10 @@ public function subject(): string
return __('Server installation succeed!');
}
public function message(bool $mail = false): mixed
public function rawText(): string
{
$this->server->refresh();
if ($mail) {
return $this->mail();
}
return __("Installation succeed for server [:server] \nServer IP: :ip \nUser: :user\nPassword: :password\n:link", [
'server' => $this->server->name,
'ip' => $this->server->ip,
@ -37,11 +32,12 @@ public function message(bool $mail = false): mixed
]);
}
public function mail(): MailMessage
public function toMail(object $notifiable): MailMessage
{
$this->server->refresh();
return (new MailMessage)
->subject(__('Server installation succeed!'))
->line('Your server ['.$this->server->name.'] has been installed successfully.')
->line('Server IP: '.$this->server->ip)
->line('User: '.$this->server->authentication['user'])