HummingBirdAnimeClient/app/appConf/routes.php

286 lines
6.8 KiB
PHP
Raw Normal View History

2017-02-15 16:13:32 -05:00
<?php declare(strict_types=1);
2015-11-16 11:40:01 -05:00
/**
2017-02-15 16:13:32 -05:00
* Hummingbird Anime List Client
2015-11-16 11:40:01 -05:00
*
2017-02-15 16:13:32 -05:00
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
2015-11-16 11:40:01 -05:00
*
2017-02-15 16:13:32 -05:00
* PHP version 7
2016-08-30 10:01:18 -04:00
*
2015-11-16 11:40:01 -05:00
* @package HummingbirdAnimeClient
2016-08-30 10:01:18 -04:00
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2018 Timothy J. Warren
2016-08-30 10:01:18 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2017-02-15 16:13:32 -05:00
* @version 4.0
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
2015-11-16 11:40:01 -05:00
*/
2015-05-22 12:36:26 -04:00
use const Aviat\AnimeClient\{
DEFAULT_CONTROLLER_METHOD,
2017-03-31 13:37:53 -04:00
DEFAULT_CONTROLLER
};
2017-03-30 16:16:40 -04:00
// -------------------------------------------------------------------------
// Routing Config
//
// Maps paths to controllers and methods
2017-03-30 16:16:40 -04:00
// -------------------------------------------------------------------------
2015-05-22 12:36:26 -04:00
return [
2017-03-30 16:16:40 -04:00
// ---------------------------------------------------------------------
// Anime List Routes
// ---------------------------------------------------------------------
'anime.add.get' => [
'path' => '/anime/add',
'action' => 'addForm',
'verb' => 'get',
],
'anime.add.post' => [
'path' => '/anime/add',
'action' => 'add',
'verb' => 'post',
],
'anime.details' => [
'path' => '/anime/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'anime.delete' => [
'path' => '/anime/delete',
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Routes
// ---------------------------------------------------------------------
'manga.search' => [
'path' => '/manga/search',
'action' => 'search',
],
'manga.add.get' => [
'path' => '/manga/add',
'action' => 'addForm',
'verb' => 'get',
],
'manga.add.post' => [
'path' => '/manga/add',
'action' => 'add',
'verb' => 'post',
],
'manga.delete' => [
'path' => '/manga/delete',
'action' => 'delete',
'verb' => 'post',
],
'manga.details' => [
'path' => '/manga/details/{id}',
'action' => 'details',
'tokens' => [
'id' => '[a-z0-9\-]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
// ---------------------------------------------------------------------
// Anime Collection Routes
// ---------------------------------------------------------------------
'anime.collection.search' => [
'path' => '/anime-collection/search',
2017-03-30 16:16:40 -04:00
'action' => 'search',
],
'anime.collection.add.get' => [
'path' => '/anime-collection/add',
2017-03-30 16:16:40 -04:00
'action' => 'form',
'params' => [],
],
'anime.collection.edit.get' => [
'path' => '/anime-collection/edit/{id}',
2017-03-30 16:16:40 -04:00
'action' => 'form',
'tokens' => [
'id' => '[0-9]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'anime.collection.add.post' => [
'path' => '/anime-collection/add',
2017-03-30 16:16:40 -04:00
'action' => 'add',
'verb' => 'post',
],
'anime.collection.edit.post' => [
'path' => '/anime-collection/edit',
2017-03-30 16:16:40 -04:00
'action' => 'edit',
'verb' => 'post',
],
'anime.collection.view' => [
'path' => '/anime-collection/view{/view}',
2017-03-30 16:16:40 -04:00
'action' => 'index',
'params' => [],
'tokens' => [
'view' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'anime.collection.delete' => [
'path' => '/anime-collection/delete',
2017-03-30 16:16:40 -04:00
'action' => 'delete',
'verb' => 'post',
],
// ---------------------------------------------------------------------
// Manga Collection Routes
// ---------------------------------------------------------------------
'manga.collection.search' => [
'path' => '/manga-collection/search',
'action' => 'search',
],
'manga.collection.add.get' => [
'path' => '/manga-collection/add',
'action' => 'form',
'params' => [],
],
'manga.collection.edit.get' => [
'path' => '/manga-collection/edit/{id}',
'action' => 'form',
'tokens' => [
'id' => '[0-9]+',
],
],
'manga.collection.add.post' => [
'path' => '/manga-collection/add',
'action' => 'add',
'verb' => 'post',
],
'manga.collection.edit.post' => [
'path' => '/manga-collection/edit',
'action' => 'edit',
'verb' => 'post',
],
'manga.collection.view' => [
'path' => '/manga-collection/view{/view}',
'action' => 'index',
'params' => [],
'tokens' => [
'view' => '[a-z_]+',
],
],
'manga.collection.delete' => [
'path' => '/manga-collection/delete',
'action' => 'delete',
'verb' => 'post',
],
2017-03-30 16:16:40 -04:00
// ---------------------------------------------------------------------
// Other Routes
// ---------------------------------------------------------------------
'character' => [
'path' => '/character/{slug}',
'action' => 'index',
'params' => [],
'tokens' => [
'slug' => '[a-z0-9\-]+'
]
],
'user_info' => [
'path' => '/me',
'action' => 'me',
'controller' => 'me',
'verb' => 'get',
],
// ---------------------------------------------------------------------
// Default / Shared routes
// ---------------------------------------------------------------------
'anilist-redirect' => [
'path' => '/anilist-redirect',
'action' => 'anilistRedirect',
2018-08-15 08:51:37 -04:00
'controller' => DEFAULT_CONTROLLER,
],
'anilist-oauth' => [
'path' => '/anilist-oauth',
'action' => 'anilistCallback',
2018-08-15 08:51:37 -04:00
'controller' => DEFAULT_CONTROLLER,
],
'image_proxy' => [
'path' => '/public/images/{type}/{file}',
'action' => 'images',
'controller' => DEFAULT_CONTROLLER,
'verb' => 'get',
'tokens' => [
'type' => '[a-z0-9\-]+',
'file' => '[a-z0-9\-]+\.[a-z]{3}'
]
],
2017-03-30 16:16:40 -04:00
'cache_purge' => [
'path' => '/cache_purge',
'action' => 'clearCache',
2017-03-31 13:37:53 -04:00
'controller' => DEFAULT_CONTROLLER,
2017-03-30 16:16:40 -04:00
'verb' => 'get',
],
2018-08-15 08:51:37 -04:00
'settings' => [
'path' => '/settings',
'action' => 'settings',
'controller' => DEFAULT_CONTROLLER,
'verb' => 'get',
],
2018-08-24 14:23:01 -04:00
'settings-post' => [
'path' => '/settings',
'action' => 'settings',
'controller' => DEFAULT_CONTROLLER,
'verb' => 'post',
],
2017-03-30 16:16:40 -04:00
'login' => [
'path' => '/login',
'action' => 'login',
2017-03-31 13:37:53 -04:00
'controller' => DEFAULT_CONTROLLER,
2017-03-30 16:16:40 -04:00
'verb' => 'get',
],
'login.post' => [
'path' => '/login',
'action' => 'loginAction',
2017-03-31 13:37:53 -04:00
'controller' => DEFAULT_CONTROLLER,
2017-03-30 16:16:40 -04:00
'verb' => 'post',
],
'logout' => [
'path' => '/logout',
'action' => 'logout',
2017-03-31 13:37:53 -04:00
'controller' => DEFAULT_CONTROLLER,
2017-03-30 16:16:40 -04:00
],
'increment' => [
'path' => '/{controller}/increment',
'action' => 'increment',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+',
],
],
2017-03-30 16:16:40 -04:00
'update' => [
'path' => '/{controller}/update',
'action' => 'update',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'update.post' => [
'path' => '/{controller}/update_form',
'action' => 'formUpdate',
'verb' => 'post',
'tokens' => [
'controller' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'edit' => [
'path' => '/{controller}/edit/{id}/{status}',
'action' => 'edit',
'tokens' => [
'id' => '[0-9a-z_]+',
'status' => '([a-zA-Z\-_]|%20)+',
2016-01-06 11:08:56 -05:00
],
2017-03-30 16:16:40 -04:00
],
'list' => [
'path' => '/{controller}/{type}{/view}',
'action' => DEFAULT_CONTROLLER_METHOD,
'tokens' => [
'type' => '[a-z_]+',
'view' => '[a-z_]+',
2016-01-06 11:08:56 -05:00
],
],
2017-03-30 16:16:40 -04:00
'index_redirect' => [
'path' => '/',
2017-03-31 13:37:53 -04:00
'controller' => DEFAULT_CONTROLLER,
2017-03-30 16:16:40 -04:00
'action' => 'redirectToDefaultRoute',
],
2016-01-06 11:08:56 -05:00
];