Files
odoo_source/addons/hw_posbox_homepage/views/remote_connect.html
T
lejeune quentin 1f845e9110 [IMP] IoT : IoT refactoring - With longpolling
Improve the implementation of IoT.
Allow both-direction communication between iot box and devices.

Now a device can send its value / status as soon as it changes. Not only when he receives a request.

Now the box have only 3 routes:

/hw_drivers/action
parameter: session_id, device_id, data
used to ask at a device to make a action (take picture, make print, ect...)

/hw_drivers/event
parameter: listener
listener is a dict where you have the session_id and a list of device_id to listen
this route wait to answer that we call device_changed for a device_id with data or value

/hw_drivers/box/connect
parameter: token
used to register the box to a Odoo database
token contain the url of Odoo database and a unique number that allow the IoT Box
to connect box in the hour

task : 1906910
2019-04-02 15:53:01 +02:00

43 lines
1.7 KiB
HTML

{% extends "layout.html" %}
{% block head %}
<script>
$(function () {
var upgrading = false;
$('#enable_debug').click(function () {
var auth_token = $('#auth_token').val();
if (auth_token == "") {
alert('Please provide an authentication token.');
} else {
$.ajax({
url: '/enable_ngrok',
data: {
'auth_token': auth_token
}
}).always(function (response) {
if (response === 'already running') {
alert('Remote debugging already activated.');
} else {
$('#auth_token').attr('disabled','disabled');
$('#enable_debug').html('Enabled remote debugging');
$('#enable_debug').removeAttr('href', '')
$('#enable_debug').off('click');
}
});
}
});
});
</script>
{% endblock %}
{% block content %}
<h2 class="text-center">Remote Debugging</h2>
<p class='text-red'>
This allows someone who give a ngrok authtoken to gain remote access to your IoT Box, and
thus your entire local network. Only enable this for someone
you trust.
</p>
<div class='text-center'>
<input type="text" id="auth_token" size="42" placeholder="Authentication Token"/> <br/>
<a class="btn" style="margin: 18px auto;" id="enable_debug" href="#">Enable Remote Debugging</a>
</div>
{% endblock %}