From 7a1748e6f02988891c6e70e50aa9e4d791fa0211 Mon Sep 17 00:00:00 2001
From: Julius Härtl <jus@bitgrid.net>
Date: Tue, 1 Sep 2020 12:07:48 +0200
Subject: Show changelog in apps management
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
---
 apps/settings/src/components/AppDetails.vue | 67 ++---------------------------
 1 file changed, 3 insertions(+), 64 deletions(-)

(limited to 'apps/settings/src/components/AppDetails.vue')

diff --git a/apps/settings/src/components/AppDetails.vue b/apps/settings/src/components/AppDetails.vue
index 55519bf9f80..d79f799fbb9 100644
--- a/apps/settings/src/components/AppDetails.vue
+++ b/apps/settings/src/components/AppDetails.vue
@@ -139,24 +139,23 @@
 				target="_blank"
 				rel="noreferrer noopener">{{ t('settings', 'Developer documentation') }} ↗</a>
 		</p>
-
-		<div class="app-details__description" v-html="renderMarkdown" />
+		<Markdown class="app-details__description" :text="app.description" />
 	</div>
 </template>
 
 <script>
 import { Multiselect } from '@nextcloud/vue'
-import marked from 'marked'
-import dompurify from 'dompurify'
 
 import AppManagement from '../mixins/AppManagement'
 import PrefixMixin from './PrefixMixin'
+import Markdown from './Markdown'
 
 export default {
 	name: 'AppDetails',
 
 	components: {
 		Multiselect,
+		Markdown,
 	},
 	mixins: [AppManagement, PrefixMixin],
 
@@ -204,66 +203,6 @@ export default {
 				.filter(group => group.id !== 'disabled')
 				.sort((a, b) => a.name.localeCompare(b.name))
 		},
-		renderMarkdown() {
-			const renderer = new marked.Renderer()
-			renderer.link = function(href, title, text) {
-				let prot
-				try {
-					prot = decodeURIComponent(unescape(href))
-						.replace(/[^\w:]/g, '')
-						.toLowerCase()
-				} catch (e) {
-					return ''
-				}
-
-				if (prot.indexOf('http:') !== 0 && prot.indexOf('https:') !== 0) {
-					return ''
-				}
-
-				let out = '<a href="' + href + '" rel="noreferrer noopener"'
-				if (title) {
-					out += ' title="' + title + '"'
-				}
-				out += '>' + text + '</a>'
-				return out
-			}
-			renderer.image = function(href, title, text) {
-				if (text) {
-					return text
-				}
-				return title
-			}
-			renderer.blockquote = function(quote) {
-				return quote
-			}
-			return dompurify.sanitize(
-				marked(this.app.description.trim(), {
-					renderer,
-					gfm: false,
-					highlight: false,
-					tables: false,
-					breaks: false,
-					pedantic: false,
-					sanitize: true,
-					smartLists: true,
-					smartypants: false,
-				}),
-				{
-					SAFE_FOR_JQUERY: true,
-					ALLOWED_TAGS: [
-						'strong',
-						'p',
-						'a',
-						'ul',
-						'ol',
-						'li',
-						'em',
-						'del',
-						'blockquote',
-					],
-				}
-			)
-		},
 	},
 	mounted() {
 		if (this.app.groups.length > 0) {
-- 
cgit v1.2.3

