Compare commits

..

No commits in common. "eb1196c841bfad61a893f8124a3303a235a2966c" and "46b30f1ebb08f5d6a34e54fc62eb46492b428b56" have entirely different histories.

18 changed files with 153 additions and 1045 deletions

View File

@ -8,15 +8,10 @@ use OCA\RePod\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Util;
class PageController extends Controller
{
public function __construct(
private IConfig $config
) {}
/**
* @NoAdminRequired
* @NoCSRFRequired
@ -28,13 +23,6 @@ class PageController extends Controller
$csp->addAllowedImageDomain('*');
$csp->addAllowedMediaDomain('*');
if ($this->config->getSystemValueBool('debug', false)) {
/** @psalm-suppress DeprecatedInterface */
$csp->allowEvalScript();
$csp->addAllowedConnectDomain('*');
$csp->addAllowedScriptDomain('*');
}
$response = new TemplateResponse(Application::APP_ID, 'main');
$response->setContentSecurityPolicy($csp);

950
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,6 @@
"@nextcloud/stylelint-config": "^3.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-pinia": "^0.2.0",
"eslint-plugin-prettier": "^5.2.1",
"vite-plugin-vue-devtools": "^7.3.8"
"eslint-plugin-prettier": "^5.2.1"
}
}

View File

@ -62,10 +62,12 @@ export default {
required: true,
},
},
data: () => ({
data() {
return {
feeds: [],
loading: false,
}),
}
},
computed: {
...mapState(useSubscriptions, ['subs']),
},

View File

