revert: ⏪ revert new subscriptions loading model (fix #182)
This commit is contained in:
parent
668c377c33
commit
75aad7baab
@ -1,3 +1,9 @@
|
|||||||
|
## 3.3.2 - What a Nightmare - 2024-10-24
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- 🚑 Revert [#178](https://git.crystalyx.net/Xefir/repod/issues/178) not working on big subscriptions lists
|
||||||
|
[#182](https://git.crystalyx.net/Xefir/repod/issues/182) reported by @SteveDinn
|
||||||
|
|
||||||
## 3.3.1 - Breaking the Loop - 2024-10-24
|
## 3.3.1 - Breaking the Loop - 2024-10-24
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!]]></description>
|
You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!]]></description>
|
||||||
<version>3.3.1</version>
|
<version>3.3.2</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="xefir@crystalyx.net" homepage="https://crystalyx.net">Michel Roux</author>
|
<author mail="xefir@crystalyx.net" homepage="https://crystalyx.net">Michel Roux</author>
|
||||||
<namespace>RePod</namespace>
|
<namespace>RePod</namespace>
|
||||||
|
18
composer.lock
generated
18
composer.lock
generated
@ -1359,12 +1359,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
||||||
"reference": "51e3fa290bca57eca7ba6c261b8a1278eb13a98a"
|
"reference": "c9898eb8a4668430f8a40e7405340f47cd73d7c0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/51e3fa290bca57eca7ba6c261b8a1278eb13a98a",
|
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/c9898eb8a4668430f8a40e7405340f47cd73d7c0",
|
||||||
"reference": "51e3fa290bca57eca7ba6c261b8a1278eb13a98a",
|
"reference": "c9898eb8a4668430f8a40e7405340f47cd73d7c0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
@ -1372,7 +1372,7 @@
|
|||||||
"admidio/admidio": "<4.3.12",
|
"admidio/admidio": "<4.3.12",
|
||||||
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
|
"adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3",
|
||||||
"aheinze/cockpit": "<2.2",
|
"aheinze/cockpit": "<2.2",
|
||||||
"aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.04.6",
|
"aimeos/ai-admin-graphql": ">=2022.04.1,<2022.10.10|>=2023.04.1,<2023.10.6|>=2024.04.1,<2024.07.2",
|
||||||
"aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1",
|
"aimeos/ai-admin-jsonadm": "<2020.10.13|>=2021.04.1,<2021.10.6|>=2022.04.1,<2022.10.3|>=2023.04.1,<2023.10.4|==2024.04.1",
|
||||||
"aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7",
|
"aimeos/ai-client-html": ">=2020.04.1,<2020.10.27|>=2021.04.1,<2021.10.22|>=2022.04.1,<2022.10.13|>=2023.04.1,<2023.10.15|>=2024.04.1,<2024.04.7",
|
||||||
"aimeos/ai-controller-frontend": "<2020.10.15|>=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.8|>=2023.04.1,<2023.10.9|==2024.04.1",
|
"aimeos/ai-controller-frontend": "<2020.10.15|>=2021.04.1,<2021.10.8|>=2022.04.1,<2022.10.8|>=2023.04.1,<2023.10.9|==2024.04.1",
|
||||||
@ -1416,7 +1416,7 @@
|
|||||||
"barrelstrength/sprout-forms": "<3.9",
|
"barrelstrength/sprout-forms": "<3.9",
|
||||||
"barryvdh/laravel-translation-manager": "<0.6.2",
|
"barryvdh/laravel-translation-manager": "<0.6.2",
|
||||||
"barzahlen/barzahlen-php": "<2.0.1",
|
"barzahlen/barzahlen-php": "<2.0.1",
|
||||||
"baserproject/basercms": "<5.0.9",
|
"baserproject/basercms": "<=5.1.1",
|
||||||
"bassjobsen/bootstrap-3-typeahead": ">4.0.2",
|
"bassjobsen/bootstrap-3-typeahead": ">4.0.2",
|
||||||
"bbpress/bbpress": "<2.6.5",
|
"bbpress/bbpress": "<2.6.5",
|
||||||
"bcosca/fatfree": "<3.7.2",
|
"bcosca/fatfree": "<3.7.2",
|
||||||
@ -1861,7 +1861,7 @@
|
|||||||
"processwire/processwire": "<=3.0.229",
|
"processwire/processwire": "<=3.0.229",
|
||||||
"propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7",
|
"propel/propel": ">=2.0.0.0-alpha1,<=2.0.0.0-alpha7",
|
||||||
"propel/propel1": ">=1,<=1.7.1",
|
"propel/propel1": ">=1,<=1.7.1",
|
||||||
"pterodactyl/panel": "<1.11.6",
|
"pterodactyl/panel": "<1.11.8",
|
||||||
"ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2",
|
"ptheofan/yii2-statemachine": ">=2.0.0.0-RC1-dev,<=2",
|
||||||
"ptrofimov/beanstalk_console": "<1.7.14",
|
"ptrofimov/beanstalk_console": "<1.7.14",
|
||||||
"pubnub/pubnub": "<6.1",
|
"pubnub/pubnub": "<6.1",
|
||||||
@ -2183,7 +2183,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-10-21T20:05:20+00:00"
|
"time": "2024-10-24T20:05:29+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/diff",
|
"name": "sebastian/diff",
|
||||||
@ -3210,8 +3210,8 @@
|
|||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": {},
|
||||||
"platform-dev": [],
|
"platform-dev": {},
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.1"
|
"php": "8.1"
|
||||||
},
|
},
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace OCA\RePod\Controller;
|
|
||||||
|
|
||||||
use OCA\GPodderSync\Core\PodcastData\PodcastDataReader;
|
|
||||||
use OCA\GPodderSync\Core\PodcastData\PodcastMetrics;
|
|
||||||
use OCA\GPodderSync\Core\PodcastData\PodcastMetricsReader;
|
|
||||||
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\JSONResponse;
|
|
||||||
use OCP\IRequest;
|
|
||||||
|
|
||||||
class MetricsController extends Controller
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
IRequest $request,
|
|
||||||
private PodcastDataReader $podcastDataReader,
|
|
||||||
private PodcastMetricsReader $podcastMetricsReader,
|
|
||||||
private UserService $userService
|
|
||||||
) {
|
|
||||||
parent::__construct(Application::APP_ID, $request);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[NoAdminRequired]
|
|
||||||
#[NoCSRFRequired]
|
|
||||||
#[FrontpageRoute(verb: 'GET', url: '/metrics')]
|
|
||||||
public function index(): JSONResponse {
|
|
||||||
$metrics = $this->podcastMetricsReader->metrics($this->userService->getUserUID());
|
|
||||||
usort($metrics, fn (PodcastMetrics $a, PodcastMetrics $b) => $b->getListenedSeconds() <=> $a->getListenedSeconds());
|
|
||||||
$subscriptions = [];
|
|
||||||
|
|
||||||
foreach ($metrics as $metric) {
|
|
||||||
$subscription = $metric->toArray();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$subscription['data'] = $this->podcastDataReader->getCachedOrFetchPodcastData($metric->getUrl(), $this->userService->getUserUID());
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
$subscriptions[] = $subscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new JSONResponse($subscriptions);
|
|
||||||
}
|
|
||||||
}
|
|
56
package-lock.json
generated
56
package-lock.json
generated
@ -19,7 +19,7 @@
|
|||||||
"pinia": "^2.2.4",
|
"pinia": "^2.2.4",
|
||||||
"toastify-js": "^1.12.0",
|
"toastify-js": "^1.12.0",
|
||||||
"vite": "^5.4.10",
|
"vite": "^5.4.10",
|
||||||
"vite-plugin-vue-devtools": "^7.5.3",
|
"vite-plugin-vue-devtools": "^7.5.4",
|
||||||
"vue": "^3.5.12",
|
"vue": "^3.5.12",
|
||||||
"vue-material-design-icons": "^5.3.1",
|
"vue-material-design-icons": "^5.3.1",
|
||||||
"vue-router": "^4.4.5"
|
"vue-router": "^4.4.5"
|
||||||
@ -583,9 +583,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@csstools/css-parser-algorithms": {
|
"node_modules/@csstools/css-parser-algorithms": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.3.tgz",
|
||||||
"integrity": "sha512-6tC/MnlEvs5suR4Ahef4YlBccJDHZuxGsAlxXmybWjZ5jPxlzLSMlRZ9mVHSRvlD+CmtE7+hJ+UQbfXrws/rUQ==",
|
"integrity": "sha512-15WQTALDyxAwSgAvLt7BksAssiSrNNhTv4zM7qX9U6R7FtpNskVVakzWQlYODlwPwXhGpKPmB10LM943pxMe7w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -3213,13 +3213,13 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@vue/devtools-core": {
|
"node_modules/@vue/devtools-core": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/devtools-core/-/devtools-core-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/devtools-core/-/devtools-core-7.5.4.tgz",
|
||||||
"integrity": "sha512-KIzT76GPubhvvQzjQtf7yhaSdVOcq/0CV2QbUw2bf3vzV+biHsgfgQ1XEbPbPKuHr1t0zshj53mBv0bx2OmkJw==",
|
"integrity": "sha512-igB2iUKsCUrXkp0wKLn3n5X8jz3AgXWk7if0QpLu3Do16QmlTO0e+/VvTpX0ZbLMh8OOAxDKyfPvJMMO/4QJ5w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/devtools-kit": "^7.5.3",
|
"@vue/devtools-kit": "^7.5.4",
|
||||||
"@vue/devtools-shared": "^7.5.3",
|
"@vue/devtools-shared": "^7.5.4",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nanoid": "^3.3.4",
|
"nanoid": "^3.3.4",
|
||||||
"pathe": "^1.1.2",
|
"pathe": "^1.1.2",
|
||||||
@ -3230,12 +3230,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/devtools-kit": {
|
"node_modules/@vue/devtools-kit": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.5.4.tgz",
|
||||||
"integrity": "sha512-XSTXCAHshYniK3gLQfhMRDuDLLj6vHFWKVl1tvtSgZ0iJy5AXoI4U/GKGlyS2uS1hwZCSoNSGdkKtbW/pn/Iuw==",
|
"integrity": "sha512-0i7WFgc1B2TL52tstn82zlb9opSA0aIiHfkUYFXtZb8CIpmlFMTkHtgwVl6PMWNBj3LNhYou1YJCLpCYvJYYoA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/devtools-shared": "^7.5.3",
|
"@vue/devtools-shared": "^7.5.4",
|
||||||
"birpc": "^0.2.19",
|
"birpc": "^0.2.19",
|
||||||
"hookable": "^5.5.3",
|
"hookable": "^5.5.3",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
@ -3245,9 +3245,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/devtools-shared": {
|
"node_modules/@vue/devtools-shared": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.5.4.tgz",
|
||||||
"integrity": "sha512-i2tCUtAEQ0S8AmTuy6FSOmVKCB5ajmMaVrrw0ypX75koLSo1mssQ8zezds5IoUZHRiXBsgoGHbJGuGwyrSGhqQ==",
|
"integrity": "sha512-dwuq4YmwTyLc7eBOqX63s3JB8il7qnKsNgENglSMkUPwiItHkVAYYfPESN1rxSdYkl1RCux1l5TBidYqfUDNAA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rfdc": "^1.4.1"
|
"rfdc": "^1.4.1"
|
||||||
@ -5043,9 +5043,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.5.43",
|
"version": "1.5.45",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.43.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.45.tgz",
|
||||||
"integrity": "sha512-NxnmFBHDl5Sachd2P46O7UJiMaMHMLSofoIWVJq3mj8NJgG0umiSeljAVP9lGzjI0UDLJJ5jjoGjcrB8RSbjLQ==",
|
"integrity": "sha512-vOzZS6uZwhhbkZbcRyiy99Wg+pYFV5hk+5YaECvx0+Z31NR3Tt5zS6dze2OepT6PCTzVzT0dIJItti+uAW5zmw==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/elliptic": {
|
"node_modules/elliptic": {
|
||||||
@ -10701,9 +10701,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sass": {
|
"node_modules/sass": {
|
||||||
"version": "1.80.3",
|
"version": "1.80.4",
|
||||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.80.3.tgz",
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.80.4.tgz",
|
||||||
"integrity": "sha512-ptDWyVmDMVielpz/oWy3YP3nfs7LpJTHIJZboMVs8GEC9eUmtZTZhMHlTW98wY4aEorDfjN38+Wr/XjskFWcfA==",
|
"integrity": "sha512-rhMQ2tSF5CsuuspvC94nPM9rToiAFw2h3JTrLlgmNw1MH79v8Cr3DH6KF6o6r+8oofY3iYVPUf66KzC8yuVN1w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -12604,14 +12604,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite-plugin-vue-devtools": {
|
"node_modules/vite-plugin-vue-devtools": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/vite-plugin-vue-devtools/-/vite-plugin-vue-devtools-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/vite-plugin-vue-devtools/-/vite-plugin-vue-devtools-7.5.4.tgz",
|
||||||
"integrity": "sha512-gpR4S1anwc3rEapcealw0EATfQHO7jLCPqqT2qZAYLyVXsRi+Ysk7Z+kr/iq0sROfcVfSNAqAMB7foZobj2m5Q==",
|
"integrity": "sha512-6yTcGrF+YdplDhNiNCkwj23BQDHA/jp06FR4Bo3rui1GW+8VdFcc26au2gtynPwRDNJXNueTxiVtVb6dq+lNZA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/devtools-core": "^7.5.3",
|
"@vue/devtools-core": "^7.5.4",
|
||||||
"@vue/devtools-kit": "^7.5.3",
|
"@vue/devtools-kit": "^7.5.4",
|
||||||
"@vue/devtools-shared": "^7.5.3",
|
"@vue/devtools-shared": "^7.5.4",
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
"sirv": "^3.0.0",
|
"sirv": "^3.0.0",
|
||||||
"vite-plugin-inspect": "^0.8.7",
|
"vite-plugin-inspect": "^0.8.7",
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"pinia": "^2.2.4",
|
"pinia": "^2.2.4",
|
||||||
"toastify-js": "^1.12.0",
|
"toastify-js": "^1.12.0",
|
||||||
"vite": "^5.4.10",
|
"vite": "^5.4.10",
|
||||||
"vite-plugin-vue-devtools": "^7.5.3",
|
"vite-plugin-vue-devtools": "^7.5.4",
|
||||||
"vue": "^3.5.12",
|
"vue": "^3.5.12",
|
||||||
"vue-material-design-icons": "^5.3.1",
|
"vue-material-design-icons": "^5.3.1",
|
||||||
"vue-router": "^4.4.5"
|
"vue-router": "^4.4.5"
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<NcGuestContent class="guest">
|
<NcGuestContent class="guest">
|
||||||
<Loading v-if="!metric.data" />
|
<Loading v-if="!feed.data" />
|
||||||
<NcAvatar
|
<NcAvatar
|
||||||
v-if="metric.data"
|
v-if="feed.data"
|
||||||
class="avatar"
|
class="avatar"
|
||||||
:display-name="metric.data.author || metric.data.title"
|
:display-name="feed.data.author || feed.data.title"
|
||||||
:is-no-user="true"
|
:is-no-user="true"
|
||||||
:size="222"
|
:size="222"
|
||||||
:url="metric.data.imageUrl" />
|
:url="feed.data.imageUrl" />
|
||||||
<div v-if="metric.data" class="list">
|
<div v-if="feed.data" class="list">
|
||||||
<h2 class="title">{{ metric.data.title }}</h2>
|
<h2 class="title">{{ feed.data.title }}</h2>
|
||||||
<Loading v-if="loading" />
|
<Loading v-if="loading" />
|
||||||
<ul v-if="!loading">
|
<ul v-if="!loading">
|
||||||
<Episode
|
<Episode
|
||||||
@ -17,14 +17,14 @@
|
|||||||
:key="episode.guid"
|
:key="episode.guid"
|
||||||
:episode="episode"
|
:episode="episode"
|
||||||
:one-line="true"
|
:one-line="true"
|
||||||
:url="metric.url" />
|
:url="feed.metrics.url" />
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</NcGuestContent>
|
</NcGuestContent>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { EpisodeInterface, PodcastMetricsInterface } from '../../utils/types.ts'
|
import type { EpisodeInterface, SubscriptionInterface } from '../../utils/types.ts'
|
||||||
import { NcAvatar, NcGuestContent } from '@nextcloud/vue'
|
import { NcAvatar, NcGuestContent } from '@nextcloud/vue'
|
||||||
import Episode from './Episode.vue'
|
import Episode from './Episode.vue'
|
||||||
import Loading from '../Atoms/Loading.vue'
|
import Loading from '../Atoms/Loading.vue'
|
||||||
@ -43,8 +43,8 @@ export default {
|
|||||||
NcGuestContent,
|
NcGuestContent,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
metric: {
|
feed: {
|
||||||
type: Object as () => PodcastMetricsInterface,
|
type: Object as () => SubscriptionInterface,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -57,7 +57,7 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
const episodes = await axios.get<EpisodeInterface[]>(
|
const episodes = await axios.get<EpisodeInterface[]>(
|
||||||
generateUrl('/apps/repod/episodes/list?url={url}', {
|
generateUrl('/apps/repod/episodes/list?url={url}', {
|
||||||
url: this.metric.url,
|
url: this.feed.metrics.url,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
this.episodes = [...episodes.data]
|
this.episodes = [...episodes.data]
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<NcAppNavigationItem
|
<NcAppNavigationItem
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:name="metric.data?.title || metric.url"
|
:name="feed?.data?.title || url"
|
||||||
:to="toFeedUrl(metric.url)">
|
:to="toFeedUrl(url)">
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<NcActionButton
|
<NcActionButton
|
||||||
:aria-label="t('repod', 'Favorite')"
|
:aria-label="t('repod', 'Favorite')"
|
||||||
:model-value="metric.isFavorite"
|
:model-value="feed?.isFavorite"
|
||||||
:name="t('repod', 'Favorite')"
|
:name="t('repod', 'Favorite')"
|
||||||
:title="t('repod', 'Favorite')"
|
:title="t('repod', 'Favorite')"
|
||||||
@update:modelValue="switchFavorite($event)">
|
@update:modelValue="switchFavorite($event)">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<StarPlusIcon v-if="!metric.isFavorite" :size="20" />
|
<StarPlusIcon v-if="!feed?.isFavorite" :size="20" />
|
||||||
<StarRemoveIcon v-if="metric.isFavorite" :size="20" />
|
<StarRemoveIcon v-if="feed?.isFavorite" :size="20" />
|
||||||
</template>
|
</template>
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
<NcActionButton
|
<NcActionButton
|
||||||
@ -27,10 +27,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<NcAvatar
|
<NcAvatar
|
||||||
:display-name="metric.data?.author || metric.data?.title"
|
:display-name="feed?.data?.author || feed?.data?.title"
|
||||||
:is-no-user="true"
|
:is-no-user="true"
|
||||||
:url="metric.data?.imageUrl" />
|
:url="feed?.data?.imageUrl" />
|
||||||
<StarIcon v-if="metric.isFavorite" class="star" :size="20" />
|
<StarIcon v-if="feed?.isFavorite" class="star" :size="20" />
|
||||||
|
<AlertIcon v-if="failed" />
|
||||||
</template>
|
</template>
|
||||||
</NcAppNavigationItem>
|
</NcAppNavigationItem>
|
||||||
</template>
|
</template>
|
||||||
@ -38,8 +39,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { NcActionButton, NcAppNavigationItem, NcAvatar } from '@nextcloud/vue'
|
import { NcActionButton, NcAppNavigationItem, NcAvatar } from '@nextcloud/vue'
|
||||||
import { mapActions, mapState } from 'pinia'
|
import { mapActions, mapState } from 'pinia'
|
||||||
|
import AlertIcon from 'vue-material-design-icons/Alert.vue'
|
||||||
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
|
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
|
||||||
import type { PodcastMetricsInterface } from '../../utils/types.ts'
|
import type { PersonalSettingsPodcastDataInterface } from '../../utils/types.ts'
|
||||||
import StarIcon from 'vue-material-design-icons/Star.vue'
|
import StarIcon from 'vue-material-design-icons/Star.vue'
|
||||||
import StarPlusIcon from 'vue-material-design-icons/StarPlus.vue'
|
import StarPlusIcon from 'vue-material-design-icons/StarPlus.vue'
|
||||||
import StarRemoveIcon from 'vue-material-design-icons/StarRemove.vue'
|
import StarRemoveIcon from 'vue-material-design-icons/StarRemove.vue'
|
||||||
@ -53,6 +55,7 @@ import { useSubscriptions } from '../../store/subscriptions.ts'
|
|||||||
export default {
|
export default {
|
||||||
name: 'Subscription',
|
name: 'Subscription',
|
||||||
components: {
|
components: {
|
||||||
|
AlertIcon,
|
||||||
DeleteIcon,
|
DeleteIcon,
|
||||||
NcActionButton,
|
NcActionButton,
|
||||||
NcAppNavigationItem,
|
NcAppNavigationItem,
|
||||||
@ -62,21 +65,44 @@ export default {
|
|||||||
StarRemoveIcon,
|
StarRemoveIcon,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
metric: {
|
url: {
|
||||||
type: Object as () => PodcastMetricsInterface,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
failed: false,
|
||||||
|
loading: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useSubscriptions, ['getSubByUrl', 'subs']),
|
...mapState(useSubscriptions, ['getSubByUrl', 'subs']),
|
||||||
|
feed() {
|
||||||
|
return this.getSubByUrl(this.url)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
try {
|
||||||
|
const podcastData =
|
||||||
|
await axios.get<PersonalSettingsPodcastDataInterface>(
|
||||||
|
generateUrl(
|
||||||
|
'/apps/gpoddersync/personal_settings/podcast_data?url={url}',
|
||||||
|
{
|
||||||
|
url: this.url,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
this.addMetadatas(this.url, podcastData.data.data)
|
||||||
|
} catch (e) {
|
||||||
|
this.failed = true
|
||||||
|
console.error(e)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useSubscriptions, ['fetch', 'setFavorite']),
|
...mapActions(useSubscriptions, ['fetch', 'addMetadatas', 'setFavorite']),
|
||||||
t,
|
t,
|
||||||
toFeedUrl,
|
toFeedUrl,
|
||||||
async deleteSubscription() {
|
async deleteSubscription() {
|
||||||
@ -89,14 +115,14 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
await axios.post(
|
await axios.post(
|
||||||
generateUrl('/apps/gpoddersync/subscription_change/create'),
|
generateUrl('/apps/gpoddersync/subscription_change/create'),
|
||||||
{ add: [], remove: [this.metric.url] },
|
{ add: [], remove: [this.url] },
|
||||||
)
|
)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
showError(t('repod', 'Error while removing the feed'))
|
showError(t('repod', 'Error while removing the feed'))
|
||||||
} finally {
|
} finally {
|
||||||
this.setFavorite(this.metric.url, false)
|
this.setFavorite(this.url, false)
|
||||||
this.loading = true
|
this.loading = false
|
||||||
this.fetch()
|
this.fetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +134,7 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setFavorite(this.metric.url, value)
|
this.setFavorite(this.url, value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
<NcAppNavigationList v-if="!loading">
|
<NcAppNavigationList v-if="!loading">
|
||||||
<Subscription
|
<Subscription
|
||||||
v-for="sub of subs.filter((sub) => sub.isFavorite)"
|
v-for="sub of subs.filter((sub) => sub.isFavorite)"
|
||||||
:key="sub.url"
|
:key="sub.metrics.url"
|
||||||
:metric="sub" />
|
:url="sub.metrics.url" />
|
||||||
<Subscription
|
<Subscription
|
||||||
v-for="sub of subs.filter((sub) => !sub.isFavorite)"
|
v-for="sub of subs.filter((sub) => !sub.isFavorite)"
|
||||||
:key="sub.url"
|
:key="sub.metrics.url"
|
||||||
:metric="sub" />
|
:url="sub.metrics.url" />
|
||||||
</NcAppNavigationList>
|
</NcAppNavigationList>
|
||||||
</NcAppContentList>
|
</NcAppContentList>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
|
import type {
|
||||||
|
PersonalSettingsMetricsInterface,
|
||||||
|
PodcastDataInterface,
|
||||||
|
SubscriptionInterface,
|
||||||
|
} from '../utils/types.ts'
|
||||||
import { getCookie, setCookie } from '../utils/cookies.ts'
|
import { getCookie, setCookie } from '../utils/cookies.ts'
|
||||||
import type { PodcastMetricsInterface } from '../utils/types.ts'
|
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
export const useSubscriptions = defineStore('subscriptions', {
|
export const useSubscriptions = defineStore('subscriptions', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
subs: [] as PodcastMetricsInterface[],
|
subs: [] as SubscriptionInterface[],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getSubByUrl: (state) => (url: string) =>
|
getSubByUrl: (state) => (url: string) =>
|
||||||
state.subs.find((sub) => sub.url === url),
|
state.subs.find((sub) => sub.metrics.url === url),
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async fetch() {
|
async fetch() {
|
||||||
@ -19,24 +23,34 @@ export const useSubscriptions = defineStore('subscriptions', {
|
|||||||
favorites = JSON.parse(getCookie('repod.favorites') || '[]') || []
|
favorites = JSON.parse(getCookie('repod.favorites') || '[]') || []
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
const metrics = await axios.get<PodcastMetricsInterface[]>(
|
const metrics = await axios.get<PersonalSettingsMetricsInterface>(
|
||||||
generateUrl('/apps/repod/metrics'),
|
generateUrl('/apps/gpoddersync/personal_settings/metrics'),
|
||||||
)
|
)
|
||||||
|
|
||||||
this.subs = [...metrics.data].map((sub) => ({
|
this.subs = [...metrics.data.subscriptions]
|
||||||
...sub,
|
.sort((a, b) => b.listenedSeconds - a.listenedSeconds)
|
||||||
|
.map((sub) => ({
|
||||||
|
metrics: sub,
|
||||||
isFavorite: favorites.includes(sub.url),
|
isFavorite: favorites.includes(sub.url),
|
||||||
|
data: this.getSubByUrl(sub.url)?.data,
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
addMetadatas(link: string, data: PodcastDataInterface) {
|
||||||
|
this.subs = this.subs.map((sub) =>
|
||||||
|
sub.metrics.url === link ? { ...sub, data } : sub,
|
||||||
|
)
|
||||||
|
},
|
||||||
setFavorite(link: string, isFavorite: boolean) {
|
setFavorite(link: string, isFavorite: boolean) {
|
||||||
this.subs = this.subs.map((sub) =>
|
this.subs = this.subs.map((sub) =>
|
||||||
sub.url === link ? { ...sub, isFavorite } : sub,
|
sub.metrics.url === link ? { ...sub, isFavorite } : sub,
|
||||||
)
|
)
|
||||||
|
|
||||||
setCookie(
|
setCookie(
|
||||||
'repod.favorites',
|
'repod.favorites',
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
this.subs.filter((sub) => sub.isFavorite).map((sub) => sub.url),
|
this.subs
|
||||||
|
.filter((sub) => sub.isFavorite)
|
||||||
|
.map((sub) => sub.metrics.url),
|
||||||
),
|
),
|
||||||
365,
|
365,
|
||||||
)
|
)
|
||||||
|
@ -56,8 +56,16 @@ export interface PodcastMetricsInterface {
|
|||||||
new: number
|
new: number
|
||||||
play: number
|
play: number
|
||||||
}
|
}
|
||||||
data: PodcastDataInterface
|
}
|
||||||
|
|
||||||
|
export interface SubscriptionInterface {
|
||||||
|
data?: PodcastDataInterface
|
||||||
isFavorite?: boolean
|
isFavorite?: boolean
|
||||||
|
metrics: PodcastMetricsInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PersonalSettingsMetricsInterface {
|
||||||
|
subscriptions: PodcastMetricsInterface[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonalSettingsPodcastDataInterface {
|
export interface PersonalSettingsPodcastDataInterface {
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</EmptyContent>
|
</EmptyContent>
|
||||||
<ul v-if="favorites.length">
|
<ul v-if="favorites.length">
|
||||||
<li v-for="favorite in favorites" :key="favorite.url">
|
<li v-for="favorite in favorites" :key="favorite.metrics.url">
|
||||||
<Favorite :metric="favorite" />
|
<Favorite :feed="favorite" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Nextcloud 3.14159\n"
|
"Project-Id-Version: Nextcloud 3.14159\n"
|
||||||
"Report-Msgid-Bugs-To: translations\\@example.com\n"
|
"Report-Msgid-Bugs-To: translations\\@example.com\n"
|
||||||
"POT-Creation-Date: 2024-10-23 22:22+0000\n"
|
"POT-Creation-Date: 2024-10-24 21:38+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -219,6 +219,6 @@ msgstr ""
|
|||||||
msgid "No favorites"
|
msgid "No favorites"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: /app/src/store/player.ts:82
|
#: /app/src/store/player.ts:89
|
||||||
msgid "A browser extension conflict with RePod"
|
msgid "A browser extension conflict with RePod"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
Loading…
Reference in New Issue
Block a user