Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Verstraeten committed Sep 2, 2016
2 parents 518eb8e + a0ae8ca commit 1d81dea
Show file tree
Hide file tree
Showing 39 changed files with 997 additions and 303 deletions.
4 changes: 3 additions & 1 deletion app/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
Route::put('condition', 'Controllers\SettingsController@updateConditions');
Route::get('condition/enabled', 'Controllers\SettingsController@getConditionEnabled');
Route::put('condition/enabled', 'Controllers\SettingsController@updateConditionEnabled');

Route::get('streamPort', 'Controllers\SettingsController@getStreamPort');

Route::get('io', 'Controllers\SettingsController@getIos');
Route::put('io', 'Controllers\SettingsController@updateIos');
Expand All @@ -96,4 +98,4 @@
*
**********************************/

Route::group(array('prefix' => 'api/v2'), function(){});
Route::group(array('prefix' => 'api/v2'), function(){});
2 changes: 1 addition & 1 deletion app/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
|
*/

'version' => '2.0.0',
'version' => '2.1.0',

'config' => '/etc/opt/kerberosio/config',

Expand Down
7 changes: 7 additions & 0 deletions app/controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ public function updateConditionEnabled()
return $this->getConditionEnabled();
}

public function getStreamPort()
{
$instance = explode(',', $this->getPiece("stream.xml", ["Mjpg","streamPort"])->__toString());
return Response::json($instance);
}


/*******************************************
* Get and set the ios.
*/
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ public function isStreamRunning()

