diff --git a/appinfo/routes.php b/appinfo/routes.php
index 7e46e20..5ffdd49 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -13,6 +13,7 @@ declare(strict_types=1);
return [
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
- ['name' => 'top#index', 'url' => '/top/{count}', 'verb' => 'GET']
+ ['name' => 'top#index', 'url' => '/top/{count}', 'verb' => 'GET'],
+ ['name' => 'search#index', 'url' => '/search/{value}', 'verb' => 'GET']
]
];
diff --git a/lib/Controller/SearchController.php b/lib/Controller/SearchController.php
new file mode 100644
index 0000000..addef5c
--- /dev/null
+++ b/lib/Controller/SearchController.php
@@ -0,0 +1,55 @@
+clientService->newClient();
+ $fyydReponse = $fyydClient->get("https://api.fyyd.de/0.2/search/podcast", [
+ 'query' => [
+ 'title' => $value,
+ 'term' => $value
+ ]
+ ]);
+ $fyydJson = (array) json_decode((string) $fyydReponse->getBody(), true, flags: JSON_THROW_ON_ERROR);
+
+ if (array_key_exists('data', $fyydJson) && is_array($fyydJson['data'])) {
+ /** @var string[] $fyydFeed */
+ foreach ($fyydJson['data'] as $fyydFeed) {
+ $podcasts[] = [
+ 'id' => $fyydFeed['id'],
+ 'title' => $fyydFeed['title'],
+ 'description' => $fyydFeed['description'],
+ 'image' => $fyydFeed['imgURL'],
+ 'url' => $fyydFeed['xmlURL'],
+ 'lang' => $fyydFeed['language'],
+ 'lastpub' => $fyydFeed['lastpub']
+ ];
+ }
+ }
+ } catch (Exception $e) {
+ }
+
+ return new JSONResponse($podcasts);
+ }
+}
diff --git a/lib/Controller/TopController.php b/lib/Controller/TopController.php
index 7dc9594..7560237 100644
--- a/lib/Controller/TopController.php
+++ b/lib/Controller/TopController.php
@@ -30,24 +30,29 @@ class TopController extends Controller
* @NoCSRFRequired
*/
public function index(int $count = 10): JSONResponse {
- $userLang = 'en';
+ $language = 'en';
try {
$langClient = $this->clientService->newClient();
$langResponse = $langClient->get("https://api.fyyd.de/0.2/feature/podcast/hot/languages");
$langJson = (array) json_decode((string) $langResponse->getBody(), true, flags: JSON_THROW_ON_ERROR);
if (array_key_exists('data', $langJson) && is_array($langJson['data'])) {
- $userLang = $this->l10n->getUserLanguage($this->userSession->getUser());
- $userLang = explode('_', $userLang);
- $userLang = count($userLang) > 1 ? $userLang[1] : $userLang[0];
- $userLang = in_array($userLang, $langJson['data']) ? $userLang : 'en';
+ $language = $this->l10n->getUserLanguage($this->userSession->getUser());
+ $language = explode('_', $language);
+ $language = count($language) > 1 ? $language[1] : $language[0];
+ $language = in_array($language, $langJson['data']) ? $language : 'en';
}
} catch (Exception $e) {
}
try {
$podcastClient = $this->clientService->newClient();
- $podcastReponse = $podcastClient->get("https://api.fyyd.de/0.2/feature/podcast/hot?count={$count}&language={$userLang}");
+ $podcastReponse = $podcastClient->get("https://api.fyyd.de/0.2/feature/podcast/hot", [
+ 'query' => [
+ 'count' => $count,
+ 'language' => $language
+ ]
+ ]);
$podcastJson = (array) json_decode((string) $podcastReponse->getBody(), true, flags: JSON_THROW_ON_ERROR);
return new JSONResponse($podcastJson, $podcastReponse->getStatusCode());
} catch (Exception $e) {
diff --git a/src/components/Search.vue b/src/components/Search.vue
new file mode 100644
index 0000000..d5d1050
--- /dev/null
+++ b/src/components/Search.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+
diff --git a/src/components/TopList.vue b/src/components/TopList.vue
index 87e3ff7..a6729dd 100644
--- a/src/components/TopList.vue
+++ b/src/components/TopList.vue
@@ -4,7 +4,7 @@
{{ t('Discover') }}