From dab05d9e67ec1acc171adba7600f02f5fcea3cc5 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Fri, 11 Oct 2019 14:01:39 +0200 Subject: [PATCH] Fix embeds settings page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dockerfile was not copying providers.json - Fix file path to providers.json - Update template to show message based on allowEmbedIframes Co-authored-by: Robert Schäfer Co-authored-by: Mike Aono --- backend/Dockerfile | 1 + .../schema/resolvers/embeds/providers.json | 257 ------------------ webapp/locales/de.json | 4 +- webapp/locales/en.json | 4 +- webapp/pages/settings/embeds.vue | 11 +- 5 files changed, 13 insertions(+), 264 deletions(-) delete mode 100644 backend/src/schema/resolvers/embeds/providers.json diff --git a/backend/Dockerfile b/backend/Dockerfile index 0d040a753..1df199c1f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -24,4 +24,5 @@ FROM base as production ENV NODE_ENV=production COPY --from=build-and-test /nitro-backend/dist ./dist COPY ./public/img/ ./public/img/ +COPY ./public/providers.json ./public/providers.json RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache diff --git a/backend/src/schema/resolvers/embeds/providers.json b/backend/src/schema/resolvers/embeds/providers.json deleted file mode 100644 index ef9f04bff..000000000 --- a/backend/src/schema/resolvers/embeds/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 3f9ed718e..c9788e591 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -244,8 +244,8 @@ "status": { "description": "Als Grundeinstellung für dich wird eingebetter Fremdcode von Drittanbietern", "disabled": { - "false": "zunächst nicht angezeigt", - "true": "sofort angezeigt" + "off": "zunächst nicht angezeigt", + "on": "sofort angezeigt" }, "change": { "question": "Soll eingebetter Fremdcode von Dritten für dich immer angezeigt werden?", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 9ed1d8d40..9d68ae6a0 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -245,8 +245,8 @@ "status": { "description": "As a default for you, embedded code of third-party providers is", "disabled": { - "false": "initially not displayed", - "true": "displayed immediately" + "off": "initially not displayed", + "on": "displayed immediately" }, "change": { "question": "Should embedded source code from third parties always be displayed to you?", diff --git a/webapp/pages/settings/embeds.vue b/webapp/pages/settings/embeds.vue index 7b85295c0..9314bb4ba 100644 --- a/webapp/pages/settings/embeds.vue +++ b/webapp/pages/settings/embeds.vue @@ -4,7 +4,12 @@ {{ $t('settings.embeds.status.description') }} - {{ $t(`settings.embeds.status.disabled.${disabled}`) }} + + . @@ -52,10 +57,10 @@ export default { } }, mounted() { - axios.get('../api/providers.json').then(response => { + axios.get('/api/providers.json').then(response => { this.providers = response.data }) - this.disabled = this.currentUser.allowEmbedIframes + if (this.currentUser.allowEmbedIframes) this.disabled = this.currentUser.allowEmbedIframes }, methods: { ...mapMutations({