From e4c7c1125da6f8fa259241b4d3838b1e7b1e24a2 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 23 Sep 2019 09:11:41 +0200 Subject: [PATCH 01/50] zwischenspeichern --- backend/public/providers.json | 257 ++++++++++++++++++ .../resolvers/embeds/findProvider.spec.js | 2 +- webapp/assets/json/providers.json | 257 ++++++++++++++++++ webapp/locales/de.json | 18 +- webapp/pages/settings.vue | 4 +- webapp/pages/settings/allow-embeds.vue | 94 +++++++ 6 files changed, 627 insertions(+), 5 deletions(-) create mode 100644 backend/public/providers.json create mode 100644 webapp/assets/json/providers.json create mode 100644 webapp/pages/settings/allow-embeds.vue diff --git a/backend/public/providers.json b/backend/public/providers.json new file mode 100644 index 000000000..ef9f04bff --- /dev/null +++ b/backend/public/providers.json @@ -0,0 +1,257 @@ +[ + { + "provider_name": "Codepen", + "provider_url": "https:\/\/codepen.io", + "endpoints": [ + { + "schemes": [ + "http:\/\/codepen.io\/*", + "https:\/\/codepen.io\/*" + ], + "url": "http:\/\/codepen.io\/api\/oembed" + } + ] + }, + { + "provider_name": "DTube", + "provider_url": "https:\/\/d.tube\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/d.tube\/v\/*" + ], + "url": "https:\/\/api.d.tube\/oembed", + "discovery": true + } + ] + }, + { + "provider_name": "Facebook (Post)", + "provider_url": "https:\/\/www.facebook.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/www.facebook.com\/*\/posts\/*", + "https:\/\/www.facebook.com\/photos\/*", + "https:\/\/www.facebook.com\/*\/photos\/*", + "https:\/\/www.facebook.com\/photo.php*", + "https:\/\/www.facebook.com\/photo.php", + "https:\/\/www.facebook.com\/*\/activity\/*", + "https:\/\/www.facebook.com\/permalink.php", + "https:\/\/www.facebook.com\/media\/set?set=*", + "https:\/\/www.facebook.com\/questions\/*", + "https:\/\/www.facebook.com\/notes\/*\/*\/*" + ], + "url": "https:\/\/www.facebook.com\/plugins\/post\/oembed.json", + "discovery": true + } + ] + }, + { + "provider_name": "Facebook (Video)", + "provider_url": "https:\/\/www.facebook.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/www.facebook.com\/*\/videos\/*", + "https:\/\/www.facebook.com\/video.php" + ], + "url": "https:\/\/www.facebook.com\/plugins\/video\/oembed.json", + "discovery": true + } + ] + }, + { + "provider_name": "Flickr", + "provider_url": "https:\/\/www.flickr.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/*.flickr.com\/photos\/*", + "http:\/\/flic.kr\/p\/*", + "https:\/\/*.flickr.com\/photos\/*", + "https:\/\/flic.kr\/p\/*" + ], + "url": "https:\/\/www.flickr.com\/services\/oembed\/", + "discovery": true + } + ] + }, + { + "provider_name": "GIPHY", + "provider_url": "https:\/\/giphy.com", + "endpoints": [ + { + "schemes": [ + "https:\/\/giphy.com\/gifs\/*", + "http:\/\/gph.is\/*", + "https:\/\/media.giphy.com\/media\/*\/giphy.gif" + ], + "url": "https:\/\/giphy.com\/services\/oembed", + "discovery": true + } + ] + }, + { + "provider_name": "Instagram", + "provider_url": "https:\/\/instagram.com", + "endpoints": [ + { + "schemes": [ + "http:\/\/instagram.com\/p\/*", + "http:\/\/instagr.am\/p\/*", + "http:\/\/www.instagram.com\/p\/*", + "http:\/\/www.instagr.am\/p\/*", + "https:\/\/instagram.com\/p\/*", + "https:\/\/instagr.am\/p\/*", + "https:\/\/www.instagram.com\/p\/*", + "https:\/\/www.instagr.am\/p\/*" + ], + "url": "https:\/\/api.instagram.com\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "Meetup", + "provider_url": "http:\/\/www.meetup.com", + "endpoints": [ + { + "schemes": [ + "http:\/\/meetup.com\/*", + "https:\/\/www.meetup.com\/*", + "https:\/\/meetup.com\/*", + "http:\/\/meetu.ps\/*" + ], + "url": "https:\/\/api.meetup.com\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "MixCloud", + "provider_url": "https:\/\/mixcloud.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/www.mixcloud.com\/*\/*\/", + "https:\/\/www.mixcloud.com\/*\/*\/" + ], + "url": "https:\/\/www.mixcloud.com\/oembed\/" + } + ] + }, + { + "provider_name": "Reddit", + "provider_url": "https:\/\/reddit.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/reddit.com\/r\/*\/comments\/*\/*", + "https:\/\/www.reddit.com\/r\/*\/comments\/*\/*" + ], + "url": "https:\/\/www.reddit.com\/oembed" + } + ] + }, + { + "provider_name": "SlideShare", + "provider_url": "http:\/\/www.slideshare.net\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/www.slideshare.net\/*\/*", + "http:\/\/fr.slideshare.net\/*\/*", + "http:\/\/de.slideshare.net\/*\/*", + "http:\/\/es.slideshare.net\/*\/*", + "http:\/\/pt.slideshare.net\/*\/*" + ], + "url": "http:\/\/www.slideshare.net\/api\/oembed\/2", + "discovery": true + } + ] + }, + { + "provider_name": "SoundCloud", + "provider_url": "http:\/\/soundcloud.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/soundcloud.com\/*", + "https:\/\/soundcloud.com\/*" + ], + "url": "https:\/\/soundcloud.com\/oembed" + } + ] + }, + { + "provider_name": "Twitch", + "provider_url": "https:\/\/www.twitch.tv", + "endpoints": [ + { + "schemes": [ + "http:\/\/clips.twitch.tv\/*", + "https:\/\/clips.twitch.tv\/*", + "http:\/\/www.twitch.tv\/*", + "https:\/\/www.twitch.tv\/*", + "http:\/\/twitch.tv\/*", + "https:\/\/twitch.tv\/*" + ], + "url": "https:\/\/api.twitch.tv\/v4\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "Twitter", + "provider_url": "http:\/\/www.twitter.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/twitter.com\/*\/status\/*", + "https:\/\/*.twitter.com\/*\/status\/*" + ], + "url": "https:\/\/publish.twitter.com\/oembed" + } + ] + }, + { + "provider_name": "Vimeo", + "provider_url": "https:\/\/vimeo.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/vimeo.com\/*", + "https:\/\/vimeo.com\/album\/*\/video\/*", + "https:\/\/vimeo.com\/channels\/*\/*", + "https:\/\/vimeo.com\/groups\/*\/videos\/*", + "https:\/\/vimeo.com\/ondemand\/*\/*", + "https:\/\/player.vimeo.com\/video\/*" + ], + "url": "https:\/\/vimeo.com\/api\/oembed.{format}", + "discovery": true + } + ] + }, + { + "provider_name": "YouTube", + "provider_url": "https:\/\/www.youtube.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/*.youtube.com\/watch*", + "https:\/\/*.youtube.com\/v\/*", + "https:\/\/youtu.be\/*" + ], + "url": "https:\/\/www.youtube.com\/oembed", + "discovery": true + } + ] + } +] \ No newline at end of file diff --git a/backend/src/schema/resolvers/embeds/findProvider.spec.js b/backend/src/schema/resolvers/embeds/findProvider.spec.js index 963b255ab..878fe741c 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.spec.js +++ b/backend/src/schema/resolvers/embeds/findProvider.spec.js @@ -1,4 +1,4 @@ -import findProvider from './findProvider' +import findProvider from '~/json/findProvider' describe('Vimeo', () => { it('matches `https://vimeo.com/showcase/2098620/video/4082288`', () => { diff --git a/webapp/assets/json/providers.json b/webapp/assets/json/providers.json new file mode 100644 index 000000000..ef9f04bff --- /dev/null +++ b/webapp/assets/json/providers.json @@ -0,0 +1,257 @@ +[ + { + "provider_name": "Codepen", + "provider_url": "https:\/\/codepen.io", + "endpoints": [ + { + "schemes": [ + "http:\/\/codepen.io\/*", + "https:\/\/codepen.io\/*" + ], + "url": "http:\/\/codepen.io\/api\/oembed" + } + ] + }, + { + "provider_name": "DTube", + "provider_url": "https:\/\/d.tube\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/d.tube\/v\/*" + ], + "url": "https:\/\/api.d.tube\/oembed", + "discovery": true + } + ] + }, + { + "provider_name": "Facebook (Post)", + "provider_url": "https:\/\/www.facebook.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/www.facebook.com\/*\/posts\/*", + "https:\/\/www.facebook.com\/photos\/*", + "https:\/\/www.facebook.com\/*\/photos\/*", + "https:\/\/www.facebook.com\/photo.php*", + "https:\/\/www.facebook.com\/photo.php", + "https:\/\/www.facebook.com\/*\/activity\/*", + "https:\/\/www.facebook.com\/permalink.php", + "https:\/\/www.facebook.com\/media\/set?set=*", + "https:\/\/www.facebook.com\/questions\/*", + "https:\/\/www.facebook.com\/notes\/*\/*\/*" + ], + "url": "https:\/\/www.facebook.com\/plugins\/post\/oembed.json", + "discovery": true + } + ] + }, + { + "provider_name": "Facebook (Video)", + "provider_url": "https:\/\/www.facebook.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/www.facebook.com\/*\/videos\/*", + "https:\/\/www.facebook.com\/video.php" + ], + "url": "https:\/\/www.facebook.com\/plugins\/video\/oembed.json", + "discovery": true + } + ] + }, + { + "provider_name": "Flickr", + "provider_url": "https:\/\/www.flickr.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/*.flickr.com\/photos\/*", + "http:\/\/flic.kr\/p\/*", + "https:\/\/*.flickr.com\/photos\/*", + "https:\/\/flic.kr\/p\/*" + ], + "url": "https:\/\/www.flickr.com\/services\/oembed\/", + "discovery": true + } + ] + }, + { + "provider_name": "GIPHY", + "provider_url": "https:\/\/giphy.com", + "endpoints": [ + { + "schemes": [ + "https:\/\/giphy.com\/gifs\/*", + "http:\/\/gph.is\/*", + "https:\/\/media.giphy.com\/media\/*\/giphy.gif" + ], + "url": "https:\/\/giphy.com\/services\/oembed", + "discovery": true + } + ] + }, + { + "provider_name": "Instagram", + "provider_url": "https:\/\/instagram.com", + "endpoints": [ + { + "schemes": [ + "http:\/\/instagram.com\/p\/*", + "http:\/\/instagr.am\/p\/*", + "http:\/\/www.instagram.com\/p\/*", + "http:\/\/www.instagr.am\/p\/*", + "https:\/\/instagram.com\/p\/*", + "https:\/\/instagr.am\/p\/*", + "https:\/\/www.instagram.com\/p\/*", + "https:\/\/www.instagr.am\/p\/*" + ], + "url": "https:\/\/api.instagram.com\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "Meetup", + "provider_url": "http:\/\/www.meetup.com", + "endpoints": [ + { + "schemes": [ + "http:\/\/meetup.com\/*", + "https:\/\/www.meetup.com\/*", + "https:\/\/meetup.com\/*", + "http:\/\/meetu.ps\/*" + ], + "url": "https:\/\/api.meetup.com\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "MixCloud", + "provider_url": "https:\/\/mixcloud.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/www.mixcloud.com\/*\/*\/", + "https:\/\/www.mixcloud.com\/*\/*\/" + ], + "url": "https:\/\/www.mixcloud.com\/oembed\/" + } + ] + }, + { + "provider_name": "Reddit", + "provider_url": "https:\/\/reddit.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/reddit.com\/r\/*\/comments\/*\/*", + "https:\/\/www.reddit.com\/r\/*\/comments\/*\/*" + ], + "url": "https:\/\/www.reddit.com\/oembed" + } + ] + }, + { + "provider_name": "SlideShare", + "provider_url": "http:\/\/www.slideshare.net\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/www.slideshare.net\/*\/*", + "http:\/\/fr.slideshare.net\/*\/*", + "http:\/\/de.slideshare.net\/*\/*", + "http:\/\/es.slideshare.net\/*\/*", + "http:\/\/pt.slideshare.net\/*\/*" + ], + "url": "http:\/\/www.slideshare.net\/api\/oembed\/2", + "discovery": true + } + ] + }, + { + "provider_name": "SoundCloud", + "provider_url": "http:\/\/soundcloud.com\/", + "endpoints": [ + { + "schemes": [ + "http:\/\/soundcloud.com\/*", + "https:\/\/soundcloud.com\/*" + ], + "url": "https:\/\/soundcloud.com\/oembed" + } + ] + }, + { + "provider_name": "Twitch", + "provider_url": "https:\/\/www.twitch.tv", + "endpoints": [ + { + "schemes": [ + "http:\/\/clips.twitch.tv\/*", + "https:\/\/clips.twitch.tv\/*", + "http:\/\/www.twitch.tv\/*", + "https:\/\/www.twitch.tv\/*", + "http:\/\/twitch.tv\/*", + "https:\/\/twitch.tv\/*" + ], + "url": "https:\/\/api.twitch.tv\/v4\/oembed", + "formats": [ + "json" + ] + } + ] + }, + { + "provider_name": "Twitter", + "provider_url": "http:\/\/www.twitter.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/twitter.com\/*\/status\/*", + "https:\/\/*.twitter.com\/*\/status\/*" + ], + "url": "https:\/\/publish.twitter.com\/oembed" + } + ] + }, + { + "provider_name": "Vimeo", + "provider_url": "https:\/\/vimeo.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/vimeo.com\/*", + "https:\/\/vimeo.com\/album\/*\/video\/*", + "https:\/\/vimeo.com\/channels\/*\/*", + "https:\/\/vimeo.com\/groups\/*\/videos\/*", + "https:\/\/vimeo.com\/ondemand\/*\/*", + "https:\/\/player.vimeo.com\/video\/*" + ], + "url": "https:\/\/vimeo.com\/api\/oembed.{format}", + "discovery": true + } + ] + }, + { + "provider_name": "YouTube", + "provider_url": "https:\/\/www.youtube.com\/", + "endpoints": [ + { + "schemes": [ + "https:\/\/*.youtube.com\/watch*", + "https:\/\/*.youtube.com\/v\/*", + "https:\/\/youtu.be\/*" + ], + "url": "https:\/\/www.youtube.com\/oembed", + "discovery": true + } + ] + } +] \ No newline at end of file diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 5b83821f5..e101cf67d 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -2,7 +2,7 @@ "maintenance": { "title": "Human Connection befindet sich in der Wartung", "explanation": "Zurzeit führen wir einige geplante Wartungsarbeiten durch, bitte versuch es später erneut.", - "questions": "Bei Fragen oder Problemen erreichst du uns per E-Mail an" + "questions": "Bei Fragen oder Problemen erreichst du uns per E-Mail an" }, "index": { "no-results": "Keine Beiträge gefunden.", @@ -306,6 +306,20 @@ "submit": "Kommentiere", "submitted": "Kommentar Gesendet", "updated": "Änderungen gespeichert" + }, + "allowEmbeds": { + "name": "Drittanbieter", + "description": "In unseren Beiträgen können aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text eingebunden werden.", + "statustext": "Momentan ist das automatische einbinden:", + "statuschange": "Einstellung ändern", + "false": "Abgestellt", + "true": "Zugelassen", + "button-tofalse": "Abstellen", + "button-toonlysession": "Zugelassen für diese Sitzung", + "button-totrue": "dauerhaft zulassen", + "third-party-false": "Es wird kein Service von Drittanbietern automatisch eingebunden.", + "third-party-onlysession": "Sie haben das automatische einbinden für diese Sitzung zugelassen. Nach einem neuen Login ist es wieder abgestellt.", + "third-party-true": "Das einbinden der Services von Drittanbietern ist dauerhaft zugelassen und gespeichert für komende Sitzungen." } }, "comment": { @@ -592,4 +606,4 @@ "have-fun": "Jetzt aber viel Spaß mit der Alpha von Human Connection! Für den ersten Weltfrieden. ♥︎", "closing": "Herzlichst

Euer Human Connection Team" } -} +} \ No newline at end of file diff --git a/webapp/pages/settings.vue b/webapp/pages/settings.vue index 67493c333..11fde8c75 100644 --- a/webapp/pages/settings.vue +++ b/webapp/pages/settings.vue @@ -32,8 +32,8 @@ export default { path: `/settings/my-social-media`, }, { - name: this.$t('settings.blocked-users.name'), - path: `/settings/blocked-users`, + name: this.$t('post.allowEmbeds.name'), + path: `/settings/allow-embeds`, }, { name: this.$t('settings.deleteUserAccount.name'), diff --git a/webapp/pages/settings/allow-embeds.vue b/webapp/pages/settings/allow-embeds.vue new file mode 100644 index 000000000..143211510 --- /dev/null +++ b/webapp/pages/settings/allow-embeds.vue @@ -0,0 +1,94 @@ + + + + + From 4b1116868719d7896b8e2664ef81f1ba4a9779f4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 23 Sep 2019 16:11:20 +0200 Subject: [PATCH 02/50] confirm embeded iframes only frontend style --- .../schema/resolvers/embeds/findProvider.js | 5 +- .../resolvers/embeds/findProvider.spec.js | 2 +- webapp/assets/json/providers.json | 257 ------------------ webapp/locales/de.json | 8 +- webapp/pages/settings/allow-embeds.vue | 132 ++++----- 5 files changed, 65 insertions(+), 339 deletions(-) delete mode 100644 webapp/assets/json/providers.json diff --git a/backend/src/schema/resolvers/embeds/findProvider.js b/backend/src/schema/resolvers/embeds/findProvider.js index 491cbb9e8..c7d910918 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.js +++ b/backend/src/schema/resolvers/embeds/findProvider.js @@ -2,7 +2,10 @@ import fs from 'fs' import path from 'path' import minimatch from 'minimatch' -let oEmbedProvidersFile = fs.readFileSync(path.join(__dirname, './providers.json'), 'utf8') +let oEmbedProvidersFile = fs.readFileSync( + path.join(__dirname, '../../../../public/providers.json'), + 'utf8', +) // some providers allow a format parameter // we need JSON oEmbedProvidersFile = oEmbedProvidersFile.replace(/\{format\}/g, 'json') diff --git a/backend/src/schema/resolvers/embeds/findProvider.spec.js b/backend/src/schema/resolvers/embeds/findProvider.spec.js index 878fe741c..963b255ab 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.spec.js +++ b/backend/src/schema/resolvers/embeds/findProvider.spec.js @@ -1,4 +1,4 @@ -import findProvider from '~/json/findProvider' +import findProvider from './findProvider' describe('Vimeo', () => { it('matches `https://vimeo.com/showcase/2098620/video/4082288`', () => { diff --git a/webapp/assets/json/providers.json b/webapp/assets/json/providers.json deleted file mode 100644 index ef9f04bff..000000000 --- a/webapp/assets/json/providers.json +++ /dev/null @@ -1,257 +0,0 @@ -[ - { - "provider_name": "Codepen", - "provider_url": "https:\/\/codepen.io", - "endpoints": [ - { - "schemes": [ - "http:\/\/codepen.io\/*", - "https:\/\/codepen.io\/*" - ], - "url": "http:\/\/codepen.io\/api\/oembed" - } - ] - }, - { - "provider_name": "DTube", - "provider_url": "https:\/\/d.tube\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/d.tube\/v\/*" - ], - "url": "https:\/\/api.d.tube\/oembed", - "discovery": true - } - ] - }, - { - "provider_name": "Facebook (Post)", - "provider_url": "https:\/\/www.facebook.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/www.facebook.com\/*\/posts\/*", - "https:\/\/www.facebook.com\/photos\/*", - "https:\/\/www.facebook.com\/*\/photos\/*", - "https:\/\/www.facebook.com\/photo.php*", - "https:\/\/www.facebook.com\/photo.php", - "https:\/\/www.facebook.com\/*\/activity\/*", - "https:\/\/www.facebook.com\/permalink.php", - "https:\/\/www.facebook.com\/media\/set?set=*", - "https:\/\/www.facebook.com\/questions\/*", - "https:\/\/www.facebook.com\/notes\/*\/*\/*" - ], - "url": "https:\/\/www.facebook.com\/plugins\/post\/oembed.json", - "discovery": true - } - ] - }, - { - "provider_name": "Facebook (Video)", - "provider_url": "https:\/\/www.facebook.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/www.facebook.com\/*\/videos\/*", - "https:\/\/www.facebook.com\/video.php" - ], - "url": "https:\/\/www.facebook.com\/plugins\/video\/oembed.json", - "discovery": true - } - ] - }, - { - "provider_name": "Flickr", - "provider_url": "https:\/\/www.flickr.com\/", - "endpoints": [ - { - "schemes": [ - "http:\/\/*.flickr.com\/photos\/*", - "http:\/\/flic.kr\/p\/*", - "https:\/\/*.flickr.com\/photos\/*", - "https:\/\/flic.kr\/p\/*" - ], - "url": "https:\/\/www.flickr.com\/services\/oembed\/", - "discovery": true - } - ] - }, - { - "provider_name": "GIPHY", - "provider_url": "https:\/\/giphy.com", - "endpoints": [ - { - "schemes": [ - "https:\/\/giphy.com\/gifs\/*", - "http:\/\/gph.is\/*", - "https:\/\/media.giphy.com\/media\/*\/giphy.gif" - ], - "url": "https:\/\/giphy.com\/services\/oembed", - "discovery": true - } - ] - }, - { - "provider_name": "Instagram", - "provider_url": "https:\/\/instagram.com", - "endpoints": [ - { - "schemes": [ - "http:\/\/instagram.com\/p\/*", - "http:\/\/instagr.am\/p\/*", - "http:\/\/www.instagram.com\/p\/*", - "http:\/\/www.instagr.am\/p\/*", - "https:\/\/instagram.com\/p\/*", - "https:\/\/instagr.am\/p\/*", - "https:\/\/www.instagram.com\/p\/*", - "https:\/\/www.instagr.am\/p\/*" - ], - "url": "https:\/\/api.instagram.com\/oembed", - "formats": [ - "json" - ] - } - ] - }, - { - "provider_name": "Meetup", - "provider_url": "http:\/\/www.meetup.com", - "endpoints": [ - { - "schemes": [ - "http:\/\/meetup.com\/*", - "https:\/\/www.meetup.com\/*", - "https:\/\/meetup.com\/*", - "http:\/\/meetu.ps\/*" - ], - "url": "https:\/\/api.meetup.com\/oembed", - "formats": [ - "json" - ] - } - ] - }, - { - "provider_name": "MixCloud", - "provider_url": "https:\/\/mixcloud.com\/", - "endpoints": [ - { - "schemes": [ - "http:\/\/www.mixcloud.com\/*\/*\/", - "https:\/\/www.mixcloud.com\/*\/*\/" - ], - "url": "https:\/\/www.mixcloud.com\/oembed\/" - } - ] - }, - { - "provider_name": "Reddit", - "provider_url": "https:\/\/reddit.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/reddit.com\/r\/*\/comments\/*\/*", - "https:\/\/www.reddit.com\/r\/*\/comments\/*\/*" - ], - "url": "https:\/\/www.reddit.com\/oembed" - } - ] - }, - { - "provider_name": "SlideShare", - "provider_url": "http:\/\/www.slideshare.net\/", - "endpoints": [ - { - "schemes": [ - "http:\/\/www.slideshare.net\/*\/*", - "http:\/\/fr.slideshare.net\/*\/*", - "http:\/\/de.slideshare.net\/*\/*", - "http:\/\/es.slideshare.net\/*\/*", - "http:\/\/pt.slideshare.net\/*\/*" - ], - "url": "http:\/\/www.slideshare.net\/api\/oembed\/2", - "discovery": true - } - ] - }, - { - "provider_name": "SoundCloud", - "provider_url": "http:\/\/soundcloud.com\/", - "endpoints": [ - { - "schemes": [ - "http:\/\/soundcloud.com\/*", - "https:\/\/soundcloud.com\/*" - ], - "url": "https:\/\/soundcloud.com\/oembed" - } - ] - }, - { - "provider_name": "Twitch", - "provider_url": "https:\/\/www.twitch.tv", - "endpoints": [ - { - "schemes": [ - "http:\/\/clips.twitch.tv\/*", - "https:\/\/clips.twitch.tv\/*", - "http:\/\/www.twitch.tv\/*", - "https:\/\/www.twitch.tv\/*", - "http:\/\/twitch.tv\/*", - "https:\/\/twitch.tv\/*" - ], - "url": "https:\/\/api.twitch.tv\/v4\/oembed", - "formats": [ - "json" - ] - } - ] - }, - { - "provider_name": "Twitter", - "provider_url": "http:\/\/www.twitter.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/twitter.com\/*\/status\/*", - "https:\/\/*.twitter.com\/*\/status\/*" - ], - "url": "https:\/\/publish.twitter.com\/oembed" - } - ] - }, - { - "provider_name": "Vimeo", - "provider_url": "https:\/\/vimeo.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/vimeo.com\/*", - "https:\/\/vimeo.com\/album\/*\/video\/*", - "https:\/\/vimeo.com\/channels\/*\/*", - "https:\/\/vimeo.com\/groups\/*\/videos\/*", - "https:\/\/vimeo.com\/ondemand\/*\/*", - "https:\/\/player.vimeo.com\/video\/*" - ], - "url": "https:\/\/vimeo.com\/api\/oembed.{format}", - "discovery": true - } - ] - }, - { - "provider_name": "YouTube", - "provider_url": "https:\/\/www.youtube.com\/", - "endpoints": [ - { - "schemes": [ - "https:\/\/*.youtube.com\/watch*", - "https:\/\/*.youtube.com\/v\/*", - "https:\/\/youtu.be\/*" - ], - "url": "https:\/\/www.youtube.com\/oembed", - "discovery": true - } - ] - } -] \ No newline at end of file diff --git a/webapp/locales/de.json b/webapp/locales/de.json index e101cf67d..d8e380449 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -309,17 +309,15 @@ }, "allowEmbeds": { "name": "Drittanbieter", - "description": "In unseren Beiträgen können aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text eingebunden werden.", + "description": "In unseren Beiträgen können / werden aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text eingebunden werden.", "statustext": "Momentan ist das automatische einbinden:", "statuschange": "Einstellung ändern", "false": "Abgestellt", "true": "Zugelassen", "button-tofalse": "Abstellen", - "button-toonlysession": "Zugelassen für diese Sitzung", "button-totrue": "dauerhaft zulassen", - "third-party-false": "Es wird kein Service von Drittanbietern automatisch eingebunden.", - "third-party-onlysession": "Sie haben das automatische einbinden für diese Sitzung zugelassen. Nach einem neuen Login ist es wieder abgestellt.", - "third-party-true": "Das einbinden der Services von Drittanbietern ist dauerhaft zugelassen und gespeichert für komende Sitzungen." + "third-party-false": "Es wird kein Service von Drittanbietern automatisch eingebunden.", + "third-party-true": "Das einbinden der Services von Drittanbietern ist dauerhaft zugelassen und gespeichert für komende Sitzungen." } }, "comment": { diff --git a/webapp/pages/settings/allow-embeds.vue b/webapp/pages/settings/allow-embeds.vue index 143211510..31380380d 100644 --- a/webapp/pages/settings/allow-embeds.vue +++ b/webapp/pages/settings/allow-embeds.vue @@ -1,94 +1,76 @@ - - From 044e2bfed958e2dc1c4654f1897f66235d16a7d5 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 23 Sep 2019 20:08:45 +0200 Subject: [PATCH 03/50] Allow embedded code in posts permanent in database --- backend/src/models/User.js | 4 ++ backend/src/schema/resolvers/users.js | 1 + backend/src/schema/resolvers/users.spec.js | 1 + backend/src/schema/types/type/User.gql | 3 + backend/src/seed/factories/users.js | 1 + webapp/locales/en.json | 16 +++++- webapp/middleware/termsAndConditions.js | 1 + webapp/pages/settings/allow-embeds.vue | 64 +++++++++++++++++++--- webapp/store/auth.js | 5 ++ 9 files changed, 85 insertions(+), 11 deletions(-) diff --git a/backend/src/models/User.js b/backend/src/models/User.js index 72cef4093..736b7b1ab 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -104,4 +104,8 @@ module.exports = { target: 'Location', direction: 'out', }, + allowEmbedIframes: { + type: 'boolean', + default: false, + }, } diff --git a/backend/src/schema/resolvers/users.js b/backend/src/schema/resolvers/users.js index ea9220d5e..7ec6d6d46 100644 --- a/backend/src/schema/resolvers/users.js +++ b/backend/src/schema/resolvers/users.js @@ -175,6 +175,7 @@ export default { 'about', 'termsAndConditionsAgreedVersion', 'termsAndConditionsAgreedAt', + 'allowEmbedIframes', ], boolean: { followedByCurrentUser: diff --git a/backend/src/schema/resolvers/users.spec.js b/backend/src/schema/resolvers/users.spec.js index 784a48c06..986f4a41f 100644 --- a/backend/src/schema/resolvers/users.spec.js +++ b/backend/src/schema/resolvers/users.spec.js @@ -86,6 +86,7 @@ describe('UpdateUser', () => { name: 'John Doe', termsAndConditionsAgreedVersion: null, termsAndConditionsAgreedAt: null, + allowEmbedIframes: false, } variables = { diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql index f1c38b8d6..d9084dd90 100644 --- a/backend/src/schema/types/type/User.gql +++ b/backend/src/schema/types/type/User.gql @@ -27,6 +27,8 @@ type User { termsAndConditionsAgreedVersion: String termsAndConditionsAgreedAt: String + allowEmbedIframes: Boolean + friends: [User]! @relation(name: "FRIENDS", direction: "BOTH") friendsCount: Int! @cypher(statement: "MATCH (this)<-[: FRIENDS]->(r: User) RETURN COUNT(DISTINCT r)") @@ -166,6 +168,7 @@ type Mutation { about: String termsAndConditionsAgreedVersion: String termsAndConditionsAgreedAt: String + allowEmbedIframes: Boolean ): User DeleteUser(id: ID!, resource: [Deletable]): User diff --git a/backend/src/seed/factories/users.js b/backend/src/seed/factories/users.js index 962f92781..b65be795d 100644 --- a/backend/src/seed/factories/users.js +++ b/backend/src/seed/factories/users.js @@ -16,6 +16,7 @@ export default function create() { about: faker.lorem.paragraph(), termsAndConditionsAgreedVersion: '0.0.1', termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z', + allowEmbedIframes: false, } defaults.slug = slugify(defaults.name, { lower: true }) args = { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 39220d318..e97360b55 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -2,7 +2,7 @@ "maintenance": { "title": "Human Connection is under maintenance", "explanation": "At the moment we are doing some scheduled maintenance, please try again later.", - "questions": "Any Questions or concerns, send an email to" + "questions": "Any Questions or concerns, send an email to" }, "index": { "no-results": "No contributions found.", @@ -307,6 +307,18 @@ "submit": "Comment", "submitted": "Comment Submitted", "updated": "Changes Saved" + }, + "allowEmbeds": { + "name": "Third party providers", + "description": "In our contributions can / will be included from the following list of providers foreign code from other providers (third parties) in the form of embedded videos, images or text.", + "statustext": "At the moment this is automatic embedding:", + "statuschange": "Change setting", + "false": "Turned off", + "true": "Admitted", + "button-tofalse": "turn-off", + "button-totrue": "allow permanently", + "third-party-false": "It automatically integrates no third-party providers' service.", + "third-party-true": "The inclusion of third-party services is permanently allowed and stored for future sessions." } }, "comment": { @@ -593,4 +605,4 @@ "have-fun": "Now have fun with the alpha version of Human Connection! For the first universal peace. ♥︎", "closing": "Thank you very much

your Human Connection Team" } -} +} \ No newline at end of file diff --git a/webapp/middleware/termsAndConditions.js b/webapp/middleware/termsAndConditions.js index 64141eed0..68ad49bf8 100644 --- a/webapp/middleware/termsAndConditions.js +++ b/webapp/middleware/termsAndConditions.js @@ -6,6 +6,7 @@ export default async ({ store, env, route, redirect }) => { if (publicPages.indexOf(route.name) >= 0) { return true } + if (route.name === 'terms-and-conditions-confirm') return true // avoid endless loop if (store.getters['auth/termsAndConditionsAgreed']) return true diff --git a/webapp/pages/settings/allow-embeds.vue b/webapp/pages/settings/allow-embeds.vue index 31380380d..61f544af9 100644 --- a/webapp/pages/settings/allow-embeds.vue +++ b/webapp/pages/settings/allow-embeds.vue @@ -12,12 +12,12 @@ - + {{ $t('post.allowEmbeds.button-tofalse') }} - + {{ $t('post.allowEmbeds.button-totrue') }} @@ -27,7 +27,7 @@ -
+

{{ $t('post.allowEmbeds.description') }}

@@ -45,13 +45,33 @@ From 7cc139e879ac7ea912e82ea7eff14f7b67eddb4a Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Oct 2019 13:20:07 +0200 Subject: [PATCH 22/50] add test embeds and links --- webapp/components/Editor/nodes/Embed.spec.js | 5 - .../components/Embed/EmbedComponent.spec.js | 151 ++++++++++++++++++ webapp/components/Embed/EmbedComponent.vue | 2 +- 3 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 webapp/components/Embed/EmbedComponent.spec.js diff --git a/webapp/components/Editor/nodes/Embed.spec.js b/webapp/components/Editor/nodes/Embed.spec.js index a2ae2e7e5..639f99338 100644 --- a/webapp/components/Editor/nodes/Embed.spec.js +++ b/webapp/components/Editor/nodes/Embed.spec.js @@ -14,11 +14,6 @@ describe('Embed.vue', () => { beforeEach(() => { propsData = {} component = new Embed() - // computed = { - // currentUser: () => { - // return { id: 'im a user', allowEmbedIframes: false } - // }, - // } Wrapper = ({ propsData }) => { return shallowMount(component.view, { propsData }) } diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js new file mode 100644 index 000000000..46a9df1b0 --- /dev/null +++ b/webapp/components/Embed/EmbedComponent.spec.js @@ -0,0 +1,151 @@ +import { mount, createLocalVue } from '@vue/test-utils' +import Vuex from 'vuex' +import Styleguide from '@human-connection/styleguide' +import EmbedComponent from './EmbedComponent' + +let Wrapper, wrapper, propsData, getters, mocks +const someUrl = 'https://www.youtube.com/watch?v=qkdXAtO40Fo' +const localVue = createLocalVue() + +localVue.use(Vuex) +localVue.use(Styleguide) + +describe('EmbedComponent.vue', () => { + beforeEach(() => { + mocks = { + $t: a => a, + } + propsData = {} + getters = { + 'auth/user': () => { + return { id: 'u5', allowEmbedIframes: false } + }, + } + Wrapper = ({ propsData }) => { + const store = new Vuex.Store({ + getters, + }) + return mount(EmbedComponent, { propsData, localVue, store, mocks }) + } + }) + + describe('given a href only for a link ', () => { + beforeEach(() => { + propsData.embedData = { + __typename: 'Embed', + type: 'link', + title: '👻 ✉️ Bruno... le ciel sur répondeur ! 🔮 🧠 - Clément FREZE', + author: null, + publisher: 'PeerTube.social', + date: null, + description: + 'Salut tout le monde ! Aujourd’hui, une vidéo sur le scepticisme, nous allons parler médiumnité avec le cas de Bruno CHARVET : « Bruno, un nouveau message ». Merci de rester respectueux dans les commentaires : SOURCES : Les sources des vi...', + url: 'https://peertube.social/videos/watch/f3cb1945-a8f7-481f-a465-946c6f884e50', + image: 'https://peertube.social/static/thumbnails/f3cb1945-a8f7-481f-a465-946c6f884e50.jpg', + audio: null, + video: null, + lang: 'fr', + sources: ['resource', 'oembed'], + html: null, + } + wrapper = Wrapper({ propsData }) + }) + + it.only('show the title', () => { + expect(wrapper.find('h4').text()).toBe( + '👻 ✉️ Bruno... le ciel sur répondeur ! 🔮 🧠 - Clément FREZE', + ) + }) + + it.only('show the desciption', () => { + expect(wrapper.find('.embed-content p').text()).toBe( + 'Salut tout le monde ! Aujourd’hui, une vidéo sur le scepticisme, nous allons parler médiumnité avec le cas de Bruno CHARVET : « Bruno, un nouveau message ». Merci de rester respectueux dans les commentaires : SOURCES : Les sources des vi...', + ) + }) + + it.only('show preview Images for link', () => { + expect(wrapper.find('.embed-preview-image--clickable')).toEqual({ + selector: '.embed-preview-image--clickable', + }) + }) + }) + + describe('given a href wite embed html', () => { + describe('onEmbed returned title and description', () => { + beforeEach(() => { + propsData.embedData = { + __typename: 'Embed', + title: 'Baby Loves Cat', + description: + 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', + } + wrapper = Wrapper({ propsData }) + }) + + it.only('show the title', () => { + expect(wrapper.find('h4').text()).toBe('Baby Loves Cat') + }) + + it.only('show the desciption', () => { + expect(wrapper.find('.embed-content p').text()).toBe( + 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', + ) + }) + }) + + describe('onEmbed returned embed data with html', () => { + beforeEach(() => { + propsData.embedData = { + __typename: 'Embed', + type: 'video', + title: 'Baby Loves Cat', + author: 'Merkley Family', + publisher: 'YouTube', + date: '2015-08-16T00:00:00.000Z', + description: + 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', + url: someUrl, + image: 'https://i.ytimg.com/vi/qkdXAtO40Fo/maxresdefault.jpg', + audio: null, + video: null, + lang: 'de', + sources: ['resource', 'oembed'], + html: + '', + } + wrapper = Wrapper({ propsData }) + }) + + it('shows a simple link when a user closes the embed preview', () => { + wrapper.find('.embed-close-button').trigger('click') + expect(wrapper.vm.showLinkOnly).toBe(true) + }) + + it.only('opens the data privacy overlay when a user clicks on the preview image', () => { + wrapper.find('.embed-preview-image--clickable').trigger('click') + expect(wrapper.vm.showOverlay).toBe(true) + }) + + it.only('click show iframe and change NOT setting permanetly', () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('.ds-button-primary').trigger('click') + expect(wrapper.vm.showEmbed).toBe(true) + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) + }) + + it.only('click show iframe and change setting permanetly', () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('input[type=checkbox]').trigger('click') + wrapper.find('.ds-button-primary').trigger('click') + expect(wrapper.vm.showEmbed).toBe(true) + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) + }) + + it.only('show only iframe if allowEmbedIframes true', () => { + wrapper.setData({ allowEmbedIframes: true }) + expect(wrapper.find('.embed-html')).toEqual({ selector: '.embed-html' }) + expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) + }) + }) + }) +}) diff --git a/webapp/components/Embed/EmbedComponent.vue b/webapp/components/Embed/EmbedComponent.vue index d7707d9bb..5dc8ad00c 100644 --- a/webapp/components/Embed/EmbedComponent.vue +++ b/webapp/components/Embed/EmbedComponent.vue @@ -71,7 +71,7 @@ export default { } }, created() { - if (this.embedData.options) { + if (this.currentUser.allowEmbedIframes) { this.showEmbed = this.currentUser.allowEmbedIframes this.checkedAlwaysAllowEmbeds = this.currentUser.allowEmbedIframes } From 0424992358d6cde034909a8c43160587a6da572f Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Oct 2019 16:35:49 +0200 Subject: [PATCH 23/50] change specs --- .../components/Embed/EmbedComponent.spec.js | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js index 46a9df1b0..09546bf15 100644 --- a/webapp/components/Embed/EmbedComponent.spec.js +++ b/webapp/components/Embed/EmbedComponent.spec.js @@ -51,26 +51,26 @@ describe('EmbedComponent.vue', () => { wrapper = Wrapper({ propsData }) }) - it.only('show the title', () => { + it('shows the title', () => { expect(wrapper.find('h4').text()).toBe( '👻 ✉️ Bruno... le ciel sur répondeur ! 🔮 🧠 - Clément FREZE', ) }) - it.only('show the desciption', () => { + it('shows the description', () => { expect(wrapper.find('.embed-content p').text()).toBe( 'Salut tout le monde ! Aujourd’hui, une vidéo sur le scepticisme, nous allons parler médiumnité avec le cas de Bruno CHARVET : « Bruno, un nouveau message ». Merci de rester respectueux dans les commentaires : SOURCES : Les sources des vi...', ) }) - it.only('show preview Images for link', () => { + it('shows preview Images for link', () => { expect(wrapper.find('.embed-preview-image--clickable')).toEqual({ selector: '.embed-preview-image--clickable', }) }) }) - describe('given a href wite embed html', () => { + describe('given a href with embed html', () => { describe('onEmbed returned title and description', () => { beforeEach(() => { propsData.embedData = { @@ -82,11 +82,11 @@ describe('EmbedComponent.vue', () => { wrapper = Wrapper({ propsData }) }) - it.only('show the title', () => { + it('show the title', () => { expect(wrapper.find('h4').text()).toBe('Baby Loves Cat') }) - it.only('show the desciption', () => { + it('show the desciption', () => { expect(wrapper.find('.embed-content p').text()).toBe( 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', ) @@ -121,19 +121,19 @@ describe('EmbedComponent.vue', () => { expect(wrapper.vm.showLinkOnly).toBe(true) }) - it.only('opens the data privacy overlay when a user clicks on the preview image', () => { + it('opens the data privacy overlay when a user clicks on the preview image', () => { wrapper.find('.embed-preview-image--clickable').trigger('click') expect(wrapper.vm.showOverlay).toBe(true) }) - it.only('click show iframe and change NOT setting permanetly', () => { + it("click show iframe, but don't select to change setting permanetly", () => { wrapper.setData({ showOverlay: true }) wrapper.find('.ds-button-primary').trigger('click') expect(wrapper.vm.showEmbed).toBe(true) expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) }) - it.only('click show iframe and change setting permanetly', () => { + it('click show iframe and change setting permanetly', () => { wrapper.setData({ showOverlay: true }) wrapper.find('input[type=checkbox]').trigger('click') wrapper.find('.ds-button-primary').trigger('click') @@ -141,7 +141,14 @@ describe('EmbedComponent.vue', () => { expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) }) - it.only('show only iframe if allowEmbedIframes true', () => { + it('click do not show iframe', () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('.ds-button-ghost').trigger('click') + expect(wrapper.vm.showOverlay).toBe(false) + expect(wrapper.vm.showEmbed).toBe(false) + }) + + it('show only iframe if allowEmbedIframes true', () => { wrapper.setData({ allowEmbedIframes: true }) expect(wrapper.find('.embed-html')).toEqual({ selector: '.embed-html' }) expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) From e2da57287b01feae82497ea260fa2d5c40acb0a6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Oct 2019 18:56:45 +0200 Subject: [PATCH 24/50] change providers.json --- backend/src/schema/resolvers/embeds/findProvider.js | 3 ++- webapp/components/Embed/EmbedComponent.spec.js | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/schema/resolvers/embeds/findProvider.js b/backend/src/schema/resolvers/embeds/findProvider.js index c7d910918..4742935b7 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.js +++ b/backend/src/schema/resolvers/embeds/findProvider.js @@ -3,9 +3,10 @@ import path from 'path' import minimatch from 'minimatch' let oEmbedProvidersFile = fs.readFileSync( - path.join(__dirname, '../../../../public/providers.json'), + path.join(__dirname, './providers.json'), 'utf8', ) + // some providers allow a format parameter // we need JSON oEmbedProvidersFile = oEmbedProvidersFile.replace(/\{format\}/g, 'json') diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js index 09546bf15..b4fbe6a60 100644 --- a/webapp/components/Embed/EmbedComponent.spec.js +++ b/webapp/components/Embed/EmbedComponent.spec.js @@ -68,6 +68,8 @@ describe('EmbedComponent.vue', () => { selector: '.embed-preview-image--clickable', }) }) + + }) describe('given a href with embed html', () => { @@ -91,7 +93,6 @@ describe('EmbedComponent.vue', () => { 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', ) }) - }) describe('onEmbed returned embed data with html', () => { beforeEach(() => { @@ -141,7 +142,7 @@ describe('EmbedComponent.vue', () => { expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) }) - it('click do not show iframe', () => { + it('click cancel do not show iframe', () => { wrapper.setData({ showOverlay: true }) wrapper.find('.ds-button-ghost').trigger('click') expect(wrapper.vm.showOverlay).toBe(false) @@ -154,5 +155,6 @@ describe('EmbedComponent.vue', () => { expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) }) }) + }) }) -}) +}) \ No newline at end of file From 3c04e1a32851cfefbb9f7add213b6a28f662e982 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Oct 2019 19:00:14 +0200 Subject: [PATCH 25/50] code blockuser in settings add --- webapp/pages/settings.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/pages/settings.vue b/webapp/pages/settings.vue index cfd258bad..a7604ea5f 100644 --- a/webapp/pages/settings.vue +++ b/webapp/pages/settings.vue @@ -35,6 +35,10 @@ export default { name: this.$t('settings.social-media.name'), path: `/settings/my-social-media`, }, + { + name: this.$t('settings.blocked-users.name'), + path: `/settings/blocked-users`, + }, { name: this.$t('post.allowEmbeds.name'), path: `/settings/allow-embeds`, From b8037b6e1f4098f4c02f7385b8c10c03cf53ec2d Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Oct 2019 20:29:41 +0200 Subject: [PATCH 26/50] fix lint --- .../schema/resolvers/embeds/findProvider.js | 5 +- .../components/Embed/EmbedComponent.spec.js | 112 +++++++++--------- 2 files changed, 56 insertions(+), 61 deletions(-) diff --git a/backend/src/schema/resolvers/embeds/findProvider.js b/backend/src/schema/resolvers/embeds/findProvider.js index 4742935b7..a4240895f 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.js +++ b/backend/src/schema/resolvers/embeds/findProvider.js @@ -2,10 +2,7 @@ import fs from 'fs' import path from 'path' import minimatch from 'minimatch' -let oEmbedProvidersFile = fs.readFileSync( - path.join(__dirname, './providers.json'), - 'utf8', -) +let oEmbedProvidersFile = fs.readFileSync(path.join(__dirname, './providers.json'), 'utf8') // some providers allow a format parameter // we need JSON diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js index b4fbe6a60..0f7c6f4e1 100644 --- a/webapp/components/Embed/EmbedComponent.spec.js +++ b/webapp/components/Embed/EmbedComponent.spec.js @@ -68,8 +68,6 @@ describe('EmbedComponent.vue', () => { selector: '.embed-preview-image--clickable', }) }) - - }) describe('given a href with embed html', () => { @@ -94,67 +92,67 @@ describe('EmbedComponent.vue', () => { ) }) - describe('onEmbed returned embed data with html', () => { - beforeEach(() => { - propsData.embedData = { - __typename: 'Embed', - type: 'video', - title: 'Baby Loves Cat', - author: 'Merkley Family', - publisher: 'YouTube', - date: '2015-08-16T00:00:00.000Z', - description: - 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', - url: someUrl, - image: 'https://i.ytimg.com/vi/qkdXAtO40Fo/maxresdefault.jpg', - audio: null, - video: null, - lang: 'de', - sources: ['resource', 'oembed'], - html: - '', - } - wrapper = Wrapper({ propsData }) - }) + describe('onEmbed returned embed data with html', () => { + beforeEach(() => { + propsData.embedData = { + __typename: 'Embed', + type: 'video', + title: 'Baby Loves Cat', + author: 'Merkley Family', + publisher: 'YouTube', + date: '2015-08-16T00:00:00.000Z', + description: + 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', + url: someUrl, + image: 'https://i.ytimg.com/vi/qkdXAtO40Fo/maxresdefault.jpg', + audio: null, + video: null, + lang: 'de', + sources: ['resource', 'oembed'], + html: + '', + } + wrapper = Wrapper({ propsData }) + }) - it('shows a simple link when a user closes the embed preview', () => { - wrapper.find('.embed-close-button').trigger('click') - expect(wrapper.vm.showLinkOnly).toBe(true) - }) + it('shows a simple link when a user closes the embed preview', () => { + wrapper.find('.embed-close-button').trigger('click') + expect(wrapper.vm.showLinkOnly).toBe(true) + }) - it('opens the data privacy overlay when a user clicks on the preview image', () => { - wrapper.find('.embed-preview-image--clickable').trigger('click') - expect(wrapper.vm.showOverlay).toBe(true) - }) + it('opens the data privacy overlay when a user clicks on the preview image', () => { + wrapper.find('.embed-preview-image--clickable').trigger('click') + expect(wrapper.vm.showOverlay).toBe(true) + }) - it("click show iframe, but don't select to change setting permanetly", () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('.ds-button-primary').trigger('click') - expect(wrapper.vm.showEmbed).toBe(true) - expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) - }) + it("click show iframe, but don't select to change setting permanetly", () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('.ds-button-primary').trigger('click') + expect(wrapper.vm.showEmbed).toBe(true) + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) + }) - it('click show iframe and change setting permanetly', () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('input[type=checkbox]').trigger('click') - wrapper.find('.ds-button-primary').trigger('click') - expect(wrapper.vm.showEmbed).toBe(true) - expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) - }) + it('click show iframe and change setting permanetly', () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('input[type=checkbox]').trigger('click') + wrapper.find('.ds-button-primary').trigger('click') + expect(wrapper.vm.showEmbed).toBe(true) + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) + }) - it('click cancel do not show iframe', () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('.ds-button-ghost').trigger('click') - expect(wrapper.vm.showOverlay).toBe(false) - expect(wrapper.vm.showEmbed).toBe(false) - }) + it('click cancel do not show iframe', () => { + wrapper.setData({ showOverlay: true }) + wrapper.find('.ds-button-ghost').trigger('click') + expect(wrapper.vm.showOverlay).toBe(false) + expect(wrapper.vm.showEmbed).toBe(false) + }) - it('show only iframe if allowEmbedIframes true', () => { - wrapper.setData({ allowEmbedIframes: true }) - expect(wrapper.find('.embed-html')).toEqual({ selector: '.embed-html' }) - expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) + it('show only iframe if allowEmbedIframes true', () => { + wrapper.setData({ allowEmbedIframes: true }) + expect(wrapper.find('.embed-html')).toEqual({ selector: '.embed-html' }) + expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) + }) }) }) - }) }) -}) \ No newline at end of file +}) From bced6983ea1f51736e989eab6a41166723a6a6ca Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 8 Oct 2019 20:47:13 +0200 Subject: [PATCH 27/50] Fix lint, update tests - to remove vue warnings - favor one expectation per it block --- .../schema/resolvers/embeds/findProvider.js | 5 +- .../components/Embed/EmbedComponent.spec.js | 184 +++++++++++------- webapp/components/Embed/EmbedComponent.vue | 1 + 3 files changed, 117 insertions(+), 73 deletions(-) diff --git a/backend/src/schema/resolvers/embeds/findProvider.js b/backend/src/schema/resolvers/embeds/findProvider.js index 4742935b7..a4240895f 100644 --- a/backend/src/schema/resolvers/embeds/findProvider.js +++ b/backend/src/schema/resolvers/embeds/findProvider.js @@ -2,10 +2,7 @@ import fs from 'fs' import path from 'path' import minimatch from 'minimatch' -let oEmbedProvidersFile = fs.readFileSync( - path.join(__dirname, './providers.json'), - 'utf8', -) +let oEmbedProvidersFile = fs.readFileSync(path.join(__dirname, './providers.json'), 'utf8') // some providers allow a format parameter // we need JSON diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js index b4fbe6a60..5ad8dd324 100644 --- a/webapp/components/Embed/EmbedComponent.spec.js +++ b/webapp/components/Embed/EmbedComponent.spec.js @@ -3,7 +3,7 @@ import Vuex from 'vuex' import Styleguide from '@human-connection/styleguide' import EmbedComponent from './EmbedComponent' -let Wrapper, wrapper, propsData, getters, mocks +let wrapper, propsData, getters, mocks const someUrl = 'https://www.youtube.com/watch?v=qkdXAtO40Fo' const localVue = createLocalVue() @@ -11,9 +11,25 @@ localVue.use(Vuex) localVue.use(Styleguide) describe('EmbedComponent.vue', () => { + const Wrapper = () => { + const store = new Vuex.Store({ + getters, + }) + return mount(EmbedComponent, { propsData, localVue, store, mocks }) + } + beforeEach(() => { mocks = { $t: a => a, + $apollo: { + mutate: jest + .fn() + .mockResolvedValueOnce({ data: { UpdateUser: { allowEmbedIframes: true } } }), + }, + $toast: { + success: jest.fn(), + error: jest.fn(), + }, } propsData = {} getters = { @@ -21,12 +37,6 @@ describe('EmbedComponent.vue', () => { return { id: 'u5', allowEmbedIframes: false } }, } - Wrapper = ({ propsData }) => { - const store = new Vuex.Store({ - getters, - }) - return mount(EmbedComponent, { propsData, localVue, store, mocks }) - } }) describe('given a href only for a link ', () => { @@ -48,7 +58,7 @@ describe('EmbedComponent.vue', () => { sources: ['resource', 'oembed'], html: null, } - wrapper = Wrapper({ propsData }) + wrapper = Wrapper() }) it('shows the title', () => { @@ -64,12 +74,8 @@ describe('EmbedComponent.vue', () => { }) it('shows preview Images for link', () => { - expect(wrapper.find('.embed-preview-image--clickable')).toEqual({ - selector: '.embed-preview-image--clickable', - }) + expect(wrapper.find('.embed-preview-image').exists()).toBe(true) }) - - }) describe('given a href with embed html', () => { @@ -81,7 +87,7 @@ describe('EmbedComponent.vue', () => { description: 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', } - wrapper = Wrapper({ propsData }) + wrapper = Wrapper() }) it('show the title', () => { @@ -94,67 +100,107 @@ describe('EmbedComponent.vue', () => { ) }) - describe('onEmbed returned embed data with html', () => { - beforeEach(() => { - propsData.embedData = { - __typename: 'Embed', - type: 'video', - title: 'Baby Loves Cat', - author: 'Merkley Family', - publisher: 'YouTube', - date: '2015-08-16T00:00:00.000Z', - description: - 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', - url: someUrl, - image: 'https://i.ytimg.com/vi/qkdXAtO40Fo/maxresdefault.jpg', - audio: null, - video: null, - lang: 'de', - sources: ['resource', 'oembed'], - html: - '', - } - wrapper = Wrapper({ propsData }) - }) + describe('onEmbed returned embed data with html', () => { + beforeEach(() => { + propsData.embedData = { + __typename: 'Embed', + type: 'video', + title: 'Baby Loves Cat', + author: 'Merkley Family', + publisher: 'YouTube', + date: '2015-08-16T00:00:00.000Z', + description: + 'She’s incapable of controlling her limbs when her kitty is around. The obsession grows every day. Ps. That’s a sleep sack she’s in. Not a starfish outfit. Al...', + url: someUrl, + image: 'https://i.ytimg.com/vi/qkdXAtO40Fo/maxresdefault.jpg', + audio: null, + video: null, + lang: 'de', + sources: ['resource', 'oembed'], + html: + '', + } + wrapper = Wrapper() + }) - it('shows a simple link when a user closes the embed preview', () => { - wrapper.find('.embed-close-button').trigger('click') - expect(wrapper.vm.showLinkOnly).toBe(true) - }) + it('shows a simple link when a user closes the embed preview', () => { + wrapper.find('.embed-close-button').trigger('click') + expect(wrapper.vm.showLinkOnly).toBe(true) + }) - it('opens the data privacy overlay when a user clicks on the preview image', () => { - wrapper.find('.embed-preview-image--clickable').trigger('click') - expect(wrapper.vm.showOverlay).toBe(true) - }) + it('opens the data privacy overlay when a user clicks on the preview image', () => { + wrapper.find('.embed-preview-image--clickable').trigger('click') + expect(wrapper.vm.showOverlay).toBe(true) + }) - it("click show iframe, but don't select to change setting permanetly", () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('.ds-button-primary').trigger('click') - expect(wrapper.vm.showEmbed).toBe(true) - expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) - }) + describe('shows iframe', () => { + beforeEach(() => { + wrapper.setData({ showOverlay: true }) + }) - it('click show iframe and change setting permanetly', () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('input[type=checkbox]').trigger('click') - wrapper.find('.ds-button-primary').trigger('click') - expect(wrapper.vm.showEmbed).toBe(true) - expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) - }) + it('when user agress', () => { + wrapper.find('.ds-button-primary').trigger('click') + expect(wrapper.vm.showEmbed).toBe(true) + }) - it('click cancel do not show iframe', () => { - wrapper.setData({ showOverlay: true }) - wrapper.find('.ds-button-ghost').trigger('click') - expect(wrapper.vm.showOverlay).toBe(false) - expect(wrapper.vm.showEmbed).toBe(false) - }) + it('does not show iframe when user clicks to cancel', () => { + wrapper.find('.ds-button-ghost').trigger('click') + expect(wrapper.vm.showEmbed).toBe(false) + }) - it('show only iframe if allowEmbedIframes true', () => { - wrapper.setData({ allowEmbedIframes: true }) - expect(wrapper.find('.embed-html')).toEqual({ selector: '.embed-html' }) - expect(wrapper.find('.embed-preview-image--clickable')).toEqual({}) + describe("doesn't set permanently", () => { + beforeEach(() => { + wrapper.find('.ds-button-primary').trigger('click') + }) + + it("if user doesn't give consent", () => { + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(false) + }) + + it("doesn't update the user's profile", () => { + expect(mocks.$apollo.mutate).not.toHaveBeenCalled() + }) + }) + + describe('sets permanently', () => { + beforeEach(() => { + wrapper.find('input[type=checkbox]').trigger('click') + wrapper.find('.ds-button-primary').trigger('click') + }) + + it('changes setting permanetly when user requests', () => { + expect(wrapper.vm.checkedAlwaysAllowEmbeds).toBe(true) + }) + + it("updates the user's profile", () => { + expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) + }) + }) + }) + + describe('immediately shows', () => { + beforeEach(() => { + getters = { + 'auth/user': () => { + return { id: 'u5', allowEmbedIframes: true } + }, + } + wrapper = Wrapper() + }) + + it('sets showEmbed to true', () => { + expect(wrapper.vm.showEmbed).toBe(true) + }) + + it('the iframe returned from oEmbed', () => { + expect(wrapper.find('iframe').html()).toEqual(propsData.embedData.html) + }) + + it('does not display image to click', () => { + expect(wrapper.find('.embed-preview-image--clickable').exists()).toBe(false) + }) + }) }) }) - }) }) -}) \ No newline at end of file +}) diff --git a/webapp/components/Embed/EmbedComponent.vue b/webapp/components/Embed/EmbedComponent.vue index 5dc8ad00c..7831c1de1 100644 --- a/webapp/components/Embed/EmbedComponent.vue +++ b/webapp/components/Embed/EmbedComponent.vue @@ -145,6 +145,7 @@ export default { this.$toast.success(this.$t('contribution.success')) this.showEmbed = this.currentUser.allowEmbedIframes } catch (err) { + console.log(err) this.$toast.error(err.message) } }, From 211bae63622625ce2121bf4dded4e04961bba43c Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 8 Oct 2019 22:42:41 +0200 Subject: [PATCH 28/50] Fix lint --- webapp/components/Embed/EmbedComponent.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/components/Embed/EmbedComponent.vue b/webapp/components/Embed/EmbedComponent.vue index 7831c1de1..5dc8ad00c 100644 --- a/webapp/components/Embed/EmbedComponent.vue +++ b/webapp/components/Embed/EmbedComponent.vue @@ -145,7 +145,6 @@ export default { this.$toast.success(this.$t('contribution.success')) this.showEmbed = this.currentUser.allowEmbedIframes } catch (err) { - console.log(err) this.$toast.error(err.message) } }, From dbbece43b5b800752cc885d7076c662b4235bcf2 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Oct 2019 16:52:48 +0200 Subject: [PATCH 29/50] List of providers is always visible, button color changed, info text adapted --- webapp/locales/de.json | 3 ++- webapp/locales/en.json | 3 ++- webapp/pages/settings/allow-embeds.vue | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index c763ea504..b7965062b 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -345,7 +345,8 @@ }, "allowEmbeds": { "name": "Drittanbieter", - "description": "In unseren Beiträgen können / werden aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text eingebunden werden.", + "info-description": "Wenn du zustimmst werden in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", + "description": "Du hast zugestimmt das in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", "statustext": "Momentan ist das automatische einbinden:", "statuschange": "Einstellung ändern", "false": "Abgestellt", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 58f56f142..162f1a0f0 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -346,7 +346,8 @@ }, "allowEmbeds": { "name": "Third party providers", - "description": "In our contributions can / will be included from the following list of providers foreign code from other providers (third parties) in the form of embedded videos, images or text.", + "info-description": "If you agree, the posts from the following list of providers will automatically include third-party code from other providers (third parties) in the form of embedded videos, images, or text.", + "description": "You have agreed that in the contributions from the following list of providers, foreign code from other providers (third parties) in the form of embedded videos, images or text automatically are embedded.", "statustext": "At the moment this is automatic embedding:", "statuschange": "Change setting", "false": "Turned off", diff --git a/webapp/pages/settings/allow-embeds.vue b/webapp/pages/settings/allow-embeds.vue index db6e7552e..c76a50422 100644 --- a/webapp/pages/settings/allow-embeds.vue +++ b/webapp/pages/settings/allow-embeds.vue @@ -12,12 +12,12 @@ - + {{ $t('post.allowEmbeds.button-tofalse') }} - + {{ $t('post.allowEmbeds.button-totrue') }} @@ -27,8 +27,11 @@ -
-

{{ $t('post.allowEmbeds.description') }}

+
+

+ {{ $t('post.allowEmbeds.description') }} +

+

{{ $t('post.allowEmbeds.info-description') }}

    From 846b5683f1a41ddbff238ff1709ed30cb727456d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2019 20:04:33 +0000 Subject: [PATCH 30/50] build(deps-dev): bump @babel/preset-env from 7.6.2 to 7.6.3 in /webapp Bumps [@babel/preset-env](https://github.com/babel/babel) from 7.6.2 to 7.6.3. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) - [Commits](https://github.com/babel/babel/compare/v7.6.2...v7.6.3) Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index ee14a4ef0..17fd9403e 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -92,7 +92,7 @@ "devDependencies": { "@babel/core": "~7.6.3", "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/preset-env": "~7.6.2", + "@babel/preset-env": "~7.6.3", "@storybook/addon-a11y": "^5.2.3", "@storybook/addon-actions": "^5.2.3", "@storybook/vue": "~5.2.3", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 65bd0b6d5..b6dca2ca6 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -438,10 +438,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.2.tgz#96c33ab97a9ae500cc6f5b19e04a7e6553360a79" - integrity sha512-zZT8ivau9LOQQaOGC7bQLQOT4XPkPXgN2ERfUgk1X8ql+mVkLc4E8eKk+FO3o0154kxzqenWCorfmEXpEZcrSQ== +"@babel/plugin-transform-block-scoping@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" @@ -563,10 +563,10 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.2.tgz#c1ca0bb84b94f385ca302c3932e870b0fb0e522b" - integrity sha512-xBdB+XOs+lgbZc2/4F5BVDVcDNS4tcSKQc96KmlqLEAwz6tpYPEvPdmDfvVG0Ssn8lAhronaRs6Z6KSexIpK5g== +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" + integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== dependencies: regexpu-core "^4.6.0" @@ -679,10 +679,10 @@ "@babel/helper-regex" "^7.4.4" regexpu-core "^4.6.0" -"@babel/preset-env@^7.4.5", "@babel/preset-env@^7.6.2", "@babel/preset-env@~7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.2.tgz#abbb3ed785c7fe4220d4c82a53621d71fc0c75d3" - integrity sha512-Ru7+mfzy9M1/YTEtlDS8CD45jd22ngb9tXnn64DvQK3ooyqSw9K4K9DUWmYknTTVk4TqygL9dqCrZgm1HMea/Q== +"@babel/preset-env@^7.4.5", "@babel/preset-env@^7.6.2", "@babel/preset-env@~7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.3.tgz#9e1bf05a2e2d687036d24c40e4639dc46cef2271" + integrity sha512-CWQkn7EVnwzlOdR5NOm2+pfgSNEZmvGjOhlCHBDq0J8/EStr+G+FvPEiz9B56dR6MoiUFjXhfE4hjLoAKKJtIQ== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" @@ -700,7 +700,7 @@ "@babel/plugin-transform-arrow-functions" "^7.2.0" "@babel/plugin-transform-async-to-generator" "^7.5.0" "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.2" + "@babel/plugin-transform-block-scoping" "^7.6.3" "@babel/plugin-transform-classes" "^7.5.5" "@babel/plugin-transform-computed-properties" "^7.2.0" "@babel/plugin-transform-destructuring" "^7.6.0" @@ -715,7 +715,7 @@ "@babel/plugin-transform-modules-commonjs" "^7.6.0" "@babel/plugin-transform-modules-systemjs" "^7.5.0" "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.2" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.3" "@babel/plugin-transform-new-target" "^7.4.4" "@babel/plugin-transform-object-super" "^7.5.5" "@babel/plugin-transform-parameters" "^7.4.4" @@ -728,7 +728,7 @@ "@babel/plugin-transform-template-literals" "^7.4.4" "@babel/plugin-transform-typeof-symbol" "^7.2.0" "@babel/plugin-transform-unicode-regex" "^7.6.2" - "@babel/types" "^7.6.0" + "@babel/types" "^7.6.3" browserslist "^4.6.0" core-js-compat "^3.1.1" invariant "^2.2.2" From 2e13b6911c2990e12802b599ff72d4f72a400ba6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2019 05:08:06 +0000 Subject: [PATCH 31/50] build(deps): bump nodemailer from 6.3.0 to 6.3.1 in /backend Bumps [nodemailer](https://github.com/nodemailer/nodemailer) from 6.3.0 to 6.3.1. - [Release notes](https://github.com/nodemailer/nodemailer/releases) - [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodemailer/nodemailer/compare/v6.3.0...v6.3.1) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 3ddfa8d23..3a0cf6be8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -93,7 +93,7 @@ "neo4j-graphql-js": "^2.7.2", "neode": "^0.3.3", "node-fetch": "~2.6.0", - "nodemailer": "^6.3.0", + "nodemailer": "^6.3.1", "nodemailer-html-to-text": "^3.1.0", "npm-run-all": "~4.1.5", "request": "~2.88.0", diff --git a/backend/yarn.lock b/backend/yarn.lock index ea3a38991..5adc174ce 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -6182,10 +6182,10 @@ nodemailer-html-to-text@^3.1.0: dependencies: html-to-text "^5.1.1" -nodemailer@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.3.0.tgz#a89b0c62d3937bdcdeecbf55687bd7911b627e12" - integrity sha512-TEHBNBPHv7Ie/0o3HXnb7xrPSSQmH1dXwQKRaMKDBGt/ZN54lvDVujP6hKkO/vjkIYL9rK8kHSG11+G42Nhxuw== +nodemailer@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.3.1.tgz#2784beebac6b9f014c424c54dbdcc5c4d1221346" + integrity sha512-j0BsSyaMlyadEDEypK/F+xlne2K5m6wzPYMXS/yxKI0s7jmT1kBx6GEKRVbZmyYfKOsjkeC/TiMVDJBI/w5gMQ== nodemon@~1.19.3: version "1.19.3" From 8f64071931e950498c0b769206b859b579b1f270 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2019 05:16:10 +0000 Subject: [PATCH 32/50] build(deps-dev): bump cypress-cucumber-preprocessor Bumps [cypress-cucumber-preprocessor](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor) from 1.16.1 to 1.16.2. - [Release notes](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/releases) - [Changelog](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/CHANGELOG.md) - [Commits](https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/compare/v1.16.1...v1.16.2) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5427090dc..18a46e56d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "codecov": "^3.6.1", "cross-env": "^6.0.3", "cypress": "^3.4.1", - "cypress-cucumber-preprocessor": "^1.16.1", + "cypress-cucumber-preprocessor": "^1.16.2", "cypress-file-upload": "^3.3.4", "cypress-plugin-retries": "^1.3.0", "dotenv": "^8.1.0", diff --git a/yarn.lock b/yarn.lock index 8d561ef5e..231e6100e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1877,10 +1877,10 @@ cucumber@^4.2.1: util-arity "^1.0.2" verror "^1.9.0" -cypress-cucumber-preprocessor@^1.16.1: - version "1.16.1" - resolved "https://registry.yarnpkg.com/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-1.16.1.tgz#2ac7e0e53396334c052aeed8b5e61e08616f73a2" - integrity sha512-m8Z5t9hSc10kv47qK0fV/JlCboCwQVxgTa+WhnCjOPB7YBnX/en4f0O8l27yaZbZyHan7JBoJvpfzINlaOKafg== +cypress-cucumber-preprocessor@^1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-1.16.2.tgz#79e0ce7e7afa781f752711f7284a3bf48aa99ab8" + integrity sha512-jDJuQnnzrOrO+4PRt+VKFkHxHO7DplJACXOMUHLLWcL7vjlRUkIG4+QWnOkn/Py3yOhv9Rmuug8Iil5+FV8wEw== dependencies: "@cypress/browserify-preprocessor" "^2.1.1" chai "^4.1.2" From 771337a654b536f2f039f619b30c8c7ca1cccf56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Thu, 10 Oct 2019 16:39:23 +0200 Subject: [PATCH 33/50] Add Hall of Fame to README Because we are so cool! :wink: See: https://github.com/sourcerer-io/hall-of-fame --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b2f42c8b9..b5064cd0d 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Join our friendly open-source community on [Discord](https://discordapp.com/invi Just introduce yourself at `#introduce-yourself` and mention `@@Mentor` to get you onboard :neckbeard: Check out the [contribution guideline](./CONTRIBUTING.md), too! +[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/0)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/0)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/1)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/1)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/2)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/2)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/3)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/3)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/4)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/4)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/5)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/5)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/6)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/6)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/7)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/7) + ## Attributions From c3b2b4fcac7c93d2272a481bb5c16a42350d6415 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 10 Oct 2019 18:27:56 +0200 Subject: [PATCH 34/50] Structure translations based on file locations --- webapp/locales/de.json | 26 ++++++++--------- webapp/locales/en.json | 26 ++++++++--------- webapp/pages/settings.vue | 4 +-- .../settings/{allow-embeds.vue => embeds.vue} | 28 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) rename webapp/pages/settings/{allow-embeds.vue => embeds.vue} (74%) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index b7965062b..cb1b60db1 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -226,6 +226,19 @@ "success": "Konto erfolgreich gelöscht!", "pleaseConfirm": "Zerstörerische Aktion! Gib {confirm} ein, um zu bestätigen." }, + "embeds": { + "name": "Drittanbieter", + "info-description": "Wenn du zustimmst werden in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", + "description": "Du hast zugestimmt das in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", + "statustext": "Momentan ist das automatische einbinden:", + "statuschange": "Einstellung ändern", + "false": "Abgestellt", + "true": "Zugelassen", + "button-tofalse": "Abstellen", + "button-totrue": "dauerhaft zulassen", + "third-party-false": "Es wird kein Service von Drittanbietern automatisch eingebunden.", + "third-party-true": "Das einbinden der Services von Drittanbietern ist dauerhaft zugelassen und gespeichert für komende Sitzungen." + }, "organizations": { "name": "Meine Organisationen" }, @@ -343,19 +356,6 @@ "submitted": "Kommentar Gesendet", "updated": "Änderungen gespeichert" }, - "allowEmbeds": { - "name": "Drittanbieter", - "info-description": "Wenn du zustimmst werden in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", - "description": "Du hast zugestimmt das in den Beiträgen aus der folgenden Liste an Providern Fremdcode von anderen Anbietern (Drittanbietern) in Form von eingebundenen Videos, Bilder oder Text automatisch eingebunden werden.", - "statustext": "Momentan ist das automatische einbinden:", - "statuschange": "Einstellung ändern", - "false": "Abgestellt", - "true": "Zugelassen", - "button-tofalse": "Abstellen", - "button-totrue": "dauerhaft zulassen", - "third-party-false": "Es wird kein Service von Drittanbietern automatisch eingebunden.", - "third-party-true": "Das einbinden der Services von Drittanbietern ist dauerhaft zugelassen und gespeichert für komende Sitzungen." - }, "edited": "bearbeitet" }, "comment": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 162f1a0f0..af416c2c9 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -227,6 +227,19 @@ "success": "Account successfully deleted!", "pleaseConfirm": "Destructive action! Type {confirm} to confirm" }, + "embeds": { + "name": "Third party providers", + "info-description": "If you agree, the posts from the following list of providers will automatically include third-party code from other providers (third parties) in the form of embedded videos, images, or text.", + "description": "You have agreed that in the contributions from the following list of providers, foreign code from other providers (third parties) in the form of embedded videos, images or text automatically are embedded.", + "statustext": "At the moment this is automatic embedding:", + "statuschange": "Change setting", + "false": "Turned off", + "true": "Admitted", + "button-tofalse": "turn-off", + "button-totrue": "allow permanently", + "third-party-false": "It automatically integrates no third-party providers' service.", + "third-party-true": "The inclusion of third-party services is permanently allowed and stored for future sessions." + }, "organizations": { "name": "My Organizations" }, @@ -344,19 +357,6 @@ "submitted": "Comment Submitted", "updated": "Changes Saved" }, - "allowEmbeds": { - "name": "Third party providers", - "info-description": "If you agree, the posts from the following list of providers will automatically include third-party code from other providers (third parties) in the form of embedded videos, images, or text.", - "description": "You have agreed that in the contributions from the following list of providers, foreign code from other providers (third parties) in the form of embedded videos, images or text automatically are embedded.", - "statustext": "At the moment this is automatic embedding:", - "statuschange": "Change setting", - "false": "Turned off", - "true": "Admitted", - "button-tofalse": "turn-off", - "button-totrue": "allow permanently", - "third-party-false": "It automatically integrates no third-party providers' service.", - "third-party-true": "The inclusion of third-party services is permanently allowed and stored for future sessions." - }, "edited": "edited" }, "comment": { diff --git a/webapp/pages/settings.vue b/webapp/pages/settings.vue index a7604ea5f..2d8ba7237 100644 --- a/webapp/pages/settings.vue +++ b/webapp/pages/settings.vue @@ -40,8 +40,8 @@ export default { path: `/settings/blocked-users`, }, { - name: this.$t('post.allowEmbeds.name'), - path: `/settings/allow-embeds`, + name: this.$t('settings.embeds.name'), + path: `/settings/embeds`, }, { name: this.$t('settings.deleteUserAccount.name'), diff --git a/webapp/pages/settings/allow-embeds.vue b/webapp/pages/settings/embeds.vue similarity index 74% rename from webapp/pages/settings/allow-embeds.vue rename to webapp/pages/settings/embeds.vue index c76a50422..f9e1abfdb 100644 --- a/webapp/pages/settings/allow-embeds.vue +++ b/webapp/pages/settings/embeds.vue @@ -1,6 +1,6 @@ diff --git a/webapp/pages/registration/signup.vue b/webapp/pages/registration/signup.vue index bfd12a045..6ba7164ca 100644 --- a/webapp/pages/registration/signup.vue +++ b/webapp/pages/registration/signup.vue @@ -1,33 +1,23 @@ From b1e01cb65a91e34da4922814ba1c98707eeeeca7 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 7 Oct 2019 23:25:49 +0200 Subject: [PATCH 42/50] refactor: better errors, introduce email constants --- .../Registration/CreateUserAccount.vue | 31 +++++++++++++------ webapp/constants/emails.js | 4 +++ webapp/locales/de.json | 4 ++- webapp/locales/en.json | 4 ++- 4 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 webapp/constants/emails.js diff --git a/webapp/components/Registration/CreateUserAccount.vue b/webapp/components/Registration/CreateUserAccount.vue index 66b63239f..3b2ec3399 100644 --- a/webapp/components/Registration/CreateUserAccount.vue +++ b/webapp/components/Registration/CreateUserAccount.vue @@ -1,10 +1,23 @@