Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/Filament/Widgets/Concerns/HasChartFilters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Filament\Widgets\Concerns;

trait HasChartFilters
{
protected function getFilters(): ?array
{
return [
'24h' => 'Last 24 hours',
'week' => 'Last 7 days',
'month' => 'Last 30 days',
];
}
}
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentDownloadChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Helpers\Average;
use App\Helpers\Number;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentDownloadChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Download (Mbps)';

protected int|string|array $columnSpan = 'full';
Expand All @@ -18,15 +21,11 @@ class RecentDownloadChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentDownloadLatencyChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentDownloadLatencyChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Download Latency';

protected int|string|array $columnSpan = 'full';
Expand All @@ -16,15 +19,11 @@ class RecentDownloadLatencyChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentJitterChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentJitterChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Jitter';

protected int|string|array $columnSpan = 'full';
Expand All @@ -16,15 +19,11 @@ class RecentJitterChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentPingChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Helpers\Average;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentPingChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Ping (ms)';

protected int|string|array $columnSpan = 'full';
Expand All @@ -17,15 +20,11 @@ class RecentPingChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentUploadChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Helpers\Average;
use App\Helpers\Number;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentUploadChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Upload (Mbps)';

protected int|string|array $columnSpan = 'full';
Expand All @@ -18,15 +21,11 @@ class RecentUploadChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
13 changes: 6 additions & 7 deletions app/Filament/Widgets/RecentUploadLatencyChartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
namespace App\Filament\Widgets;

use App\Enums\ResultStatus;
use App\Filament\Widgets\Concerns\HasChartFilters;
use App\Models\Result;
use Filament\Widgets\ChartWidget;

class RecentUploadLatencyChartWidget extends ChartWidget
{
use HasChartFilters;

protected static ?string $heading = 'Upload Latency';

protected int|string|array $columnSpan = 'full';
Expand All @@ -16,15 +19,11 @@ class RecentUploadLatencyChartWidget extends ChartWidget

protected static ?string $pollingInterval = '60s';

public ?string $filter = '24h';
public ?string $filter = null;

protected function getFilters(): ?array
public function mount(): void
{
return [
'24h' => 'Last 24h',
'week' => 'Last week',
'month' => 'Last month',
];
$this->filter = $this->filter ?? config('speedtest.default_chart_range', '24h');
}

protected function getData(): array
Expand Down
14 changes: 5 additions & 9 deletions config/speedtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/**
* General settings.
*/

'build_date' => Carbon::parse('2025-10-24'),

'build_version' => 'v1.6.9',
Expand All @@ -17,6 +16,7 @@

'public_dashboard' => env('PUBLIC_DASHBOARD', false),

'default_chart_range' => env('DEFAULT_CHART_RANGE', '24h'),

/**
* Speedtest settings.
Expand All @@ -31,25 +31,21 @@

'checkinternet_url' => env('SPEEDTEST_CHECKINTERNET_URL', 'https://icanhazip.com'),


/**
* IP filtering settings.
*/

'allowed_ips' => env('ALLOWED_IPS'),

'skip_ips' => env('SPEEDTEST_SKIP_IPS', ''),


/**
* Threshold settings.
*/
'threshold_enabled' => env('THRESHOLD_ENABLED', false),

'threshold_enabled' => env('THRESHOLD_ENABLED', false),

'threshold_download' => env('THRESHOLD_DOWNLOAD', 0),
'threshold_download' => env('THRESHOLD_DOWNLOAD', 0),

'threshold_upload' => env('THRESHOLD_UPLOAD', 0),
'threshold_upload' => env('THRESHOLD_UPLOAD', 0),

'threshold_ping' => env('THRESHOLD_PING', 0) ,
'threshold_ping' => env('THRESHOLD_PING', 0),
];