try
{
$fp = fsockopen('127.0.0.1', 8888, $errno, $errstr, 5);
$directory = $this->config;
$settings = $this->reader->parse($directory)["instance"]["children"];
$port = $settings['stream']['dropdown']['Mjpg']['children']['streamPort']['value'];

$fp = fsockopen('127.0.0.1', $port, $errno, $errstr, 5);
if(!$fp)
{
// port is closed or blocked
Expand Down
82 changes: 46 additions & 36 deletions app/repositories/support/ZendeskSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,61 @@ public function getArticles($count = 7)
{
$articles = [];

// Get ID of the Announcements section
$url = 'https://kerberosio.zendesk.com/api/v2/help_center/sections.json';
$client = new Client();
$request = $client->get($url);
$response = $client->send($request);
$body = json_decode($response->getBody());
$body = $body->sections;

$id = null;
for($i = 0; $i < count($body); $i++)
try
{
if($body[$i]->name == 'Announcements')
{
$id = $body[$i]->id;
break;
}
}

if($id != null)
{
// Get all articles and filter on announcement
$url = "https://kerberosio.zendesk.com/api/v2/help_center/articles/search.json?query=&section=$id";
// Get ID of the Announcements section
$url = 'https://kerberosio.zendesk.com/api/v2/help_center/sections.json';
$client = new Client();
$request = $client->get($url);
$response = $client->send($request);
$body = json_decode($response->getBody());
$body = $body->results;
$body = $body->sections;

$id = null;
for($i = 0; $i < count($body); $i++)
{
array_push($articles, [
'title' => $body[$i]->title,
'date' => Carbon::parse($body[$i]->created_at)->formatLocalized('%d %B %Y'),
'body' => $body[$i]->body,
'url' => $body[$i]->html_url
]);
if($body[$i]->name == 'Announcements')
{
$id = $body[$i]->id;
break;
}
}

if($id != null)
{
// Get all articles and filter on announcement
$url = "https://kerberosio.zendesk.com/api/v2/help_center/articles/search.json?query=&section=$id";
$request = $client->get($url);
$response = $client->send($request);
$body = json_decode($response->getBody());
$body = $body->results;

for($i = 0; $i < count($body); $i++)
{
array_push($articles, [
'title' => $body[$i]->title,
'timestamp' => Carbon::parse($body[$i]->created_at)->timestamp,
'date' => Carbon::parse($body[$i]->created_at)->formatLocalized('%d %B %Y'),
'body' => $body[$i]->body,
'url' => $body[$i]->html_url
]);
}

usort($articles, function($a, $b)
{
return strcmp($a['timestamp'], $b['timestamp']);
});
}

if($count > count($articles))
{
$count = count($articles);
}

$articles = array_reverse($articles);
$articles = array_slice($articles, 0, $count);
}

if($count > count($articles))
{
$count = count($articles);
}

$articles = array_reverse($articles);
$articles = array_slice($articles, 0, $count);
catch (\Exception $e) {}

return $articles;
}
Expand Down
2 changes: 1 addition & 1 deletion app/repositories/system/OSSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function rebooting()
public function shuttingdown()
{
// reboot
$cmd = 'shutdown -r now';
$cmd = 'halt';
$output = shell_exec($cmd);

return true;
Expand Down
16 changes: 14 additions & 2 deletions app/traits/GetVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ trait GetVersions
public function isUpdateAvailable()
{
$currentVersion = $this->getCurrentVersion();

if($currentVersion)
{
$latestVersion = array_reverse($this->getVersionsFromGithub())[0]['version'];
return ($currentVersion !== $latestVersion);
$versions = [];

try
{
$versions = $this->getVersionsFromGithub();
}
catch(\Exception $e){}

if(count($versions) > 0)
{
$latestVersion = array_reverse($versions)[0]['version'];
return ($currentVersion !== $latestVersion);
}
}

return false;
Expand Down
1 change: 1 addition & 0 deletions app/views/controls/hullselection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
?>

<script type="text/javascript">
// Select a hull
require([_jsBase + 'main.js'], function(common)
{
Expand Down
36 changes: 36 additions & 0 deletions app/views/controls/twolines.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div class="image twolines">

<div id="map"></div>

<?php
$src = App::make("Controllers\ImageController")->getLatestImage();
if($src != "")
{
$image = Image::make($src);
}
else
{
// fake an image
$image = Image::canvas(800, 640);
}
?>

<script type="text/javascript">
// Select two lines
require([_jsBase + 'main.js'], function(common)
{
require(["app/controllers/twolines"], function(twolines)
{
twolines.setElement($(".twolines #map"));
twolines.setImage("{{$src}}");
twolines.setImageSize("{{$image->width()}}","{{$image->height()}}");
twolines.setCoordinates("{{$value}}");
twolines.setName("{{$file."__".$attribute}}");
twolines.initialize();
});
});
</script>
</div>
19 changes: 11 additions & 8 deletions app/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,18 @@
],
function(Streamer, Sequencer, Heatmap, Pie, Graph, Radar)
{
Streamer.initialize(
$.get('api/v1/streamPort',function(data)
{
element: "livestream",
host: "<?=parse_url(URL::to('/'), PHP_URL_HOST)?>",
port: 8888,
width: '100%',
callback: function(){}
});
Streamer.initialize(
{
element: "livestream",
host: "<?=parse_url(URL::to('/'), PHP_URL_HOST)?>",
port: data[0],
width: '100%',
callback: function(){}
});
})
Sequencer.initialize(
{
element: "canvas",
Expand Down
8 changes: 6 additions & 2 deletions app/views/image.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@

</div>

@include('photoswipe')
<div id="loading-image-view" class="load4" style="padding:50px 0;">
<div class="loader"></div>
</div>

@include('photoswipe')

<div id="images-overview"></div>
<script type="text/javascript">
require([_jsBase + 'main.js'], function(common)
Expand All @@ -38,7 +42,7 @@
<!-- CSS loader, shown when an url is pasted -->
<div class="start-loading">
<div class="scroll-down"><i class="fa fa-repeat"></i> Load more..</div>
<div class="load4" style="display:none;">
<div id="load-more-images" class="load4" style="display:none;">
<div class="loader"></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<script src="{{URL::to('/')}}/js/vendor/requirejs/require.js"></script>
<!-- Core CSS -->
<link href="{{URL::to('/')}}/css/kerberos.min.css" rel="stylesheet">
<link href="{{URL::to('/')}}/js/vendor/csshake/csshake.css" rel="stylesheet">
<link href="{{URL::to('/')}}/js/vendor/csshake/dist/csshake.css" rel="stylesheet">
</head>
<body id="red">
<body id="red" class="login">
<div class="center">
<div class="content">
<div class="circle">
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="container-fluid">
<div class="row">
<div id="settings" class="col-lg-12">
<h2><i class="fa fa-list"></i> {{Lang::get('settings.settings')}}</h2>
<h2><i class="fa fa-wrench"></i> {{Lang::get('settings.settings')}}</h2>
{{ Form::open(array('action' => 'Controllers\SettingsController@update')) }}
@include('settings_controls', array('settings' => $settings))
<div class="submit-form">
Expand Down
4 changes: 2 additions & 2 deletions app/views/system.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
},
step: function(state, bar)
{
bar.setText(60 - (bar.value() * 100).toFixed(0));
bar.setText(60 - (bar.value() * 60).toFixed(0));
}
});
Expand Down Expand Up @@ -336,7 +336,7 @@
},
step: function(state, bar)
{
bar.setText(60 - (bar.value() * 100).toFixed(0));
bar.setText(60 - (bar.value() * 60).toFixed(0));
}
});
Expand Down
13 changes: 10 additions & 3 deletions app/views/template.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@
</button>
<a class="system" href="{{URL::to('/')}}/system">
<i class="fa fa-desktop"></i>
</a>
<a class="settings" href="{{URL::to('/settings')}}">
<i class="fa fa-wrench"></i>
</a>
<div class="circle">
<div class="kerberos"></div>
<a href="{{URL::to('/')}}">
<div class="kerberos"></div>
</a>
</div>
<a class="navbar-brand" href="{{URL::to('/')}}"><h1>KERBEROS.IO</h1></a>
<a class="navbar-brand" href="{{URL::to('/')}}">
<h1>KERBEROS.IO</h1>
</a>
</div>
<!-- Top Menu Items -->
<ul class="nav navbar-right top-nav">
Expand All @@ -73,7 +80,7 @@
</li>
@if(Config::get('app.config') != '')
<li>
<a href="{{URL::to('/settings')}}"><i class="fa fa-list"></i> {{Lang::get('general.settings')}}</a>
<a href="{{URL::to('/settings')}}"><i class="fa fa-wrench"></i> {{Lang::get('general.settings')}}</a>
</li>
<li>
<a href="{{URL::to('/cloud')}}"><i class="fa fa-cloud"></i> {{Lang::get('general.cloud')}}</a>
Expand Down
9 changes: 8 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM phusion/baseimage:latest
FROM phusion/baseimage:0.9.16

MAINTAINER "Cédric Verstraeten" <[email protected]>

Expand Down Expand Up @@ -33,6 +33,13 @@ RUN apt-get -y install supervisor curl subversion libcurl4-gnutls-dev cmake dh-a
RUN sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php5/fpm/pool.d/www.conf && \
find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;

########################################
# Force both nginx and PHP-FPM to run in the foreground
# This is a requirement for supervisor

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf

###################
# nginx site conf

Expand Down
2 changes: 1 addition & 1 deletion public/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"tests"
],
"dependencies": {
"jquery": "*",
"jquery": "2.2.2",
"fancybox": "*",
"bootstrap": "*",
"underscore": "*",
Expand Down
1 change: 0 additions & 1 deletion public/capture-wrong

This file was deleted.

Loading

0 comments on commit 1d81dea

Please sign in to comment.