@ -30,10 +30,12 @@ export default {
required: true,
},
},
data: () => ({
data() {
return {
loading: true,
tops: [],
}),
}
},
computed: {
title() {
switch (this.type) {

View File

@ -158,12 +158,14 @@ export default {
PlaylistRemoveIcon,
StopIcon,
},
data: () => ({
data() {
return {
episodes: [],
loading: true,
loadingAction: false,
modalEpisode: null,
}),
}
},
computed: {
...mapState(usePlayer, ['episode']),
...mapState(useSettings, ['filters']),

View File

@ -1,33 +0,0 @@
<template>
<div>
<Loading v-if="!currentFavoriteData" class="loading" />
<NcAvatar v-if="currentFavoriteData" />
</div>
</template>
<script>
import { mapState } from 'pinia';
import Loading from '../Atoms/Loading.vue'
import { NcAvatar } from '@nextcloud/vue'
import { useSubscriptions } from '../../store/subscriptions';
export default {
name: 'Item',
components: {
Loading,
NcAvatar,
},
props: {
url: {
type: String,
required: true,
},
},
computed: {
...mapState(useSubscriptions, ['favs']),
currentFavoriteData() {
return this.favs.find((fav) => fav.url === this.url)?.data
},
}
}
</script>

View File

@ -32,9 +32,11 @@ export default {
Modal,
NcModal,
},
data: () => ({
data() {
return {
modal: false,
}),
}
},
computed: {
...mapState(usePlayer, ['episode', 'podcastUrl']),
hash() {

View File

@ -46,9 +46,11 @@ export default {
VolumeMediumIcon,
VolumeMuteIcon,
},
data: () => ({
data() {
return {
volumeMuted: 0,
}),
}
},
computed: {
...mapState(usePlayer, ['volume']),
},

View File

@ -44,10 +44,12 @@ export default {
NcAppNavigationItem,
NcModal,
},
data: () => ({
data() {
return {
loading: false,
modal: false,
}),
}
},
methods: {
generateUrl,
async importOpml(event) {

View File

@ -69,18 +69,20 @@ export default {
required: true,
},
},
data: () => ({
data() {
return {
failed: false,
loading: true,
feed: null,
}),
}
},
computed: {
...mapState(useSubscriptions, ['favs']),
...mapState(useSubscriptions, ['favorites']),
hash() {
return toUrl(this.url)
},
isFavorite() {
return this.favs.map((fav) => fav.url).includes(this.url)
return this.favorites.includes(this.url)
},
},
async mounted() {
@ -94,7 +96,6 @@ export default {
),
)
this.feed = podcastData.data.data
this.editFavoriteData(this.url, podcastData.data.data)
} catch (e) {
this.failed = true
console.error(e)
@ -103,7 +104,7 @@ export default {
}
},
methods: {
...mapActions(useSubscriptions, ['fetch', 'addFavorite', 'editFavoriteData', 'removeFavorite']),
...mapActions(useSubscriptions, ['fetch', 'addFavorite', 'removeFavorite']),
async deleteSubscription() {
if (
confirm(
@ -128,7 +129,7 @@ export default {
},
switchFavorite(value) {
if (value) {
if (this.favs.length >= 10) {
if (this.favorites.length >= 10) {
showError(t('repod', 'You can only have 10 favorites'))
return
}

View File

@ -11,18 +11,7 @@
</router-link>
<Loading v-if="loading" />
<NcAppNavigationList v-if="!loading">
<Item
v-for="url of favs
.sort((fav) => fav.lastPub)
.map((fav) => fav.url)"
:key="url"
:url="url" />
<Item
v-for="url of subs.filter(
(sub) => !favs.map((fav) => fav.url).includes(sub),
)"
:key="url"
:url="url" />
<Item v-for="url of subs" :key="url" :url="url" />
</NcAppNavigationList>
</NcAppContentList>
</template>
@ -59,11 +48,13 @@ export default {
PlusIcon,
Settings,
},
data: () => ({
data() {
return {
loading: true,
}),
}
},
computed: {
...mapState(useSubscriptions, ['subs', 'favs']),
...mapState(useSubscriptions, ['subs']),
},
async mounted() {
try {

View File

@ -6,7 +6,7 @@ import { generateUrl } from '@nextcloud/router'
export const useSubscriptions = defineStore('subscriptions', {
state: () => ({
subs: [],
favs: [],
favorites: [],
}),
actions: {
async fetch() {
@ -19,30 +19,16 @@ export const useSubscriptions = defineStore('subscriptions', {
this.subs = subs.map((sub) => sub.url)
try {
const favs = JSON.parse(getCookie('repod.favorites')) || []
this.favs = favs.map((url) => ({ url }))
this.favorites = JSON.parse(getCookie('repod.favorites')) || []
} catch {}
},
addFavorite(url) {
this.favs.push({ url })
setCookie(
'repod.favorites',
JSON.stringify(this.favs.map((fav) => fav.url)),
365,
)
},
editFavoriteData(url, data) {
this.favs = this.favs.map((fav) =>
fav.url === url ? { ...fav, ...data } : fav,
)
this.favorites.push(url)
setCookie('repod.favorites', JSON.stringify(this.favorites), 365)
},
removeFavorite(url) {
this.favs = this.favs.filter((fav) => fav.url !== url)
setCookie(
'repod.favorites',
JSON.stringify(this.favs.map((fav) => fav.url)),
365,
)
this.favorites = this.favorites.filter((favorite) => favorite !== url)
setCookie('repod.favorites', JSON.stringify(this.favorites), 365)
},
},
})

View File

@ -30,9 +30,11 @@ export default {
Search,
Toplist,
},
data: () => ({
data() {
return {
search: '',
}),
}
},
}
</script>

View File

@ -41,11 +41,13 @@ export default {
Loading,
NcEmptyContent,
},
data: () => ({
data() {
return {
failed: false,
loading: true,
feed: null,
}),
}
},
computed: {
url() {
return decodeUrl(this.$route.params.url)

View File

@ -1,50 +1,23 @@
<template>
<AppContent>
<NcEmptyContent
v-if="!favs.length"
class="empty"
:description="
t('repod', 'Pin some subscriptions to see their latest updates')
"
:name="t('repod', 'No favorites')">
<template #icon>
<StarOffIcon :size="20" />
</template>
</NcEmptyContent>
<ul v-if="favs.length">
<li
v-for="url in favs.sort((fav) => fav.lastPub).map((fav) => fav.url)"
:key="url">
<Item :url="url" />
</li>
</ul>
<AppContent class="content">
<Loading />
</AppContent>
</template>
<script>
import AppContent from '../components/Atoms/AppContent.vue'
import Item from '../components/Home/Item.vue'
import { NcEmptyContent } from '@nextcloud/vue'
import StarOffIcon from 'vue-material-design-icons/StarOff.vue'
import { mapState } from 'pinia'
import { useSubscriptions } from '../store/subscriptions.js'
import Loading from '../components/Atoms/Loading.vue'
export default {
name: 'Home',
components: {
AppContent,
Item,
NcEmptyContent,
StarOffIcon,
Loading,
},
computed: {
...mapState(useSubscriptions, ['favs']),
data() {
return {
loading: true,
}
},
}
</script>
<style scoped>
.empty {
height: 100%;
}
</style>

View File

@ -1,6 +1,5 @@
import { createAppConfig } from '@nextcloud/vite-config'
import { defineConfig } from 'vite'
import vueDevTools from 'vite-plugin-vue-devtools'
const config = defineConfig(({ mode }) => ({
build: {
@ -11,12 +10,8 @@ const config = defineConfig(({ mode }) => ({
manualChunks: false,
},
},
sourcemap: mode !== 'production',
sourcemap: mode === 'development',
},
define: {
__VUE_PROD_DEVTOOLS__: mode !== 'production'
},
plugins: [vueDevTools()],
}))
export default createAppConfig(