2020-05-16 15:18:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$router = new Router();
|
|
|
|
|
|
|
|
$router->setDefault(function(){
|
|
|
|
echo $_GET['url'].': 404';
|
|
|
|
});
|
|
|
|
|
|
|
|
//Pages
|
2020-07-23 15:29:55 +00:00
|
|
|
$router->any('/', 'Log');
|
2020-07-23 13:16:44 +00:00
|
|
|
$router->any('/log', 'Log');
|
2020-07-23 15:58:46 +00:00
|
|
|
$router->any('/server', 'Server');
|
2020-05-16 15:18:27 +00:00
|
|
|
$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
|
|
|
|
2020-07-14 16:24:21 +00:00
|
|
|
//Vue APP
|
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:40:49 +00:00
|
|
|
$router->get('/api/rooms/{roomId}/update', 'RoomsApi@update');
|
2020-05-24 17:35:19 +00:00
|
|
|
$router->get('/api/devices', 'DevicesApi@default');
|
2020-06-23 18:28:11 +00:00
|
|
|
$router->get('/api/users', 'UsersApi@default');
|
2020-05-24 17:42:03 +00:00
|
|
|
$router->post('/api/widgets/{widgetId}/run', 'WidgetApi@run');
|
2020-05-26 19:47:36 +00:00
|
|
|
$router->post('/api/widgets/{widgetId}/detail', 'WidgetApi@detail');
|
|
|
|
|
2020-07-21 08:29:26 +00:00
|
|
|
//cron
|
|
|
|
$router->post('/cron/clean', 'CronApi@clean');
|
2020-05-26 19:42:39 +00:00
|
|
|
|
2020-06-28 14:45:05 +00:00
|
|
|
//Google Home - API
|
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');
|
|
|
|
|
2020-06-28 14:45:05 +00:00
|
|
|
//Endpoints API
|
2020-07-14 16:24:21 +00:00
|
|
|
$router->post('/api/endpoint/', 'EndpointsApi@default');
|
2020-07-15 10:54:45 +00:00
|
|
|
$router->any('/api/update/', 'UpdatesApi@default');
|
2020-07-14 17:59:18 +00:00
|
|
|
$router->any('/api/users/status', 'UsersApi@status');
|
2020-06-28 14:45:05 +00:00
|
|
|
|
2020-05-16 15:18:27 +00:00
|
|
|
// 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'] : ''));
|