diff --git a/appinfo/info.xml b/appinfo/info.xml
index 32c3ad9..98a5415 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -29,12 +29,15 @@ You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) inst
https://git.crystalyx.net/Xefir/repod/raw/branch/main/screens/modal.png
-
+
+ repod
Podcast
repod.page.index
+ app.svg
+ link
diff --git a/appinfo/routes.php b/appinfo/routes.php
deleted file mode 100644
index a58166f..0000000
--- a/appinfo/routes.php
+++ /dev/null
@@ -1,27 +0,0 @@
- OCA\RePod\Controller\PageController->index().
- *
- * The controller class has to be registered in the application.php file since
- * it's instantiated in there
- */
-return [
- 'routes' => [
- ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
- ['name' => 'page#feed', 'url' => '/feed/{path}', 'verb' => 'GET', 'requirements' => ['path' => '.+']],
- ['name' => 'page#discover', 'url' => '/discover', 'verb' => 'GET'],
- ['name' => 'episodes#action', 'url' => '/episodes/action', 'verb' => 'GET'],
- ['name' => 'episodes#list', 'url' => '/episodes/list', 'verb' => 'GET'],
- ['name' => 'opml#export', 'url' => '/opml/export', 'verb' => 'GET'],
- ['name' => 'opml#import', 'url' => '/opml/import', 'verb' => 'POST'],
- ['name' => 'podcast#index', 'url' => '/podcast', 'verb' => 'GET'],
- ['name' => 'search#index', 'url' => '/search', 'verb' => 'GET'],
- ['name' => 'toplist#hot', 'url' => '/toplist/hot', 'verb' => 'GET'],
- ['name' => 'toplist#new', 'url' => '/toplist/new', 'verb' => 'GET'],
- ],
-];
diff --git a/lib/Controller/EpisodesController.php b/lib/Controller/EpisodesController.php
index c4e97d3..58dc462 100644
--- a/lib/Controller/EpisodesController.php
+++ b/lib/Controller/EpisodesController.php
@@ -11,6 +11,9 @@ use OCA\RePod\Core\EpisodeAction\EpisodeActionReader;
use OCA\RePod\Service\UserService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Http\Client\IClientService;
use OCP\IRequest;
@@ -27,10 +30,9 @@ class EpisodesController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/episodes/list')]
public function list(string $url): JSONResponse {
$client = $this->clientService->newClient();
$feed = $client->get($url);
@@ -41,10 +43,9 @@ class EpisodesController extends Controller
return new JSONResponse($episodes, $feed->getStatusCode());
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/episodes/action')]
public function action(string $url): JSONResponse {
$action = $this->episodeActionRepository->findByEpisodeUrl($url, $this->userService->getUserUID());
diff --git a/lib/Controller/OpmlController.php b/lib/Controller/OpmlController.php
index 7934eb3..4200a82 100644
--- a/lib/Controller/OpmlController.php
+++ b/lib/Controller/OpmlController.php
@@ -10,6 +10,9 @@ use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeSaver;
use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\UserService;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\DataDownloadResponse;
use OCP\AppFramework\Http\Response;
use OCP\IL10N;
@@ -28,10 +31,9 @@ class OpmlController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/opml/export')]
public function export(): DataDownloadResponse {
// https://github.com/AntennaPod/AntennaPod/blob/master/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java
$xml = new \SimpleXMLElement('', namespaceOrPrefix: 'http://xmlpull.org/v1/doc/features.html#indent-output');
@@ -82,10 +84,9 @@ class OpmlController extends Controller
return new DataDownloadResponse((string) $xml->asXML(), 'repod-'.$dateCreated->getTimestamp().'.opml', ' application/xml');
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'POST', url: '/opml/import')]
public function import(): Response {
$file = $this->request->getUploadedFile('import');
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 01b2932..07038aa 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -6,6 +6,9 @@ namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
@@ -21,10 +24,9 @@ class PageController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/')]
public function index(): TemplateResponse {
Util::addScript(Application::APP_ID, Application::APP_ID.'-main');
Util::addStyle(Application::APP_ID, Application::APP_ID.'-main');
@@ -46,18 +48,16 @@ class PageController extends Controller
return $response;
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/discover')]
public function discover(): TemplateResponse {
return $this->index();
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/feed/{path}', requirements: ['path' => '.+'])]
public function feed(): TemplateResponse {
return $this->index();
}
diff --git a/lib/Controller/PodcastController.php b/lib/Controller/PodcastController.php
index 2e3dd29..8e2d18f 100644
--- a/lib/Controller/PodcastController.php
+++ b/lib/Controller/PodcastController.php
@@ -8,6 +8,9 @@ use OCA\GPodderSync\Core\PodcastData\PodcastData;
use OCA\GPodderSync\Core\PodcastData\PodcastDataReader;
use OCA\RePod\AppInfo\Application;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Http\Client\IClientService;
use OCP\ICacheFactory;
@@ -24,10 +27,9 @@ class PodcastController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/podcast')]
public function index(string $url): JSONResponse {
$podcast = null;
diff --git a/lib/Controller/SearchController.php b/lib/Controller/SearchController.php
index d0a388a..6e8a351 100644
--- a/lib/Controller/SearchController.php
+++ b/lib/Controller/SearchController.php
@@ -7,6 +7,9 @@ namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\MultiPodService;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
@@ -19,10 +22,9 @@ class SearchController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/search')]
public function index(string $q): JSONResponse {
return new JSONResponse($this->multiPodService->search($q));
}
diff --git a/lib/Controller/ToplistController.php b/lib/Controller/ToplistController.php
index 161cb6b..b81c55a 100644
--- a/lib/Controller/ToplistController.php
+++ b/lib/Controller/ToplistController.php
@@ -7,6 +7,9 @@ namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\FyydService;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\FrontpageRoute;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
+use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
@@ -19,18 +22,16 @@ class ToplistController extends Controller
parent::__construct(Application::APP_ID, $request);
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/toplist/hot')]
public function hot(): JSONResponse {
return new JSONResponse($this->fyydService->hot());
}
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
+ #[NoAdminRequired]
+ #[NoCSRFRequired]
+ #[FrontpageRoute(verb: 'GET', url: '/toplist/new')]
public function new(): JSONResponse {
return new JSONResponse($this->fyydService->latest());
}