From 597de32e1233a38aba7589bcdf4ad1f019ab4714 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 17 Aug 2022 09:16:10 +0100 Subject: [PATCH 1/4] use sourceContent for mfm --- src/components/rich_content/rich_content.jsx | 10 ++++++++-- src/components/status_body/status_body.vue | 1 + src/modules/users.js | 2 +- .../entity_normalizer/entity_normalizer.service.js | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 0d4127b6..0da3c18f 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -66,6 +66,11 @@ export default { required: false, type: Boolean, default: false + }, + sourceContent: { + required: false, + type: String, + default: '' } }, // NEVER EVER TOUCH DATA INSIDE RENDER @@ -74,7 +79,8 @@ export default { const greentext = this.mfm ? false : this.greentext // Pre-process HTML - const { newHtml: html } = preProcessPerLine(this.html, greentext) + const useContent = this.sourceContent === '' ? this.html : this.sourceContent + const { newHtml: html } = preProcessPerLine(useContent, greentext) let currentMentions = null // Current chain of mentions, we group all mentions together // This is used to recover spacing removed when parsing mentions let lastSpacing = '' @@ -169,7 +175,7 @@ export default { } // Processor to use with html_tree_converter - const processItem = (item, index, array, what) => { + const processItem = (item, index, array) => { // Handle text nodes - just add emoji if (typeof item === 'string') { const emptyText = item.trim() === '' diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue index 321f3c4b..5a5f3e5e 100644 --- a/src/components/status_body/status_body.vue +++ b/src/components/status_body/status_body.vue @@ -52,6 +52,7 @@ :emoji="status.emojis" :handle-links="true" :mfm="renderMisskeyMarkdown && (status.media_type === 'text/x.misskeymarkdown')" + :sourceContent="status.source_content" :greentext="mergedConfig.greentext" :attentions="status.attentions" @parseReady="onParseReady" diff --git a/src/modules/users.js b/src/modules/users.js index 02a9e361..5daf3862 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -589,7 +589,7 @@ const users = { const response = data.error // Authentication failed commit('endLogin') - if (response.status === 401) { + if (response.status === 401 || response.status === 403) { reject(new Error('Wrong username or password')) } else { reject(new Error('An error occurred, please try again')) diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index b66191bf..29032a65 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -282,6 +282,7 @@ export const parseStatus = (data) => { const { akkoma } = data if (akkoma && akkoma.source) { output.media_type = akkoma.source.mediaType + output.source_content = akkoma.source.content } } -- 2.34.1 From 86813e1136f2e30032136d89181da13d9dc0354d Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 17 Aug 2022 09:51:17 +0100 Subject: [PATCH 2/4] use standard misskey content unless asked not to --- src/components/rich_content/rich_content.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 0da3c18f..e384b745 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -10,6 +10,11 @@ import HashtagLink from 'src/components/hashtag_link/hashtag_link.vue' import './rich_content.scss' +const selectContent = (html, sourceContent, mfm) => { + if (!mfm) return html + return sourceContent === '' ? html : sourceContent +} + /** * RichContent, The Über-powered component for rendering Post HTML. * @@ -79,7 +84,7 @@ export default { const greentext = this.mfm ? false : this.greentext // Pre-process HTML - const useContent = this.sourceContent === '' ? this.html : this.sourceContent + const useContent = selectContent(this.html, this.sourceContent, this.mfm) const { newHtml: html } = preProcessPerLine(useContent, greentext) let currentMentions = null // Current chain of mentions, we group all mentions together // This is used to recover spacing removed when parsing mentions -- 2.34.1 From d26522903b6f7a652e35012fad9586028d77fbe6 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 17 Aug 2022 10:32:26 +0100 Subject: [PATCH 3/4] copy instance options for new nav --- src/boot/after_store.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index c0a4cff9..8671c6b6 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -124,6 +124,11 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { copyInstanceOption('hideBotIndication') copyInstanceOption('hideUserStats') copyInstanceOption('hideFilteredStatuses') + copyInstanceOption('hideSiteName') + copyInstanceOption('hideSiteFavicon') + copyInstanceOption('showWiderShortcuts') + copyInstanceOption('showNavShortcuts') + copyInstanceOption('showPanelNavShortcuts') copyInstanceOption('logo') store.dispatch('setInstanceOption', { -- 2.34.1 From 4153448abf3621dda012a10a02b4e7779cd92e93 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 17 Aug 2022 10:34:31 +0100 Subject: [PATCH 4/4] include misskey markdown rendering option --- src/boot/after_store.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 8671c6b6..b1f1ee02 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -159,6 +159,7 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { copyInstanceOption('alwaysShowSubjectInput') copyInstanceOption('showFeaturesPanel') copyInstanceOption('hideSitename') + copyInstanceOption('renderMisskeyMarkdown') copyInstanceOption('sidebarRight') return store.dispatch('setTheme', config['theme']) -- 2.34.1