mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 22:39:26 +01:00
Added base url setting
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Speedtest Tracker
|
||||
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits)  [](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 [speedtest-cli](https://github.com/sivel/speedtest-cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ else
|
||||
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=$SLACK_WEBHOOK," -i.bak .env
|
||||
fi
|
||||
|
||||
if [ -z ${BASE_PATH+x} ]; then
|
||||
echo "Base path is unset"
|
||||
else
|
||||
sed "s,BASE_PATH=.*,BASE_PATH=$BASE_PATH," -i.bak .env
|
||||
fi
|
||||
|
||||
cd /app/site && php artisan migrate
|
||||
|
||||
cd /config
|
||||
|
||||
@@ -23,3 +23,5 @@ SPEEDTEST_PASSWORD=
|
||||
REMEMBER_DAYS=30
|
||||
|
||||
SLACK_WEBHOOK=
|
||||
|
||||
BASE_PATH=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Speedtest Tracker
|
||||
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues)  [](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
|
||||
[](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [](https://github.com/henrywhitaker3/Speedtest-Tracker/issues)  [](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 [speedtest-cli](https://github.com/sivel/speedtest-cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.
|
||||
|
||||
|
||||
@@ -35,4 +35,20 @@ class SettingsHelper {
|
||||
|
||||
return $setting;
|
||||
}
|
||||
|
||||
public static function getBase()
|
||||
{
|
||||
$base = env('BASE_PATH', '/');
|
||||
if($base == '') {
|
||||
$base = '/';
|
||||
} else {
|
||||
if($base[0] != '/') {
|
||||
$base = '/' . $base;
|
||||
}
|
||||
if($base[-1] != '/') {
|
||||
$base = $base . '/';
|
||||
}
|
||||
}
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,4 +48,15 @@ class SettingsController extends Controller
|
||||
'data' => $setting
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function config()
|
||||
{
|
||||
|
||||
|
||||
$config = [
|
||||
'base' => SettingsHelper::getBase()
|
||||
];
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Helpers\SettingsHelper;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@@ -72,7 +73,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
Route::prefix(SettingsHelper::getBase() . 'api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
{
|
||||
"1.5.0": [
|
||||
{
|
||||
"description": "Added option to set base path",
|
||||
"link": ""
|
||||
}
|
||||
],
|
||||
"1.4.1": [
|
||||
{
|
||||
"description": "Updated laravel framework",
|
||||
|
||||
@@ -7,7 +7,7 @@ return [
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'version' => '1.4.1',
|
||||
'version' => '1.5.0',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
BIN
conf/site/node_modules/.cache/babel-loader/3d08807090e7c4e7b8d3f69636dc056d.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/3d08807090e7c4e7b8d3f69636dc056d.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/523d96daae624dedd33ac07ebce06081.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/523d96daae624dedd33ac07ebce06081.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/97fd89772ee3ade38c95037a6fb78206.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/97fd89772ee3ade38c95037a6fb78206.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/a8b1ac6e7d97e5ac6b257a3a4a64282a.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/a8b1ac6e7d97e5ac6b257a3a4a64282a.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/c0ba0973d3f4ce8c08f3806f61b021a2.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/c0ba0973d3f4ce8c08f3806f61b021a2.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/c134e3d0072d2a21bd20de3a46270663.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/c134e3d0072d2a21bd20de3a46270663.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/c3538c875932685ac3727da9d3c776b2.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/c3538c875932685ac3727da9d3c776b2.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/c90ab1cef069146fbefb24195e7d0dfd.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/c90ab1cef069146fbefb24195e7d0dfd.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/ca18f478eaf93d0888b5bec061c093ad.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/ca18f478eaf93d0888b5bec061c093ad.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/dfac6cf1b2aac1b9b89d42412c7ecdfb.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/dfac6cf1b2aac1b9b89d42412c7ecdfb.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/e1c1ac5bd9971b4c50f26f88640d6f97.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/e1c1ac5bd9971b4c50f26f88640d6f97.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
conf/site/node_modules/.cache/babel-loader/f2cf1afe1a664cfa3c937ae50f479bf2.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/f2cf1afe1a664cfa3c937ae50f479bf2.json.gz
generated
vendored
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/22/77/507aad1fbd248bb09f8544068d8e5c1eb2a3fb5943b600441091d4786cc4
generated
vendored
Normal file
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/22/77/507aad1fbd248bb09f8544068d8e5c1eb2a3fb5943b600441091d4786cc4
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
c54307967324200175062a1527872f8ce69b945d {"key":"{\"terser\":\"4.6.10\",\"terser-webpack-plugin\":\"2.3.5\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.m?js(\\\\?.*)?$\", \"i\"),\"chunkFilter\":() => true,\"warningsFilter\":() => true,\"extractComments\":true,\"sourceMap\":true,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"compress\":{\"warnings\":false},\"output\":{\"comments\":false}}},\"nodeVersion\":\"v10.19.0\",\"filename\":\"\\u002Fjs\\u002Fapp.js\",\"contentHash\":\"84614deb710d47a03e42\"}","integrity":"sha512-w8pTOgSs2Hfpyrhml44arTMG2YKT2JzE0hqYdA7kWeJswdu2MmDu0MDumKp5Z2nsQfpK9J9mwYu7i+BEApYLzw==","time":1590013678983,"size":2368305}
|
||||
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/d4/4c/462948edebde2913df7bf1f0dd7829d4fe87a6a83a61d420aef2176a9959
generated
vendored
Normal file
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/d4/4c/462948edebde2913df7bf1f0dd7829d4fe87a6a83a61d420aef2176a9959
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
b0bd509c98122036a9303b527d56eb993dc70952 {"key":"{\"terser\":\"4.6.10\",\"terser-webpack-plugin\":\"2.3.5\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.m?js(\\\\?.*)?$\", \"i\"),\"chunkFilter\":() => true,\"warningsFilter\":() => true,\"extractComments\":true,\"sourceMap\":true,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"compress\":{\"warnings\":false},\"output\":{\"comments\":false}}},\"nodeVersion\":\"v10.19.0\",\"filename\":\"\\u002Fjs\\u002Fapp.js\",\"contentHash\":\"8df815f69f0203e553ed\"}","integrity":"sha512-PL+L+yKIvOR5XfftUSSgKLqhXzQvCElCMjv7cBB6NiA5zxS2gShYYn0bf3vyxkixRwiiu1CJae8BLqo2LsEwyA==","time":1590017361773,"size":2368166}
|
||||
2
conf/site/public/js/app.js
vendored
2
conf/site/public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@ import Axios from 'axios';
|
||||
|
||||
export default class Backup extends Component {
|
||||
backup = () => {
|
||||
var url = '/api/backup';
|
||||
var url = 'api/backup';
|
||||
|
||||
toast.info('Your backup has started downloading...');
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class Changelog extends Component {
|
||||
}
|
||||
|
||||
getChangelog = () => {
|
||||
Axios.get('/api/update/changelog')
|
||||
Axios.get('api/update/changelog')
|
||||
.then((resp) => {
|
||||
this.setState({
|
||||
changelog: resp.data.data,
|
||||
|
||||
@@ -53,7 +53,7 @@ export default class Restore extends Component {
|
||||
|
||||
uploadFile = () => {
|
||||
var data = { data: this.state.data };
|
||||
var url = '/api/restore';
|
||||
var url = 'api/restore';
|
||||
|
||||
Axios.post(url, data)
|
||||
.then((resp) => {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class HistoryGraph extends Component {
|
||||
}
|
||||
|
||||
getData = (days = this.state.days) => {
|
||||
var url = '/api/speedtest/time/' + days;
|
||||
var url = 'api/speedtest/time/' + days;
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default class LatestResults extends Component {
|
||||
}
|
||||
|
||||
getData = () => {
|
||||
var url = '/api/speedtest/latest';
|
||||
var url = 'api/speedtest/latest';
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
@@ -45,7 +45,7 @@ export default class LatestResults extends Component {
|
||||
}
|
||||
|
||||
newScan = () => {
|
||||
var url = '/api/speedtest/run';
|
||||
var url = 'api/speedtest/run';
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class TestsTable extends Component {
|
||||
}
|
||||
|
||||
getData = (page = this.state.page) => {
|
||||
var url = '/api/speedtest/?page=' + page;
|
||||
var url = 'api/speedtest/?page=' + page;
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class Setting extends Component {
|
||||
}
|
||||
|
||||
update = () => {
|
||||
var url = '/api/settings';
|
||||
var url = 'api/settings';
|
||||
var data = {
|
||||
name: this.state.name,
|
||||
value: this.state.value
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class Settings extends Component {
|
||||
}
|
||||
|
||||
getData = () => {
|
||||
var url = '/api/settings/';
|
||||
var url = 'api/settings/';
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class Version extends Component {
|
||||
}
|
||||
|
||||
checkForUpdates = () => {
|
||||
var url = '/api/update/check';
|
||||
var url = 'api/update/check';
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
@@ -61,19 +61,19 @@ export default class Version extends Component {
|
||||
updateProgress: 0,
|
||||
});
|
||||
toast.info('Downloading update');
|
||||
Axios.get('/api/update/download')
|
||||
Axios.get('api/update/download')
|
||||
.then((resp) => {
|
||||
this.setState({
|
||||
updateProgress: 50,
|
||||
});
|
||||
toast.info('Extracting update');
|
||||
Axios.get('/api/speedtest/extract')
|
||||
Axios.get('api/speedtest/extract')
|
||||
.then((resp) => {
|
||||
this.setState({
|
||||
updateProgress: 75,
|
||||
});
|
||||
toast.info('Applying update');
|
||||
Axios.get('/api/update/move')
|
||||
Axios.get('api/update/move')
|
||||
.then((resp) => {
|
||||
this.setState({
|
||||
updateProgress: 100,
|
||||
|
||||
2
conf/site/resources/js/components/Login.js
vendored
2
conf/site/resources/js/components/Login.js
vendored
@@ -24,7 +24,7 @@ export default class Login extends Component {
|
||||
email: this.state.loginEmailInput,
|
||||
password: this.state.loginPasswordInput
|
||||
};
|
||||
var url = '/api/auth/login';
|
||||
var url = 'api/auth/login';
|
||||
|
||||
Axios.post(url, data)
|
||||
.then((resp) => {
|
||||
|
||||
68
conf/site/resources/js/index.js
vendored
68
conf/site/resources/js/index.js
vendored
@@ -15,26 +15,66 @@ export default class Index extends Component {
|
||||
|
||||
this.state = {
|
||||
loading: true,
|
||||
redirect: false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
this.getConfig();
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
var url = 'api/settings/config';
|
||||
|
||||
Axios.get(url)
|
||||
.then((resp) => {
|
||||
window.config = resp.data;
|
||||
this.setState({
|
||||
loading: false,
|
||||
redirect: true,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
var loading = this.state.loading;
|
||||
var redirect = this.state.redirect;
|
||||
var baseSet = this.isset(window.config);
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Route render={(props) => (<ToastContainer />)} />
|
||||
<Switch>
|
||||
<Route exact path="/" render={(props) => (
|
||||
<div>
|
||||
<HomePage />
|
||||
</div>
|
||||
)} />
|
||||
<Route exact path="/error/:code" render={(props) => ( <ErrorPage code={props.match.params.code} /> )} />
|
||||
<Route render={(props) => (<ErrorPage code="404" />)} />
|
||||
</Switch>
|
||||
</BrowserRouter>
|
||||
);
|
||||
if(loading) {
|
||||
return (
|
||||
<Loader />
|
||||
);
|
||||
} else {
|
||||
if(baseSet && window.config.base) {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Route render={(props) => (<ToastContainer />)} />
|
||||
<Switch>
|
||||
<Route exact path={window.config.base} render={(props) => (
|
||||
<div>
|
||||
<HomePage />
|
||||
</div>
|
||||
)} />
|
||||
<Route exact path={window.config.base + "error/:code"} render={(props) => ( <ErrorPage code={props.match.params.code} /> )} />
|
||||
<Route render={(props) => (<ErrorPage code="404" />)} />
|
||||
</Switch>
|
||||
</BrowserRouter>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Loader />
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isset(v) {
|
||||
if(typeof v !== "undefined" || v !== null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,26 +7,26 @@
|
||||
<meta name="author" content="Henry Whitaker">
|
||||
<meta name="version" content="{{ config('speedtest.version', 'Unknown') }}">
|
||||
|
||||
<link href="/icons/themify/themify-icons.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/css/bootstrap.dark.min.css">
|
||||
<link rel="stylesheet" href="/css/main.css">
|
||||
<link href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/themify/themify-icons.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ App\Helpers\SettingsHelper::getBase() }}files/css/bootstrap.dark.min.css">
|
||||
<link rel="stylesheet" href="{{ App\Helpers\SettingsHelper::getBase() }}files/css/main.css?v={{ str_replace('.', '-', config('speedtest.version')) }}">
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/icons/fav/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/icons/fav/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/icons/fav/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/icons/fav/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/icons/fav/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/icons/fav/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/icons/fav/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/icons/fav/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/icons/fav/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/icons/fav/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/icons/fav/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/icons/fav/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/icons/fav/favicon-16x16.png">
|
||||
<link rel="manifest" href="/icons/fav/manifest.json">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/favicon-16x16.png">
|
||||
<link rel="manifest" href="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/manifest.json">
|
||||
<meta name="msapplication-TileColor" content="#303030">
|
||||
<meta name="msapplication-TileImage" content="/icons/fav/ms-icon-144x144.png">
|
||||
<meta name="msapplication-TileImage" content="{{ App\Helpers\SettingsHelper::getBase() }}files/icons/fav/ms-icon-144x144.png">
|
||||
<meta name="theme-color" content="#303030">
|
||||
|
||||
<title>{{ $title }}</title>
|
||||
@@ -34,8 +34,8 @@
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/popper.min.js"></script>
|
||||
<script src="/js/app.js"></script>
|
||||
<script src="{{ App\Helpers\SettingsHelper::getBase() }}files/js/jquery.min.js"></script>
|
||||
<script src="{{ App\Helpers\SettingsHelper::getBase() }}files/js/popper.min.js"></script>
|
||||
<script src="{{ App\Helpers\SettingsHelper::getBase() }}files/js/app.js?v={{ str_replace('.', '-', config('speedtest.version')) }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -58,6 +58,8 @@ Route::group([
|
||||
'middleware' => 'api',
|
||||
'prefix' => 'settings'
|
||||
], function () {
|
||||
Route::get('/config', 'SettingsController@config')
|
||||
->name('settings.config');
|
||||
Route::get('/', 'SettingsController@index')
|
||||
->name('settings.index');
|
||||
Route::put('/', 'SettingsController@store')
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Helpers\SettingsHelper;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -13,8 +16,20 @@ use Illuminate\Support\Facades\Route;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get(SettingsHelper::getBase() . 'files/{path?}', function($file) {
|
||||
$fileP = explode('?', $file)[0];
|
||||
$fileP = public_path() . '/' . $fileP;
|
||||
if(file_exists($fileP)) {
|
||||
$contents = File::get($fileP);
|
||||
$mime = \GuzzleHttp\Psr7\mimetype_from_filename($fileP);
|
||||
return Response::make(File::get($fileP), 200, [ 'Content-type' => $mime ]);
|
||||
} else {
|
||||
abort(404);
|
||||
}
|
||||
})->where('path', '.*')
|
||||
->name('files');
|
||||
|
||||
Route::get('/{path?}', function() {
|
||||
return view('app', [ 'title' => 'Speedtest Checker' ]);
|
||||
})
|
||||
->where('path', '.*')
|
||||
->name('react');
|
||||
})->where('path', '^((?!\/api\/).)*$')
|
||||
->name('react');
|
||||
|
||||
Reference in New Issue
Block a user