diff --git a/Dockerfile b/Dockerfile index 80e7927..621c6fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,8 @@ RUN curl -sSLo /tmp/gpoddersync.tar.gz https://github.com/thrillfall/nextcloud-g tar xvzf /tmp/gpoddersync.tar.gz -C apps && \ rm /tmp/gpoddersync.tar.gz && \ cd apps/repod && make build && cd - && \ - php occ app:enable gpoddersync repod + php occ app:enable gpoddersync repod && \ + php occ config:system:set debug --value=true && \ + php occ config:system:set memcache.local --value=none USER root diff --git a/appinfo/routes.php b/appinfo/routes.php index 2ba0621..16dc3fb 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -12,6 +12,7 @@ declare(strict_types=1); */ return [ 'routes' => [ - ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'] + ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], + ['name' => 'top#index', 'url' => '/top/{limit}', 'verb' => 'GET'] ] ]; diff --git a/img/app.svg b/img/app.svg index fe370f8..188b5c2 100644 --- a/img/app.svg +++ b/img/app.svg @@ -1,56 +1,40 @@ - - - - image/svg+xml - - - - + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + style="fill:#ffffff;fill-opacity:1;opacity:0.6" /> + diff --git a/img/app.svg.license b/img/app.svg.license deleted file mode 100644 index 586a413..0000000 --- a/img/app.svg.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: XĂ©fir Destiny -SPDX-License-Identifier: AGPL-3.0-or-later \ No newline at end of file diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 5dcce06..8b6fe4d 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -6,6 +6,7 @@ namespace OCA\RePod\Controller; use OCA\RePod\AppInfo\Application; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\TemplateResponse; use OCP\IRequest; use OCP\Util; @@ -23,6 +24,11 @@ class PageController extends Controller public function index(): TemplateResponse { Util::addScript(Application::APP_ID, 'repod-main'); - return new TemplateResponse(Application::APP_ID, 'main'); + $csp = new ContentSecurityPolicy(); + $csp->addAllowedImageDomain('*'); + + $response = new TemplateResponse(Application::APP_ID, 'main'); + $response->setContentSecurityPolicy($csp); + return $response; } } diff --git a/lib/Controller/TopController.php b/lib/Controller/TopController.php new file mode 100644 index 0000000..bfcb143 --- /dev/null +++ b/lib/Controller/TopController.php @@ -0,0 +1,43 @@ +clientService = $clientService; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function index(int $limit = 10): JSONResponse { + if (!in_array($limit, [10, 25, 50])) { + return new JSONResponse('Invalid limit, can be 10, 25 or 50.', Http::STATUS_BAD_REQUEST); + } + + try { + $client = $this->clientService->newClient(); + $response = $client->get("https://rss.applemarketingtools.com/api/v2/fr/podcasts/top/{$limit}/podcasts.json"); + $json = json_decode($response->getBody(), flags: JSON_THROW_ON_ERROR); + return new JSONResponse($json, $response->getStatusCode()); + } catch (Exception $e) { + return new JSONResponse($e->getMessage(), Http::STATUS_INTERNAL_SERVER_ERROR); + } + } +} diff --git a/package-lock.json b/package-lock.json index a239ad2..c4283ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@nextcloud/router": "^2.1.2", "@nextcloud/vue": "^7.12.0", "vue": "^2", + "vue-fragment": "^1.6.0", "vue-material-design-icons": "^5.2.0", "vue-router": "^3" }, @@ -12954,6 +12955,14 @@ "dev": true, "peer": true }, + "node_modules/vue-fragment": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vue-fragment/-/vue-fragment-1.6.0.tgz", + "integrity": "sha512-a5T8ZZZK/EQzgVShEl374HbobUJ0a7v12BzOzS6Z/wd/5EE/5SffcyHC+7bf9hP3L7Yc0hhY/GhMdwFQ25O/8A==", + "peerDependencies": { + "vue": "^2.5.16" + } + }, "node_modules/vue-hot-reload-api": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", diff --git a/package.json b/package.json index 62d9ef2..6b9a58a 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@nextcloud/router": "^2.1.2", "@nextcloud/vue": "^7.12.0", "vue": "^2", + "vue-fragment": "^1.6.0", "vue-material-design-icons": "^5.2.0", "vue-router": "^3" }, diff --git a/src/components/Top.vue b/src/components/Top.vue new file mode 100644 index 0000000..2aa4d79 --- /dev/null +++ b/src/components/Top.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/main.js b/src/main.js index 14c4193..c06c716 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,6 @@ import { translatePlural as n, translate as t } from '@nextcloud/l10n' import App from './App.vue' +import { Plugin } from 'vue-fragment' import Vue from 'vue' import { generateFilePath } from '@nextcloud/router' import router from './router.js' @@ -8,6 +9,7 @@ import router from './router.js' __webpack_public_path__ = generateFilePath(appName, '', 'js/') Vue.mixin({ methods: { t, n } }) +Vue.use(Plugin) export default new Vue({ el: '#content', diff --git a/src/views/Discover.vue b/src/views/Discover.vue index e781612..9ec0bba 100644 --- a/src/views/Discover.vue +++ b/src/views/Discover.vue @@ -1,29 +1,28 @@