mirror of
https://github.com/kerberos-io/documentation.git
synced 2026-08-23 15:18:31 +00:00
64 lines
22 KiB
HTML
64 lines
22 KiB
HTML
<!doctype html><html lang=en-us><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="ie=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel=stylesheet href=https://doc.kerberos.io/main.5aa8061fdddcae33bf9aae606a659f783fca649c2a6c915897a14d1088493ae547064045e7ca5a43d69061955d449757d1bcb708760ae71f478384770974e798.css integrity="sha512-WqgGH93crjO/mq5gamWfeD/KZJwqbJFYl6FNEIhJOuVHBkBF58paQ9aQYZVdRJdX0by3CHYK5x9Hg4R3CXTnmA==" crossorigin=anonymous><noscript><style>img.lazyload{display:none}</style></noscript><meta name=robots content="index, follow"><meta name=googlebot content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"><meta name=bingbot content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"><title>Web - Kerberos Docs</title><meta name=description content="The web is the front-end for the Kerberos Open Source agent, it allows you to review recordings and update camera settings."><link rel=canonical href=https://doc.kerberos.io/opensource/web/><meta name=twitter:card content="summary_large_image"><meta name=twitter:image content="/doks.png"><meta name=twitter:title content="Web"><meta name=twitter:description content="The web is the front-end for the Kerberos Open Source agent, it allows you to review recordings and update camera settings."><meta name=twitter:site content="@kerberosio"><meta name=twitter:creator content="@kerberosio"><meta property="og:title" content="Web"><meta property="og:description" content="The web is the front-end for the Kerberos Open Source agent, it allows you to review recordings and update camera settings."><meta property="og:type" content="article"><meta property="og:url" content="/opensource/web/"><meta property="og:image" content="/doks.png"><meta property="article:published_time" content="2020-10-06T08:49:31+00:00"><meta property="article:modified_time" content="2020-10-06T08:49:31+00:00"><meta property="og:site_name" content="Kerberos Docs"><meta property="article:publisher" content="https://www.facebook.com/"><meta property="article:author" content="https://www.facebook.com/"><meta property="og:locale" content="en_US"><script type=application/ld+json>{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/doc.kerberos.io\/"},{"@type":"ListItem","position":3,"name":"Opensource","item":"https:\/\/doc.kerberos.io\/\/opensource\/"},{"@type":"ListItem","position":4,"name":"Web","item":"https:\/\/doc.kerberos.io\/\/opensource\/web\/"}]}</script><meta name=theme-color content="#fff"><link rel=apple-touch-icon sizes=180x180 href=https://doc.kerberos.io/favicons/apple-touch-icon.png><link rel=icon type=image/png sizes=32x32 href=https://doc.kerberos.io/favicons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=https://doc.kerberos.io/favicons/favicon-16x16.png><link rel=manifest href=https://doc.kerberos.io/site.webmanifest><script async defer data-domain=doc.kerberos.io src=https://plausible.kerberos.io/js/plausible.js></script></head><body class="opensource single"><div class="header-bar fixed-top"></div><header class="navbar fixed-top navbar-expand-md navbar-light"><div class=container><input class="menu-btn order-0" type=checkbox id=menu-btn>
|
|
<label class="menu-icon d-md-none" for=menu-btn><span class=navicon></span></label><a class="navbar-brand order-1 order-md-0 me-auto" href=https://doc.kerberos.io/><img src=https://doc.kerberos.io/images/kerberos-logo.svg class=logo>
|
|
Kerberos Docs</a>
|
|
<button id=mode class="btn btn-link order-2 order-md-4" type=button aria-label="Toggle mode">
|
|
<span class=toggle-dark><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg></span><span class=toggle-light><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></span></button><div class="collapse navbar-collapse order-4 order-md-1"><ul class="navbar-nav main-nav me-auto order-5 order-md-2"><li class=nav-item><a class=nav-link href=https://kerberos.io>Homepage</a></li></ul><div class="break order-6 d-md-none"></div><form class="navbar-form flex-grow-1 order-7 order-md-3"><input id=userinput class="form-control is-search" type=search placeholder="Search docs..." aria-label="Search docs..." autocomplete=off><div id=suggestions class="shadow bg-white rounded"></div></form></div></div></header><div class="wrap container" role=document><div class=content><div class="row flex-xl-nowrap"><div class="col-lg-5 col-xl-4 docs-sidebar"><nav class=docs-links aria-label="Main navigation"><h3>Prologue</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/>Introduction</a></li><li><a class=docs-link href=https://doc.kerberos.io/prologue/how/>How it works</a></li><li><a class=docs-link href=https://doc.kerberos.io/prologue/deployments/>Deployments</a></li><li><a class=docs-link href=https://doc.kerberos.io/prologue/glossary/>Glossary</a></li></ul><h3>Opensource v2</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/opensource/first-things-first/>First things first</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/get-started/>Get started</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/installation/>Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/installation-advanced/>Advanced Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/releases/>Release notes</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/license/>License</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/upgrade/>Upgrade</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/contribute/>Contribute</a></li><li><a class=docs-link href=https://doc.kerberos.io/opensource/machinery/>Machinery</a></li><li><a class="docs-link active" href=https://doc.kerberos.io/opensource/web/>Web</a></li></ul><h3>Opensource v3</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/opensourcev3/announcement/>Announcement</a></li></ul><h3>Enterprise</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/enterprise/first-things-first/>First things first</a></li><li><a class=docs-link href=https://doc.kerberos.io/enterprise/get-started/>Get Started</a></li><li><a class=docs-link href=https://doc.kerberos.io/enterprise/installation/>Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/enterprise/installation-cloud/>Cloud Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/enterprise/installation-edge/>Edge Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/enterprise/releases/>Releases</a></li></ul><h3>Vault</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/vault/first-things-first/>First things first</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/get-started/>Get Started</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/installation/>Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/installation-cloud/>Cloud Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/installation-edge/>Edge Installation</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/providers/>Providers</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/recycle/>Recycle</a></li><li><a class=docs-link href=https://doc.kerberos.io/vault/releases/releases/>Releases</a></li></ul><h3>Hub</h3><ul class=list-unstyled><li><a class=docs-link href=https://doc.kerberos.io/hub/first-things-first/>First things first</a></li></ul></nav></div><nav class="docs-toc d-none d-xl-block col-xl-4" aria-label="Secondary navigation"><div class=page-links><h3>On this page</h3><nav id=TableOfContents><ul><li><a href=#overview>Overview</a><ul><li><a href=#dashboard>Dashboard</a></li><li><a href=#overview-1>Overview</a></li><li><a href=#settings>Settings</a></li><li><a href=#system>System</a></li></ul></li><li><a href=#project-structure>Project structure</a><ul><li><a href=#back-end>Back-end</a></li><li><a href=#front-end>Front-end</a></li></ul></li><li><a href=#api>API</a><ul><li><a href=#authentication>Authentication</a></li><li><a href=#endpoints>Endpoints</a></li><li><a href=#version-1>Version 1</a></li></ul></li></ul></nav></div></nav><main class="docs-content col-lg-11 col-xl-8"><h1>Web</h1><p class=lead>The web is the front-end for the Kerberos Open Source agent, it allows you to review recordings and update camera settings.</p><p>The web is responsible for the visualization. It’s a GUI which helps the user to find activity at a specific period, configure the machinery, view a live stream, see system information and much more.</p><p>It’s written in PHP using the extremely popular PHP Framework Laravel, and Javascript using the client-side framework BackboneJS. We will discuss the different pages and functionality briefly. Please check out <a href=https://demo.kerberos.io>the demo environment</a> if you want to see a real life example.</p><h2 id=overview>Overview<a href=#overview class=anchor aria-hidden=true>#</a></h2><p>We will shortly discuss the different pages that make up the web interface of Kerberos Open Source.</p><h3 id=dashboard>Dashboard<a href=#dashboard class=anchor aria-hidden=true>#</a></h3><p>The landing page of the web is the dashboard. On the dashboard a user will see some statistics: activity per hour, activity per day, a live stream, the latest activity and a heatmap.</p><figure class=stretch><img src=dashboard.png alt="The dashboard gives a high-level overview of your Kerberos Opensource agent."><figcaption><p>The dashboard gives a high-level overview of your Kerberos Opensource agent.</p></figcaption></figure><h3 id=overview-1>Overview<a href=#overview-1 class=anchor aria-hidden=true>#</a></h3><p>When selecting a specific day, you’ll will get a timeline and overview. By using the timeline you can navigate through a day; the timeline highlights the amount of activity, from gray to red.</p><figure class=stretch><img src=overview.png alt="The media page gives an overview of your recordings (grouped into sequences) for that specific day."><figcaption><p>The media page gives an overview of your recordings (grouped into sequences) for that specific day.</p></figcaption></figure><h3 id=settings>Settings<a href=#settings class=anchor aria-hidden=true>#</a></h3><p>The settings page allows you to configure the machinery. You can define the type of camera, post-processes, conditions and much more; it’s highly configurable.</p><figure class=stretch><img src=settings.png alt="The settings page allows you to modify and tweak the camera and motion settings."><figcaption><p>The settings page allows you to modify and tweak the camera and motion settings.</p></figcaption></figure><h3 id=system>System<a href=#system class=anchor aria-hidden=true>#</a></h3><p>The system page allows you to monitor the system. On this page you’ll get an overview of the system specifications (CPU, Memory, Network, etc). Several actions are available: you can download system information (for debugging purposes) and download or remove your images.</p><figure class=stretch><img src=system.png alt="The system pages show you the current status of your agent."><figcaption><p>The system pages show you the current status of your agent.</p></figcaption></figure><h2 id=project-structure>Project structure<a href=#project-structure class=anchor aria-hidden=true>#</a></h2><p>The web interface is using the Laravel framework (version 5.4). There is a lot of documentation related to Laravel, please review <a href=https://laravel.com/docs/5.4>their documentation website here</a>. In a nutshell this is how the web is organised.</p><h3 id=back-end>Back-end<a href=#back-end class=anchor aria-hidden=true>#</a></h3><ul><li>config/app.php - general application settings.</li><li>config/kerberos.php - this file contains web specific parameters; the user credentials to sign in, etc.</li><li>app/Http/Controllers - MVC controllers</li><li>app/Http/Repositories -repositories are injected into the controller.</li><li>app/Providers/AppServiceProvider.php - bind repositories to a specific interface - dependency injection.</li><li>routes/api.php - contains all the URI endpoints for Ajax calls.</li><li>routes/web.php - url routing for pages.</li></ul><h3 id=front-end>Front-end<a href=#front-end class=anchor aria-hidden=true>#</a></h3><ul><li>public/css/less - LESS is used for the CSS.</li><li>public/js/app - BackboneJS and RequireJS is used for building modular JS classes.</li><li>public/js/mustache - Mustache is used for the client-side view rendering.</li><li>public/js/vendor - This is where the bower extensions are installed.</li><li>public/capture - A directory where images are written to by default.</li><li>public/bower.json - The bower extensions used in the web repository.</li><li>public/Gruntfile.js - We are using Grunt for our task manager.</li></ul><h2 id=api>API<a href=#api class=anchor aria-hidden=true>#</a></h2><p>If you want to integrate the Kerberos agent with your own application, you’re at the right place! The web interface comes with a RESTfull API, that allows you to retrieve and modify information from the Kerberos agent.</p><ul><li>Disable the machinery</li><li>Health check</li><li>Enable or disable output devices</li><li>etc.</li></ul><h3 id=authentication>Authentication<a href=#authentication class=anchor aria-hidden=true>#</a></h3><p>To use the RESTfull API of your Kerberos agent you need to define an Authorization header with each request. We use Basic Authentication to secure the different endpoints.</p><pre><code class=language-json>"Authorization": "Basic root:root"
|
|
</code></pre><p>An example with Python looks like this.</p><pre><code class=language-python>import requests
|
|
import json
|
|
import base64
|
|
url = "http://ip-of-pi/api/v1/condition/enabled"
|
|
username = "user"
|
|
password = "passw"
|
|
basicAuth = base64.b64encode('%s:%s' % (username, password))
|
|
headers = {"Authorization": "Basic " + basicAuth, "Content-Type": "application/json"}
|
|
data = '{"active": "true"}'
|
|
#Call REST API
|
|
response = requests.put(url, data=data, headers=headers)
|
|
print(response.text)
|
|
</code></pre><p>If you’re using the wrong credentials, the web will return following error message.</p><pre><code class=language-text>Invalid credentials.
|
|
</code></pre><h3 id=endpoints>Endpoints<a href=#endpoints class=anchor aria-hidden=true>#</a></h3><p>All endpoints are prefixed with api/v[version]/, in which the last part defines the API version number. Below you will find all the available endpoints with there signature and response. Note that when you call an endpoint which doesn’t exists, the web will throw an 404.</p><pre><code class=language-json>{
|
|
"error": "API method does not exists"
|
|
}
|
|
</code></pre><h3 id=version-1>Version 1<a href=#version-1 class=anchor aria-hidden=true>#</a></h3><p>Below you’ll find a list of all API methods which are available for version 1.</p><p><code>GET api/v1/name</code></p><p><strong>Description</strong></p><p>Retrieve the name of your instance.</p><p><strong>Response</strong></p><pre><code class=language-json>{
|
|
"name": "frontdoor"
|
|
}
|
|
</code></pre><p><code>PUT api/v1/name</code></p><p><strong>Description</strong></p><p>Change the name of your instance.</p><p><strong>Payload</strong></p><pre><code class=language-json>{
|
|
"name": "frontdoor-changed"
|
|
}
|
|
</code></pre><p><strong>Response</strong></p><pre><code class=language-json>{
|
|
"name": "frontdoor-changed"
|
|
}
|
|
</code></pre><p><code>GET api/v1/images/latest_sequence</code></p><p><strong>Description</strong></p><p>Retrieve the latest sequence detected.</p><p><strong>Response</strong></p><pre><code class=language-json>[
|
|
{
|
|
time: "10:59:57",
|
|
src: "https://demo.kerberos.io/capture/1501491597_6-310145_frontdoor_722-691-873-926_703_511.mp4",
|
|
local_src: "/var/www/web/public/capture/1501491597_6-310145_frontdoor_722-691-873-926_703_511.mp4",
|
|
metadata: {
|
|
key: "1501491597_6-310145_frontdoor_722-691-873-926_703_511.mp4",
|
|
user: "1501491597_6-310145_frontdoor_722-691-873-926_703_511.mp4",
|
|
timestamp: 1501491597,
|
|
microseconds: "6-310145",
|
|
instanceName: "frontdoor",
|
|
regionCoordinates: "722-691-873-926",
|
|
numberOfChanges: "703",
|
|
token: "511"
|
|
},
|
|
type: "video"
|
|
}
|
|
]
|
|
</code></pre><p><code>GET api/v1/condition/enabled</code></p><p><strong>Description</strong></p><p>Check if enabled or disabled.</p><p><strong>Response</strong></p><pre><code class=language-json>{
|
|
"active": "true",
|
|
"delay": "5000"
|
|
}
|
|
</code></pre><p><code>PUT api/v1/condition/enabled</code></p><p><strong>Description</strong></p><p>Activate or disable the system.</p><p><strong>Payload</strong></p><pre><code class=language-json>{
|
|
"active": "false"
|
|
}
|
|
</code></pre><p><strong>Response</strong></p><pre><code class=language-json>{
|
|
"active": "false",
|
|
"delay": "5000"
|
|
}
|
|
</code></pre><p><code>GET api/v1/system/health</code></p><p><strong>Description</strong></p><p>Check if the machinery is running (the stream is connected).</p><p><strong>Response</strong></p><pre><code class=language-json>{
|
|
"status": "false"
|
|
}
|
|
</code></pre><p class=edit-page><a href=https://github.com/kerberos-io/documentation/blob/master/content/opensource/web/index.md><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828.0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>Edit this page on GitHub</a></p><div class="docs-navigation d-flex justify-content-between"><a href=https://doc.kerberos.io/opensource/machinery/><div class="card my-1"><div class="card-body py-2">← Machinery</div></div></a></div></main></div></div></div><footer class="footer text-muted"><div class=container><div class=row><div class="col-lg-6 order-last order-lg-first"><ul class="navbar-nav social-nav"><li class=copyright>© 2014–2021
|
|
<a href=https://kerberos.io>Kerberos.io</a></li><li class=nav-item><a class=link href=https://twitter.com/kerberosio title=Twitter><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9.0 01-3.14 1.53 4.48 4.48.0 00-7.86 3v1A10.66 10.66.0 013 4s-4 9 5 13a11.64 11.64.0 01-7 2c9 5 20 0 20-11.5a4.5 4.5.0 00-.08-.83A7.72 7.72.0 0023 3z"/></svg><span class="ms-2 visually-hidden">Twitter</span></a></li><li class=nav-item><a class=link href=https://github.com/kerberos-io title=GitHub><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37.0 00-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44.0 0020 4.77 5.07 5.07.0 0019.91 1S18.73.65 16 2.48a13.38 13.38.0 00-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07.0 005 4.77 5.44 5.44.0 003.5 8.55c0 5.42 3.3 6.61 6.44 7A3.37 3.37.0 009 18.13V22"/></svg><span class="ms-2 visually-hidden">GitHub</span></a></li><li class=nav-item><a class=link href=https://www.reddit.com/r/kerberos_io/ title=Reddit><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-circle"><path d="M21 11.5a8.38 8.38.0 01-.9 3.8A8.5 8.5.0 0112.5 20a8.38 8.38.0 01-3.8-.9L3 21l1.9-5.7A8.38 8.38.0 014 11.5a8.5 8.5.0 014.7-7.6 8.38 8.38.0 013.8-.9h.5a8.48 8.48.0 018 8v.5z"/></svg><span class="ms-2 visually-hidden">Reddit</span></a></li></ul></div><div class="col-lg-10 order-first order-lg-last text-lg-end"><ul class=list-inline><li class=list-inline-item>Learn more about</li><li class=list-inline-item><a href=https://kerberos.io/product/enterprise-agent/>Enterprise Agent</a></li><li class=list-inline-item><a href=https://kerberos.io/product/hub/>Hub</a></li><li class=list-inline-item><a href=https://kerberos.io/product/open-source/>Kerberos Opensource</a></li><li class=list-inline-item><a href=https://kerberos.io/product/vault/>Vault</a></li></ul></div></div></div></footer><script src=https://doc.kerberos.io/js/highlight.min.13bf6b39f28cd07b0780c0c154bf050bad1e7b73231c15e43b993504cca3fa814222ded3c525f429528451fe039a5078c71ae4d000486d26f9b920cc7db474da.js integrity="sha512-E79rOfKM0HsHgMDBVL8FC60ee3MjHBXkO5k1BMyj+oFCIt7TxSX0KVKEUf4DmlB4xxrk0ABIbSb5uSDMfbR02g==" crossorigin=anonymous defer></script><script src=https://doc.kerberos.io/main.min.89223fc6eee34e2dc10266cff3c7fc87949c595388f775ec6e93132410cef77e5ff7f24a81db03c9b9eb6d2e6d75ea5a7d22945c574b65dfeb426f65af771230.js integrity="sha512-iSI/xu7jTi3BAmbP88f8h5ScWVOI93XsbpMTJBDO935f9/JKgdsDybnrbS5tdepafSKUXFdLZd/rQm9lr3cSMA==" crossorigin=anonymous defer></script><script src=https://doc.kerberos.io/index.min.71e05784bf5441c378e8824d18e4b5a057f28cde2bd06f927216eb278586f7ea7d96309df4600474b3b928ef2b635a64248e2cf3a7a023136087ed4050162608.js integrity="sha512-ceBXhL9UQcN46IJNGOS1oFfyjN4r0G+SchbrJ4WG9+p9ljCd9GAEdLO5KO8rY1pkJI4s86egIxNgh+1AUBYmCA==" crossorigin=anonymous defer></script></body></html> |