Few Fixes After infrastructure migration
This commit is contained in:
parent
32521d0ed3
commit
30da6e162b
@ -1,9 +1,9 @@
|
||||
RewriteEngine On
|
||||
|
||||
# require https
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteCond %{REQUEST_URI} !^/api/update
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
#RewriteCond %{HTTPS} off
|
||||
#RewriteCond %{REQUEST_URI} !^/api/update
|
||||
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
#token to HTTP_AUTHORIZATION
|
||||
RewriteCond %{HTTP:Authorization} ^(.*)
|
||||
|
@ -1,4 +1,15 @@
|
||||
<?php
|
||||
//Debug
|
||||
error_reporting(E_ALL);
|
||||
ini_set( 'display_errors','1');
|
||||
|
||||
//setup
|
||||
ini_set ('session.cookie_httponly', '1');
|
||||
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
|
||||
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])));
|
||||
ini_set('session.cookie_secure', '1');
|
||||
mb_internal_encoding ("UTF-8");
|
||||
|
||||
session_start();
|
||||
|
||||
// import configs
|
||||
@ -75,16 +86,7 @@ $apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRI
|
||||
$apiLogManager->write("[API] POST body\n" . json_encode($_POST, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
||||
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
|
||||
|
||||
//Debug
|
||||
error_reporting(E_ALL);
|
||||
ini_set( 'display_errors','1');
|
||||
|
||||
//setup
|
||||
ini_set ('session.cookie_httponly', '1');
|
||||
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
|
||||
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])));
|
||||
ini_set('session.cookie_secure', '1');
|
||||
mb_internal_encoding ("UTF-8");
|
||||
|
||||
Debugger::flag('dbconnect');
|
||||
//D B Conector
|
||||
|
@ -12,7 +12,7 @@ class WidgetApi extends ApiController{
|
||||
$subDeviceData = SubDeviceManager::getSubDevice($subDeviceId);
|
||||
if ($subDeviceData['type'] == 'on/off'){
|
||||
$lastValue = RecordManager::getLastRecord($subDeviceData['subdevice_id'])['value'];
|
||||
RecordManager::create($subDeviceData['device_id'], 'on/off', !$lastValue);
|
||||
RecordManager::create($subDeviceData['device_id'], 'on/off', (int) !$lastValue);
|
||||
$response = !$lastValue;
|
||||
} else {
|
||||
throw new Exception("Bad Request", 403);
|
||||
|
@ -30,6 +30,12 @@ class Device extends Template
|
||||
} else {
|
||||
$devices[$key]['firmware_hash'] = "false";
|
||||
}
|
||||
|
||||
$wifi = SubDeviceManager::getSubDeviceByMaster($device['device_id'], 'wifi');
|
||||
if ($wifi) {
|
||||
$signalStrenght = RecordManager::getLastRecordNotNull($wifi['subdevice_id']);
|
||||
$devices[$key]['signal'] = (!$signalStrenght ? 0 : $signalStrenght['value']);
|
||||
}
|
||||
}
|
||||
|
||||
$rooms = $roomManager->getAllRooms();
|
||||
|
@ -26,6 +26,7 @@
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th>Signal</th>
|
||||
<th>Room</th>
|
||||
<th>Firmware</th>
|
||||
<th>IP Address<br>(Mac)<br>Token</th>
|
||||
@ -43,6 +44,7 @@
|
||||
<tr>
|
||||
<td><i class="fa">&#x<?php echo (!empty($device['icon']) ? $device['icon'] : ""); ?></i></td>
|
||||
<td><?php echo (!empty($device['name']) ? $device['name'] : ""); ?></td>
|
||||
<td><?php echo (!empty($device['signal']) ? $device['signal'] : ""); ?></td>
|
||||
<td>
|
||||
<select class="input" id="device-<?php echo $device['device_id']?>-roomId">
|
||||
<?php
|
||||
|
Loading…
Reference in New Issue
Block a user