Add option to copy public link as RSS feed

see #1059
This commit is contained in:
Marcel Klehr 2020-05-31 21:21:23 +02:00
parent f49e1b3394
commit 906de9ce56
1 changed files with 24 additions and 1 deletions

View File

@ -34,6 +34,10 @@
<ActionButton icon="icon-clippy" @click="onCopyPublicLink">
{{ t('bookmarks', 'Copy link') }}
</ActionButton>
<ActionButton icon="icon-clippy" @click="onCopyRssLink">
{{ t('bookmarks', 'Copy RSS feed') }}
</ActionButton>
<ActionSeparator />
<ActionButton icon="icon-delete" @click="onDeletePublicLink">
{{ t('bookmarks', 'Delete link') }}
</ActionButton>
@ -131,7 +135,22 @@ export default {
},
publicLink() {
if (!this.token) return
return window.location.protocol + '//' + window.location.host + generateUrl('/apps/bookmarks/public/' + this.token)
return window.location.origin + generateUrl('/apps/bookmarks/public/' + this.token)
},
rssLink() {
return (
window.location.origin
+ generateUrl(
'/apps/bookmarks/public/rest/v2/bookmark?'
+ new URLSearchParams(
Object.assign({}, this.$store.state.fetchState.query, {
format: 'rss',
page: -1,
token: this.token,
})
).toString()
)
)
},
},
@ -150,6 +169,10 @@ export default {
copy(this.publicLink)
this.$store.commit(mutations.SET_NOTIFICATION, t('bookmarks', 'Link copied'))
},
onCopyRssLink() {
copy(this.rssLink)
this.$store.commit(mutations.SET_NOTIFICATION, t('bookmarks', 'RSS feed copied'))
},
async onDeletePublicLink() {
await this.$store.dispatch(actions.DELETE_PUBLIC_LINK, this.folder.id)
},