mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-24 22:39:26 +01:00
Fixed some bugs/changed scripts
This commit is contained in:
@@ -19,12 +19,18 @@ else
|
||||
eulaError
|
||||
fi
|
||||
|
||||
echo "Ookla GDPR and EULA accepted. Downloading Speedtest CLI."
|
||||
cd /tmp
|
||||
wget https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-1.0.0-x86_64-linux.tgz -O speedtest.tgz > /dev/null
|
||||
tar zxvf speedtest.tgz > /dev/null
|
||||
cp speedtest /site/app/Bin/
|
||||
HOME=/config && timeout 5s s6-setuidgid abc /site/app/Bin/speedtest --accept-license --accept-gdpr > /dev/null
|
||||
if [ ! -f /config/www/app/Bin/speedtest ]; then
|
||||
echo "Ookla GDPR and EULA accepted. Downloading Speedtest CLI."
|
||||
cd /tmp
|
||||
wget https://bintray.com/ookla/download/download_file?file_path=ookla-speedtest-1.0.0-x86_64-linux.tgz -O speedtest.tgz > /dev/null
|
||||
tar zxvf speedtest.tgz > /dev/null
|
||||
cp speedtest /site/app/Bin/
|
||||
|
||||
HOME=/config && timeout 5s s6-setuidgid abc /site/app/Bin/speedtest --accept-license --accept-gdpr > /dev/null
|
||||
HOME=/root
|
||||
fi
|
||||
|
||||
HOME=/config && timeout 5s s6-setuidgid abc /config/www/app/Bin/speedtest --accept-license --accept-gdpr > /dev/null
|
||||
HOME=/root
|
||||
fi
|
||||
|
||||
@@ -72,17 +78,21 @@ fi
|
||||
|
||||
if [ -z ${SLACK_WEBHOOK+x} ]; then
|
||||
echo "Slack webhook is unset"
|
||||
php /config/www/artisan speedtest:slack ""
|
||||
else
|
||||
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=," -i.bak /config/www/.env
|
||||
elsecd
|
||||
echo "Slack webhook set, updating db"
|
||||
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=$SLACK_WEBHOOK," -i.bak /config/www/.env
|
||||
php /config/www/artisan speedtest:slack $SLACK_WEBHOOK
|
||||
fi
|
||||
|
||||
if [ -z ${TELEGRAM_BOT_TOKEN+x} ] && [ -z ${TELEGRAM_CHAT_ID+x} ]; then
|
||||
echo "Telegram chat id and bot token unset"
|
||||
php /config/www/artisan speedtest:telegram --chat="" --bot=""
|
||||
sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=," -i.bak /config/www/.env
|
||||
sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=," -i.bak /config/www/.env
|
||||
else
|
||||
echo "Telegram chat id and bot token set, updating .env"
|
||||
sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN," -i.bak /config/www/.env
|
||||
sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID," -i.bak /config/www/.env
|
||||
php /config/www/artisan speedtest:telegram --chat=$TELEGRAM_CHAT_ID --bot=$TELEGRAM_BOT_TOKEN
|
||||
fi
|
||||
|
||||
|
||||
@@ -85,21 +85,43 @@ class SettingsHelper {
|
||||
*/
|
||||
public static function settingIsEditable(string $key)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
// Try exact key
|
||||
$val = exec('echo $' . $key);
|
||||
|
||||
if($val == "") {
|
||||
return true;
|
||||
array_push($results, true);
|
||||
} else {
|
||||
array_push($results, false);
|
||||
}
|
||||
|
||||
// Try key all caps
|
||||
$val = exec('echo $' . strtoupper($key));
|
||||
|
||||
if($val == "") {
|
||||
return true;
|
||||
array_push($results, true);
|
||||
} else {
|
||||
array_push($results, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
if(env($key, false) == false) {
|
||||
array_push($results, true);
|
||||
} else {
|
||||
array_push($results, false);
|
||||
}
|
||||
|
||||
if(env(strtoupper($key), false) == false) {
|
||||
array_push($results, true);
|
||||
} else {
|
||||
array_push($results, false);
|
||||
}
|
||||
|
||||
if(in_array(false, $results)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ class SettingsController extends Controller
|
||||
|
||||
if($setting == false) {
|
||||
$setting = SettingsHelper::set($d['name'], $d['value']);
|
||||
} else if($setting->editable == true) {
|
||||
} else if(SettingsHelper::settingIsEditable($setting->name)) {
|
||||
$setting = SettingsHelper::set($d['name'], $d['value']);
|
||||
} else {
|
||||
continue;
|
||||
|
||||
@@ -17,11 +17,4 @@ class Setting extends Model
|
||||
];
|
||||
|
||||
protected $table = 'settings';
|
||||
|
||||
protected $attributes = [ 'editable' ];
|
||||
|
||||
public function getEditableAttribute()
|
||||
{
|
||||
return SettingsHelper::settingIsEditable($this->name);
|
||||
}
|
||||
}
|
||||
|
||||
BIN
conf/site/node_modules/.cache/babel-loader/8660f7247bf51093c2c8530ac56024d5.json.gz
generated
vendored
Normal file
BIN
conf/site/node_modules/.cache/babel-loader/8660f7247bf51093c2c8530ac56024d5.json.gz
generated
vendored
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/09/9a/e4b2484793dc2434473fc7d82cade1e944a5b8ababc6652a23519d9e2d52
generated
vendored
Normal file
2
conf/site/node_modules/.cache/terser-webpack-plugin/index-v5/09/9a/e4b2484793dc2434473fc7d82cade1e944a5b8ababc6652a23519d9e2d52
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
53e55266d3a4efcbfec4f2aa43eee8be551cf3bb {"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\":\"6ae69fed8fc83cdd5a01\"}","integrity":"sha512-Dg+YaS0UuShDa6G4C40AoR3twdR5pIxVW1vbnrqGMNp1F/HJzYFgnrp5cOjY+CqDwBDSw/6OQ/OWAO4rJ0Nxog==","time":1594155293163,"size":2545026}
|
||||
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
@@ -27,11 +27,13 @@ export default class SettingWithModal extends Component {
|
||||
var settings = this.state.settings;
|
||||
|
||||
settings.forEach(e => {
|
||||
var res = {
|
||||
name: e.obj.name,
|
||||
value: e.obj.value
|
||||
};
|
||||
data.push(res);
|
||||
if(e.type !== 'button-get') {
|
||||
var res = {
|
||||
name: e.obj.name,
|
||||
value: e.obj.value
|
||||
};
|
||||
data.push(res);
|
||||
}
|
||||
});
|
||||
|
||||
data = {
|
||||
|
||||
Reference in New Issue
Block a user