Added home prefixes to helpers

This commit is contained in:
Henry Whitaker
2020-08-03 10:42:38 +01:00
parent 2ebbc6c8cb
commit 004a6b34d4
6 changed files with 57 additions and 4 deletions

1
.gitignore vendored
View File

@@ -15,3 +15,4 @@ yarn-error.log
_ide_helper.php _ide_helper.php
.idea .idea
.config

View File

@@ -1,6 +1,6 @@
# Speedtest Tracker # Speedtest Tracker
[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![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.14-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) [![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)
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. 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.

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use PhpParser\Node\Expr\ShellExec;
class AcceptEULACommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'speedtest:eula';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Accept the Ookla EULA and GDPR agreements.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
shell_exec('HOME=' . base_path() . '/ && ' . app_path() . '/Bin/speedtest --accept-license --accept-gdpr');
}
}

View File

@@ -78,7 +78,10 @@ class SpeedtestHelper {
public static function output() public static function output()
{ {
$server = SettingsHelper::get('server')['value']; $server = SettingsHelper::get('server')['value'];
$binPath = app_path() . DIRECTORY_SEPARATOR . 'Bin' . DIRECTORY_SEPARATOR . 'speedtest'; $binPath = app_path() . DIRECTORY_SEPARATOR . 'Bin' . DIRECTORY_SEPARATOR . 'speedtest';
$homePrefix = 'HOME=' . base_path() . '/ && ';
if($server != '' && $server != false) { if($server != '' && $server != false) {
$server = explode(',', $server); $server = explode(',', $server);
$server = $server[array_rand($server)]; $server = $server[array_rand($server)];
@@ -87,10 +90,10 @@ class SpeedtestHelper {
return false; return false;
} }
return shell_exec($binPath . ' -f json -s ' . $server); return shell_exec($homePrefix . $binPath . ' -f json -s ' . $server);
} }
return shell_exec($binPath . ' -f json'); return shell_exec($homePrefix . $binPath . ' -f json');
} }
/** /**

View File

@@ -1,4 +1,10 @@
{ {
"1.7.15": [
{
"description": "Updates for manual installs.",
"link": ""
}
],
"1.7.14": [ "1.7.14": [
{ {
"description": "Updated dependencies.", "description": "Updated dependencies.",

View File

@@ -7,7 +7,7 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
*/ */
'version' => '1.7.14', 'version' => '1.7.15',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------