mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Maintenance for a few modules (#42)
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
<?php namespace pineapple;
|
||||
|
||||
putenv('LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH').':/sd/lib:/sd/usr/lib');
|
||||
putenv('PATH='.getenv('PATH').':/sd/usr/bin:/sd/usr/sbin');
|
||||
|
||||
class dump1090 extends Module
|
||||
{
|
||||
public function route()
|
||||
public function route()
|
||||
{
|
||||
switch ($this->request->action) {
|
||||
case 'refreshInfo':
|
||||
$this->refreshInfo();
|
||||
break;
|
||||
case 'refreshOutput':
|
||||
case 'refreshInfo':
|
||||
$this->refreshInfo();
|
||||
break;
|
||||
case 'refreshOutput':
|
||||
$this->refreshOutput();
|
||||
break;
|
||||
case 'clearOutput':
|
||||
$this->clearOutput();
|
||||
break;
|
||||
case 'clearOutput':
|
||||
$this->clearOutput();
|
||||
break;
|
||||
case 'refreshStatus':
|
||||
$this->refreshStatus();
|
||||
break;
|
||||
@@ -34,234 +35,229 @@ class dump1090 extends Module
|
||||
case 'deleteHistory':
|
||||
$this->deleteHistory();
|
||||
break;
|
||||
case 'downloadHistory':
|
||||
$this->downloadHistory();
|
||||
break;
|
||||
case 'viewHistory':
|
||||
$this->viewHistory();
|
||||
break;
|
||||
case 'getSettings':
|
||||
$this->getSettings();
|
||||
break;
|
||||
case 'setSettings':
|
||||
$this->setSettings();
|
||||
break;
|
||||
case 'refreshList':
|
||||
$this->refreshList();
|
||||
break;
|
||||
case 'downloadHistory':
|
||||
$this->downloadHistory();
|
||||
break;
|
||||
case 'viewHistory':
|
||||
$this->viewHistory();
|
||||
break;
|
||||
case 'getSettings':
|
||||
$this->getSettings();
|
||||
break;
|
||||
case 'setSettings':
|
||||
$this->setSettings();
|
||||
break;
|
||||
case 'refreshList':
|
||||
$this->refreshList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkDependency($dependencyName)
|
||||
{
|
||||
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("dump1090.module.installed")));
|
||||
}
|
||||
protected function checkDependency($dependencyName)
|
||||
{
|
||||
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("dump1090.module.installed")));
|
||||
}
|
||||
|
||||
protected function getDevice()
|
||||
{
|
||||
return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'"));
|
||||
}
|
||||
protected function getDevice()
|
||||
{
|
||||
return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'"));
|
||||
}
|
||||
|
||||
protected function refreshInfo()
|
||||
{
|
||||
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/dump1090/module.info"));
|
||||
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
|
||||
}
|
||||
protected function refreshInfo()
|
||||
{
|
||||
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/dump1090/module.info"));
|
||||
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
|
||||
}
|
||||
|
||||
private function handleDependencies()
|
||||
{
|
||||
if(!$this->checkDependency("dump1090"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh install ".$this->request->destination);
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh remove");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
if (!$this->checkDependency("dump1090")) {
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh install ".$this->request->destination);
|
||||
$this->response = array('success' => true);
|
||||
} else {
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh remove");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDependenciesStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/dump1090.progress'))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
if (!file_exists('/tmp/dump1090.progress')) {
|
||||
$this->response = array('success' => true);
|
||||
} else {
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function toggledump1090()
|
||||
{
|
||||
if(!$this->checkRunning("dump1090"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh start");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh stop");
|
||||
}
|
||||
}
|
||||
if (!$this->checkRunning("dump1090")) {
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh start");
|
||||
} else {
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh stop");
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/dump1090.progress'))
|
||||
{
|
||||
if (!$this->checkDependency("dump1090"))
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Not installed";
|
||||
$installLabel = "danger";
|
||||
$processing = false;
|
||||
if (!file_exists('/tmp/dump1090.progress')) {
|
||||
if (!$this->checkDependency("dump1090")) {
|
||||
$installed = false;
|
||||
$install = "Not installed";
|
||||
$installLabel = "danger";
|
||||
$processing = false;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = true;
|
||||
$install = "Installed";
|
||||
$installLabel = "success";
|
||||
$processing = false;
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
} else {
|
||||
$installed = true;
|
||||
$install = "Installed";
|
||||
$installLabel = "success";
|
||||
$processing = false;
|
||||
|
||||
if ($this->checkRunning("dump1090"))
|
||||
{
|
||||
$status = "Stop";
|
||||
$statusLabel = "danger";
|
||||
$running = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Installing...";
|
||||
$installLabel = "warning";
|
||||
$processing = true;
|
||||
if ($this->checkRunning("dump1090")) {
|
||||
$status = "Stop";
|
||||
$statusLabel = "danger";
|
||||
$running = true;
|
||||
} else {
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$installed = false;
|
||||
$install = "Installing...";
|
||||
$installLabel = "warning";
|
||||
$processing = true;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
|
||||
$device = $this->getDevice();
|
||||
$sdAvailable = $this->isSDAvailable();
|
||||
$device = $this->getDevice();
|
||||
$sdAvailable = $this->isSDAvailable();
|
||||
|
||||
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing, "running" => $running);
|
||||
}
|
||||
|
||||
private function refreshOutput()
|
||||
{
|
||||
if ($this->checkDependency("dump1090"))
|
||||
{
|
||||
if (file_exists("/tmp/dump1090_capture.log"))
|
||||
{
|
||||
$output = file_get_contents("/tmp/dump1090_capture.log");
|
||||
if(!empty($output))
|
||||
$this->response = $output;
|
||||
else
|
||||
$this->response = "dump1090 is running...";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "dump1090 is not running...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "dump1090 is not installed...";
|
||||
}
|
||||
}
|
||||
|
||||
private function clearOutput()
|
||||
{
|
||||
exec("rm -rf /tmp/dump1090_capture.log");
|
||||
}
|
||||
|
||||
private function refreshHistory()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
$log_list = array_reverse(glob("/pineapple/modules/dump1090/log/*.log"));
|
||||
|
||||
echo '[';
|
||||
for($i=0;$i<count($log_list);$i++)
|
||||
{
|
||||
$info = explode("_", basename($log_list[$i]));
|
||||
$entryDate = gmdate('Y-m-d H-i-s', $info[1]);
|
||||
$entryName = basename($log_list[$i],".log");
|
||||
|
||||
if(file_exists("/pineapple/modules/dump1090/log/".$entryName.".csv"))
|
||||
echo json_encode(array($entryDate, $entryName.".log", $entryName.".csv"));
|
||||
else
|
||||
echo json_encode(array($entryDate, $entryName.".log", ''));
|
||||
|
||||
if($i!=count($log_list)-1) echo ',';
|
||||
}
|
||||
echo ']';
|
||||
};
|
||||
}
|
||||
|
||||
private function downloadHistory()
|
||||
{
|
||||
$this->response = array("download" => $this->downloadFile("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
}
|
||||
|
||||
private function viewHistory()
|
||||
{
|
||||
$log_date = gmdate("F d Y H:i:s", filemtime("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
exec ("strings /pineapple/modules/dump1090/log/".$this->request->file, $output);
|
||||
|
||||
if(!empty($output))
|
||||
$this->response = array("output" => implode("\n", $output), "date" => $log_date);
|
||||
else
|
||||
$this->response = array("output" => "Empty log...", "date" => $log_date);
|
||||
}
|
||||
|
||||
private function deleteHistory()
|
||||
{
|
||||
$file = basename($this->request->file,".log");
|
||||
exec("rm -rf /pineapple/modules/dump1090/log/".$file.".*");
|
||||
}
|
||||
|
||||
private function getSettings()
|
||||
{
|
||||
$settings = array(
|
||||
'csv' => $this->uciGet("dump1090.settings.csv"),
|
||||
'gain' => $this->uciGet("dump1090.settings.gain"),
|
||||
'frequency' => $this->uciGet("dump1090.settings.frequency"),
|
||||
'metrics' => $this->uciGet("dump1090.settings.metrics"),
|
||||
'agc' => $this->uciGet("dump1090.settings.agc"),
|
||||
'aggressive' => $this->uciGet("dump1090.settings.aggressive")
|
||||
);
|
||||
$this->response = array('settings' => $settings);
|
||||
}
|
||||
|
||||
private function setSettings()
|
||||
{
|
||||
$settings = $this->request->settings;
|
||||
$this->uciSet("dump1090.settings.gain", $settings->gain);
|
||||
$this->uciSet("dump1090.settings.frequency", $settings->frequency);
|
||||
if ($settings->csv) $this->uciSet("dump1090.settings.csv", 1); else $this->uciSet("dump1090.settings.csv", 0);
|
||||
if ($settings->metrics) $this->uciSet("dump1090.settings.metrics", 1); else $this->uciSet("dump1090.settings.metrics", 0);
|
||||
if ($settings->agc) $this->uciSet("dump1090.settings.agc", 1); else $this->uciSet("dump1090.settings.agc", 0);
|
||||
if ($settings->aggressive) $this->uciSet("dump1090.settings.aggressive", 1); else $this->uciSet("dump1090.settings.aggressive", 0);
|
||||
}
|
||||
|
||||
private function refreshList()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
echo file_get_contents("http://127.0.0.1:9090/data.json");
|
||||
};
|
||||
}
|
||||
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing, "running" => $running);
|
||||
}
|
||||
|
||||
private function refreshOutput()
|
||||
{
|
||||
if ($this->checkDependency("dump1090")) {
|
||||
if (file_exists("/tmp/dump1090_capture.log")) {
|
||||
$output = file_get_contents("/tmp/dump1090_capture.log");
|
||||
if (!empty($output)) {
|
||||
$this->response = $output;
|
||||
} else {
|
||||
$this->response = "dump1090 is running...";
|
||||
}
|
||||
} else {
|
||||
$this->response = "dump1090 is not running...";
|
||||
}
|
||||
} else {
|
||||
$this->response = "dump1090 is not installed...";
|
||||
}
|
||||
}
|
||||
|
||||
private function clearOutput()
|
||||
{
|
||||
exec("rm -rf /tmp/dump1090_capture.log");
|
||||
}
|
||||
|
||||
private function refreshHistory()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
$log_list = array_reverse(glob("/pineapple/modules/dump1090/log/*.log"));
|
||||
|
||||
echo '[';
|
||||
for ($i=0;$i<count($log_list);$i++) {
|
||||
$info = explode("_", basename($log_list[$i]));
|
||||
$entryDate = gmdate('Y-m-d H-i-s', $info[1]);
|
||||
$entryName = basename($log_list[$i], ".log");
|
||||
|
||||
if (file_exists("/pineapple/modules/dump1090/log/".$entryName.".csv")) {
|
||||
echo json_encode(array($entryDate, $entryName.".log", $entryName.".csv"));
|
||||
} else {
|
||||
echo json_encode(array($entryDate, $entryName.".log", ''));
|
||||
}
|
||||
|
||||
if ($i!=count($log_list)-1) {
|
||||
echo ',';
|
||||
}
|
||||
}
|
||||
echo ']';
|
||||
};
|
||||
}
|
||||
|
||||
private function downloadHistory()
|
||||
{
|
||||
$this->response = array("download" => $this->downloadFile("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
}
|
||||
|
||||
private function viewHistory()
|
||||
{
|
||||
$log_date = gmdate("F d Y H:i:s", filemtime("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
exec("strings /pineapple/modules/dump1090/log/".$this->request->file, $output);
|
||||
|
||||
if (!empty($output)) {
|
||||
$this->response = array("output" => implode("\n", $output), "date" => $log_date);
|
||||
} else {
|
||||
$this->response = array("output" => "Empty log...", "date" => $log_date);
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteHistory()
|
||||
{
|
||||
$file = basename($this->request->file, ".log");
|
||||
exec("rm -rf /pineapple/modules/dump1090/log/".$file.".*");
|
||||
}
|
||||
|
||||
private function getSettings()
|
||||
{
|
||||
$settings = array(
|
||||
'csv' => $this->uciGet("dump1090.settings.csv"),
|
||||
'gain' => $this->uciGet("dump1090.settings.gain"),
|
||||
'frequency' => $this->uciGet("dump1090.settings.frequency"),
|
||||
'metrics' => $this->uciGet("dump1090.settings.metrics"),
|
||||
'agc' => $this->uciGet("dump1090.settings.agc"),
|
||||
'aggressive' => $this->uciGet("dump1090.settings.aggressive")
|
||||
);
|
||||
$this->response = array('settings' => $settings);
|
||||
}
|
||||
|
||||
private function setSettings()
|
||||
{
|
||||
$settings = $this->request->settings;
|
||||
$this->uciSet("dump1090.settings.gain", $settings->gain);
|
||||
$this->uciSet("dump1090.settings.frequency", $settings->frequency);
|
||||
if ($settings->csv) {
|
||||
$this->uciSet("dump1090.settings.csv", 1);
|
||||
} else {
|
||||
$this->uciSet("dump1090.settings.csv", 0);
|
||||
}
|
||||
if ($settings->metrics) {
|
||||
$this->uciSet("dump1090.settings.metrics", 1);
|
||||
} else {
|
||||
$this->uciSet("dump1090.settings.metrics", 0);
|
||||
}
|
||||
if ($settings->agc) {
|
||||
$this->uciSet("dump1090.settings.agc", 1);
|
||||
} else {
|
||||
$this->uciSet("dump1090.settings.agc", 0);
|
||||
}
|
||||
if ($settings->aggressive) {
|
||||
$this->uciSet("dump1090.settings.aggressive", 1);
|
||||
} else {
|
||||
$this->uciSet("dump1090.settings.aggressive", 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshList()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
echo file_get_contents("http://127.0.0.1:9090/data.json");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@ registerController('dump1090_Controller', ['$api', '$scope', '$rootScope', '$int
|
||||
$scope.title = "Loading...";
|
||||
$scope.version = "Loading...";
|
||||
|
||||
$scope.refreshInfo = (function() {
|
||||
$scope.refreshInfo = (function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: "refreshInfo"
|
||||
}, function(response) {
|
||||
$scope.title = response.title;
|
||||
$scope.version = "v"+response.version;
|
||||
})
|
||||
});
|
||||
module: 'dump1090',
|
||||
action: "refreshInfo"
|
||||
}, function(response) {
|
||||
$scope.title = response.title;
|
||||
$scope.version = "v" + response.version;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshInfo();
|
||||
$scope.refreshInfo();
|
||||
|
||||
}]);
|
||||
|
||||
@@ -29,32 +29,32 @@ registerController('dump1090_ControlsController', ['$api', '$scope', '$rootScope
|
||||
$scope.sdAvailable = false;
|
||||
|
||||
$rootScope.status = {
|
||||
installed : false,
|
||||
running : false,
|
||||
refreshOutput : false,
|
||||
refreshHistory : false
|
||||
installed: false,
|
||||
running: false,
|
||||
refreshOutput: false,
|
||||
refreshHistory: false
|
||||
};
|
||||
|
||||
$scope.refreshStatus = (function() {
|
||||
$scope.refreshStatus = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshStatus"
|
||||
}, function(response) {
|
||||
$scope.status = response.status;
|
||||
$scope.statusLabel = response.statusLabel;
|
||||
module: "dump1090",
|
||||
action: "refreshStatus"
|
||||
}, function(response) {
|
||||
$scope.status = response.status;
|
||||
$scope.statusLabel = response.statusLabel;
|
||||
|
||||
$rootScope.status.installed = response.installed;
|
||||
$scope.device = response.device;
|
||||
$scope.sdAvailable = response.sdAvailable;
|
||||
if(response.processing) $scope.processing = true;
|
||||
$scope.install = response.install;
|
||||
$scope.installLabel = response.installLabel;
|
||||
$rootScope.status.running = response.running;
|
||||
})
|
||||
});
|
||||
$rootScope.status.installed = response.installed;
|
||||
$scope.device = response.device;
|
||||
$scope.sdAvailable = response.sdAvailable;
|
||||
if (response.processing) $scope.processing = true;
|
||||
$scope.install = response.install;
|
||||
$scope.installLabel = response.installLabel;
|
||||
$rootScope.status.running = response.running;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.toggledump1090 = (function() {
|
||||
if($scope.status != "Stop")
|
||||
$scope.toggledump1090 = (function() {
|
||||
if ($scope.status != "Stop")
|
||||
$scope.status = "Starting...";
|
||||
else
|
||||
$scope.status = "Stopping...";
|
||||
@@ -66,105 +66,102 @@ registerController('dump1090_ControlsController', ['$api', '$scope', '$rootScope
|
||||
$rootScope.status.refreshHistory = false;
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'toggledump1090',
|
||||
command: $rootScope.command
|
||||
}, function(response) {
|
||||
$timeout(function(){
|
||||
$rootScope.status.refreshOutput = true;
|
||||
$rootScope.status.refreshHistory = true;
|
||||
module: 'dump1090',
|
||||
action: 'toggledump1090',
|
||||
command: $rootScope.command
|
||||
}, function(response) {
|
||||
$timeout(function() {
|
||||
$rootScope.status.refreshOutput = true;
|
||||
$rootScope.status.refreshHistory = true;
|
||||
|
||||
$scope.starting = false;
|
||||
$scope.refreshStatus();
|
||||
$scope.starting = false;
|
||||
$scope.refreshStatus();
|
||||
|
||||
}, 2000);
|
||||
})
|
||||
}, 2000);
|
||||
})
|
||||
});
|
||||
|
||||
$scope.handleDependencies = (function(param) {
|
||||
if(!$rootScope.status.installed)
|
||||
$scope.handleDependencies = (function(param) {
|
||||
if (!$rootScope.status.installed)
|
||||
$scope.install = "Installing...";
|
||||
else
|
||||
$scope.install = "Removing...";
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'handleDependencies',
|
||||
destination: param
|
||||
}, function(response){
|
||||
if (response.success === true) {
|
||||
module: 'dump1090',
|
||||
action: 'handleDependencies',
|
||||
destination: param
|
||||
}, function(response) {
|
||||
if (response.success === true) {
|
||||
$scope.installLabel = "warning";
|
||||
$scope.processing = true;
|
||||
|
||||
$scope.handleDependenciesInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'handleDependenciesStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$scope.processing = false;
|
||||
$interval.cancel($scope.handleDependenciesInterval);
|
||||
$scope.refreshStatus();
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
$scope.handleDependenciesInterval = $interval(function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'handleDependenciesStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true) {
|
||||
$scope.processing = false;
|
||||
$interval.cancel($scope.handleDependenciesInterval);
|
||||
$scope.refreshStatus();
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshStatus();
|
||||
$scope.refreshStatus();
|
||||
}]);
|
||||
|
||||
registerController('dump1090_OutputController', ['$api', '$scope', '$rootScope', '$interval', function($api, $scope, $rootScope, $interval) {
|
||||
$scope.output = 'Loading...';
|
||||
$scope.output = 'Loading...';
|
||||
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
|
||||
$scope.refreshOutput = (function() {
|
||||
$scope.refreshOutput = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshOutput"
|
||||
}, function(response) {
|
||||
$scope.output = response;
|
||||
})
|
||||
});
|
||||
module: "dump1090",
|
||||
action: "refreshOutput"
|
||||
}, function(response) {
|
||||
$scope.output = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.clearOutput = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "clearOutput"
|
||||
}, function(response) {
|
||||
$scope.refreshOutput();
|
||||
})
|
||||
});
|
||||
module: "dump1090",
|
||||
action: "clearOutput"
|
||||
}, function(response) {
|
||||
$scope.refreshOutput();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if($scope.autoRefreshInterval)
|
||||
{
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if ($scope.autoRefreshInterval) {
|
||||
$interval.cancel($scope.autoRefreshInterval);
|
||||
$scope.autoRefreshInterval = null;
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$scope.refreshLabelON = "success";
|
||||
$scope.refreshLabelOFF = "default";
|
||||
|
||||
$scope.autoRefreshInterval = $interval(function(){
|
||||
$scope.autoRefreshInterval = $interval(function() {
|
||||
$scope.refreshOutput();
|
||||
}, 5000);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshOutput();
|
||||
$scope.refreshOutput();
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshOutput();
|
||||
}
|
||||
});
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if (param) {
|
||||
$scope.refreshOutput();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
@@ -173,52 +170,52 @@ registerController('dump1090_HistoryController', ['$api', '$scope', '$rootScope'
|
||||
$scope.historyOutput = 'Loading...';
|
||||
$scope.historyDate = 'Loading...';
|
||||
|
||||
$scope.refreshHistory = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshHistory"
|
||||
}, function(response) {
|
||||
$scope.history = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.viewHistory = (function(param) {
|
||||
$scope.refreshHistory = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "viewHistory",
|
||||
module: "dump1090",
|
||||
action: "refreshHistory"
|
||||
}, function(response) {
|
||||
$scope.history = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.viewHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "viewHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.historyOutput = response.output;
|
||||
}, function(response) {
|
||||
$scope.historyOutput = response.output;
|
||||
$scope.historyDate = response.date;
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
$scope.deleteHistory = (function(param) {
|
||||
$scope.deleteHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "deleteHistory",
|
||||
module: "dump1090",
|
||||
action: "deleteHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.refreshHistory();
|
||||
})
|
||||
});
|
||||
}, function(response) {
|
||||
$scope.refreshHistory();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.downloadHistory = (function(param) {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'downloadHistory',
|
||||
file: param
|
||||
}, function(response) {
|
||||
if (response.error === undefined) {
|
||||
window.location = '/api/?download=' + response.download;
|
||||
}
|
||||
});
|
||||
});
|
||||
$scope.downloadHistory = (function(param) {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'downloadHistory',
|
||||
file: param
|
||||
}, function(response) {
|
||||
if (response.error === undefined) {
|
||||
window.location = '/api/?download=' + response.download;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshHistory();
|
||||
|
||||
$rootScope.$watch('status.refreshHistory', function(param) {
|
||||
if(param) {
|
||||
if (param) {
|
||||
$scope.refreshHistory();
|
||||
}
|
||||
});
|
||||
@@ -228,15 +225,15 @@ registerController('dump1090_HistoryController', ['$api', '$scope', '$rootScope'
|
||||
registerController('dump1090_MapController', ['$api', '$scope', '$rootScope', '$timeout', '$location', '$sce', function($api, $scope, $rootScope, $timeout, $location, $sce) {
|
||||
|
||||
$scope.getMapSrc = (function(param) {
|
||||
return $sce.trustAsResourceUrl('http://' + $location.host() + ':9090/');
|
||||
});
|
||||
return $sce.trustAsResourceUrl('http://' + $location.host() + ':9090/');
|
||||
});
|
||||
|
||||
$scope.refreshMap = (function(param) {
|
||||
document.getElementById('map').src += '';
|
||||
});
|
||||
document.getElementById('map').src += '';
|
||||
});
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
if (param) {
|
||||
$scope.refreshMap();
|
||||
}
|
||||
});
|
||||
@@ -250,37 +247,34 @@ registerController('dump1090_ListController', ['$api', '$scope', '$rootScope', '
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if($scope.autoRefreshInterval)
|
||||
{
|
||||
if ($scope.autoRefreshInterval) {
|
||||
$interval.cancel($scope.autoRefreshInterval);
|
||||
$scope.autoRefreshInterval = null;
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$scope.refreshLabelON = "success";
|
||||
$scope.refreshLabelOFF = "default";
|
||||
|
||||
$scope.autoRefreshInterval = $interval(function(){
|
||||
$scope.autoRefreshInterval = $interval(function() {
|
||||
$scope.refreshList();
|
||||
}, 5000);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshList = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshList"
|
||||
}, function(response) {
|
||||
$scope.list = response;
|
||||
})
|
||||
});
|
||||
$scope.refreshList = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshList"
|
||||
}, function(response) {
|
||||
$scope.list = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshList();
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
if (param) {
|
||||
$scope.refreshList();
|
||||
}
|
||||
});
|
||||
@@ -288,51 +282,51 @@ registerController('dump1090_ListController', ['$api', '$scope', '$rootScope', '
|
||||
}]);
|
||||
|
||||
registerController('dump1090_SettingsController', ['$api', '$scope', '$rootScope', '$timeout', function($api, $scope, $rootScope, $timeout) {
|
||||
$scope.settings = {
|
||||
csv : false,
|
||||
gain : "",
|
||||
frequency : "",
|
||||
metrics : false,
|
||||
agc : false,
|
||||
aggressive : false
|
||||
};
|
||||
$scope.settings = {
|
||||
csv: false,
|
||||
gain: "",
|
||||
frequency: "",
|
||||
metrics: false,
|
||||
agc: false,
|
||||
aggressive: false
|
||||
};
|
||||
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
|
||||
$scope.getSettings = function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'getSettings'
|
||||
}, function(response) {
|
||||
$scope.settings = response.settings;
|
||||
});
|
||||
};
|
||||
$scope.getSettings = function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'getSettings'
|
||||
}, function(response) {
|
||||
$scope.settings = response.settings;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.setSettings = function() {
|
||||
$scope.saveSettingsLabel = "warning";
|
||||
$scope.saveSettings = "Saving...";
|
||||
$scope.saving = true;
|
||||
$scope.setSettings = function() {
|
||||
$scope.saveSettingsLabel = "warning";
|
||||
$scope.saveSettings = "Saving...";
|
||||
$scope.saving = true;
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'setSettings',
|
||||
settings: $scope.settings
|
||||
}, function(response) {
|
||||
$scope.getSettings();
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'setSettings',
|
||||
settings: $scope.settings
|
||||
}, function(response) {
|
||||
$scope.getSettings();
|
||||
|
||||
$scope.saveSettingsLabel = "success";
|
||||
$scope.saveSettings = "Saved";
|
||||
$scope.saveSettingsLabel = "success";
|
||||
$scope.saveSettings = "Saved";
|
||||
|
||||
$timeout(function(){
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
$timeout(function() {
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getSettings();
|
||||
$scope.getSettings();
|
||||
|
||||
}]);
|
||||
|
||||
1
dump1090/log/README.txt
Normal file
1
dump1090/log/README.txt
Normal file
@@ -0,0 +1 @@
|
||||
Logs will be saved here.
|
||||
@@ -12,14 +12,13 @@ touch /tmp/dump1090.progress
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
if [ "$2" = "internal" ]; then
|
||||
opkg update
|
||||
opkg install dump1090
|
||||
opkg update
|
||||
opkg install dump1090
|
||||
elif [ "$2" = "sd" ]; then
|
||||
opkg update
|
||||
opkg install dump1090 --dest sd
|
||||
|
||||
ln -s /sd/usr/share/dump1090/ /usr/share/dump1090
|
||||
|
||||
fi
|
||||
|
||||
touch /etc/config/dump1090
|
||||
@@ -30,8 +29,8 @@ if [ "$1" = "install" ]; then
|
||||
uci commit dump1090.module.installed
|
||||
|
||||
elif [ "$1" = "remove" ]; then
|
||||
opkg remove dump1090
|
||||
rm -rf /etc/config/dump1090
|
||||
opkg remove dump1090
|
||||
rm -rf /etc/config/dump1090
|
||||
fi
|
||||
|
||||
rm /tmp/dump1090.progress
|
||||
|
||||
@@ -38,6 +38,6 @@ if [ "$1" = "start" ]; then
|
||||
fi
|
||||
|
||||
elif [ "$1" = "stop" ]; then
|
||||
killall -9 dump1090
|
||||
killall -9 dump1090
|
||||
killall -9 nc
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user