From 5db1106c37689c49150af16a1672e264b5d8bf63 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 21:57:31 +0100 Subject: [PATCH 01/14] Adds support for influxdb version 1 --- app/Console/Commands/TestInfluxConnection.php | 62 ++++++++++ .../InfluxDBConnectionErrorException.php | 10 ++ .../InfluxDBNotEnabledException.php | 10 ++ app/Observers/SpeedtestObserver.php | 31 +++++ app/Providers/EventServiceProvider.php | 4 +- app/Speedtest.php | 14 +++ app/Utils/InfluxDB/InfluxDB.php | 104 ++++++++++++++++ .../InfluxDB/InfluxDBVersion1Wrapper.php | 71 +++++++++++ .../InfluxDB/InfluxDBWrapperInterface.php | 13 ++ composer.json | 2 + composer.lock | 114 +++++++++++++++++- config/services.php | 5 + ...21_04_10_182503_add_influx_db_settings.php | 74 ++++++++++++ 13 files changed, 512 insertions(+), 2 deletions(-) create mode 100644 app/Console/Commands/TestInfluxConnection.php create mode 100644 app/Exceptions/InfluxDBConnectionErrorException.php create mode 100644 app/Exceptions/InfluxDBNotEnabledException.php create mode 100644 app/Observers/SpeedtestObserver.php create mode 100644 app/Utils/InfluxDB/InfluxDB.php create mode 100644 app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php create mode 100644 app/Utils/InfluxDB/InfluxDBWrapperInterface.php create mode 100644 database/migrations/2021_04_10_182503_add_influx_db_settings.php diff --git a/app/Console/Commands/TestInfluxConnection.php b/app/Console/Commands/TestInfluxConnection.php new file mode 100644 index 00000000..ae789eeb --- /dev/null +++ b/app/Console/Commands/TestInfluxConnection.php @@ -0,0 +1,62 @@ +enabled = (bool) SettingsHelper::get('influx_db_enabled')->value; + } + + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { + if (!$this->enabled) { + $this->warn('InfluxDB is not enabled'); + exit; + } + + try { + InfluxDB::connect(); + $this->info('Connected successfully'); + } catch (InfluxDBConnectionErrorException $e) { + $this->error('Couldn\'t connect'); + return 1; + } + + return 0; + } +} diff --git a/app/Exceptions/InfluxDBConnectionErrorException.php b/app/Exceptions/InfluxDBConnectionErrorException.php new file mode 100644 index 00000000..24266020 --- /dev/null +++ b/app/Exceptions/InfluxDBConnectionErrorException.php @@ -0,0 +1,10 @@ +store($speedtest); + } catch (InfluxDBNotEnabledException $e) { + info('not enabled'); + } catch (Exception $e) { + Log::error($e); + } + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index b33e65d5..25c07449 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -10,6 +10,8 @@ use App\Listeners\SpeedtestCompleteListener; use App\Listeners\SpeedtestFailedListener; use App\Listeners\SpeedtestOverviewListener; use App\Listeners\TestNotificationListener; +use App\Observers\SpeedtestObserver; +use App\Speedtest; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; @@ -49,6 +51,6 @@ class EventServiceProvider extends ServiceProvider { parent::boot(); - // + Speedtest::observe(SpeedtestObserver::class); } } diff --git a/app/Speedtest.php b/app/Speedtest.php index f0bc85ad..f7dbe02e 100644 --- a/app/Speedtest.php +++ b/app/Speedtest.php @@ -25,4 +25,18 @@ class Speedtest extends Model ]; protected $table = 'speedtests'; + + public function formatForInfluxDB() + { + return [ + 'id' => (int) $this->id, + 'download' => (float) $this->download, + 'upload' => (float) $this->upload, + 'ping' => (float) $this->ping, + 'server_id' => (int) $this->server_id, + 'server_host' => $this->server_host, + 'server_name' => $this->server_name, + 'scheduled' => (bool) $this->scheduled, + ]; + } } diff --git a/app/Utils/InfluxDB/InfluxDB.php b/app/Utils/InfluxDB/InfluxDB.php new file mode 100644 index 00000000..ebe9a00b --- /dev/null +++ b/app/Utils/InfluxDB/InfluxDB.php @@ -0,0 +1,104 @@ +client = $client; + } + + /** + * Connect to influx db + * + * @param string $host + * @param integer $port + * @param string $database + * @return InfluxDB + */ + public static function connect() + { + if (!(bool) SettingsHelper::get('influx_db_enabled')->value) { + throw new InfluxDBNotEnabledException(); + } + + $host = SettingsHelper::get('influx_db_host')->value; + $port = SettingsHelper::get('influx_db_port')->value; + $token = ''; + $database = SettingsHelper::get('influx_db_database')->value; + $version = (int) SettingsHelper::get('influx_db_version')->value; + + $wrapper = $version === 1 + ? new InfluxDBVersion1Wrapper( + new Version1(str_replace(['http://', 'https://'], '', $host), $port) + ) + : new InfluxDBVersion2Wrapper( + new Version2([]) + ); + + return (new self($wrapper))->setDatabase($database) + ->testConnection(); + } + + /** + * Set the database field + * + * @param string $database + * @return InfluxDB + */ + public function setDatabase(string $database): InfluxDB + { + $this->database = $database; + + return $this; + } + + /** + * Test the connection + * + * @throws InfluxDBConnectionErrorException + * @return InfluxDB + */ + public function testConnection(): InfluxDB + { + if (!$this->client->testConnection()) { + throw new InfluxDBConnectionErrorException(); + } + + if (!$this->doesDatabaseExist()) { + $this->createDatabase(); + } + + return $this; + } + + public function doesDatabaseExist(): bool + { + return $this->client->doesDatabaseExist($this->database); + } + + public function createDatabase(): bool + { + return $this->client->createDatabase($this->database); + } + + public function store(Speedtest $speedtest): InfluxDB + { + $this->client->store($speedtest); + + return $this; + } +} diff --git a/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php new file mode 100644 index 00000000..7f4cabec --- /dev/null +++ b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php @@ -0,0 +1,71 @@ +client = $client; + } + + public function testConnection(): bool + { + try { + $this->client->listDatabases(); + + return true; + } catch (Exception $e) { + Log::error($e); + + return false; + } + } + + public function doesDatabaseExist(string $database): bool + { + $this->database = $this->client->selectDB($database); + + return (bool) $this->database->exists(); + } + + public function createDatabase(string $database): bool + { + try { + $this->database->create(new RetentionPolicy( + 'speedtest_retention_policy', + config('services.influxdb.retention'), + 1, + true + )); + + return true; + } catch (Exception $e) { + Log::error($e); + return false; + } + } + + public function store(Speedtest $speedtest): bool + { + return $this->database->writePoints([ + new Point( + 'speedtest', + null, + ['host' => config('services.influxdb.host')], + $speedtest->formatForInfluxDB(), + ) + ]); + } +} diff --git a/app/Utils/InfluxDB/InfluxDBWrapperInterface.php b/app/Utils/InfluxDB/InfluxDBWrapperInterface.php new file mode 100644 index 00000000..3c72c7ea --- /dev/null +++ b/app/Utils/InfluxDB/InfluxDBWrapperInterface.php @@ -0,0 +1,13 @@ +=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.4|^9.1", + "squizlabs/php_codesniffer": "~2.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "InfluxDB2\\": "src/InfluxDB2" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "InfluxDB (v2+) Client Library for PHP", + "homepage": "https://www.github.com/influxdata/influxdb-client-php", + "keywords": [ + "influxdb" + ], + "support": { + "issues": "https://github.com/influxdata/influxdb-client-php/issues", + "source": "https://github.com/influxdata/influxdb-client-php/tree/1.12.0" + }, + "time": "2021-04-01T06:28:57+00:00" + }, + { + "name": "influxdb/influxdb-php", + "version": "1.15.2", + "source": { + "type": "git", + "url": "https://github.com/influxdata/influxdb-php.git", + "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/influxdata/influxdb-php/zipball/d6e59f4f04ab9107574fda69c2cbe36671253d03", + "reference": "d6e59f4f04ab9107574fda69c2cbe36671253d03", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0|^7.0", + "php": "^5.5 || ^7.0 || ^8.0" + }, + "require-dev": { + "dms/phpunit-arraysubset-asserts": "^0.2.1", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "ext-curl": "Curl extension, needed for Curl driver", + "stefanotorresi/influxdb-php-async": "An asyncronous client for InfluxDB, implemented via ReactPHP." + }, + "type": "library", + "autoload": { + "psr-4": { + "InfluxDB\\": "src/InfluxDB" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Stephen Hoogendijk", + "email": "stephen@tca0.nl" + }, + { + "name": "Daniel Martinez", + "email": "danimartcas@hotmail.com" + }, + { + "name": "Gianluca Arbezzano", + "email": "gianarb92@gmail.com" + } + ], + "description": "InfluxDB client library for PHP", + "keywords": [ + "client", + "influxdata", + "influxdb", + "influxdb class", + "influxdb client", + "influxdb library", + "time series" + ], + "support": { + "issues": "https://github.com/influxdata/influxdb-php/issues", + "source": "https://github.com/influxdata/influxdb-php/tree/1.15.2" + }, + "time": "2020-12-26T17:45:17+00:00" + }, { "name": "laravel-notification-channels/telegram", "version": "0.5.1", diff --git a/config/services.php b/config/services.php index 88eb96e4..c966d76e 100644 --- a/config/services.php +++ b/config/services.php @@ -34,4 +34,9 @@ return [ 'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE') ], + 'influxdb' => [ + 'retention' => env('INFLUXDB_RETENTION', '30d'), + 'host' => env('INFLUXDB_HOST_TAG', 'speedtest'), + ], + ]; diff --git a/database/migrations/2021_04_10_182503_add_influx_db_settings.php b/database/migrations/2021_04_10_182503_add_influx_db_settings.php new file mode 100644 index 00000000..2a1e66eb --- /dev/null +++ b/database/migrations/2021_04_10_182503_add_influx_db_settings.php @@ -0,0 +1,74 @@ + 'influx_db_enabled', + 'value' => false, + 'description' => 'Enable the InfluxDB integration for speedtests.' + ]); + } + + if (!SettingsHelper::get('influx_db_host')) { + Setting::create([ + 'name' => 'influx_db_host', + 'value' => '', + 'description' => 'InfluxDB hostname, include the protocol (http:// or https://).' + ]); + } + + if (!SettingsHelper::get('influx_db_port')) { + Setting::create([ + 'name' => 'influx_db_port', + 'value' => '', + 'description' => 'InfluxDB port' + ]); + } + + if (!SettingsHelper::get('influx_db_database')) { + Setting::create([ + 'name' => 'influx_db_database', + 'value' => '', + 'description' => 'InfluxDB database' + ]); + } + + if (!SettingsHelper::get('influx_db_version')) { + Setting::create([ + 'name' => 'influx_db_version', + 'value' => 1, + 'description' => 'InfluxDB version' + ]); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Setting::whereIn('name', [ + 'influx_db_enabled', + 'influx_db_host', + 'influx_db_port', + 'influx_db_database', + 'influx_db_version', + ])->delete(); + } +} From 4e6049b7ece86b26febab038de80888f5eae21b5 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 21:58:41 +0100 Subject: [PATCH 02/14] Remove logging --- app/Observers/SpeedtestObserver.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Observers/SpeedtestObserver.php b/app/Observers/SpeedtestObserver.php index 61439423..2ba992e1 100644 --- a/app/Observers/SpeedtestObserver.php +++ b/app/Observers/SpeedtestObserver.php @@ -18,12 +18,11 @@ class SpeedtestObserver */ public function created(Speedtest $speedtest) { - info('trying influx'); try { InfluxDB::connect() ->store($speedtest); } catch (InfluxDBNotEnabledException $e) { - info('not enabled'); + // / } catch (Exception $e) { Log::error($e); } From 845359726d31c74453ca0e64d6fb0c003f9a631f Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 22:02:27 +0100 Subject: [PATCH 03/14] Formatting --- app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php index 7f4cabec..d3fec128 100644 --- a/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php +++ b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php @@ -43,12 +43,14 @@ class InfluxDBVersion1Wrapper implements InfluxDBWrapperInterface public function createDatabase(string $database): bool { try { - $this->database->create(new RetentionPolicy( - 'speedtest_retention_policy', - config('services.influxdb.retention'), - 1, - true - )); + $this->database->create( + new RetentionPolicy( + 'speedtest_retention_policy', + config('services.influxdb.retention'), + 1, + true + ) + ); return true; } catch (Exception $e) { From 7b16f1ab09a276be40d050605e65eed786de0d98 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 22:08:07 +0100 Subject: [PATCH 04/14] Remove influx console command --- app/Console/Commands/TestInfluxConnection.php | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 app/Console/Commands/TestInfluxConnection.php diff --git a/app/Console/Commands/TestInfluxConnection.php b/app/Console/Commands/TestInfluxConnection.php deleted file mode 100644 index ae789eeb..00000000 --- a/app/Console/Commands/TestInfluxConnection.php +++ /dev/null @@ -1,62 +0,0 @@ -enabled = (bool) SettingsHelper::get('influx_db_enabled')->value; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - if (!$this->enabled) { - $this->warn('InfluxDB is not enabled'); - exit; - } - - try { - InfluxDB::connect(); - $this->info('Connected successfully'); - } catch (InfluxDBConnectionErrorException $e) { - $this->error('Couldn\'t connect'); - return 1; - } - - return 0; - } -} From 0b8ccfd8d34ab624c96715308fd16140957f70bf Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 22:27:31 +0100 Subject: [PATCH 05/14] Added speedtest seeder --- app/Speedtest.php | 3 ++ composer.json | 10 +++--- database/factories/SpeedtestFactory.php | 31 +++++++++++++++++++ .../{seeds => seeders}/DatabaseSeeder.php | 5 ++- database/seeders/SpeedtestSeeder.php | 21 +++++++++++++ 5 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 database/factories/SpeedtestFactory.php rename database/{seeds => seeders}/DatabaseSeeder.php (64%) create mode 100644 database/seeders/SpeedtestSeeder.php diff --git a/app/Speedtest.php b/app/Speedtest.php index f7dbe02e..80cb2644 100644 --- a/app/Speedtest.php +++ b/app/Speedtest.php @@ -2,10 +2,13 @@ namespace App; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Speedtest extends Model { + use HasFactory; + /** * The attributes that are mass assignable. * diff --git a/composer.json b/composer.json index fe020273..aa56ac7e 100644 --- a/composer.json +++ b/composer.json @@ -47,12 +47,10 @@ }, "autoload": { "psr-4": { - "App\\": "app/" - }, - "classmap": [ - "database/seeds", - "database/factories" - ] + "App\\": "app/", + "Database\\Factories\\": "database/factories/", + "Database\\Seeders\\": "database/seeders/" + } }, "autoload-dev": { "psr-4": { diff --git a/database/factories/SpeedtestFactory.php b/database/factories/SpeedtestFactory.php new file mode 100644 index 00000000..f2a59d93 --- /dev/null +++ b/database/factories/SpeedtestFactory.php @@ -0,0 +1,31 @@ + rand(15, 900), + 'upload' => rand(15, 900), + 'ping' => rand(1, 25), + 'scheduled' => (bool) rand(0, 1), + ]; + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php similarity index 64% rename from database/seeds/DatabaseSeeder.php rename to database/seeders/DatabaseSeeder.php index 237dfc5d..79580814 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -1,5 +1,8 @@ call(UserSeeder::class); + $this->call(SpeedtestSeeder::class); } } diff --git a/database/seeders/SpeedtestSeeder.php b/database/seeders/SpeedtestSeeder.php new file mode 100644 index 00000000..1b8ed32f --- /dev/null +++ b/database/seeders/SpeedtestSeeder.php @@ -0,0 +1,21 @@ +count(250) + ->create(); + } +} From 99c64af48207c51c25aef08b6e50e295b270884d Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 22:32:51 +0100 Subject: [PATCH 06/14] Move models into Models dir --- app/Actions/GetFailedSpeedtestData.php | 2 +- app/Actions/GetLatestSpeedtestData.php | 2 +- app/Actions/GetSpeedtestTimeData.php | 2 +- app/Helpers/BackupHelper.php | 2 +- app/Helpers/EmailVerificationHelper.php | 2 +- app/Helpers/SettingsHelper.php | 2 +- app/Helpers/SpeedtestHelper.php | 2 +- app/Http/Controllers/AuthController.php | 2 +- app/Http/Controllers/SettingsController.php | 2 +- app/Http/Controllers/SpeedtestController.php | 2 +- app/Interfaces/SpeedtestProvider.php | 2 +- app/{ => Models}/Setting.php | 2 +- app/{ => Models}/Speedtest.php | 2 +- app/{ => Models}/User.php | 4 ++-- app/Observers/SpeedtestObserver.php | 2 +- app/Providers/EventServiceProvider.php | 2 +- app/Utils/InfluxDB/InfluxDB.php | 2 +- .../InfluxDB/InfluxDBVersion1Wrapper.php | 2 +- .../InfluxDB/InfluxDBWrapperInterface.php | 2 +- app/Utils/OoklaTester.php | 2 +- database/factories/SpeedtestFactory.php | 2 +- database/factories/UserFactory.php | 2 +- .../2014_10_12_000000_create_users_table.php | 2 +- ...020_05_18_211812_create_settings_table.php | 2 +- ...6_21_171849_add_notifications_settings.php | 2 +- .../2020_07_06_105930_add_graph_settings.php | 2 +- ...215412_add_notification_agent_settings.php | 2 +- ...08_12_123941_add_healthchecks_settings.php | 2 +- ..._21_133343_add_authentication_settings.php | 2 +- ...add_conditional_notifications_settings.php | 2 +- ...8_192136_add_show_failed_tests_setting.php | 2 +- ..._09_10_231121_add_widget_card_settings.php | 2 +- ...19_211232_add_schedule_enabled_setting.php | 2 +- ...2020_12_19_234248_add_app_name_setting.php | 2 +- ...001345_add_custom_healthchecks_setting.php | 2 +- ..._101259_add_speedtest_provider_setting.php | 2 +- ..._update_speedtest_server_settings_text.php | 2 +- ..._10_082758_add_visible_columns_setting.php | 2 +- ...4_10_102320_add_hidden_columns_setting.php | 2 +- ...21_04_10_182503_add_influx_db_settings.php | 2 +- database/seeders/SpeedtestSeeder.php | 2 +- database/speed.db | Bin 139264 -> 139264 bytes routes/api.php | 2 +- tests/Feature/APISpeedtestTest.php | 2 +- .../SpeedtestController/DeleteTest.php | 2 +- .../SpeedtestController/LatestTest.php | 2 +- .../SpeedtestHelper/AbsoluteThresholdTest.php | 2 +- .../SpeedtestHelper/FailureRateTest.php | 2 +- .../PercentageThresholdTest.php | 2 +- .../SpeedtestCompleteListener/SlackTest.php | 2 +- .../TelegramTest.php | 2 +- .../SpeedtestFailedListener/SlackTest.php | 2 +- .../SpeedtestFailedListener/TelegramTest.php | 2 +- .../SpeedtestOverviewListener/SlackTest.php | 2 +- .../TelegramTest.php | 2 +- 55 files changed, 55 insertions(+), 55 deletions(-) rename app/{ => Models}/Setting.php (95%) rename app/{ => Models}/Speedtest.php (97%) rename app/{ => Models}/User.php (97%) diff --git a/app/Actions/GetFailedSpeedtestData.php b/app/Actions/GetFailedSpeedtestData.php index 7ffd586a..652f85c7 100644 --- a/app/Actions/GetFailedSpeedtestData.php +++ b/app/Actions/GetFailedSpeedtestData.php @@ -2,7 +2,7 @@ namespace App\Actions; -use App\Speedtest; +use App\Models\Speedtest; use Cache; use Carbon\Carbon; use DB; diff --git a/app/Actions/GetLatestSpeedtestData.php b/app/Actions/GetLatestSpeedtestData.php index ec6b8044..bc456ded 100644 --- a/app/Actions/GetLatestSpeedtestData.php +++ b/app/Actions/GetLatestSpeedtestData.php @@ -4,7 +4,7 @@ namespace App\Actions; use App\Helpers\SettingsHelper; use App\Helpers\SpeedtestHelper; -use App\Speedtest; +use App\Models\Speedtest; use DB; use Henrywhitaker3\LaravelActions\Interfaces\ActionInterface; diff --git a/app/Actions/GetSpeedtestTimeData.php b/app/Actions/GetSpeedtestTimeData.php index 105baa00..d2b15988 100644 --- a/app/Actions/GetSpeedtestTimeData.php +++ b/app/Actions/GetSpeedtestTimeData.php @@ -3,7 +3,7 @@ namespace App\Actions; use App\Helpers\SettingsHelper; -use App\Speedtest; +use App\Models\Speedtest; use Cache; use Carbon\Carbon; use Henrywhitaker3\LaravelActions\Interfaces\ActionInterface; diff --git a/app/Helpers/BackupHelper.php b/app/Helpers/BackupHelper.php index 48c332d9..1ec966a0 100644 --- a/app/Helpers/BackupHelper.php +++ b/app/Helpers/BackupHelper.php @@ -2,7 +2,7 @@ namespace App\Helpers; -use App\Speedtest; +use App\Models\Speedtest; use Cache; use DateTime; use Exception; diff --git a/app/Helpers/EmailVerificationHelper.php b/app/Helpers/EmailVerificationHelper.php index d12fc5ca..a6a3bedd 100644 --- a/app/Helpers/EmailVerificationHelper.php +++ b/app/Helpers/EmailVerificationHelper.php @@ -3,7 +3,7 @@ namespace App\Helpers; use App\Auth\EmailVerification; -use App\User; +use App\Models\User; class EmailVerificationHelper { public static function checkVerificationAttempt($userID, $token) diff --git a/app/Helpers/SettingsHelper.php b/app/Helpers/SettingsHelper.php index 767f70e3..3a9fb7bd 100644 --- a/app/Helpers/SettingsHelper.php +++ b/app/Helpers/SettingsHelper.php @@ -3,7 +3,7 @@ namespace App\Helpers; use App\Events\TestNotificationEvent; -use App\Setting; +use App\Models\Setting; use Cache; use Carbon\Carbon; diff --git a/app/Helpers/SpeedtestHelper.php b/app/Helpers/SpeedtestHelper.php index b4bf3e10..a5b9c1d6 100644 --- a/app/Helpers/SpeedtestHelper.php +++ b/app/Helpers/SpeedtestHelper.php @@ -2,7 +2,7 @@ namespace App\Helpers; -use App\Speedtest; +use App\Models\Speedtest; use App\Utils\OoklaTester; use Carbon\Carbon; use Exception; diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 2a610fe9..c712ac59 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Auth; use App\Http\Controllers\Controller; use App\LoginSession; use App\Rules\CurrentPasswordMatches; -use App\User; +use App\Models\User; use DateTime; use Hash; use Illuminate\Support\Facades\Request as RequestFacade; diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 4d7202d6..b8359c37 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers; use App\Helpers\SettingsHelper; use App\Rules\Cron; -use App\Setting; +use App\Models\Setting; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Validator; diff --git a/app/Http/Controllers/SpeedtestController.php b/app/Http/Controllers/SpeedtestController.php index f4204ff0..20169675 100644 --- a/app/Http/Controllers/SpeedtestController.php +++ b/app/Http/Controllers/SpeedtestController.php @@ -9,7 +9,7 @@ use App\Actions\QueueSpeedtest; use App\Helpers\SettingsHelper; use App\Helpers\SpeedtestHelper; use App\Jobs\SpeedtestJob; -use App\Speedtest; +use App\Models\Speedtest; use Carbon\Carbon; use Exception; use Illuminate\Http\Request; diff --git a/app/Interfaces/SpeedtestProvider.php b/app/Interfaces/SpeedtestProvider.php index f0124d7f..6a9ad0fe 100644 --- a/app/Interfaces/SpeedtestProvider.php +++ b/app/Interfaces/SpeedtestProvider.php @@ -2,7 +2,7 @@ namespace App\Interfaces; -use App\Speedtest; +use App\Models\Speedtest; interface SpeedtestProvider { diff --git a/app/Setting.php b/app/Models/Setting.php similarity index 95% rename from app/Setting.php rename to app/Models/Setting.php index 075fa304..3f208599 100644 --- a/app/Setting.php +++ b/app/Models/Setting.php @@ -1,6 +1,6 @@ attributes['password'] = Hash::make($password); } } diff --git a/app/Observers/SpeedtestObserver.php b/app/Observers/SpeedtestObserver.php index 2ba992e1..1ad26d27 100644 --- a/app/Observers/SpeedtestObserver.php +++ b/app/Observers/SpeedtestObserver.php @@ -3,7 +3,7 @@ namespace App\Observers; use App\Exceptions\InfluxDBNotEnabledException; -use App\Speedtest; +use App\Models\Speedtest; use App\Utils\InfluxDB\InfluxDB; use Exception; use Log; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 25c07449..e343a8b6 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -11,7 +11,7 @@ use App\Listeners\SpeedtestFailedListener; use App\Listeners\SpeedtestOverviewListener; use App\Listeners\TestNotificationListener; use App\Observers\SpeedtestObserver; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; diff --git a/app/Utils/InfluxDB/InfluxDB.php b/app/Utils/InfluxDB/InfluxDB.php index ebe9a00b..e283790c 100644 --- a/app/Utils/InfluxDB/InfluxDB.php +++ b/app/Utils/InfluxDB/InfluxDB.php @@ -5,7 +5,7 @@ namespace App\Utils\InfluxDB; use App\Exceptions\InfluxDBConnectionErrorException; use App\Exceptions\InfluxDBNotEnabledException; use App\Helpers\SettingsHelper; -use App\Speedtest; +use App\Models\Speedtest; use InfluxDB\Client as Version1; use InfluxDB2\Client as Version2; use App\Utils\InfluxDB\InfluxDBWrapperInterface as Client; diff --git a/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php index d3fec128..d8192a5d 100644 --- a/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php +++ b/app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php @@ -2,7 +2,7 @@ namespace App\Utils\InfluxDB; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use InfluxDB\Client; use InfluxDB\Database; diff --git a/app/Utils/InfluxDB/InfluxDBWrapperInterface.php b/app/Utils/InfluxDB/InfluxDBWrapperInterface.php index 3c72c7ea..e91df405 100644 --- a/app/Utils/InfluxDB/InfluxDBWrapperInterface.php +++ b/app/Utils/InfluxDB/InfluxDBWrapperInterface.php @@ -2,7 +2,7 @@ namespace App\Utils\InfluxDB; -use App\Speedtest; +use App\Models\Speedtest; interface InfluxDBWrapperInterface { diff --git a/app/Utils/OoklaTester.php b/app/Utils/OoklaTester.php index 74e617da..f127b08f 100644 --- a/app/Utils/OoklaTester.php +++ b/app/Utils/OoklaTester.php @@ -6,7 +6,7 @@ use App\Exceptions\SpeedtestFailureException; use App\Helpers\SettingsHelper; use App\Helpers\SpeedtestHelper; use App\Interfaces\SpeedtestProvider; -use App\Speedtest; +use App\Models\Speedtest; use Cache; use Exception; use JsonException; diff --git a/database/factories/SpeedtestFactory.php b/database/factories/SpeedtestFactory.php index f2a59d93..4cc2efc3 100644 --- a/database/factories/SpeedtestFactory.php +++ b/database/factories/SpeedtestFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Database\Eloquent\Factories\Factory; class SpeedtestFactory extends Factory diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 741edead..fa9360e7 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,7 +2,7 @@ /** @var \Illuminate\Database\Eloquent\Factory $factory */ -use App\User; +use App\Models\User; use Faker\Generator as Faker; use Illuminate\Support\Str; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 4bfd7b91..5d0ad5dc 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,6 +1,6 @@ %)sO0T9y6H<5K@^WBttSY-P1i&HIoDqk^mtgke3h;o0{pGOp~7O zrmH(MK~SpWW3MhQtAeiA_3?3)1y=F8xcGkXQLd}&s@IR}imw$P$hs>&?kdXN-Fr^; zW2(CUlP$RFMf^APWai)hU!DK?o>QkzRiDR^LkIFzLzyX6=JcwPCd&w=WT&DK;=h>? zGQi(a{*LkYoA}$u->nyI{j&7G{20TR{bek)lf?Yzlf>~vFupPNaP+;AcZN4dUgSSt z-X45B7zl_X;|mEO0VMF8B2Yga3ihpAM_<09s!tURvuqf-s$o{m#oxla5AWS|bgy!B z*Chw`Dg%oj3@Doi^0@&eU#uD@jEYh$Rh43`P*BR1{G47nt(-JYD|)S3$`_|A#+*^C zZdC@#`QnKIWu{Q#jd4rB&AHNik=yvux<0Cvm-v7mRIeJjtX>^Za{RYye$L>Bs+Gkb zU1rm$oH8m|N5I^-X)Nk<#(;84uT0PCl|}Px$>fJ#G}kHx=bz^EtdXk~3?6hfUp&n* zY)%bw^^BhHFt&55vFXoH|)2Q;JoG`N@m~5?>zqw|# zY>8$O96Px0(6PPBzJq)AUMqs{RtzYm;^HTwgzUTxS}%$Q`_`CylvtRmC4c3`kh!@<7ZUV6r`sfka;JL0C*5;>|?I~Qj?7aFOwDp*^? zQI+-6jY?lN7F_3vUacB)D{k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Ex=pG zMV{0)DvGNcpjXO&_o~@+#NKuzF3lJj)K24TDnH z|I=$0=6vFyQLI;2@Xp6_ZS6H=pg-LZE$z-Z=(>sk`~SvG+^XM3bFuPULH^RGYls!- z^zLQvqWiy=F~2*fB3Cr`64wz7_W#S@v%vnpvfM2mU9~tieO$8|rkAeX!~VZmP)$>H z-hGDsf4!>ds?Bcf+t0B7Z{9TcVApj21N(n&Sl?z~5BvYxY;8Cv!v4SgjR@HP7thhN zzm?v?`_}gB!v0@Wr1UT3^cRE%0T2KI5C8!X009sH0T2KI5C8!X009sH0T2KI5C8!X z009sH0T2KI5C8!XSVUksn{e3w^VeWkZ9%<+DSgm2#gbOkE$^tfdD`Dn>CQW7O9&17 zfA?MJRV#sOtG>uazG2wd>DA3ed1*1&hQA7||L@q{!v24SZ%4JfB7yb)8SMYt-)r~n zty^9rb>FAK`u~QRShkZb4R8%_Kg0gt$JyM1{lA$AuHoKzGl?vavHt%oYqj4Fl4@CZ z-BBdi{|AY{{=Zd!mL2fdm;Jv?E&!5?9tI!+1V8`;KmY_l00ck)1V8`;KmY_l00ck) z1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`; wKmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l;D!_Ue`ChJv;Y7A diff --git a/routes/api.php b/routes/api.php index 939628e3..8970db36 100644 --- a/routes/api.php +++ b/routes/api.php @@ -7,7 +7,7 @@ use App\Http\Controllers\HomepageDataController; use App\Http\Controllers\SettingsController; use App\Http\Controllers\SpeedtestController; use App\Http\Controllers\UpdateController; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; diff --git a/tests/Feature/APISpeedtestTest.php b/tests/Feature/APISpeedtestTest.php index fa13e7d0..4c40ca10 100644 --- a/tests/Feature/APISpeedtestTest.php +++ b/tests/Feature/APISpeedtestTest.php @@ -2,7 +2,7 @@ namespace Tests\Feature; -use App\Speedtest; +use App\Models\Speedtest; use Faker\Factory; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; diff --git a/tests/Unit/Controllers/SpeedtestController/DeleteTest.php b/tests/Unit/Controllers/SpeedtestController/DeleteTest.php index 00e1ed95..4265c184 100644 --- a/tests/Unit/Controllers/SpeedtestController/DeleteTest.php +++ b/tests/Unit/Controllers/SpeedtestController/DeleteTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\Controllers\SpeedtestController; use App\Http\Controllers\SpeedtestController; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; diff --git a/tests/Unit/Controllers/SpeedtestController/LatestTest.php b/tests/Unit/Controllers/SpeedtestController/LatestTest.php index af7209cd..f1e18b53 100644 --- a/tests/Unit/Controllers/SpeedtestController/LatestTest.php +++ b/tests/Unit/Controllers/SpeedtestController/LatestTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\Controllers\SpeedtestController; use App\Http\Controllers\SpeedtestController; -use App\Speedtest; +use App\Models\Speedtest; use DB; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; diff --git a/tests/Unit/Helpers/SpeedtestHelper/AbsoluteThresholdTest.php b/tests/Unit/Helpers/SpeedtestHelper/AbsoluteThresholdTest.php index f257f6ff..b372dc50 100644 --- a/tests/Unit/Helpers/SpeedtestHelper/AbsoluteThresholdTest.php +++ b/tests/Unit/Helpers/SpeedtestHelper/AbsoluteThresholdTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Helpers\SpeedtestHelper; use App\Helpers\SettingsHelper; use App\Helpers\SpeedtestHelper; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Foundation\Testing\RefreshDatabase; use InvalidArgumentException; use Tests\TestCase; diff --git a/tests/Unit/Helpers/SpeedtestHelper/FailureRateTest.php b/tests/Unit/Helpers/SpeedtestHelper/FailureRateTest.php index fe32692e..50ab4332 100644 --- a/tests/Unit/Helpers/SpeedtestHelper/FailureRateTest.php +++ b/tests/Unit/Helpers/SpeedtestHelper/FailureRateTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\Helpers\SpeedtestHelper; use App\Helpers\SpeedtestHelper; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; diff --git a/tests/Unit/Helpers/SpeedtestHelper/PercentageThresholdTest.php b/tests/Unit/Helpers/SpeedtestHelper/PercentageThresholdTest.php index 2ac63c27..d3ab232a 100644 --- a/tests/Unit/Helpers/SpeedtestHelper/PercentageThresholdTest.php +++ b/tests/Unit/Helpers/SpeedtestHelper/PercentageThresholdTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Helpers\SpeedtestHelper; use App\Helpers\SettingsHelper; use App\Helpers\SpeedtestHelper; -use App\Speedtest; +use App\Models\Speedtest; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; diff --git a/tests/Unit/Listeners/SpeedtestCompleteListener/SlackTest.php b/tests/Unit/Listeners/SpeedtestCompleteListener/SlackTest.php index 65708a8e..72b94ffb 100644 --- a/tests/Unit/Listeners/SpeedtestCompleteListener/SlackTest.php +++ b/tests/Unit/Listeners/SpeedtestCompleteListener/SlackTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestCompleteListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestCompleteListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; diff --git a/tests/Unit/Listeners/SpeedtestCompleteListener/TelegramTest.php b/tests/Unit/Listeners/SpeedtestCompleteListener/TelegramTest.php index 8c37051b..17fd28a2 100644 --- a/tests/Unit/Listeners/SpeedtestCompleteListener/TelegramTest.php +++ b/tests/Unit/Listeners/SpeedtestCompleteListener/TelegramTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestCompleteListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestCompleteListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; diff --git a/tests/Unit/Listeners/SpeedtestFailedListener/SlackTest.php b/tests/Unit/Listeners/SpeedtestFailedListener/SlackTest.php index fea50dc1..1ab96fda 100644 --- a/tests/Unit/Listeners/SpeedtestFailedListener/SlackTest.php +++ b/tests/Unit/Listeners/SpeedtestFailedListener/SlackTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestFailedListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestFailedListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; diff --git a/tests/Unit/Listeners/SpeedtestFailedListener/TelegramTest.php b/tests/Unit/Listeners/SpeedtestFailedListener/TelegramTest.php index 2e273738..f437abe5 100644 --- a/tests/Unit/Listeners/SpeedtestFailedListener/TelegramTest.php +++ b/tests/Unit/Listeners/SpeedtestFailedListener/TelegramTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestFailedListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestFailedListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; diff --git a/tests/Unit/Listeners/SpeedtestOverviewListener/SlackTest.php b/tests/Unit/Listeners/SpeedtestOverviewListener/SlackTest.php index 8e471aa0..aa88395c 100644 --- a/tests/Unit/Listeners/SpeedtestOverviewListener/SlackTest.php +++ b/tests/Unit/Listeners/SpeedtestOverviewListener/SlackTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestOverviewListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestOverviewListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; diff --git a/tests/Unit/Listeners/SpeedtestOverviewListener/TelegramTest.php b/tests/Unit/Listeners/SpeedtestOverviewListener/TelegramTest.php index fb841e03..001e0189 100644 --- a/tests/Unit/Listeners/SpeedtestOverviewListener/TelegramTest.php +++ b/tests/Unit/Listeners/SpeedtestOverviewListener/TelegramTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit\Listeners\SpeedtestOverviewListener; use App\Helpers\SettingsHelper; use App\Listeners\SpeedtestOverviewListener; -use App\Speedtest; +use App\Models\Speedtest; use Exception; use Illuminate\Foundation\Testing\RefreshDatabase; use stdClass; From 7cf8dfc0b2d36fb6ea158f86c429a1878f91c2bd Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 22:55:19 +0100 Subject: [PATCH 07/14] Moved auth models into right folder --- .../Commands/ClearOldSessionsCommand.php | 2 +- app/Helpers/EmailVerificationHelper.php | 2 +- app/Http/Controllers/AuthController.php | 4 ++-- app/Http/Middleware/CheckActiveSession.php | 2 +- app/{ => Models}/Auth/EmailVerification.php | 2 +- app/{ => Models}/Auth/LoginSession.php | 2 +- database/speed.db | Bin 139264 -> 139264 bytes 7 files changed, 7 insertions(+), 7 deletions(-) rename app/{ => Models}/Auth/EmailVerification.php (86%) rename app/{ => Models}/Auth/LoginSession.php (91%) diff --git a/app/Console/Commands/ClearOldSessionsCommand.php b/app/Console/Commands/ClearOldSessionsCommand.php index b6d69933..223b2bf5 100644 --- a/app/Console/Commands/ClearOldSessionsCommand.php +++ b/app/Console/Commands/ClearOldSessionsCommand.php @@ -2,7 +2,7 @@ namespace App\Console\Commands; -use App\Auth\LoginSession; +use App\Models\Auth\LoginSession; use Carbon\Carbon; use Illuminate\Console\Command; use Log; diff --git a/app/Helpers/EmailVerificationHelper.php b/app/Helpers/EmailVerificationHelper.php index a6a3bedd..4d5695a7 100644 --- a/app/Helpers/EmailVerificationHelper.php +++ b/app/Helpers/EmailVerificationHelper.php @@ -2,7 +2,7 @@ namespace App\Helpers; -use App\Auth\EmailVerification; +use App\Models\Auth\EmailVerification; use App\Models\User; class EmailVerificationHelper { diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index c712ac59..abbf0564 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers; -use App\Auth\EmailVerification; -use App\Auth\LoginSession as AuthLoginSession; +use App\Models\Auth\EmailVerification; +use App\Models\Auth\LoginSession as AuthLoginSession; use App\Helpers\EmailVerificationHelper; use Illuminate\Support\Facades\Auth; use App\Http\Controllers\Controller; diff --git a/app/Http/Middleware/CheckActiveSession.php b/app/Http/Middleware/CheckActiveSession.php index 6b46bfb1..11c43a27 100644 --- a/app/Http/Middleware/CheckActiveSession.php +++ b/app/Http/Middleware/CheckActiveSession.php @@ -2,7 +2,7 @@ namespace App\Http\Middleware; -use App\Auth\LoginSession; +use App\Models\Auth\LoginSession; use Closure; use Exception; diff --git a/app/Auth/EmailVerification.php b/app/Models/Auth/EmailVerification.php similarity index 86% rename from app/Auth/EmailVerification.php rename to app/Models/Auth/EmailVerification.php index 7c9a96b2..c46b9bf7 100644 --- a/app/Auth/EmailVerification.php +++ b/app/Models/Auth/EmailVerification.php @@ -1,6 +1,6 @@ i>g&n7hNUf3&siUGf@^*=4GTaPjk<_ zJMZ0hCx6e9zh_x!Y%m!)j%%jWQyM6D3LSplWc+^QfWc6^2ObuBoz?MII@Zt;?H;M* zGTwO~viL`%7bdXIA%lk94nLg2X-7AV<4s2pGPvRh!5Dtv+y!ZjITaYiFP%O};SFa1 zlK7`{H;kZD^usWIB1-T%=EV>U;j-8cpW%Hm3MbLw>VgwE=#n9UU%5KrI4-+7;28ex z+6jXwxI5uf>~>YC-oDsm@1ca+HxQH($M+wNL_4K3X;nR-_07)@#^Xm0P7JEKiM>)MdaCmq+jyOUMb*}C68b33I@7@VV%&GJ?fPaPeC;s?R4eMSpS_bR^3J;Wjm!B z-A1V%Ull^JQUuC7lsZZ+#X>PtOqA+z8%j-{Jh`1W*y?~(Xn<=Xm6CmF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(=-Z_3xd>pms%rDnO8 zr}xvt}jqWb#GUJ(XdJRNd>-%j5^p}k;2HANp0NenRW;s`<7n_>=iu@7a2beU=y*hndT2DR*_yH!(606fY=c#-L>Uuy$ zqgn3d=^4|>-9Qq6NwdWA^sQ9IrY2vLUIzF9Ce3oMPaj~{vDX5AfJwFN_37K~Qi6P| zdv5U(bwA{Ym(SN_6BOvRz?5W%RBSr%Jz!Gc5~&7VQXk*+^+q6HfJwCiT)KF{=)IL4 z1Ka?UX8B!-_R+hfTf6+=DVLVdC5=kEXm{lYrQjVm8j%1JKmter2_OL^fCP{L5XRFon})!`)n zuVV$)q&k`DShdbJU9~YtMurm3P)->YGhZsUqiO!_@qnCT>37GH9N!QmsgbqL_;Y$y zpVCdEoq?9YEE`6yYM52`DtAkvIj}xR1~>IO4_z)*7E4L|p(VAB Date: Sat, 10 Apr 2021 22:57:11 +0100 Subject: [PATCH 08/14] Move influx interface into interfaces folder --- app/{Utils/InfluxDB => Interfaces}/InfluxDBWrapperInterface.php | 2 +- app/Utils/InfluxDB/InfluxDB.php | 2 +- app/Utils/InfluxDB/InfluxDBVersion1Wrapper.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename app/{Utils/InfluxDB => Interfaces}/InfluxDBWrapperInterface.php (90%) diff --git a/app/Utils/InfluxDB/InfluxDBWrapperInterface.php b/app/Interfaces/InfluxDBWrapperInterface.php similarity index 90% rename from app/Utils/InfluxDB/InfluxDBWrapperInterface.php rename to app/Interfaces/InfluxDBWrapperInterface.php index e91df405..329429b7 100644 --- a/app/Utils/InfluxDB/InfluxDBWrapperInterface.php +++ b/app/Interfaces/InfluxDBWrapperInterface.php @@ -1,6 +1,6 @@ Date: Sat, 10 Apr 2021 23:43:35 +0100 Subject: [PATCH 09/14] Added username/password fields --- app/Utils/InfluxDB/InfluxDB.php | 15 ++++++++++++--- ...021_04_10_182503_add_influx_db_settings.php | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/Utils/InfluxDB/InfluxDB.php b/app/Utils/InfluxDB/InfluxDB.php index 5664bed2..defe5f63 100644 --- a/app/Utils/InfluxDB/InfluxDB.php +++ b/app/Utils/InfluxDB/InfluxDB.php @@ -37,16 +37,25 @@ class InfluxDB $host = SettingsHelper::get('influx_db_host')->value; $port = SettingsHelper::get('influx_db_port')->value; - $token = ''; + $username = SettingsHelper::get('influx_db_username')->value; + $password = SettingsHelper::get('influx_db_password')->value; $database = SettingsHelper::get('influx_db_database')->value; $version = (int) SettingsHelper::get('influx_db_version')->value; $wrapper = $version === 1 ? new InfluxDBVersion1Wrapper( - new Version1(str_replace(['http://', 'https://'], '', $host), $port) + new Version1( + str_replace(['http://', 'https://'], '', $host), + $port, + $username, + $password + ) ) : new InfluxDBVersion2Wrapper( - new Version2([]) + new Version2([ + 'url' => $host . ':' . $port, + 'token' => '', + ]) ); return (new self($wrapper))->setDatabase($database) diff --git a/database/migrations/2021_04_10_182503_add_influx_db_settings.php b/database/migrations/2021_04_10_182503_add_influx_db_settings.php index 7ff7e8a5..33993cf3 100644 --- a/database/migrations/2021_04_10_182503_add_influx_db_settings.php +++ b/database/migrations/2021_04_10_182503_add_influx_db_settings.php @@ -47,6 +47,22 @@ class AddInfluxDbSettings extends Migration ]); } + if (!SettingsHelper::get('influx_db_username')) { + Setting::create([ + 'name' => 'influx_db_username', + 'value' => '', + 'description' => 'InfluxDB username' + ]); + } + + if (!SettingsHelper::get('influx_db_password')) { + Setting::create([ + 'name' => 'influx_db_password', + 'value' => '', + 'description' => 'InfluxDB password' + ]); + } + if (!SettingsHelper::get('influx_db_version')) { Setting::create([ 'name' => 'influx_db_version', @@ -68,6 +84,8 @@ class AddInfluxDbSettings extends Migration 'influx_db_host', 'influx_db_port', 'influx_db_database', + 'influx_db_username', + 'influx_db_password', 'influx_db_version', ])->delete(); } From 91b7ec7fab3af4de7cc96ffc099707216e9c174d Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sat, 10 Apr 2021 23:48:29 +0100 Subject: [PATCH 10/14] Added helm chart to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1b738472..1abcee48 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,7 @@ After enabling, you should change the password through the web UI. ### Manual Install For manual installations, please follow the instructions [here](https://github.com/henrywhitaker3/Speedtest-Tracker/wiki/Manual-Installation). + +### Kubernetes + +There is a 3rd party helm chart available [here](https://github.com/sOblivionsCall/charts). From f809f816c166b190b0c2908c0d9a36ebec8df448 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 11 Apr 2021 08:46:01 +0100 Subject: [PATCH 11/14] Used a mock ooklatester in tests Speed up test suite --- README.md | 5 +- app/Helpers/SpeedtestHelper.php | 3 +- .../InfluxDB/InfluxDBVersion2Wrapper.php | 37 +++++++++++ changelog.json | 6 ++ config/speedtest.php | 2 +- database/factories/SpeedtestFactory.php | 1 + database/speed.db | Bin 139264 -> 139264 bytes tests/Feature/SpeedtestTest.php | 14 +++++ .../InfluxDB/InfluxDBWrapperWrapperTest.php | 26 ++++++++ tests/Mocks/OoklaTesterMocker.php | 59 ++++++++++++++++++ .../SpeedtestHelper/CheckOutputTest.php | 2 + .../Helpers/SpeedtestHelper/SpeedtestTest.php | 13 +--- 12 files changed, 154 insertions(+), 14 deletions(-) create mode 100644 app/Utils/InfluxDB/InfluxDBVersion2Wrapper.php create mode 100644 tests/Feature/Utils/InfluxDB/InfluxDBWrapperWrapperTest.php create mode 100644 tests/Mocks/OoklaTesterMocker.php diff --git a/README.md b/README.md index 1abcee48..c1ce12fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Speedtest Tracker -[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Stable?label=master&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Dev?label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.11.1-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE) +[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Stable?label=master&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Dev?label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.12.0-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE) This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results. @@ -18,6 +18,7 @@ Disclaimer: You will need to accept Ookla's EULA and privacy agreements in order - Slack/Discord/Telegram notifications - [healthchecks.io](https://healthchecks.io) integration - Organizr integration +- InfluxDB integration (currently v1 only, v2 is a WIP) ## Installation & Setup @@ -84,6 +85,8 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PUID` | Optional. Supply a local user ID for volume permissions | | `-e PGID` | Optional. Supply a local group ID for volume permissions | | `-e AUTH` | Optional. Set to 'true' to enable authentication for the app | +| `-e INFLUXDB_RETENTION`| Optional. Sets the InfluxDB retention period, defaults to `30d` | +| `-e INFLUXDB_HOST_TAG | Optional. Sets the InfluxDB host tag value, defaults to `speedtest` | ### Authentication diff --git a/app/Helpers/SpeedtestHelper.php b/app/Helpers/SpeedtestHelper.php index a5b9c1d6..016da06e 100644 --- a/app/Helpers/SpeedtestHelper.php +++ b/app/Helpers/SpeedtestHelper.php @@ -2,6 +2,7 @@ namespace App\Helpers; +use App\Interfaces\SpeedtestProvider; use App\Models\Speedtest; use App\Utils\OoklaTester; use Carbon\Carbon; @@ -25,7 +26,7 @@ class SpeedtestHelper */ public static function runSpeedtest() { - $tester = new OoklaTester(); + $tester = app()->make(SpeedtestProvider::class); return $tester->run(); } diff --git a/app/Utils/InfluxDB/InfluxDBVersion2Wrapper.php b/app/Utils/InfluxDB/InfluxDBVersion2Wrapper.php new file mode 100644 index 00000000..f7d24946 --- /dev/null +++ b/app/Utils/InfluxDB/InfluxDBVersion2Wrapper.php @@ -0,0 +1,37 @@ +client = $client; + } + + public function testConnection(): bool + { + return $this->client->health()->getStatus() !== 'pass'; + } + + public function doesDatabaseExist(string $database): bool + { + return true; + } + + public function createDatabase(string $database): bool + { + return true; + } + + public function store(Speedtest $speedtest): bool + { + return true; + } +} diff --git a/changelog.json b/changelog.json index 7302b2c9..89c3ab38 100644 --- a/changelog.json +++ b/changelog.json @@ -1,4 +1,10 @@ { + "1.12.0": [ + { + "description": "Added InfluxDB intergation.", + "link": "" + } + ], "1.11.1": [ { "description": "Add option to show/hide columns in the all tests table.", diff --git a/config/speedtest.php b/config/speedtest.php index 1db30b80..d39eaf89 100644 --- a/config/speedtest.php +++ b/config/speedtest.php @@ -7,7 +7,7 @@ return [ |-------------------------------------------------------------------------- */ - 'version' => '1.11.1', + 'version' => '1.12.0', /* |-------------------------------------------------------------------------- diff --git a/database/factories/SpeedtestFactory.php b/database/factories/SpeedtestFactory.php index 4cc2efc3..c09c6798 100644 --- a/database/factories/SpeedtestFactory.php +++ b/database/factories/SpeedtestFactory.php @@ -26,6 +26,7 @@ class SpeedtestFactory extends Factory 'upload' => rand(15, 900), 'ping' => rand(1, 25), 'scheduled' => (bool) rand(0, 1), + 'failed' => false, ]; } } diff --git a/database/speed.db b/database/speed.db index f2560a3d4a286bdf2a5fda0111761895fb767b4b..b84a194ab10a1a607e3d10c529090c1d7f9b40fb 100644 GIT binary patch delta 2180 zcmai!Uu;uV9LH}@v90a7_iS?vX?xpkY#o!8-9P=aE?XFrfdi-V<(~*t~im0dG7DzrPRL_zQO)A%l^Y|e; zeGN*)2S>u0cq*CZKGCMi9#3nvM0!z|j%G6Pa z4uriix9U;+0m*YT+9G-2!(F!5hFU@g4!smqGCeQGd&gz6EVez338+nn;H zJ#Bt>>h9=9x4Oa4}mw^eQ_BF%PKhILlJGirT}_PcAl zzLr>(Hmv`@ucfi^or}y|bn3T|m0bDxzX`1VVsJI!AjfYP#*C4SvC+5tBS-s(!|C)`Y9!)%QXWl5N0Q-0 zGZNE-nl*h#mJ>#N~TK3=jYP7=!rg{znWV z^57JMDF5e7eaV_qRB7Z6#|b1J*g(9^L;Vr~-C`rdci-X!!`Dz@2sCb{vm^r+t*E06;gLZIQ;MhM#%FIk2470qj3iD{iD|z#NO4j3}R{Z&(g$aI^DqJ zz@|zQp65thCtEs+$QBT9vB#)H$O4cXjGIDY=uc}Y?v6uhrYJc_|@VGbD6PF5QIuiL{pij?zs4!ZD)trp(GMcV=B#OLgF@FoWA3Upw~ z-T>`5XRn7h@K1ZSsO{6hmISuKme_9@T0YMvFYc|8wB>&vVknScWFVbZQ}Gc8g@Ou5 zs_`?Cv^ty`NzBVJRu$=2lxWoFb4L3c6sIQ=@i_y&zJSx)7xl=onB1@UUHH*UmQw>q znwpbG+QOlx7Ox!cdbPtJsFUA|hC;{HrqR*P*4FmdhB`y(p`)o*Polm>^}EirMBK95 z<&-^6mt5|41-+i2w?SuVzR~n9R3f>oILun>`!tnm+N){%P`AZ2QBB*MHf5rh=j;U) zY%^0jv%+v|(OBsqV}f{qo@EJkoE6f$^mCEWaq>5rBG<@wkMJ7n&W$H?E=TwSXLx-CmDv;tT?z# zHQ!*)Q*YvMY~9HreqP_tA&l8>4l$ms;t)S(EAtam8}|GF9@=Q*5VIRQ#!xqo;!W-I zl<$gSe3KXH51U;t=JiMzi-cosOi^(7o`m5iHJp+&Pu}MczNe!c;+LnVIm9blpXCU> zsm1lJ+c`onz6F41JqsnUvi&M;oa)_GViYF?rqV1uM-}m=IHCPc#ze#Gj_Kuhz@2l` nt2cc!30@AOq+rMV>bjguK@Z0zn}T)@q7K83i1iA62~hG6ob%j{ diff --git a/tests/Feature/SpeedtestTest.php b/tests/Feature/SpeedtestTest.php index 4efc6e17..e3560a20 100644 --- a/tests/Feature/SpeedtestTest.php +++ b/tests/Feature/SpeedtestTest.php @@ -3,14 +3,28 @@ namespace Tests\Feature; use App\Helpers\SpeedtestHelper; +use App\Interfaces\SpeedtestProvider; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; +use Tests\Mocks\OoklaTesterMocker; use Tests\TestCase; class SpeedtestTest extends TestCase { use RefreshDatabase; + public function setUp(): void + { + parent::setUp(); + + $this->app->singleton( + SpeedtestProvider::class, + function () { + return new OoklaTesterMocker(); + } + ); + } + /** * Runs a speedtest * diff --git a/tests/Feature/Utils/InfluxDB/InfluxDBWrapperWrapperTest.php b/tests/Feature/Utils/InfluxDB/InfluxDBWrapperWrapperTest.php new file mode 100644 index 00000000..2ccdc5e8 --- /dev/null +++ b/tests/Feature/Utils/InfluxDB/InfluxDBWrapperWrapperTest.php @@ -0,0 +1,26 @@ +expectException(InfluxDBNotEnabledException::class); + + InfluxDB::connect(); + } +} diff --git a/tests/Mocks/OoklaTesterMocker.php b/tests/Mocks/OoklaTesterMocker.php new file mode 100644 index 00000000..035696c3 --- /dev/null +++ b/tests/Mocks/OoklaTesterMocker.php @@ -0,0 +1,59 @@ +passes = $passes; + } + + public function run($output = null): Speedtest + { + $output = $output ?? $this->output(); + + try { + $output = json_decode($output, true, 512, JSON_THROW_ON_ERROR); + } catch (Exception $e) { + throw new SpeedtestFailureException(); + } + + return $this->passes + ? Speedtest::factory()->create() + : Speedtest::factory()->create([ + 'download' => 0, + 'upload' => 0, + 'ping' => 0, + 'failed' => true, + ]); + } + + public function output() + { + return !$this->passes + ? null + : json_encode([ + 'type' => 'result', + 'download' => ['bandwidth' => '50'], + 'upload' => ['bandwidth' => '50'], + 'ping' => ['latency' => '50'], + 'server' => [ + 'id' => '1', + 'name' => 'PHPUnit', + 'host' => 'phpunit', + 'port' => '443', + ], + 'result' => [ + 'url' => 'some-url', + ] + ]); + } +} diff --git a/tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php b/tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php index d017cb7b..febf818f 100644 --- a/tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php +++ b/tests/Unit/Helpers/SpeedtestHelper/CheckOutputTest.php @@ -4,6 +4,7 @@ namespace Tests\Unit\Helpers\SpeedtestHelper; use App\Utils\OoklaTester; use PHPUnit\Framework\TestCase; +use Tests\Mocks\OoklaTesterMocker; class CheckOutputTest extends TestCase { @@ -12,6 +13,7 @@ class CheckOutputTest extends TestCase public function setUp(): void { $this->speedtestProvider = new OoklaTester(); + $this->mocker = new OoklaTesterMocker(); } /** diff --git a/tests/Unit/Helpers/SpeedtestHelper/SpeedtestTest.php b/tests/Unit/Helpers/SpeedtestHelper/SpeedtestTest.php index 9c5db28f..7e4670bb 100644 --- a/tests/Unit/Helpers/SpeedtestHelper/SpeedtestTest.php +++ b/tests/Unit/Helpers/SpeedtestHelper/SpeedtestTest.php @@ -6,6 +6,7 @@ use App\Exceptions\SpeedtestFailureException; use App\Helpers\SpeedtestHelper; use App\Utils\OoklaTester; use Illuminate\Foundation\Testing\RefreshDatabase; +use Tests\Mocks\OoklaTesterMocker; use Tests\TestCase; class SpeedtestTest extends TestCase @@ -22,17 +23,7 @@ class SpeedtestTest extends TestCase $this->speedtestProvider = new OoklaTester(); - $this->output = $this->speedtestProvider->output(); - } - - /** - * A basic unit test example. - * - * @return void - */ - public function testOutputFunction() - { - $this->assertJson($this->output); + $this->output = (new OoklaTesterMocker())->output(); } /** From 48fbbc3713a3153eb719d0369bef2b627964da91 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 11 Apr 2021 09:13:13 +0100 Subject: [PATCH 12/14] Added version 1 fields to settings page --- public/js/app.js | 153 +++++++++++++++++- .../js/components/Settings/SettingsIndex.js | 24 ++- .../js/components/Settings/SettingsInput.js | 13 ++ .../js/components/Settings/SettingsTabs.js | 7 + .../Settings/tabs/InfluxDBSettings.js | 46 ++++++ 5 files changed, 240 insertions(+), 3 deletions(-) create mode 100644 resources/js/components/Settings/tabs/InfluxDBSettings.js diff --git a/public/js/app.js b/public/js/app.js index 24d6b2cc..e7ae6b17 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -146695,7 +146695,7 @@ var TableRow = /*#__PURE__*/function (_Component) { }); _defineProperty(_assertThisInitialized(_this), "delete", function (id) { - var url = 'api/speedtest/delete/' + id; + var url = 'api/speedtest/delete/' + id + '?token=' + window.token; axios__WEBPACK_IMPORTED_MODULE_3___default.a["delete"](url).then(function (resp) { console.log(resp); react_toastify__WEBPACK_IMPORTED_MODULE_4__["toast"].success('Speedtest deleted'); @@ -148414,6 +148414,22 @@ var SettingsIndex = /*#__PURE__*/function (_Component) { inline: true, earlyReturn: true, classes: 'mr-2' + }], + influxdb: [{ + obj: data.influx_db_enabled, + type: 'checkbox' + }, { + obj: data.influx_db_host, + type: 'text' + }, { + obj: data.influx_db_port, + type: 'number' + }, { + obj: data.influx_db_username, + type: 'text' + }, { + obj: data.influx_db_password, + type: 'password' }] }; }); @@ -148552,6 +148568,10 @@ var SettingsInput = /*#__PURE__*/function (_Component) { input = _this.generateTextInput(disabled); } + if (_this.state.type === 'password') { + input = _this.generatePasswordInput(disabled); + } + if (_this.state.type === 'btn-get') { input = _this.generateButtonGetInput(); } @@ -148665,6 +148685,17 @@ var SettingsInput = /*#__PURE__*/function (_Component) { onInput: this.handleInput }); } + }, { + key: "generatePasswordInput", + value: function generatePasswordInput(disabled) { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_1__["Form"].Control, { + name: this.state.name, + type: this.state.type, + defaultValue: this.state.value, + disabled: disabled, + onInput: this.handleInput + }); + } }, { key: "generateButtonGetInput", value: function generateButtonGetInput() { @@ -148723,6 +148754,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _tabs_NotificationsSettings__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tabs/NotificationsSettings */ "./resources/js/components/Settings/tabs/NotificationsSettings.js"); /* harmony import */ var _Authentication_Authentication__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Authentication/Authentication */ "./resources/js/components/Authentication/Authentication.js"); /* harmony import */ var _tabs_TableSettings__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./tabs/TableSettings */ "./resources/js/components/Settings/tabs/TableSettings.js"); +/* harmony import */ var _tabs_InfluxDBSettings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tabs/InfluxDBSettings */ "./resources/js/components/Settings/tabs/InfluxDBSettings.js"); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -148762,6 +148794,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope + var SettingsTabs = /*#__PURE__*/function (_Component) { _inherits(SettingsTabs, _Component); @@ -148775,7 +148808,7 @@ var SettingsTabs = /*#__PURE__*/function (_Component) { _this = _super.call(this, props); _defineProperty(_assertThisInitialized(_this), "generateTabs", function () { - var tabs = ['General', 'Graphs', 'Tables', 'Notifications', 'healthchecks.io', 'Reset', 'Backup/Restore']; + var tabs = ['General', 'Graphs', 'Tables', 'Notifications', 'healthchecks.io', 'InfluxDB', 'Reset', 'Backup/Restore']; if (window.config.auth) { tabs.push('Authentication'); @@ -148881,6 +148914,13 @@ var SettingsTabs = /*#__PURE__*/function (_Component) { save: _this.save }); + case 'InfluxDB': + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_tabs_InfluxDBSettings__WEBPACK_IMPORTED_MODULE_14__["default"], { + data: data.influxdb, + generateInputs: _this.generateInputs, + save: _this.save + }); + case 'Reset': return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_tabs_ResetSettings__WEBPACK_IMPORTED_MODULE_6__["default"], { data: data.healthchecks, @@ -149356,6 +149396,115 @@ if (document.getElementById('HealthchecksSettings')) { /***/ }), +/***/ "./resources/js/components/Settings/tabs/InfluxDBSettings.js": +/*!*******************************************************************!*\ + !*** ./resources/js/components/Settings/tabs/InfluxDBSettings.js ***! + \*******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return InfluxDBSettings; }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var react_bootstrap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-bootstrap */ "./node_modules/react-bootstrap/esm/index.js"); +/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); +/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_3__); +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + + + + + +var InfluxDBSettings = /*#__PURE__*/function (_Component) { + _inherits(InfluxDBSettings, _Component); + + var _super = _createSuper(InfluxDBSettings); + + function InfluxDBSettings(props) { + var _this; + + _classCallCheck(this, InfluxDBSettings); + + _this = _super.call(this, props); + + _defineProperty(_assertThisInitialized(_this), "inputHandler", function (name, val) { + var settings = _this.state.data; + var i = 0; + settings.forEach(function (ele) { + if (ele.obj.name == name) { + ele.obj.value = val; + } + + settings[i] = ele; + i++; + }); + + _this.setState({ + data: settings + }); + }); + + _this.state = { + data: _this.props.data + }; + return _this; + } + + _createClass(InfluxDBSettings, [{ + key: "render", + value: function render() { + var _this2 = this; + + var settings = this.props.generateInputs(this.state.data, this.inputHandler); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_bootstrap__WEBPACK_IMPORTED_MODULE_2__["Tab"].Content, null, settings, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { + className: "mt-3" + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { + className: "btn btn-primary", + onClick: function onClick() { + _this2.props.save(_this2.state.data, 'healthchecks.io'); + } + }, "Save"))); + } + }]); + + return InfluxDBSettings; +}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); + + + +if (document.getElementById('InfluxDBSettings')) { + react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(InfluxDBSettings, null), document.getElementById('InfluxDBSettings')); +} + +/***/ }), + /***/ "./resources/js/components/Settings/tabs/NotificationsSettings.js": /*!************************************************************************!*\ !*** ./resources/js/components/Settings/tabs/NotificationsSettings.js ***! diff --git a/resources/js/components/Settings/SettingsIndex.js b/resources/js/components/Settings/SettingsIndex.js index ddd5c8cf..4c831856 100644 --- a/resources/js/components/Settings/SettingsIndex.js +++ b/resources/js/components/Settings/SettingsIndex.js @@ -259,7 +259,29 @@ export default class SettingsIndex extends Component { classes: 'mr-2' }, - ] + ], + influxdb: [ + { + obj: data.influx_db_enabled, + type: 'checkbox' + }, + { + obj: data.influx_db_host, + type: 'text' + }, + { + obj: data.influx_db_port, + type: 'number' + }, + { + obj: data.influx_db_username, + type: 'text' + }, + { + obj: data.influx_db_password, + type: 'password' + } + ], }; } diff --git a/resources/js/components/Settings/SettingsInput.js b/resources/js/components/Settings/SettingsInput.js index 464edd3c..caca1a54 100644 --- a/resources/js/components/Settings/SettingsInput.js +++ b/resources/js/components/Settings/SettingsInput.js @@ -112,6 +112,15 @@ export default class SettingsInput extends Component { onInput={this.handleInput} /> } + generatePasswordInput(disabled) { + return + } + generateButtonGetInput() { var url = this.state.url; @@ -146,6 +155,10 @@ export default class SettingsInput extends Component { input = this.generateTextInput(disabled); } + if(this.state.type === 'password') { + input = this.generatePasswordInput(disabled); + } + if(this.state.type === 'btn-get') { input = this.generateButtonGetInput(); } diff --git a/resources/js/components/Settings/SettingsTabs.js b/resources/js/components/Settings/SettingsTabs.js index d4721dac..28ff1825 100644 --- a/resources/js/components/Settings/SettingsTabs.js +++ b/resources/js/components/Settings/SettingsTabs.js @@ -12,6 +12,7 @@ import HealthchecksSettings from './tabs/HealthchecksSettings'; import NotificationsSettings from './tabs/NotificationsSettings'; import Authentication from '../Authentication/Authentication'; import TableSettings from './tabs/TableSettings'; +import InfluxDBSettings from './tabs/InfluxDBSettings'; export default class SettingsTabs extends Component { constructor(props) { @@ -30,6 +31,7 @@ export default class SettingsTabs extends Component { 'Tables', 'Notifications', 'healthchecks.io', + 'InfluxDB', 'Reset', 'Backup/Restore', ]; @@ -138,6 +140,11 @@ export default class SettingsTabs extends Component { data={data.healthchecks} generateInputs={this.generateInputs} save={this.save} /> + case 'InfluxDB': + return case 'Reset': return { + var settings = this.state.data; + var i = 0; + settings.forEach(ele => { + if(ele.obj.name == name) { + ele.obj.value = val; + } + settings[i] = ele; + i++; + }); + this.setState({ + data: settings + }); + } + + render() { + var settings = this.props.generateInputs(this.state.data, this.inputHandler); + + return ( + + {settings} +
+ +
+
+ ); + } +} + +if (document.getElementById('InfluxDBSettings')) { + ReactDOM.render(, document.getElementById('InfluxDBSettings')); +} From a962865867cbcff27e71223897b6469c8fb6cab9 Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 11 Apr 2021 09:40:30 +0100 Subject: [PATCH 13/14] Add db field to settings page --- public/js/app.js | 3 +++ resources/js/components/Settings/SettingsIndex.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/public/js/app.js b/public/js/app.js index e7ae6b17..a1500918 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -148424,6 +148424,9 @@ var SettingsIndex = /*#__PURE__*/function (_Component) { }, { obj: data.influx_db_port, type: 'number' + }, { + obj: data.influx_db_database, + type: 'text' }, { obj: data.influx_db_username, type: 'text' diff --git a/resources/js/components/Settings/SettingsIndex.js b/resources/js/components/Settings/SettingsIndex.js index 4c831856..d25731bd 100644 --- a/resources/js/components/Settings/SettingsIndex.js +++ b/resources/js/components/Settings/SettingsIndex.js @@ -273,6 +273,10 @@ export default class SettingsIndex extends Component { obj: data.influx_db_port, type: 'number' }, + { + obj: data.influx_db_database, + type: 'text' + }, { obj: data.influx_db_username, type: 'text' From ce549b5b7a0ecb66a76eb3a709bfa588d1e24cbb Mon Sep 17 00:00:00 2001 From: Henry Whitaker Date: Sun, 11 Apr 2021 10:31:28 +0100 Subject: [PATCH 14/14] Try to stop chrome form autofilling --- public/js/app.js | 20 ++++++++++++------- .../js/components/Settings/SettingsIndex.js | 6 ++++-- .../js/components/Settings/SettingsInput.js | 10 +++++++--- .../js/components/Settings/SettingsTabs.js | 1 + .../Settings/tabs/InfluxDBSettings.js | 6 +++++- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index a1500918..fabc9b55 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -148429,10 +148429,12 @@ var SettingsIndex = /*#__PURE__*/function (_Component) { type: 'text' }, { obj: data.influx_db_username, - type: 'text' + type: 'text', + autoComplete: false }, { obj: data.influx_db_password, - type: 'password' + type: 'password', + autoComplete: false }] }; }); @@ -148616,7 +148618,8 @@ var SettingsInput = /*#__PURE__*/function (_Component) { url: _this.props.url, inline: _this.props.inline ? 'd-inline-block' : 'd-block', btnType: _this.props.btnType, - earlyReturn: _this.props.earlyReturn ? true : false + earlyReturn: _this.props.earlyReturn ? true : false, + autoComplete: String(_this.props.autoComplete ? true : "off") }; return _this; } @@ -148644,7 +148647,8 @@ var SettingsInput = /*#__PURE__*/function (_Component) { disabled: disabled, min: this.state.min, max: this.state.max, - onInput: this.handleInput + onInput: this.handleInput, + autoComplete: this.state.autoComplete }); } }, { @@ -148685,7 +148689,8 @@ var SettingsInput = /*#__PURE__*/function (_Component) { type: this.state.type, defaultValue: this.state.value, disabled: disabled, - onInput: this.handleInput + onInput: this.handleInput, + autoComplete: this.state.autoComplete }); } }, { @@ -148696,7 +148701,8 @@ var SettingsInput = /*#__PURE__*/function (_Component) { type: this.state.type, defaultValue: this.state.value, disabled: disabled, - onInput: this.handleInput + onInput: this.handleInput, + autoComplete: this.state.autoComplete }); } }, { @@ -148874,7 +148880,7 @@ var SettingsTabs = /*#__PURE__*/function (_Component) { description: setting.obj.description, handler: handler, label: setting.obj.name - }, _defineProperty(_React$createElement, "description", setting.obj.description), _defineProperty(_React$createElement, "options", setting.type == 'select' ? setting.options : []), _defineProperty(_React$createElement, "hideDescription", setting.hideDescription ? setting.hideDescription : false), _defineProperty(_React$createElement, "min", setting.min ? setting.min : false), _defineProperty(_React$createElement, "max", setting.max ? setting.max : false), _defineProperty(_React$createElement, "btnType", setting.btnType), _defineProperty(_React$createElement, "inline", setting.inline), _defineProperty(_React$createElement, "url", setting.url), _defineProperty(_React$createElement, "earlyReturn", setting.earlyReturn ? true : false), _defineProperty(_React$createElement, "classes", setting.classes ? setting.classes : ''), _React$createElement)); + }, _defineProperty(_React$createElement, "description", setting.obj.description), _defineProperty(_React$createElement, "options", setting.type == 'select' ? setting.options : []), _defineProperty(_React$createElement, "hideDescription", setting.hideDescription ? setting.hideDescription : false), _defineProperty(_React$createElement, "min", setting.min ? setting.min : false), _defineProperty(_React$createElement, "max", setting.max ? setting.max : false), _defineProperty(_React$createElement, "btnType", setting.btnType), _defineProperty(_React$createElement, "inline", setting.inline), _defineProperty(_React$createElement, "url", setting.url), _defineProperty(_React$createElement, "earlyReturn", setting.earlyReturn ? true : false), _defineProperty(_React$createElement, "classes", setting.classes ? setting.classes : ''), _defineProperty(_React$createElement, "autoComplete", setting.autoComplete ? true : false), _React$createElement)); }); }); diff --git a/resources/js/components/Settings/SettingsIndex.js b/resources/js/components/Settings/SettingsIndex.js index d25731bd..0733e7d2 100644 --- a/resources/js/components/Settings/SettingsIndex.js +++ b/resources/js/components/Settings/SettingsIndex.js @@ -279,11 +279,13 @@ export default class SettingsIndex extends Component { }, { obj: data.influx_db_username, - type: 'text' + type: 'text', + autoComplete: false, }, { obj: data.influx_db_password, - type: 'password' + type: 'password', + autoComplete: false, } ], }; diff --git a/resources/js/components/Settings/SettingsInput.js b/resources/js/components/Settings/SettingsInput.js index caca1a54..2d11f9f6 100644 --- a/resources/js/components/Settings/SettingsInput.js +++ b/resources/js/components/Settings/SettingsInput.js @@ -24,6 +24,7 @@ export default class SettingsInput extends Component { inline: this.props.inline ? 'd-inline-block' : 'd-block', btnType: this.props.btnType, earlyReturn: this.props.earlyReturn ? true : false, + autoComplete: String(this.props.autoComplete ? true : Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 7)), } } @@ -72,7 +73,8 @@ export default class SettingsInput extends Component { disabled={disabled} min={this.state.min} max={this.state.max} - onInput={this.handleInput} /> + onInput={this.handleInput} + autoComplete={this.state.autoComplete} /> } generateSelectInput(disabled) { @@ -109,7 +111,8 @@ export default class SettingsInput extends Component { type={this.state.type} defaultValue={this.state.value} disabled={disabled} - onInput={this.handleInput} /> + onInput={this.handleInput} + autoComplete={this.state.autoComplete} /> } generatePasswordInput(disabled) { @@ -118,7 +121,8 @@ export default class SettingsInput extends Component { type={this.state.type} defaultValue={this.state.value} disabled={disabled} - onInput={this.handleInput} /> + onInput={this.handleInput} + autoComplete={this.state.autoComplete} /> } generateButtonGetInput() { diff --git a/resources/js/components/Settings/SettingsTabs.js b/resources/js/components/Settings/SettingsTabs.js index 28ff1825..59dc4cba 100644 --- a/resources/js/components/Settings/SettingsTabs.js +++ b/resources/js/components/Settings/SettingsTabs.js @@ -107,6 +107,7 @@ export default class SettingsTabs extends Component { url={setting.url} earlyReturn={setting.earlyReturn ? true : false} classes={setting.classes ? setting.classes : ''} + autoComplete={setting.autoComplete ? true : false} /> }) } diff --git a/resources/js/components/Settings/tabs/InfluxDBSettings.js b/resources/js/components/Settings/tabs/InfluxDBSettings.js index d3ba155e..c27202bd 100644 --- a/resources/js/components/Settings/tabs/InfluxDBSettings.js +++ b/resources/js/components/Settings/tabs/InfluxDBSettings.js @@ -32,7 +32,11 @@ export default class InfluxDBSettings extends Component { return ( - {settings} +
{ e.preventDefault() }} autoComplete="off"> + + + {settings} +