Skip to content

Commit

Permalink
Merge branch 'main' into fix-ping-url-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen authored Nov 14, 2024
2 parents 1cbb819 + defd665 commit ddcd161
Show file tree
Hide file tree
Showing 14 changed files with 676 additions and 542 deletions.
Binary file modified .github/screenshots/dashboard_screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ docker run -d --name speedtest-tracker --restart unless-stopped \
-e PUID=1000 \
-e PGID=1000 \
-e APP_KEY= \ # How to generate an app key: https://speedtest-tracker.dev/
# -e SPEEDTEST_SCHEDULE= \ # optional: schedule a speedtest with an cronjob https://crontab.guru
-e APP_URL=http://localhost \
-e DB_CONNECTION=sqlite \
-v ${PWD}:/config \
Expand All @@ -47,18 +48,20 @@ services:
- APP_KEY= # How to generate an app key: https://speedtest-tracker.dev/
- APP_URL=http://localhost
- DB_CONNECTION=sqlite
# - SPEEDTEST_SCHEDULE= # optional: schedule a speedtest with an cronjob https://crontab.guru
volumes:
- /path/to/data:/config
- /path/to-custom-ssl-keys:/config/keys
image: lscr.io/linuxserver/speedtest-tracker:latest
restart: unless-stopped
```
For more environment configuration to customize your installation see the docs: https://docs.speedtest-tracker.dev/getting-started/environment-variables


## Image version

A full list of released versions can be found here: https://fleet.linuxserver.io/image?name=linuxserver/speedtest-tracker

For more environment configuration see the docs: https://docs.speedtest-tracker.dev/getting-started/environment-variables

### FAQs and Features

[FAQs](https://docs.speedtest-tracker.dev/faqs) and a full list of planned and completed [features](https://docs.speedtest-tracker.dev/getting-started/features) can be found in the [documentation](https://docs.speedtest-tracker.dev).
Expand Down
281 changes: 202 additions & 79 deletions _ide_helper.php

Large diffs are not rendered by default.

145 changes: 74 additions & 71 deletions app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use App\Enums\UserRole;
use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\Pages\CreateUser;
use App\Filament\Resources\UserResource\Pages\EditUser;
use App\Models\User;
use Filament\Forms;
use Filament\Forms\Form;
Expand All @@ -14,8 +12,6 @@
use Filament\Tables\Table;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\Rules\Password;

class UserResource extends Resource
{
Expand All @@ -29,77 +25,72 @@ public static function form(Form $form): Form
->schema([
Forms\Components\Grid::make([
'default' => 1,
'md' => 3,
])
])->columnSpan([
'lg' => 2,
])->schema([
Forms\Components\Section::make('Details')
->columns([
'default' => 1,
'lg' => 2,
])
->schema([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255)
->columnSpanFull(),

Forms\Components\TextInput::make('email')
->email()
->required()
->maxLength(255)
->columnSpanFull(),

Forms\Components\TextInput::make('password')
->confirmed()
->password()
->revealable()
->required(fn (string $context): bool => $context === 'create')
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->dehydrated(fn ($state) => filled($state)),

Forms\Components\TextInput::make('password_confirmation')
->password()
->revealable(),

// ...
]),
]),

Forms\Components\Grid::make(1)
->columnSpan(1)
->schema([
Forms\Components\Section::make()
Forms\Components\Section::make('Platform')
->schema([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\TextInput::make('email')
->required()
->email()
->unique(ignoreRecord: true),
Forms\Components\TextInput::make('password')
Forms\Components\Select::make('role')
->label('Role')
->default(UserRole::User)
->options(UserRole::class)
->required()
->password()
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->visible(fn ($livewire) => $livewire instanceof CreateUser)
->rule(Password::default()),
Forms\Components\TextInput::make('new_password')
->password()
->label('New Password')
->nullable()
->rule(Password::default())
->visible(fn ($livewire) => $livewire instanceof EditUser)
->dehydrated(false),
Forms\Components\TextInput::make('new_password_confirmation')
->password()
->label('Confirm New Password')
->rule('required', fn ($get) => (bool) $get('new_password'))
->same('new_password')
->visible(fn ($livewire) => $livewire instanceof EditUser)
->dehydrated(false),
])
->columns(1)
->columnSpan([
'md' => 2,
->disabled(fn (?User $record): bool => Auth::user()->role !== UserRole::Admin),

// ...
]),

Forms\Components\Grid::make([
'default' => 1,
])
Forms\Components\Section::make()
->schema([
Forms\Components\Section::make()
->schema([
Forms\Components\Select::make('role')
->options(UserRole::class)
->default(UserRole::User)
->disabled(fn (): bool => ! Auth::user()->is_admin)
->required(),
])
->columns(1)
->columnSpan([
'md' => 1,
]),

Forms\Components\Section::make()
->schema([
Forms\Components\Placeholder::make('created_at')
->content(fn ($record) => $record?->created_at?->diffForHumans() ?? new HtmlString('—')),
Forms\Components\Placeholder::make('updated_at')
->content(fn ($record) => $record?->updated_at?->diffForHumans() ?? new HtmlString('—')),
])
->columns(1)
->columnSpan([
'md' => 1,
]),
])
->columns(1)
->columnSpan([
'md' => 1,
Forms\Components\Placeholder::make('created_at')
->content(fn (?User $record): string => $record ? $record->created_at->diffForHumans() : '-'),

Forms\Components\Placeholder::make('updated_at')
->content(fn (?User $record): string => $record ? $record->updated_at->diffForHumans() : '-'),

// ...
]),
]),
])
->columns([
'default' => 1,
'lg' => 3,
]);
}

Expand All @@ -108,33 +99,45 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('id')
->label('ID'),
->label('ID')
->sortable(),

Tables\Columns\TextColumn::make('name')
->searchable(),

Tables\Columns\TextColumn::make('email')
->searchable(),

Tables\Columns\TextColumn::make('role')
->badge(),

Tables\Columns\TextColumn::make('created_at')
->alignEnd()
->dateTime(config('app.datetime_format'))
->timezone(config('app.display_timezone')),
->timezone(config('app.display_timezone'))
->sortable()
->toggleable(isToggledHiddenByDefault: false),

Tables\Columns\TextColumn::make('updated_at')
->alignEnd()
->dateTime(config('app.datetime_format'))
->timezone(config('app.display_timezone'))
->sortable()
->toggleable(isToggledHiddenByDefault: true),

// ...
])
->filters([
Tables\Filters\SelectFilter::make('role')
->options(UserRole::class),
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
]),
])
->bulkActions([
// ...
]);
}

Expand Down
10 changes: 0 additions & 10 deletions app/Filament/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Hash;

class EditUser extends EditRecord
{
Expand All @@ -17,13 +16,4 @@ protected function getHeaderActions(): array
Actions\DeleteAction::make(),
];
}

public function beforeSave()
{
if (! array_key_exists('new_password', $this->data) || ! filled($this->data['new_password'])) {
return;
}

$this->record->password = Hash::make($this->data['new_password']);
}
}
3 changes: 3 additions & 0 deletions app/Jobs/Speedtests/ExecuteOoklaSpeedtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ protected function checkForInternetConnection(): bool
{
$url = config('speedtest.ping_url');

// TODO: skip checking for internet connection, current validation does not take into account different host formats and ip addresses.
return true;

// Skip checking for internet connection if ping url isn't set (disabled)
if (blank($url)) {
return true;
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@
"awcodes/filament-versions": "^2.0.1",
"chrisullyott/php-filesize": "^4.2.1",
"dragonmantank/cron-expression": "^3.4.0",
"filament/filament": "^3.2.117",
"filament/spatie-laravel-settings-plugin": "^3.2.117",
"filament/filament": "^3.2.124",
"filament/spatie-laravel-settings-plugin": "^3.2.124",
"geerlingguy/ping": "^1.2.1",
"guzzlehttp/guzzle": "^7.9.2",
"influxdata/influxdb-client-php": "^3.6",
"laravel-notification-channels/telegram": "^5.0",
"laravel/framework": "^11.27.2",
"laravel/framework": "^11.31",
"laravel/prompts": "^0.2.1",
"laravel/sanctum": "^4.0.3",
"laravel/tinker": "^2.10.0",
"livewire/livewire": "^3.5.4",
"livewire/livewire": "^3.5.12",
"lorisleiva/laravel-actions": "^2.8.4",
"maennchen/zipstream-php": "^2.4",
"spatie/laravel-settings": "^3.4",
"spatie/laravel-webhook-server": "^3.8.1",
"timokoerber/laravel-one-time-operations": "^1.4.2"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^3.1",
"fakerphp/faker": "^1.23.1",
"barryvdh/laravel-ide-helper": "^3.2.2",
"fakerphp/faker": "^1.24.0",
"laravel/pint": "^1.18.1",
"laravel/sail": "^1.35.0",
"laravel/telescope": "^5.2.2",
"laravel/sail": "^1.38.0",
"laravel/telescope": "^5.2.5",
"mockery/mockery": "^1.6.12",
"nunomaduro/collision": "^8.4.0",
"phpunit/phpunit": "^11.4.1",
"nunomaduro/collision": "^8.5.0",
"phpunit/phpunit": "^11.4.3",
"spatie/laravel-ignition": "^2.8.0",
"tightenco/duster": "^3.0.3"
},
Expand Down
Loading

0 comments on commit ddcd161

Please sign in to comment.