Interesting Stuff
This commit is contained in:
		@@ -65,9 +65,11 @@ require_once '../config/config.php';
 | 
			
		||||
$logManager = new LogManager();
 | 
			
		||||
 | 
			
		||||
// Language
 | 
			
		||||
$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
 | 
			
		||||
$langMng = new LanguageManager($langTag);
 | 
			
		||||
$langMng->load();
 | 
			
		||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
 | 
			
		||||
	$langTag = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
 | 
			
		||||
	$langMng = new LanguageManager($langTag);
 | 
			
		||||
	$langMng->load();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//D B Conector
 | 
			
		||||
Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
 | 
			
		||||
@@ -76,4 +78,4 @@ Db::connect (DBHOST, DBUSER, DBPASS, DBNAME);
 | 
			
		||||
$userManager = new UserManager();
 | 
			
		||||
 | 
			
		||||
// import routes
 | 
			
		||||
require_once '../app/Routes.php';
 | 
			
		||||
require_once '../app/Routes.php';
 | 
			
		||||
@@ -18,7 +18,10 @@ $router->any('/ajax', 'Ajax');
 | 
			
		||||
$router->any('/log', 'Log');
 | 
			
		||||
$router->any('/rooms', 'Rooms');
 | 
			
		||||
 | 
			
		||||
$router->get('/api/devices', 'DevicesApi@getAllDevices');
 | 
			
		||||
$router->get('/api/login', 'AuthApi@login');
 | 
			
		||||
$router->post('/api/devices', 'DevicesApi@getAllDevices');
 | 
			
		||||
$router->post('/api/login', 'AuthApi@login');
 | 
			
		||||
 | 
			
		||||
$router->post('/api/HA', 'GoogleHome@response');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$router->run($_SERVER['REQUEST_METHOD'], '/'.(isset($_GET['url']) ? $_GET['url'] : ''));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								app/models/GoogleHome.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								app/models/GoogleHome.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
<?php 
 | 
			
		||||
class GoogleHome {
 | 
			
		||||
    function response()
 | 
			
		||||
    {
 | 
			
		||||
        header('Content-Type: application/json');
 | 
			
		||||
        $update_response = file_get_contents("php://input");
 | 
			
		||||
        $update = json_decode($update_response, true);
 | 
			
		||||
        echo '"RichResponse": {
 | 
			
		||||
            "items": [
 | 
			
		||||
              {
 | 
			
		||||
                "simpleResponse": {
 | 
			
		||||
                  "textToSpeech": "test speech"
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            ]
 | 
			
		||||
          }';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user