Fix front
All checks were successful
repod / nextcloud (push) Successful in 1m9s
repod / nodejs (push) Successful in 1m35s

This commit is contained in:
Michel Roux 2023-08-22 20:14:15 +02:00
parent 941e1cabbd
commit f26957a69e
9 changed files with 27 additions and 44 deletions

View File

@ -13,8 +13,8 @@ declare(strict_types=1);
return [ return [
'routes' => [ 'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'fetch#index', 'url' => '/fetch/{uri}', 'verb' => 'GET'], ['name' => 'fetch#index', 'url' => '/fetch', 'verb' => 'GET'],
['name' => 'search#index', 'url' => '/search/{value}', 'verb' => 'GET'], ['name' => 'search#index', 'url' => '/search', 'verb' => 'GET'],
['name' => 'toplist#index', 'url' => '/toplist/{count}', 'verb' => 'GET'], ['name' => 'toplist#index', 'url' => '/toplist', 'verb' => 'GET'],
], ],
]; ];

View File

@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="140" height="140" viewBox="0 0 1098 1098">
<path
d="m11 547c0-301 245-546 546-546s546 245 546 546c0 301-245 546-546 546s-546-245-546-546zm446 355c18 18 46 18 64 0l323-323c18-18 18-46 0-64l-323-323c-18-18-46-18-64 0l-73 73c-18 18-18 46 0 64l218 218-218 218c-18 18-18 46 0 64l73 73z"
fill="#008000" style="--darkreader-inline-fill: #006600;" data-darkreader-inline-fill=""></path>
</svg>

Before

Width:  |  Height:  |  Size: 473 B

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="842.32007" height="1000.0001">
<path fill="#b3b3b3" d="M824.66636 779.30363c-15.12299 34.93724-33.02368 67.09674-53.7638 96.66374-28.27076 40.3074-51.4182 68.2078-69.25717 83.7012-27.65347 25.4313-57.2822 38.4556-89.00964 39.1963-22.77708 0-50.24539-6.4813-82.21973-19.629-32.07926-13.0861-61.55985-19.5673-88.51583-19.5673-28.27075 0-58.59083 6.4812-91.02193 19.5673-32.48053 13.1477-58.64639 19.9994-78.65196 20.6784-30.42501 1.29623-60.75123-12.0985-91.02193-40.2457-19.32039-16.8514-43.48632-45.7394-72.43607-86.6641-31.060778-43.7024-56.597041-94.37983-76.602609-152.15586C10.740416 658.44309 0 598.01283 0 539.50845c0-67.01648 14.481044-124.8172 43.486336-173.25401C66.28194 327.34823 96.60818 296.6578 134.5638 274.1276c37.95566-22.53016 78.96676-34.01129 123.1321-34.74585 24.16591 0 55.85633 7.47508 95.23784 22.166 39.27042 14.74029 64.48571 22.21538 75.54091 22.21538 8.26518 0 36.27668-8.7405 83.7629-26.16587 44.90607-16.16001 82.80614-22.85118 113.85458-20.21546 84.13326 6.78992 147.34122 39.95559 189.37699 99.70686-75.24463 45.59122-112.46573 109.4473-111.72502 191.36456.67899 63.8067 23.82643 116.90384 69.31888 159.06309 20.61664 19.56727 43.64066 34.69027 69.2571 45.4307-5.55531 16.11062-11.41933 31.54225-17.65372 46.35662zM631.70926 20.0057c0 50.01141-18.27108 96.70693-54.6897 139.92782-43.94932 51.38118-97.10817 81.07162-154.75459 76.38659-.73454-5.99983-1.16045-12.31444-1.16045-18.95003 0-48.01091 20.9006-99.39207 58.01678-141.40314 18.53027-21.27094 42.09746-38.95744 70.67685-53.0663C578.3158 9.00229 605.2903 1.31621 630.65988 0c.74076 6.68575 1.04938 13.37191 1.04938 20.00505z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -24,16 +24,16 @@ class FetchController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
public function index(string $uri): JSONResponse public function index(string $url): JSONResponse
{ {
$podcastData = $this->podcastDataReader->getCachedOrFetchPodcastData($uri, $this->userService->getUserUID()); $podcastData = $this->podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID());
if ($podcastData) { if ($podcastData) {
return new JSONResponse($podcastData->toArray()); return new JSONResponse(['data' => $podcastData->toArray()]);
} }
$client = $this->clientService->newClient(); $client = $this->clientService->newClient();
$feed = $client->get($uri); $feed = $client->get($url);
$statusCode = $feed->getStatusCode(); $statusCode = $feed->getStatusCode();
if ($statusCode < 200 || $statusCode >= 300) { if ($statusCode < 200 || $statusCode >= 300) {
@ -42,6 +42,6 @@ class FetchController extends Controller
$podcastData = PodcastData::parseRssXml((string) $feed->getBody()); $podcastData = PodcastData::parseRssXml((string) $feed->getBody());
return new JSONResponse($podcastData->toArray()); return new JSONResponse(['data' => $podcastData->toArray()]);
} }
} }

View File

