You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -67,6 +67,7 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
'ip_current' => $ip,
|
'ip_current' => $ip,
|
||||||
'auth_ticket' => '',
|
'auth_ticket' => '',
|
||||||
'home_room' => (int) (setting('hotel_home_room') ?: 0),
|
'home_room' => (int) (setting('hotel_home_room') ?: 0),
|
||||||
|
'referral_code' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->update([
|
$user->update([
|
||||||
@@ -134,17 +135,20 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
private function sendDiscordWebhook(string $username, string $ip, string $email): void
|
private function sendDiscordWebhook(string $username, string $ip, string $email): void
|
||||||
{
|
{
|
||||||
if (setting('discord_webhook_url') === '') {
|
if (setting('discord_webhook_url') === '') {
|
||||||
Log::error('Discord webhook url not provided', ['Please provide a discord webhook url before being able to send any webhook requests.']);
|
Log::error('Discord webhook url not provided', [
|
||||||
|
'message' => 'Please provide a discord webhook url before being able to send any webhook requests.',
|
||||||
|
]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = Http::asJson()->post(setting('discord_webhook_url'), [
|
$request = Http::asJson()->post(
|
||||||
'username' => sprintf('%s Bot', setting('hotel_name')),
|
url: setting('discord_webhook_url'),
|
||||||
'content' => "User: {$username} has just registered, with the IP: {$ip} and E-mail: {$email}",
|
data: [
|
||||||
]);
|
'username' => sprintf('%s Bot', setting('hotel_name')),
|
||||||
|
'content' => "User: {$username} has just registered, with the IP: {$ip} and E-mail: {$email}",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
// Log the error in-case webhook wasn't sent
|
|
||||||
if (! $request->successful()) {
|
if (! $request->successful()) {
|
||||||
Log::error('Failed to send Discord webhook notification', [
|
Log::error('Failed to send Discord webhook notification', [
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ class UserObserver
|
|||||||
{
|
{
|
||||||
public function created(User $user): void
|
public function created(User $user): void
|
||||||
{
|
{
|
||||||
// We voegen haakjes toe zodat PHP 8.5 de volgorde begrijpt
|
|
||||||
$isHcEnabled = (setting('give_hc_on_register') ?: '0') === '1';
|
$isHcEnabled = (setting('give_hc_on_register') ?: '0') === '1';
|
||||||
|
|
||||||
$user->settings()->create([
|
$user->settings()->create([
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ use Illuminate\Support\Facades\Cache;
|
|||||||
|
|
||||||
class PermissionsService
|
class PermissionsService
|
||||||
{
|
{
|
||||||
public ?Collection $permissions;
|
public private(set) ?Collection $permissions;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->permissions = Cache::remember(
|
$this->permissions = Cache::remember(
|
||||||
'website_permissions',
|
key: 'website_permissions',
|
||||||
now()->addMinutes(30),
|
ttl: now()->addMinutes(30),
|
||||||
fn () => WebsitePermission::all()->pluck('min_rank', 'permission')
|
callback: fn () => WebsitePermission::all()->pluck('min_rank', 'permission')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,9 +37,9 @@ class PermissionsService
|
|||||||
Cache::forget('website_permissions');
|
Cache::forget('website_permissions');
|
||||||
|
|
||||||
$this->permissions = Cache::remember(
|
$this->permissions = Cache::remember(
|
||||||
'website_permissions',
|
key: 'website_permissions',
|
||||||
now()->addMinutes(30),
|
ttl: now()->addMinutes(30),
|
||||||
fn () => WebsitePermission::all()->pluck('min_rank', 'permission')
|
callback: fn () => WebsitePermission::all()->pluck('min_rank', 'permission')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class RconService
|
|||||||
{
|
{
|
||||||
protected ?Socket $socket = null;
|
protected ?Socket $socket = null;
|
||||||
|
|
||||||
public bool $isConnected = false;
|
public private(set) bool $isConnected = false;
|
||||||
|
|
||||||
protected array $config = [];
|
protected array $config = [];
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class RconService
|
|||||||
|
|
||||||
private function initialize(): void
|
private function initialize(): void
|
||||||
{
|
{
|
||||||
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$this->socket = @socket_create(domain: AF_INET, type: SOCK_STREAM, protocol: SOL_TCP);
|
||||||
|
|
||||||
if (! $this->socket) {
|
if (! $this->socket) {
|
||||||
$error = socket_strerror(socket_last_error());
|
$error = socket_strerror(socket_last_error());
|
||||||
@@ -39,8 +39,18 @@ class RconService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_set_option($this->socket, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 5, 'usec' => 0]);
|
socket_set_option(
|
||||||
socket_set_option($this->socket, SOL_SOCKET, SO_SNDTIMEO, ['sec' => 5, 'usec' => 0]);
|
socket: $this->socket,
|
||||||
|
level: SOL_SOCKET,
|
||||||
|
option: SO_RCVTIMEO,
|
||||||
|
value: ['sec' => 5, 'usec' => 0]
|
||||||
|
);
|
||||||
|
socket_set_option(
|
||||||
|
socket: $this->socket,
|
||||||
|
level: SOL_SOCKET,
|
||||||
|
option: SO_SNDTIMEO,
|
||||||
|
value: ['sec' => 5, 'usec' => 0]
|
||||||
|
);
|
||||||
|
|
||||||
if (! @socket_connect($this->socket, $this->config['ip'], $this->config['port'])) {
|
if (! @socket_connect($this->socket, $this->config['ip'], $this->config['port'])) {
|
||||||
$error = socket_strerror(socket_last_error());
|
$error = socket_strerror(socket_last_error());
|
||||||
|
|||||||
@@ -10,15 +10,17 @@ use Throwable;
|
|||||||
|
|
||||||
class SettingsService
|
class SettingsService
|
||||||
{
|
{
|
||||||
public ?Collection $settings;
|
public private(set) ?Collection $settings;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->settings = Cache::remember(
|
$this->settings = Cache::remember(
|
||||||
'website_settings',
|
key: 'website_settings',
|
||||||
now()->addMinutes(5),
|
ttl: now()->addMinutes(5),
|
||||||
fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect()
|
callback: fn () => Schema::hasTable('website_settings')
|
||||||
|
? WebsiteSetting::all()->pluck('value', 'key')
|
||||||
|
: collect()
|
||||||
);
|
);
|
||||||
} catch (Throwable) {
|
} catch (Throwable) {
|
||||||
$this->settings = collect();
|
$this->settings = collect();
|
||||||
@@ -40,9 +42,11 @@ class SettingsService
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->settings = Cache::remember(
|
$this->settings = Cache::remember(
|
||||||
'website_settings',
|
key: 'website_settings',
|
||||||
now()->addMinutes(5),
|
ttl: now()->addMinutes(5),
|
||||||
fn () => Schema::hasTable('website_settings') ? WebsiteSetting::all()->pluck('value', 'key') : collect()
|
callback: fn () => Schema::hasTable('website_settings')
|
||||||
|
? WebsiteSetting::all()->pluck('value', 'key')
|
||||||
|
: collect()
|
||||||
);
|
);
|
||||||
} catch (Throwable) {
|
} catch (Throwable) {
|
||||||
$this->settings = collect();
|
$this->settings = collect();
|
||||||
|
|||||||
+3
-4
@@ -47,12 +47,11 @@ return new class extends Migration
|
|||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn(array_merge([
|
$table->dropColumn([
|
||||||
'two_factor_secret',
|
'two_factor_secret',
|
||||||
'two_factor_recovery_codes',
|
'two_factor_recovery_codes',
|
||||||
], Fortify::confirmsTwoFactorAuthentication() ? [
|
...(Fortify::confirmsTwoFactorAuthentication() ? ['two_factor_confirmed_at'] : []),
|
||||||
'two_factor_confirmed_at',
|
]);
|
||||||
] : []));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user