Permalink
Browse files

fixed error on sudo installation page

  • Loading branch information...
flxn committed Jan 2, 2019
1 parent a283835 commit 33df50e32b1c1ca2e0bf03b65738fde72cea3012
Showing with 10 additions and 7 deletions.
  1. +10 −7 index.php
@@ -13,10 +13,13 @@
if(file_exists('misc/stats.txt')) {
$fh = fopen('misc/stats.txt', 'r');
$stats = new TRCStats();
Flight::set('serverCount', intval(fgets($fh, 4096)));
Flight::set('combinedUptime', round(intval(fgets($fh, 4069))/60/60) . 'h');
Flight::set('combinedBandwidth', round(intval(fgets($fh, 4069))*8/1000/1000) . 'Mb/s');
Flight::set('currentCommit', trim(exec('git log --pretty="%h" -n1 HEAD')));
Flight::set('bandwidthChartJson', json_encode($stats->getBandwidthOverTime(30)));
Flight::set('nodesChartJson', json_encode($stats->getNodesOverTime(30)));
fclose($fh);
}
@@ -34,7 +37,6 @@
}
Flight::route('GET /', function () {
$stats = new TRCStats();
Flight::render('main', array('errors' => ''), 'main_content');
Flight::render('layout', array(
'title' => 'Tor Relay Configurator',
@@ -43,13 +45,12 @@
'combinedBandwidth' => Flight::get('combinedBandwidth'),
'currentCommit' => Flight::get('currentCommit'),
'nodes' => Flight::get('nodeslist'),
'bandwidthChartData' => json_encode($stats->getBandwidthOverTime(30)),
'nodesChartData' => json_encode($stats->getNodesOverTime(30))
'bandwidthChartData' => Flight::get('bandwidthChartJson'),
'nodesChartData' => Flight::get('nodesChartJson')
));
});
Flight::route('POST /', function () {
$stats = new TRCStats();
$req = Flight::request();
try {
$torConfig = new TorConfig($req->data);
@@ -91,8 +92,8 @@
'combinedBandwidth' => Flight::get('combinedBandwidth'),
'currentCommit' => Flight::get('currentCommit'),
'nodes' => Flight::get('nodeslist'),
'bandwidthChartData' => json_encode($stats->getBandwidthOverTime(30)),
'nodesChartData' => json_encode($stats->getNodesOverTime(30))
'bandwidthChartData' => Flight::get('bandwidthChartJson'),
'nodesChartData' => Flight::get('nodesChartJson')
));
});
@@ -115,7 +116,9 @@
'combinedUptime' => Flight::get('combinedUptime'),
'combinedBandwidth' => Flight::get('combinedBandwidth'),
'currentCommit' => Flight::get('currentCommit'),
'nodes' => Flight::get('nodeslist')
'nodes' => Flight::get('nodeslist'),
'bandwidthChartData' => Flight::get('bandwidthChartJson'),
'nodesChartData' => Flight::get('nodesChartJson')
));
});

0 comments on commit 33df50e

Please sign in to comment.