@ -37,7 +37,7 @@ class SearchController extends Controller
} }
} }
usort($podcasts, fn (PodcastData $a, PodcastData $b) => $a->getFetchedAtUnix() <=> $b->getFetchedAtUnix()); usort($podcasts, fn (PodcastData $a, PodcastData $b) => $b->getFetchedAtUnix() <=> $a->getFetchedAtUnix());
$podcasts = array_intersect_key($podcasts, array_unique(array_map(fn (PodcastData $feed) => $feed->getLink(), $podcasts))); $podcasts = array_intersect_key($podcasts, array_unique(array_map(fn (PodcastData $feed) => $feed->getLink(), $podcasts)));
return new JSONResponse($podcasts); return new JSONResponse($podcasts);

View File

@ -1,24 +1,18 @@
<template> <template>
<ul> <ul>
<NcListItem v-for="feed in feeds" <NcListItem v-for="feed in feeds"
:key="`${feed.provider}_${feed.id}`" :key="`${feed.link}`"
:counter-number="feed.episode_count" :details="formatTimeAgo(new Date(feed.fetchedAtUnix*1000))"
:details="formatTimeAgo(new Date(feed.lastpub))"
:title="feed.title" :title="feed.title"
:to="toUrl(feed.url)"> :to="toUrl(feed.link)">
<template #icon> <template #icon>
<NcAvatar :display-name="feed.author" <NcAvatar :display-name="feed.author"
:is-no-user="true" :is-no-user="true"
:url="feed.logo_url" /> :url="feed.imageUrl" />
</template> </template>
<template #subtitle> <template #subtitle>
{{ feed.author }} {{ feed.author }}
</template> </template>
<template #indicator>
<img :alt="feed.provider"
height="15"
:src="generateUrl(`/apps/repod/img/${feed.provider}.svg`)">
</template>
</NcListItem> </NcListItem>
</ul> </ul>
</template> </template>
@ -57,7 +51,7 @@ export default {
search: debounce(async function value() { search: debounce(async function value() {
try { try {
const currentSearch = this.value const currentSearch = this.value
const feeds = await axios.get(generateUrl('/apps/repod/search/{value}', { value: currentSearch })) const feeds = await axios.get(generateUrl('/apps/repod/search?value={value}', { value: currentSearch }))
if (currentSearch === this.value) { if (currentSearch === this.value) {
this.feeds = feeds.data this.feeds = feeds.data
} }
@ -70,7 +64,6 @@ export default {
return `/${btoa(url)}` return `/${btoa(url)}`
}, },
formatTimeAgo, formatTimeAgo,
generateUrl,
}, },
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<a @click="addSubscription"> <a @click="addSubscription">
<img :alt="`${title} - ${author}`" <img :alt="`${title} - ${author}`"
:src="logo" :src="imageUrl"
:title="author"> :title="author">
</a> </a>
</template> </template>
@ -19,7 +19,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
logo: { imageUrl: {
type: String,
required: true,
},
link: {
type: String, type: String,
required: true, required: true,
}, },
@ -27,15 +31,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
url: {
type: String,
required: true,
},
}, },
methods: { methods: {
async addSubscription() { async addSubscription() {
try { try {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.url], remove: [] }) await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.link], remove: [] })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Error while adding the feed')) showError(t('Error while adding the feed'))

View File

@ -6,11 +6,11 @@
<p> <p>
<NcLoadingIcon v-if="loading" /> <NcLoadingIcon v-if="loading" />
<ul v-if="!loading" class="tops"> <ul v-if="!loading" class="tops">
<li v-for="top in tops" :key="top.id"> <li v-for="top in tops" :key="top.link">
<TopItem :author="top.author" <TopItem :author="top.author"
:logo="top.logo_url" :image-url="top.imageUrl"
:title="top.title" :link="top.link"
:url="top.url" /> :title="top.title" />
</li> </li>
</ul> </ul>
<span class="caption">{{ t('Suggests by fyyd') }}</span> <span class="caption">{{ t('Suggests by fyyd') }}</span>
@ -40,7 +40,7 @@ export default {
async mounted() { async mounted() {
try { try {
this.loading = true this.loading = true
const toplist = await axios.get(generateUrl('/apps/repod/toplist/10')) const toplist = await axios.get(generateUrl('/apps/repod/toplist'))
this.tops = toplist.data this.tops = toplist.data
} catch (e) { } catch (e) {
console.error(e) console.error(e)

View File

@ -15,7 +15,6 @@
<a :href="feed.link" target="_blank"> <a :href="feed.link" target="_blank">
{{ feed.author }} {{ feed.author }}
</a> </a>
<i>{{ feed.description }}</i>
</div> </div>
<NcAppNavigationNew :text="t('Subscribe')"> <NcAppNavigationNew :text="t('Subscribe')">
<template #icon> <template #icon>
@ -57,7 +56,7 @@ export default {
}, },
async mounted() { async mounted() {
try { try {
const podcastData = await axios.get(generateUrl('/apps/gpoddersync/personal_settings/podcast_data?url={url}', { url: this.url })) const podcastData = await axios.get(generateUrl('/apps/repod/fetch?url={url}', { url: this.url }))
this.feed = podcastData.data.data this.feed = podcastData.data.data
} catch (e) { } catch (e) {
this.failed = true this.failed = true