Skip to content

Commit 0b8c633

Browse files
Merge pull request #300 from henrywhitaker3/dev
2 parents 212c7a9 + 8ae4bc6 commit 0b8c633

115 files changed

Lines changed: 6726 additions & 1719 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/laravel-dev.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- name: Copy .env
1515
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
16+
- name: Update .env with secrets
17+
env:
18+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
19+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
20+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
21+
HEALTHCHECKS_UUID: ${{ secrets.HEALTHCHECKS_UUID }}
22+
run: |
23+
echo SLACK_WEBHOOK=$SLACK_WEBHOOK >> .env
24+
echo TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN >> .env
25+
echo TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID >> .env
26+
echo HEALTHCHECKS_UUID=$HEALTHCHECKS_UUID >> .env
1627
- name: Install Dependencies
1728
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
1829
- name: Create Database

.github/workflows/laravel-pr.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- name: Copy .env
1515
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
16+
- name: Update .env with secrets
17+
env:
18+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
19+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
20+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
21+
HEALTHCHECKS_UUID: ${{ secrets.HEALTHCHECKS_UUID }}
22+
run: |
23+
echo SLACK_WEBHOOK=$SLACK_WEBHOOK >> .env
24+
echo TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN >> .env
25+
echo TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID >> .env
26+
echo HEALTHCHECKS_UUID=$HEALTHCHECKS_UUID >> .env
1627
- name: Install Dependencies
1728
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
1829
- name: Create Database

.github/workflows/laravel-stable.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- name: Copy .env
1515
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
16+
- name: Update .env with secrets
17+
env:
18+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
19+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
20+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
21+
HEALTHCHECKS_UUID: ${{ secrets.HEALTHCHECKS_UUID }}
22+
run: |
23+
echo SLACK_WEBHOOK=$SLACK_WEBHOOK >> .env
24+
echo TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN >> .env
25+
echo TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID >> .env
26+
echo HEALTHCHECKS_UUID=$HEALTHCHECKS_UUID >> .env
1627
- name: Install Dependencies
1728
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
1829
- name: Create Database

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ yarn-error.log
1616
_ide_helper.php
1717
.idea
1818
.config
19+
reports/

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Speedtest Tracker
22

3-
[![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.7.15-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)
3+
[![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.9.6-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)
44

55
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.
66

@@ -16,6 +16,7 @@ Disclaimer: You will need to accept Ookla's EULA and privacy agreements in order
1616
- Graph of previous speedtests going back x days
1717
- Backup/restore data in JSON/CSV format
1818
- Slack/Discord/Telegram notifications
19+
- [healthchecks.io](https://healthchecks.io) integration
1920
- Organizr integration
2021

2122
## Installation & Setup
@@ -82,7 +83,21 @@ Container images are configured using parameters passed at runtime (such as thos
8283
| `-e TELEGRAM_CHAT_ID` | Optional. Telegram chat ID. |
8384
| `-e PUID` | Optional. Supply a local user ID for volume permissions |
8485
| `-e PGID` | Optional. Supply a local group ID for volume permissions |
86+
| `-e AUTH` | Optional. Set to 'true' to enable authentication for the app |
8587

88+
### Authentication
89+
90+
Authentication is optional. When enabled, unauthenticated users will only be able to see the graphs and tests table. To be able to queue a new speedtest, backup/restore data and update instance settings you will need to log in. To enable authentication, pass the `AUTH=true` environment variable in docker or run `php artisan speedtest:auth --enable` for manual installs (same command with `--disable` to turn it off).
91+
92+
The default credentials are:
93+
94+
| Field | Function |
95+
| --- | --- |
96+
| username | admin@admin.com |
97+
| password | password |
98+
99+
After enabling, you should change the password through the web UI.
100+
86101
### Manual Install
87102

88103
For manual installtions, please follow the instrucitons [here](https://github.com/henrywhitaker3/Speedtest-Tracker/wiki/Manual-Installation).

app/Console/Commands/AcceptEULACommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct()
3434
/**
3535
* Execute the console command.
3636
*
37-
* @return int
37+
* @return void
3838
*/
3939
public function handle()
4040
{
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Helpers\SettingsHelper;
6+
use Illuminate\Console\Command;
7+
8+
class AuthenticationCommand extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'speedtest:auth {--enable} {--disable}';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Toggle authentication for the app';
23+
24+
/**
25+
* Create a new command instance.
26+
*
27+
* @return void
28+
*/
29+
public function __construct()
30+
{
31+
parent::__construct();
32+
}
33+
34+
/**
35+
* Execute the console command.
36+
*
37+
* @return int
38+
*/
39+
public function handle()
40+
{
41+
$opts = $this->options();
42+
43+
if($opts['enable'] === true && $opts['disable'] === true) {
44+
$this->warn('Please specify only ONE of --enable and --disable');
45+
} else if($opts['enable'] === false && $opts['disable'] === false) {
46+
$this->warn('You need to specify either --enable OR --disable');
47+
} else {
48+
if($opts['enable'] === true) {
49+
$this->info('Enabling authentication');
50+
SettingsHelper::set('auth', true);
51+
}
52+
53+
if($opts['disable'] === true) {
54+
$this->info('Disabling authentication');
55+
SettingsHelper::set('auth', false);
56+
}
57+
}
58+
}
59+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Auth\LoginSession;
6+
use Carbon\Carbon;
7+
use Illuminate\Console\Command;
8+
use Log;
9+
10+
class ClearOldSessionsCommand extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'speedtest:clear-sessions';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Clear expired sessions from database';
25+
26+
/**
27+
* Create a new command instance.
28+
*
29+
* @return void
30+
*/
31+
public function __construct()
32+
{
33+
parent::__construct();
34+
}
35+
36+
/**
37+
* Execute the console command.
38+
*
39+
* @return int
40+
*/
41+
public function handle()
42+
{
43+
$now = Carbon::now()->timestamp;
44+
$sessions = LoginSession::where('expires', '<=', $now)
45+
->delete();
46+
$this->info('Invalidated expired sessions');
47+
}
48+
}

app/Console/Commands/ClearQueueCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct()
3434
/**
3535
* Execute the console command.
3636
*
37-
* @return int
37+
* @return void
3838
*/
3939
public function handle()
4040
{

app/Console/Commands/GetConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct()
3434
/**
3535
* Execute the console command.
3636
*
37-
* @return int
37+
* @return void
3838
*/
3939
public function handle()
4040
{

0 commit comments

Comments
 (0)