mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-08-24 13:17:17 +02:00
* add DashboardCard component * add instance wide podcasts and episodes numbers * add app.storageLimit environment variable * divide bytes by 1000 instead of 1024 in stats sql queries closes #216
80 lines
2.7 KiB
PHP
80 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @copyright 2021 Ad Aures
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
$routes = service('routes');
|
|
|
|
/**
|
|
* Analytics routes file
|
|
*/
|
|
$routes->addPlaceholder(
|
|
'class',
|
|
'\bPodcastByCountry|\bPodcastByEpisode|\bPodcastByHour|\bPodcastByPlayer|\bPodcastByRegion|\bPodcastByService|\bPodcast|\bWebsiteByBrowser|\bWebsiteByEntryPage|\bWebsiteByReferer',
|
|
);
|
|
$routes->addPlaceholder(
|
|
'filter',
|
|
'\bWeekly|\bYearly|\bByDay|\bByWeekday|\bByMonth|\bByAppWeekly|\bByAppYearly|\bByOsWeekly|\bByDeviceWeekly|\bBots|\bByServiceWeekly|\bBandwidthByDay|\bUniqueListenersByDay|\bUniqueListenersByMonth|\bTotalListeningTimeByDay|\bTotalListeningTimeByMonth|\bByDomainWeekly|\bByDomainYearly|\bTotalBandwidthByMonth|\bTotalStorageByMonth',
|
|
);
|
|
|
|
$routes->group('', [
|
|
'namespace' => 'Modules\Analytics\Controllers',
|
|
], function ($routes): void {
|
|
$routes->group(config('Analytics')->gateway . '/(:num)/(:class)', function ($routes): void {
|
|
$routes->get('/', 'AnalyticsController::getData/$1/$2', [
|
|
'as' => 'analytics-full-data',
|
|
'filter' => config('Analytics')
|
|
->routeFilters[
|
|
'analytics-full-data'
|
|
],
|
|
]);
|
|
|
|
$routes->get('(:filter)', 'AnalyticsController::getData/$1/$2/$3', [
|
|
'as' => 'analytics-data',
|
|
'filter' => config('Analytics')
|
|
->routeFilters['analytics-data'],
|
|
]);
|
|
|
|
$routes->get(
|
|
'(:filter)/(:num)',
|
|
'AnalyticsController::getData/$1/$2/$3/$4',
|
|
[
|
|
'as' => 'analytics-filtered-data',
|
|
'filter' => config('Analytics')
|
|
->routeFilters[
|
|
'analytics-filtered-data'
|
|
],
|
|
],
|
|
);
|
|
});
|
|
|
|
$routes->get(config('Analytics')->gateway . '/(:class)/(:filter)', 'AnalyticsController::getData/$1/$2', [
|
|
'as' => 'analytics-data-instance',
|
|
]);
|
|
|
|
// Route for podcast audio file analytics (/audio/pack(podcast_id,episode_id,bytes_threshold,filesize,duration,date)/podcast_folder/filename.mp3)
|
|
$routes->head(
|
|
'audio/(:base64)/(:any)',
|
|
'EpisodeAnalyticsController::hit/$1/$2',
|
|
[
|
|
'as' => 'episode-analytics-hit',
|
|
],
|
|
);
|
|
$routes->get(
|
|
'audio/(:base64)/(:any)',
|
|
'EpisodeAnalyticsController::hit/$1/$2',
|
|
[
|
|
'as' => 'episode-analytics-hit',
|
|
],
|
|
);
|
|
});
|
|
|
|
// Show the Unknown UserAgents
|
|
$routes->get('.well-known/unknown-useragents', 'UnknownUserAgentsController');
|
|
$routes->get('.well-known/unknown-useragents/(:num)', 'UnknownUserAgentsController/$1');
|