confirm embeded iframes only frontend style

This commit is contained in:
ogerly 2019-09-23 16:11:20 +02:00
parent e4c7c1125d
commit 4b11168687
5 changed files with 65 additions and 339 deletions

View File

@ -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')

View File

@ -1,4 +1,4 @@
import findProvider from '~/json/findProvider'
import findProvider from './findProvider'
describe('Vimeo', () => {
it('matches `https://vimeo.com/showcase/2098620/video/4082288`', () => {

View File

@ -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
}
]
}
]

View File

@ -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 <b style='color:red'>kein</b> Service von Drittanbietern automatisch eingebunden.",
"third-party-true": "Das einbinden der Services von Drittanbietern ist <b style='color:red'>dauerhaft zugelassen</b> und gespeichert für komende Sitzungen."
}
},
"comment": {

View File

@ -1,94 +1,76 @@
<template>
<div>
<ds-card :header="$t('post.allowEmbeds.name')">
<ds-container width="large">
<ds-placeholder>
<h3>{{ this.allowEmbeds_h3 }}</h3>
<div>{{ this.allowEmbeds_desc }}</div>
</ds-placeholder>
</ds-container>
<p>{{ $t('post.allowEmbeds.description') }}</p>
<div>
<ds-container>
<ds-placeholder>
<ds-list ordered>
<ds-list-item>http://www.dailymotion.com</ds-list-item>
<ds-list-item>https://www.facebook.com</ds-list-item>
<ds-list-item>https://giphy.com</ds-list-item>
<ds-list-item>https://www.flickr.com</ds-list-item>
<ds-list-item>https://d.tube</ds-list-item>
<ds-list-item>https://codepen.io</ds-list-item>
<ds-list-item>http://www.meetup.com</ds-list-item>
<ds-list-item>https://mixcloud.com</ds-list-item>
<ds-list-item>https://reddit.com</ds-list-item>
<ds-list-item>http://www.slideshare.net</ds-list-item>
<ds-list-item>http://soundcloud.com</ds-list-item>
<ds-list-item>https://www.twitch.tv</ds-list-item>
<ds-list-item>http://www.twitter.com</ds-list-item>
<ds-list-item>https://vimeo.com</ds-list-item>
<ds-list-item>https://www.youtube.com</ds-list-item>
</ds-list>
</ds-placeholder>
</ds-container>
</div>
<p>{{ $t('post.allowEmbeds.statustext') }}</p>
<div>
<ds-card :header="$t('post.allowEmbeds.name')">
<p>{{ $t('post.allowEmbeds.statustext') }}</p>
<ds-container width="large">
<ds-placeholder>
<h3>{{ this.allowEmbeds_h3 }}</h3>
<div>{{ this.allowEmbeds_desc }}</div>
</ds-placeholder>
<h3 v-html="allowEmbeds_h3" />
<div v-html="allowEmbeds_desc" />
</ds-container>
<p>{{ $t('post.allowEmbeds.statuschange') }}</p>
<ds-button @click="toFalse" size="x-large">{{ $t('post.allowEmbeds.button-tofalse') }}</ds-button>
<ds-button @click="toOnlySession" size="x-large">{{ $t('post.allowEmbeds.button-toonlysession') }}</ds-button>
<ds-button @click="toTrue" size="x-large">{{ $t('post.allowEmbeds.button-totrue') }}</ds-button>
<div>
<ds-space />
<ds-space />
<p>{{ $t('post.allowEmbeds.statuschange') }}</p>
<ds-container width="large">
<ds-flex>
<ds-flex-item>
<ds-button @click="toFalse" primary :disabled="disabled">
{{ $t('post.allowEmbeds.button-tofalse') }}
</ds-button>
</ds-flex-item>
<ds-flex-item>
<ds-button @click="toTrue" danger :disabled="!disabled">
{{ $t('post.allowEmbeds.button-totrue') }}
</ds-button>
</ds-flex-item>
</ds-flex>
</ds-container>
</div>
</ds-card>
</div>
<ds-space />
<ds-space />
<div v-show="!disabled">
<p>{{ $t('post.allowEmbeds.description') }}</p>
<ds-container>
<ds-placeholder>
<ul>
<li v-for="provider in providers" :key="provider.provider_name">
{{ provider.provider_name }},
<small>{{ provider.provider_url }}</small>
</li>
</ul>
</ds-placeholder>
</ds-container>
</div>
</ds-card>
</template>
<script>
import json from '../assets/providers.json'
import axios from 'axios'
export default {
data() {
return {
allowEmbeds_h3: this.$t('post.allowEmbeds.false'),
allowEmbeds_desc: this.$t('post.allowEmbeds.third-party-false'),
allowEmbeds_h3: this.$t('post.allowEmbeds.false'),
allowEmbeds_desc: this.$t('post.allowEmbeds.third-party-false'),
disabled: true,
providers: [],
}
},
mounted() {
axios.get('../api/providers.json').then(response => {
this.providers = response.data
})
},
methods: {
toFalse: function(){
this.allowEmbeds_h3 = this.$t('post.allowEmbeds.false')
this.allowEmbeds_desc = this.$t('post.allowEmbeds.third-party-false')
toFalse: function() {
this.allowEmbeds_h3 = this.$t('post.allowEmbeds.false')
this.allowEmbeds_desc = this.$t('post.allowEmbeds.third-party-false')
this.disabled = true
},
toOnlySession: function(){
this.allowEmbeds_h3 = this.$t('post.allowEmbeds.true')
this.allowEmbeds_desc = this.$t('post.allowEmbeds.third-party-toonlysession')
toTrue: function() {
this.allowEmbeds_h3 = this.$t('post.allowEmbeds.true')
this.allowEmbeds_desc = this.$t('post.allowEmbeds.third-party-true')
this.disabled = false
},
toTrue: function(){
this.allowEmbeds_h3 = this.$t('post.allowEmbeds.true')
this.allowEmbeds_desc = this.$t('post.allowEmbeds.third-party-true')
},
fetchData(){
console.log(json);
}
},
},
}
</script>
<style lang="scss">
</style>