2020-05-16 15:18:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$router = new Router();
|
|
|
|
|
|
|
|
$router->setDefault(function(){
|
|
|
|
echo $_GET['url'].': 404';
|
|
|
|
});
|
|
|
|
|
|
|
|
//Pages
|
|
|
|
$router->any('/', 'Log');
|
|
|
|
$router->any('/login', 'Login');
|
|
|
|
$router->any('/logout', 'Logout');
|
|
|
|
$router->any('/automation', 'Automation');
|
|
|
|
$router->any('/setting', 'Setting');
|
|
|
|
$router->any('/ajax', 'Ajax');
|
2020-05-16 23:27:06 +00:00
|
|
|
$router->any('/oauth', 'Oauth');
|
2020-05-16 15:18:27 +00:00
|
|
|
|
|
|
|
$router->post('/api/login', 'AuthApi@login');
|
|
|
|
$router->post('/api/logout', 'AuthApi@logout');
|
|
|
|
|
|
|
|
$router->get('/api/rooms', 'RoomsApi@default');
|
2020-05-24 17:35:19 +00:00
|
|
|
$router->get('/api/rooms/:id/update', 'RoomsApi@update');
|
|
|
|
|
|
|
|
$router->get('/api/devices', 'DevicesApi@default');
|
|
|
|
|
|
|
|
$router->get('/api/widget/:id/run', 'WidgetApi@default');
|
2020-05-16 15:18:27 +00:00
|
|
|
|
2020-05-16 23:27:06 +00:00
|
|
|
$router->any('/api/HA/auth', 'Oauth');
|
2020-05-16 15:18:27 +00:00
|
|
|
$router->any('/api/HA', 'GoogleHomeApi@response');
|
|
|
|
|
|
|
|
// examples
|
|
|
|
$router->any('/api/example', 'ExampleApi@example');
|
|
|
|
$router->any('/example', 'ExampleController@index');
|
|
|
|
$router->any('/example/subpage', 'ExampleController@subpage');
|
|
|
|
|
|
|
|
$router->run($_SERVER['REQUEST_METHOD'], '/'.(isset($_GET['url']) ? $_GET['url'] : ''));
|