From 746416207bd15f7883af18e359b84f0c4444a12a Mon Sep 17 00:00:00 2001 From: rinpatch Date: Thu, 30 Jan 2020 19:55:01 +0300 Subject: [PATCH 1/8] Escape HTML from display name and subject fields Closes #724 --- package.json | 1 + src/services/entity_normalizer/entity_normalizer.service.js | 6 ++++-- yarn.lock | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9ec8c1eb..5c7fa31e 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "chromatism": "^3.0.0", "cropperjs": "^1.4.3", "diff": "^3.0.1", + "escape-html": "^1.0.3", "karma-mocha-reporter": "^2.2.1", "localforage": "^1.5.0", "object-path": "^0.11.3", diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index a3d0b782..3116d211 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -1,3 +1,5 @@ +import escape from 'escape-html' + const qvitterStatusType = (status) => { if (status.is_post_verb) { return 'status' @@ -41,7 +43,7 @@ export const parseUser = (data) => { } output.name = data.display_name - output.name_html = addEmojis(data.display_name, data.emojis) + output.name_html = addEmojis(escape(data.display_name), data.emojis) output.description = data.note output.description_html = addEmojis(data.note, data.emojis) @@ -256,7 +258,7 @@ export const parseStatus = (data) => { output.retweeted_status = parseStatus(data.reblog) } - output.summary_html = addEmojis(data.spoiler_text, data.emojis) + output.summary_html = addEmojis(escape(data.spoiler_text), data.emojis) output.external_url = data.url output.poll = data.poll output.pinned = data.pinned diff --git a/yarn.lock b/yarn.lock index 1a5d4cef..b794042f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2757,9 +2757,10 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -escape-html@~1.0.3: +escape-html@^1.0.3, escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" From 9bbf10b55d97f6dbe3197ebbd1bb29d294ff6b55 Mon Sep 17 00:00:00 2001 From: kPherox Date: Tue, 4 Feb 2020 04:26:32 +0900 Subject: [PATCH 2/8] Add setting for allow_following_move --- src/components/user_settings/user_settings.js | 2 ++ src/components/user_settings/user_settings.vue | 9 ++++++--- .../entity_normalizer/entity_normalizer.service.js | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 38373056..eca6f9b1 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -55,6 +55,7 @@ const UserSettings = { showRole: this.$store.state.users.currentUser.show_role, role: this.$store.state.users.currentUser.role, discoverable: this.$store.state.users.currentUser.discoverable, + allowFollowingMove: this.$store.state.users.currentUser.allow_following_move, pickAvatarBtnVisible: true, bannerUploading: false, backgroundUploading: false, @@ -162,6 +163,7 @@ const UserSettings = { hide_follows: this.hideFollows, hide_followers: this.hideFollowers, discoverable: this.discoverable, + allow_following_move: this.allowFollowingMove, hide_follows_count: this.hideFollowsCount, hide_followers_count: this.hideFollowersCount, show_role: this.showRole diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 2222c293..8b2336b4 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -90,9 +90,7 @@

- + {{ $t('settings.hide_followers_description') }}

@@ -104,6 +102,11 @@ {{ $t('settings.hide_followers_count_description') }}

+

+ + {{ $t('settings.allow_following_move') }} + +