2020-06-10 17:00:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Config;
|
2020-05-27 18:46:16 +02:00
|
|
|
|
|
|
|
// Create a new instance of our RouteCollection class.
|
|
|
|
$routes = Services::routes();
|
|
|
|
|
|
|
|
// Load the system's routing file first, so that the app and ENVIRONMENT
|
|
|
|
// can override as needed.
|
2020-06-01 23:23:14 +02:00
|
|
|
if (file_exists(SYSTEMPATH . 'Config/Routes.php')) {
|
|
|
|
require SYSTEMPATH . 'Config/Routes.php';
|
2020-05-27 18:46:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Router Setup
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
$routes->setDefaultNamespace('App\Controllers');
|
|
|
|
$routes->setDefaultController('Home');
|
|
|
|
$routes->setDefaultMethod('index');
|
|
|
|
$routes->setTranslateURIDashes(false);
|
|
|
|
$routes->set404Override();
|
2020-06-01 23:23:14 +02:00
|
|
|
$routes->setAutoRoute(false);
|
2020-07-31 18:05:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Placeholder definitions
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->addPlaceholder('podcastName', '[a-zA-Z0-9\_]{1,32}');
|
2020-08-18 18:31:28 +02:00
|
|
|
$routes->addPlaceholder('slug', '[a-zA-Z0-9\-]{1,191}');
|
2020-10-29 17:27:16 +01:00
|
|
|
$routes->addPlaceholder('base64', '[A-Za-z0-9\.\_]+\-{0,2}');
|
2020-11-18 18:17:56 +01:00
|
|
|
$routes->addPlaceholder('platformType', '\bpodcasting|\bsocial|\bfunding');
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->addPlaceholder('noteAction', '\bfavourite|\breblog|\breply');
|
|
|
|
$routes->addPlaceholder(
|
|
|
|
'embeddablePlayerTheme',
|
|
|
|
'\blight|\bdark|\blight-transparent|\bdark-transparent',
|
|
|
|
);
|
|
|
|
$routes->addPlaceholder(
|
|
|
|
'uuid',
|
|
|
|
'[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}',
|
|
|
|
);
|
2020-05-27 18:46:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Route Definitions
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
// We get a performance increase by specifying the default
|
|
|
|
// route since we don't have to scan directories.
|
2020-06-10 17:00:12 +02:00
|
|
|
$routes->get('/', 'Home::index', ['as' => 'home']);
|
|
|
|
|
2020-08-12 22:03:45 +02:00
|
|
|
// Install Wizard route
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->group(config('App')->installGateway, function ($routes) {
|
2020-08-12 22:03:45 +02:00
|
|
|
$routes->get('/', 'Install', ['as' => 'install']);
|
2020-10-08 18:38:30 +02:00
|
|
|
$routes->post('instance-config', 'Install::attemptInstanceConfig', [
|
|
|
|
'as' => 'instance-config',
|
|
|
|
]);
|
|
|
|
$routes->post('database-config', 'Install::attemptDatabaseConfig', [
|
|
|
|
'as' => 'database-config',
|
|
|
|
]);
|
|
|
|
$routes->post('cache-config', 'Install::attemptCacheConfig', [
|
|
|
|
'as' => 'cache-config',
|
2020-08-12 22:03:45 +02:00
|
|
|
]);
|
|
|
|
$routes->post('create-superadmin', 'Install::attemptCreateSuperAdmin', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'create-superadmin',
|
2020-08-12 22:03:45 +02:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2020-10-29 17:27:16 +01:00
|
|
|
// Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3)
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('audio/(:base64)/(:any)', 'Analytics::hit/$1/$2', [
|
2020-10-29 17:27:16 +01:00
|
|
|
'as' => 'analytics_hit',
|
|
|
|
]);
|
2020-06-12 22:41:09 +02:00
|
|
|
|
|
|
|
// Show the Unknown UserAgents
|
2020-07-16 12:08:23 +02:00
|
|
|
$routes->get('.well-known/unknown-useragents', 'UnknownUserAgents');
|
|
|
|
$routes->get('.well-known/unknown-useragents/(:num)', 'UnknownUserAgents/$1');
|
2020-06-12 22:41:09 +02:00
|
|
|
|
2020-11-18 18:17:56 +01:00
|
|
|
$routes->get('.well-known/platforms', 'Platform');
|
|
|
|
|
2020-07-10 14:20:25 +02:00
|
|
|
// Admin area
|
|
|
|
$routes->group(
|
|
|
|
config('App')->adminGateway,
|
|
|
|
['namespace' => 'App\Controllers\Admin'],
|
|
|
|
function ($routes) {
|
2020-07-16 12:08:23 +02:00
|
|
|
$routes->get('/', 'Home', [
|
2020-08-12 22:03:45 +02:00
|
|
|
'as' => 'admin',
|
2020-07-10 14:20:25 +02:00
|
|
|
]);
|
|
|
|
|
2021-02-10 17:20:01 +01:00
|
|
|
$routes->group('persons', function ($routes) {
|
|
|
|
$routes->get('/', 'Person', [
|
|
|
|
'as' => 'person-list',
|
|
|
|
'filter' => 'permission:person-list',
|
|
|
|
]);
|
|
|
|
$routes->get('new', 'Person::create', [
|
|
|
|
'as' => 'person-create',
|
|
|
|
'filter' => 'permission:person-create',
|
|
|
|
]);
|
|
|
|
$routes->post('new', 'Person::attemptCreate', [
|
|
|
|
'filter' => 'permission:person-create',
|
|
|
|
]);
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'Person::view/$1', [
|
|
|
|
'as' => 'person-view',
|
|
|
|
'filter' => 'permission:person-view',
|
|
|
|
]);
|
|
|
|
$routes->get('edit', 'Person::edit/$1', [
|
|
|
|
'as' => 'person-edit',
|
|
|
|
'filter' => 'permission:person-edit',
|
|
|
|
]);
|
|
|
|
$routes->post('edit', 'Person::attemptEdit/$1', [
|
|
|
|
'filter' => 'permission:person-edit',
|
|
|
|
]);
|
|
|
|
$routes->add('delete', 'Person::delete/$1', [
|
|
|
|
'as' => 'person-delete',
|
|
|
|
'filter' => 'permission:person-delete',
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Podcasts
|
|
|
|
$routes->group('podcasts', function ($routes) {
|
|
|
|
$routes->get('/', 'Podcast::list', [
|
|
|
|
'as' => 'podcast-list',
|
2020-07-31 18:05:10 +02:00
|
|
|
]);
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->get('new', 'Podcast::create', [
|
|
|
|
'as' => 'podcast-create',
|
|
|
|
'filter' => 'permission:podcasts-create',
|
2020-07-10 14:20:25 +02:00
|
|
|
]);
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->post('new', 'Podcast::attemptCreate', [
|
|
|
|
'filter' => 'permission:podcasts-create',
|
2020-07-10 14:20:25 +02:00
|
|
|
]);
|
2020-11-18 18:17:56 +01:00
|
|
|
$routes->get('import', 'PodcastImport', [
|
2020-08-21 10:41:09 +02:00
|
|
|
'as' => 'podcast-import',
|
|
|
|
'filter' => 'permission:podcasts-import',
|
|
|
|
]);
|
2020-11-18 18:17:56 +01:00
|
|
|
$routes->post('import', 'PodcastImport::attemptImport', [
|
2020-08-21 10:41:09 +02:00
|
|
|
'filter' => 'permission:podcasts-import',
|
|
|
|
]);
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Podcast
|
|
|
|
// Use ids in admin area to help permission and group lookups
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'Podcast::view/$1', [
|
|
|
|
'as' => 'podcast-view',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
|
|
|
]);
|
|
|
|
$routes->get('edit', 'Podcast::edit/$1', [
|
|
|
|
'as' => 'podcast-edit',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast-edit',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->post('edit', 'Podcast::attemptEdit/$1', [
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast-edit',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('delete', 'Podcast::delete/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'podcast-delete',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcasts-delete',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
2020-10-14 12:38:48 +02:00
|
|
|
|
2021-02-10 17:20:01 +01:00
|
|
|
$routes->group('persons', function ($routes) {
|
|
|
|
$routes->get('/', 'PodcastPerson/$1', [
|
|
|
|
'as' => 'podcast-person-manage',
|
|
|
|
'filter' => 'permission:podcast-edit',
|
|
|
|
]);
|
|
|
|
$routes->post('/', 'PodcastPerson::attemptAdd/$1', [
|
|
|
|
'filter' => 'permission:podcast-edit',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$routes->get(
|
|
|
|
'(:num)/remove',
|
|
|
|
'PodcastPerson::remove/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-person-remove',
|
|
|
|
'filter' => 'permission:podcast-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2021-02-10 17:20:01 +01:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-10-14 12:38:48 +02:00
|
|
|
$routes->group('analytics', function ($routes) {
|
|
|
|
$routes->get('/', 'Podcast::viewAnalytics/$1', [
|
|
|
|
'as' => 'podcast-analytics',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
|
|
|
]);
|
|
|
|
$routes->get(
|
|
|
|
'webpages',
|
|
|
|
'Podcast::viewAnalyticsWebpages/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-webpages',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-14 12:38:48 +02:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'locations',
|
|
|
|
'Podcast::viewAnalyticsLocations/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-locations',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-14 12:38:48 +02:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'unique-listeners',
|
|
|
|
'Podcast::viewAnalyticsUniqueListeners/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-unique-listeners',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-14 12:38:48 +02:00
|
|
|
);
|
2020-10-19 12:33:23 +02:00
|
|
|
$routes->get(
|
|
|
|
'listening-time',
|
|
|
|
'Podcast::viewAnalyticsListeningTime/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-listening-time',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-19 12:33:23 +02:00
|
|
|
);
|
2020-11-02 19:15:19 +01:00
|
|
|
$routes->get(
|
|
|
|
'time-periods',
|
|
|
|
'Podcast::viewAnalyticsTimePeriods/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-time-periods',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-02 19:15:19 +01:00
|
|
|
);
|
2020-10-14 12:38:48 +02:00
|
|
|
$routes->get(
|
|
|
|
'players',
|
|
|
|
'Podcast::viewAnalyticsPlayers/$1',
|
|
|
|
[
|
|
|
|
'as' => 'podcast-analytics-players',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-14 12:38:48 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-10-08 16:45:46 +02:00
|
|
|
$routes->get(
|
|
|
|
'analytics-data/(:segment)',
|
|
|
|
'AnalyticsData::getData/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'analytics-full-data',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-08 16:45:46 +02:00
|
|
|
);
|
2020-10-06 17:39:27 +02:00
|
|
|
$routes->get(
|
|
|
|
'analytics-data/(:segment)/(:segment)',
|
|
|
|
'AnalyticsData::getData/$1/$2/$3',
|
|
|
|
[
|
|
|
|
'as' => 'analytics-data',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-06 17:39:27 +02:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'analytics-data/(:segment)/(:segment)/(:num)',
|
|
|
|
'AnalyticsData::getData/$1/$2/$3/$4',
|
|
|
|
[
|
|
|
|
'as' => 'analytics-filtered-data',
|
|
|
|
'filter' => 'permission:podcasts-view,podcast-view',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-10-06 17:39:27 +02:00
|
|
|
);
|
2020-07-16 12:08:23 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Podcast episodes
|
|
|
|
$routes->group('episodes', function ($routes) {
|
|
|
|
$routes->get('/', 'Episode::list/$1', [
|
|
|
|
'as' => 'episode-list',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' =>
|
|
|
|
'permission:episodes-list,podcast_episodes-list',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->get('new', 'Episode::create/$1', [
|
|
|
|
'as' => 'episode-create',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast_episodes-create',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->post('new', 'Episode::attemptCreate/$1', [
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast_episodes-create',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Episode
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'Episode::view/$1/$2', [
|
|
|
|
'as' => 'episode-view',
|
|
|
|
'filter' =>
|
|
|
|
'permission:episodes-view,podcast_episodes-view',
|
|
|
|
]);
|
|
|
|
$routes->get('edit', 'Episode::edit/$1/$2', [
|
|
|
|
'as' => 'episode-edit',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->post('edit', 'Episode::attemptEdit/$1/$2', [
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('publish', 'Episode::publish/$1/$2', [
|
|
|
|
'as' => 'episode-publish',
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
]);
|
|
|
|
$routes->post(
|
|
|
|
'publish',
|
|
|
|
'Episode::attemptPublish/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
],
|
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'publish-edit',
|
|
|
|
'Episode::publishEdit/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'episode-publish_edit',
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
],
|
|
|
|
);
|
|
|
|
$routes->post(
|
|
|
|
'publish-edit',
|
|
|
|
'Episode::attemptPublishEdit/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
],
|
|
|
|
);
|
|
|
|
$routes->get('unpublish', 'Episode::unpublish/$1/$2', [
|
|
|
|
'as' => 'episode-unpublish',
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
]);
|
|
|
|
$routes->post(
|
|
|
|
'unpublish',
|
|
|
|
'Episode::attemptUnpublish/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_publications',
|
|
|
|
],
|
|
|
|
);
|
|
|
|
$routes->get('delete', 'Episode::delete/$1/$2', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'episode-delete',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast_episodes-delete',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
2020-11-24 21:18:08 +01:00
|
|
|
$routes->get(
|
|
|
|
'transcript-delete',
|
|
|
|
'Episode::transcriptDelete/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'transcript-delete',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-24 21:18:08 +01:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'chapters-delete',
|
|
|
|
'Episode::chaptersDelete/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'chapters-delete',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-24 21:18:08 +01:00
|
|
|
);
|
2020-12-07 21:13:46 +01:00
|
|
|
$routes->get(
|
|
|
|
'soundbites',
|
|
|
|
'Episode::soundbitesEdit/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'soundbites-edit',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-12-07 21:13:46 +01:00
|
|
|
);
|
|
|
|
$routes->post(
|
|
|
|
'soundbites',
|
|
|
|
'Episode::soundbitesAttemptEdit/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-12-07 21:13:46 +01:00
|
|
|
);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get(
|
2020-12-07 21:13:46 +01:00
|
|
|
'soundbites/(:num)/delete',
|
|
|
|
'Episode::soundbiteDelete/$1/$2/$3',
|
|
|
|
[
|
|
|
|
'as' => 'soundbite-delete',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-12-07 21:13:46 +01:00
|
|
|
);
|
2021-02-27 22:21:26 +01:00
|
|
|
$routes->get(
|
|
|
|
'embeddable-player',
|
|
|
|
'Episode::embeddablePlayer/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'embeddable-player-add',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2021-02-27 22:21:26 +01:00
|
|
|
);
|
2021-02-10 17:20:01 +01:00
|
|
|
|
|
|
|
$routes->group('persons', function ($routes) {
|
|
|
|
$routes->get('/', 'EpisodePerson/$1/$2', [
|
|
|
|
'as' => 'episode-person-manage',
|
|
|
|
'filter' => 'permission:podcast_episodes-edit',
|
|
|
|
]);
|
|
|
|
$routes->post(
|
|
|
|
'/',
|
|
|
|
'EpisodePerson::attemptAdd/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2021-02-10 17:20:01 +01:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'(:num)/remove',
|
|
|
|
'EpisodePerson::remove/$1/$2/$3',
|
|
|
|
[
|
|
|
|
'as' => 'episode-person-remove',
|
|
|
|
'filter' =>
|
|
|
|
'permission:podcast_episodes-edit',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2021-02-10 17:20:01 +01:00
|
|
|
);
|
|
|
|
});
|
2020-08-14 20:27:57 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Podcast contributors
|
|
|
|
$routes->group('contributors', function ($routes) {
|
|
|
|
$routes->get('/', 'Contributor::list/$1', [
|
|
|
|
'as' => 'contributor-list',
|
|
|
|
'filter' =>
|
2020-08-27 16:17:56 +02:00
|
|
|
'permission:podcasts-view,podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->get('add', 'Contributor::add/$1', [
|
|
|
|
'as' => 'contributor-add',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->post('add', 'Contributor::attemptAdd/$1', [
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Contributor
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'Contributor::view/$1/$2', [
|
|
|
|
'as' => 'contributor-view',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' =>
|
|
|
|
'permission:podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->get('edit', 'Contributor::edit/$1/$2', [
|
|
|
|
'as' => 'contributor-edit',
|
|
|
|
'filter' =>
|
2020-08-27 16:17:56 +02:00
|
|
|
'permission:podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
$routes->post(
|
|
|
|
'edit',
|
|
|
|
'Contributor::attemptEdit/$1/$2',
|
|
|
|
[
|
|
|
|
'filter' =>
|
2020-08-27 16:17:56 +02:00
|
|
|
'permission:podcast-manage_contributors',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-08-14 20:27:57 +02:00
|
|
|
);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('remove', 'Contributor::remove/$1/$2', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'contributor-remove',
|
|
|
|
'filter' =>
|
2020-08-27 16:17:56 +02:00
|
|
|
'permission:podcast-manage_contributors',
|
2020-08-14 20:27:57 +02:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
2020-08-27 12:05:44 +02:00
|
|
|
|
2020-11-18 18:17:56 +01:00
|
|
|
$routes->group('platforms', function ($routes) {
|
|
|
|
$routes->get(
|
|
|
|
'/',
|
|
|
|
'PodcastPlatform::platforms/$1/podcasting',
|
|
|
|
[
|
|
|
|
'as' => 'platforms-podcasting',
|
|
|
|
'filter' => 'permission:podcast-manage_platforms',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-18 18:17:56 +01:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'social',
|
|
|
|
'PodcastPlatform::platforms/$1/social',
|
|
|
|
[
|
|
|
|
'as' => 'platforms-social',
|
|
|
|
'filter' => 'permission:podcast-manage_platforms',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-18 18:17:56 +01:00
|
|
|
);
|
|
|
|
$routes->get(
|
|
|
|
'funding',
|
|
|
|
'PodcastPlatform::platforms/$1/funding',
|
|
|
|
[
|
|
|
|
'as' => 'platforms-funding',
|
|
|
|
'filter' => 'permission:podcast-manage_platforms',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-11-18 18:17:56 +01:00
|
|
|
);
|
2020-08-27 12:05:44 +02:00
|
|
|
$routes->post(
|
2020-11-18 18:17:56 +01:00
|
|
|
'save/(:platformType)',
|
|
|
|
'PodcastPlatform::attemptPlatformsUpdate/$1/$2',
|
|
|
|
[
|
|
|
|
'as' => 'platforms-save',
|
|
|
|
'filter' => 'permission:podcast-manage_platforms',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-08-27 12:05:44 +02:00
|
|
|
);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get(
|
2020-11-18 18:17:56 +01:00
|
|
|
'(:slug)/podcast-platform-remove',
|
|
|
|
'PodcastPlatform::removePodcastPlatform/$1/$2',
|
2020-08-27 12:05:44 +02:00
|
|
|
[
|
2020-11-18 18:17:56 +01:00
|
|
|
'as' => 'podcast-platform-remove',
|
2020-08-27 12:05:44 +02:00
|
|
|
'filter' => 'permission:podcast-manage_platforms',
|
2021-04-02 19:20:02 +02:00
|
|
|
],
|
2020-08-27 12:05:44 +02:00
|
|
|
);
|
|
|
|
});
|
2020-08-14 20:27:57 +02:00
|
|
|
});
|
2020-07-10 14:20:25 +02:00
|
|
|
});
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
// Instance wide Fediverse config
|
|
|
|
$routes->group('fediverse', function ($routes) {
|
|
|
|
$routes->get('/', 'Fediverse::dashboard', [
|
|
|
|
'as' => 'fediverse-dashboard',
|
|
|
|
]);
|
|
|
|
$routes->get('blocked-actors', 'Fediverse::blockedActors', [
|
|
|
|
'as' => 'fediverse-blocked-actors',
|
|
|
|
'filter' => 'permission:fediverse-block_actors',
|
|
|
|
]);
|
|
|
|
$routes->get('blocked-domains', 'Fediverse::blockedDomains', [
|
|
|
|
'as' => 'fediverse-blocked-domains',
|
|
|
|
'filter' => 'permission:fediverse-block_domains',
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2020-08-18 18:31:28 +02:00
|
|
|
// Pages
|
|
|
|
$routes->group('pages', function ($routes) {
|
|
|
|
$routes->get('/', 'Page::list', ['as' => 'page-list']);
|
|
|
|
$routes->get('new', 'Page::create', [
|
|
|
|
'as' => 'page-create',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:pages-manage',
|
|
|
|
]);
|
|
|
|
$routes->post('new', 'Page::attemptCreate', [
|
|
|
|
'filter' => 'permission:pages-manage',
|
2020-08-18 18:31:28 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'Page::view/$1', ['as' => 'page-view']);
|
|
|
|
$routes->get('edit', 'Page::edit/$1', [
|
|
|
|
'as' => 'page-edit',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:pages-manage',
|
|
|
|
]);
|
|
|
|
$routes->post('edit', 'Page::attemptEdit/$1', [
|
|
|
|
'filter' => 'permission:pages-manage',
|
2020-08-18 18:31:28 +02:00
|
|
|
]);
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('delete', 'Page::delete/$1', [
|
2020-08-18 18:31:28 +02:00
|
|
|
'as' => 'page-delete',
|
2020-08-27 16:17:56 +02:00
|
|
|
'filter' => 'permission:pages-manage',
|
2020-08-18 18:31:28 +02:00
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-07-10 14:20:25 +02:00
|
|
|
// Users
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->group('users', function ($routes) {
|
|
|
|
$routes->get('/', 'User::list', [
|
|
|
|
'as' => 'user-list',
|
|
|
|
'filter' => 'permission:users-list',
|
|
|
|
]);
|
|
|
|
$routes->get('new', 'User::create', [
|
|
|
|
'as' => 'user-create',
|
|
|
|
'filter' => 'permission:users-create',
|
|
|
|
]);
|
|
|
|
$routes->post('new', 'User::attemptCreate', [
|
|
|
|
'filter' => 'permission:users-create',
|
|
|
|
]);
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// User
|
|
|
|
$routes->group('(:num)', function ($routes) {
|
|
|
|
$routes->get('/', 'User::view/$1', [
|
|
|
|
'as' => 'user-view',
|
|
|
|
'filter' => 'permission:users-view',
|
|
|
|
]);
|
|
|
|
$routes->get('edit', 'User::edit/$1', [
|
|
|
|
'as' => 'user-edit',
|
|
|
|
'filter' => 'permission:users-manage_authorizations',
|
|
|
|
]);
|
|
|
|
$routes->post('edit', 'User::attemptEdit/$1', [
|
|
|
|
'filter' => 'permission:users-manage_authorizations',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('ban', 'User::ban/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'user-ban',
|
|
|
|
'filter' => 'permission:users-manage_bans',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('unban', 'User::unBan/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'user-unban',
|
|
|
|
'filter' => 'permission:users-manage_bans',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('force-pass-reset', 'User::forcePassReset/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'user-force_pass_reset',
|
|
|
|
'filter' => 'permission:users-force_pass_reset',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('delete', 'User::delete/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'user-delete',
|
|
|
|
'filter' => 'permission:users-delete',
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
2020-07-10 14:20:25 +02:00
|
|
|
|
|
|
|
// My account
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->group('my-account', function ($routes) {
|
2020-08-27 16:17:56 +02:00
|
|
|
$routes->get('/', 'MyAccount', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'my-account',
|
|
|
|
]);
|
2020-08-27 16:17:56 +02:00
|
|
|
$routes->get('change-password', 'MyAccount::changePassword/$1', [
|
2020-08-14 20:27:57 +02:00
|
|
|
'as' => 'change-password',
|
|
|
|
]);
|
2020-08-27 16:17:56 +02:00
|
|
|
$routes->post('change-password', 'MyAccount::attemptChange/$1');
|
2020-08-14 20:27:57 +02:00
|
|
|
});
|
2021-04-02 19:20:02 +02:00
|
|
|
},
|
2020-07-10 14:20:25 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Overwriting Myth:auth routes file
|
|
|
|
*/
|
2020-08-14 20:27:57 +02:00
|
|
|
$routes->group(config('App')->authGateway, function ($routes) {
|
|
|
|
// Login/out
|
|
|
|
$routes->get('login', 'Auth::login', ['as' => 'login']);
|
|
|
|
$routes->post('login', 'Auth::attemptLogin');
|
|
|
|
$routes->get('logout', 'Auth::logout', ['as' => 'logout']);
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Registration
|
|
|
|
$routes->get('register', 'Auth::register', [
|
|
|
|
'as' => 'register',
|
|
|
|
]);
|
|
|
|
$routes->post('register', 'Auth::attemptRegister');
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Activation
|
|
|
|
$routes->get('activate-account', 'Auth::activateAccount', [
|
|
|
|
'as' => 'activate-account',
|
|
|
|
]);
|
|
|
|
$routes->get('resend-activate-account', 'Auth::resendActivateAccount', [
|
|
|
|
'as' => 'resend-activate-account',
|
|
|
|
]);
|
2020-07-31 18:05:10 +02:00
|
|
|
|
2020-08-14 20:27:57 +02:00
|
|
|
// Forgot/Resets
|
|
|
|
$routes->get('forgot', 'Auth::forgotPassword', [
|
|
|
|
'as' => 'forgot',
|
|
|
|
]);
|
|
|
|
$routes->post('forgot', 'Auth::attemptForgot');
|
|
|
|
$routes->get('reset-password', 'Auth::resetPassword', [
|
|
|
|
'as' => 'reset-password',
|
|
|
|
]);
|
|
|
|
$routes->post('reset-password', 'Auth::attemptReset');
|
|
|
|
});
|
2020-07-10 14:20:25 +02:00
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
// Podcast's Public routes
|
2020-08-18 18:31:28 +02:00
|
|
|
$routes->group('@(:podcastName)', function ($routes) {
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('/', 'Podcast::activity/$1', [
|
|
|
|
'as' => 'podcast-activity',
|
|
|
|
]);
|
|
|
|
// override default ActivityPub Library's actor route
|
|
|
|
$routes->get('/', 'Podcast::activity/$1', [
|
|
|
|
'as' => 'actor',
|
|
|
|
'alternate-content' => [
|
|
|
|
'application/activity+json' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'ActorController/$1',
|
|
|
|
],
|
|
|
|
'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'ActorController/$1',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
$routes->get('episodes', 'Podcast::episodes/$1', [
|
|
|
|
'as' => 'podcast-episodes',
|
|
|
|
]);
|
|
|
|
$routes->group('episodes/(:slug)', function ($routes) {
|
2021-02-27 22:21:26 +01:00
|
|
|
$routes->get('/', 'Episode/$1/$2', [
|
|
|
|
'as' => 'episode',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get('oembed.json', 'Episode::oembedJSON/$1/$2', [
|
|
|
|
'as' => 'episode-oembed-json',
|
|
|
|
]);
|
|
|
|
$routes->get('oembed.xml', 'Episode::oembedXML/$1/$2', [
|
|
|
|
'as' => 'episode-oembed-xml',
|
|
|
|
]);
|
2021-02-27 22:21:26 +01:00
|
|
|
$routes->group('embeddable-player', function ($routes) {
|
|
|
|
$routes->get('/', 'Episode::embeddablePlayer/$1/$2', [
|
|
|
|
'as' => 'embeddable-player',
|
|
|
|
]);
|
2021-04-02 19:20:02 +02:00
|
|
|
$routes->get(
|
|
|
|
'(:embeddablePlayerTheme)',
|
|
|
|
'Episode::embeddablePlayer/$1/$2/$3',
|
|
|
|
[
|
|
|
|
'as' => 'embeddable-player-theme',
|
|
|
|
],
|
|
|
|
);
|
2021-02-27 22:21:26 +01:00
|
|
|
});
|
|
|
|
});
|
2021-04-02 19:20:02 +02:00
|
|
|
|
2020-11-13 16:01:55 +01:00
|
|
|
$routes->head('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']);
|
2020-08-18 18:31:28 +02:00
|
|
|
$routes->get('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']);
|
|
|
|
});
|
2021-04-02 19:20:02 +02:00
|
|
|
|
|
|
|
// Other pages
|
2021-02-10 17:20:01 +01:00
|
|
|
$routes->get('/credits', 'Page::credits', ['as' => 'credits']);
|
2020-08-18 18:31:28 +02:00
|
|
|
$routes->get('/(:slug)', 'Page/$1', ['as' => 'page']);
|
|
|
|
|
2021-04-02 19:20:02 +02:00
|
|
|
// interacting as an actor
|
|
|
|
$routes->post('interact-as-actor', 'Auth::attemptInteractAsActor', [
|
|
|
|
'as' => 'interact-as-actor',
|
|
|
|
]);
|
|
|
|
|
2020-05-27 18:46:16 +02:00
|
|
|
/**
|
2021-04-02 19:20:02 +02:00
|
|
|
* Overwriting ActivityPub routes file
|
|
|
|
*/
|
|
|
|
$routes->group('@(:podcastName)', function ($routes) {
|
|
|
|
$routes->post('notes/new', 'Note::attemptCreate/$1', [
|
|
|
|
'as' => 'note-attempt-create',
|
|
|
|
'filter' => 'permission:podcast-manage_publications',
|
|
|
|
]);
|
|
|
|
// Note
|
|
|
|
$routes->group('notes/(:uuid)', function ($routes) {
|
|
|
|
$routes->get('/', 'Note/$1/$2', [
|
|
|
|
'as' => 'note',
|
|
|
|
'alternate-content' => [
|
|
|
|
'application/activity+json' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'NoteController/$2',
|
|
|
|
],
|
|
|
|
'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'NoteController/$2',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
$routes->get('replies', 'Note/$1/$2', [
|
|
|
|
'as' => 'note-replies',
|
|
|
|
'alternate-content' => [
|
|
|
|
'application/activity+json' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'NoteController::replies/$2',
|
|
|
|
],
|
|
|
|
'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [
|
|
|
|
'namespace' => 'ActivityPub\Controllers',
|
|
|
|
'controller-method' => 'NoteController::replies/$2',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
// Actions
|
|
|
|
$routes->post('action', 'Note::attemptAction/$1/$2', [
|
|
|
|
'as' => 'note-attempt-action',
|
|
|
|
'filter' => 'permission:podcast-interact_as',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$routes->post('block-actor', 'Note::attemptBlockActor/$1/$2', [
|
|
|
|
'as' => 'note-attempt-block-actor',
|
|
|
|
'filter' => 'permission:fediverse-block_actors',
|
|
|
|
]);
|
|
|
|
$routes->post('block-domain', 'Note::attemptBlockDomain/$1/$2', [
|
|
|
|
'as' => 'note-attempt-block-domain',
|
|
|
|
'filter' => 'permission:fediverse-block_domains',
|
|
|
|
]);
|
|
|
|
$routes->post('delete', 'Note::attemptDelete/$1/$2', [
|
|
|
|
'as' => 'note-attempt-delete',
|
|
|
|
'filter' => 'permission:podcast-manage_publications',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$routes->get('remote/(:noteAction)', 'Note::remoteAction/$1/$2/$3', [
|
|
|
|
'as' => 'note-remote-action',
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
$routes->get('follow', 'Actor::follow/$1', [
|
|
|
|
'as' => 'follow',
|
|
|
|
]);
|
|
|
|
$routes->get('outbox', 'Actor::outbox/$1', [
|
|
|
|
'as' => 'outbox',
|
|
|
|
'filter' => 'activity-pub:verify-activitystream',
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
2020-05-27 18:46:16 +02:00
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Additional Routing
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* There will often be times that you need additional routing and you
|
2021-04-02 19:20:02 +02:00
|
|
|
* need it to be able to override any defaults in this file. Environment
|
2020-05-27 18:46:16 +02:00
|
|
|
* based routes is one such time. require() additional route files here
|
|
|
|
* to make that happen.
|
|
|
|
*
|
|
|
|
* You will have access to the $routes object within that file without
|
|
|
|
* needing to reload it.
|
|
|
|
*/
|
2020-06-01 23:23:14 +02:00
|
|
|
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
|
|
|
|
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
2020-05-27 18:46:16 +02:00
|
|
|
}
|