Twitch fix (#135)

* fix

* Update embed.css

* upd version from master
This commit is contained in:
George Berezhnoy 2017-01-28 17:59:57 +03:00 committed by Peter Savchenko
parent 13d9c04781
commit 81886fc563
7 changed files with 21 additions and 21 deletions

View file

@ -88,7 +88,7 @@ var codex =
codex.sanitizer = __webpack_require__(18); codex.sanitizer = __webpack_require__(18);
}; };
codex.version = ("1.3.8"); codex.version = ("1.3.09");
/** /**
* @public * @public

File diff suppressed because one or more lines are too long

View file

@ -14,4 +14,4 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
opacity: 0.5; opacity: 0.5;
} }

View file

@ -50,14 +50,14 @@ var embed = function(embed){
var services = { var services = {
vimeo: { vimeo: {
regex: /(?:http[s]?:\/\/)?(?:www.)?vimeo\.co(?:.+\/([^\/]\d+)(?:#t=[\d]+)?s?$)/, regex: /(?:http[s]?:\/\/)?(?:www.)?vimeo\.co(?:.+\/([^\/]\d+)(?:#t=[\d]+)?s?$)/,
html: "<iframe src=\"https://player.vimeo.com/video/<%= remote_id %>?title=0&byline=0\" width=\"580\" height=\"320\" frameborder=\"0\"></iframe>", html: "<iframe src=\"https://player.vimeo.com/video/<%= remote_id %>?title=0&byline=0\" style=\"width:100%;\" height=\"320\" frameborder=\"0\"></iframe>",
height: 320, height: 320,
width: 580 width: 580
}, },
youtube: { youtube: {
regex: /^.*(?:(?:youtu\.be\/)|(?:youtube\.com)\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*)(?:[\?\&]t\=(\d*)|)/, regex: /^.*(?:(?:youtu\.be\/)|(?:youtube\.com)\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*)(?:[\?\&]t\=(\d*)|)/,
html: "<iframe src=\"https://www.youtube.com/embed/<%= remote_id %>\" width=\"580\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>", html: "<iframe src=\"https://www.youtube.com/embed/<%= remote_id %>\" style=\"width:100%;\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>",
height: 320, height: 320,
width: 580 width: 580
}, },
@ -67,49 +67,49 @@ var embed = function(embed){
}, },
coub: { coub: {
regex: /https?:\/\/coub\.com\/view\/([^\/\?\&]+)/, regex: /https?:\/\/coub\.com\/view\/([^\/\?\&]+)/,
html: "<iframe src=\"//coub.com/embed/<%= remote_id %>\" width=\"580\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>", html: "<iframe src=\"//coub.com/embed/<%= remote_id %>\" style=\"width:100%;\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>",
height: 320, height: 320,
width: 580 width: 580
}, },
vine: { vine: {
regex: /https?:\/\/vine\.co\/v\/([^\/\?\&]+)/, regex: /https?:\/\/vine\.co\/v\/([^\/\?\&]+)/,
html: "<iframe src=\"https://vine.co/v/<%= remote_id %>/embed/simple/\" width=\"580\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>", html: "<iframe src=\"https://vine.co/v/<%= remote_id %>/embed/simple/\" style=\"width:100%;\" height=\"320\" frameborder=\"0\" allowfullscreen></iframe>",
height: 320, height: 320,
width: 580 width: 580
}, },
imgur: { imgur: {
regex: /https?:\/\/(?:i\.)?imgur\.com.*\/([a-zA-Z0-9]+)(?:\.gifv)?/, regex: /https?:\/\/(?:i\.)?imgur\.com.*\/([a-zA-Z0-9]+)(?:\.gifv)?/,
html: "<iframe allowfullscreen=\"true\" scrolling=\"no\" src=\"http://imgur.com/<%= remote_id %>/embed\" id=\"imgur-embed-iframe-pub-<%= remote_id %>\" class=\"imgur-embed-iframe-pub\" style=\"height: 500px; width: 540px; border: 1px solid #000\"></iframe>", html: "<iframe allowfullscreen=\"true\" scrolling=\"no\" src=\"http://imgur.com/<%= remote_id %>/embed\" id=\"imgur-embed-iframe-pub-<%= remote_id %>\" class=\"imgur-embed-iframe-pub\" style=\"height: 500px; width: 100%; border: 1px solid #000\"></iframe>",
height: 500, height: 500,
width: 540 width: 540
}, },
gfycat: { gfycat: {
regex: /https?:\/\/gfycat\.com(?:\/detail)?\/([a-zA-Z]+)/, regex: /https?:\/\/gfycat\.com(?:\/detail)?\/([a-zA-Z]+)/,
html: "<iframe src='https://gfycat.com/ifr/<%= remote_id %>' frameborder='0' scrolling='no' width='580' height='436' allowfullscreen ></iframe>", html: "<iframe src='https://gfycat.com/ifr/<%= remote_id %>' frameborder='0' scrolling='no' style=\"width:100%;\" height='436' allowfullscreen ></iframe>",
height: 436, height: 436,
width: 580 width: 580
}, },
'twitch-channel': { 'twitch-channel': {
regex: /https?:\/\/twitch.tv\/([^\/\?\&]*)/, regex: /https?:\/\/www.twitch.tv\/([^\/\?\&]*)/,
html: "<iframe src=\"https://player.twitch.tv/?channel=<%= remote_id %>\" frameborder=\"0\" allowfullscreen=\"true\" scrolling=\"no\" height=\"366\" width=\"600\"></iframe>", html: "<iframe src=\"https://player.twitch.tv/?channel=<%= remote_id %>\" frameborder=\"0\" allowfullscreen=\"true\" scrolling=\"no\" height=\"366\" style=\"width:100%;\"></iframe>",
height: 366, height: 366,
width: 600 width: 600
}, },
'twitch-video': { 'twitch-video': {
regex: /https?:\/\/www.twitch.tv\/[^\/\?\&]*\/v\/([0-9]*)/, regex: /https?:\/\/www.twitch.tv\/(?:[^\/\?\&]*\/v|videos)\/([0-9]*)/,
html: "<iframe src=\"https://player.twitch.tv/?video=v<%= remote_id %>\" frameborder=\"0\" allowfullscreen=\"true\" scrolling=\"no\" height=\"366\" width=\"600\"></iframe>", html: "<iframe src=\"https://player.twitch.tv/?video=v<%= remote_id %>\" frameborder=\"0\" allowfullscreen=\"true\" scrolling=\"no\" height=\"366\" style=\"width:100%;\"></iframe>",
height: 366, height: 366,
width: 600 width: 600
}, },
'yandex-music-album': { 'yandex-music-album': {
regex: /https?:\/\/music.yandex.ru\/album\/([0-9]*)/, regex: /https?:\/\/music.yandex.ru\/album\/([0-9]*)/,
html: "<iframe frameborder=\"0\" style=\"border:none;width:540px;height:400px;\" width=\"540\" height=\"400\" src=\"https://music.yandex.ru/iframe/#album/<%= remote_id %>/\"></iframe>", html: "<iframe frameborder=\"0\" style=\"border:none;width:540px;height:400px;\" style=\"width:100%;\" height=\"400\" src=\"https://music.yandex.ru/iframe/#album/<%= remote_id %>/\"></iframe>",
height: 400, height: 400,
width: 540 width: 540
}, },
'yandex-music-track': { 'yandex-music-track': {
regex: /https?:\/\/music.yandex.ru\/album\/([0-9]*)\/track\/([0-9]*)/, regex: /https?:\/\/music.yandex.ru\/album\/([0-9]*)\/track\/([0-9]*)/,
html: "<iframe frameborder=\"0\" style=\"border:none;width:540px;height:100px;\" width=\"540\" height=\"100\" src=\"https://music.yandex.ru/iframe/#track/<%= remote_id %>/\"></iframe>", html: "<iframe frameborder=\"0\" style=\"border:none;width:540px;height:100px;\" style=\"width:100%;\" height=\"100\" src=\"https://music.yandex.ru/iframe/#track/<%= remote_id %>/\"></iframe>",
height: 100, height: 100,
width: 540 width: 540
}, },

View file

@ -82,7 +82,7 @@ paste.patterns = [
}, },
{ {
type: 'twitch-video', type: 'twitch-video',
regex: /https?:\/\/www.twitch.tv\/[^\/\?\&]*\/v\/([0-9]*)/, regex: /https?:\/\/www.twitch.tv\/(?:[^\/\?\&]*\/v|videos)\/([0-9]*)/,
callback: embed.urlPastedCallback callback: embed.urlPastedCallback
}, },
{ {

View file

@ -350,9 +350,7 @@ var codex =
options = options || {} options = options || {}
var body = options.body var body = options.body
if (typeof input === 'string') { if (input instanceof Request) {
this.url = input
} else {
if (input.bodyUsed) { if (input.bodyUsed) {
throw new TypeError('Already read') throw new TypeError('Already read')
} }
@ -367,6 +365,8 @@ var codex =
body = input._bodyInit body = input._bodyInit
input.bodyUsed = true input.bodyUsed = true
} }
} else {
this.url = String(input)
} }
this.credentials = options.credentials || this.credentials || 'omit' this.credentials = options.credentials || this.credentials || 'omit'
@ -402,7 +402,7 @@ var codex =
function parseHeaders(rawHeaders) { function parseHeaders(rawHeaders) {
var headers = new Headers() var headers = new Headers()
rawHeaders.split('\r\n').forEach(function(line) { rawHeaders.split(/\r?\n/).forEach(function(line) {
var parts = line.split(':') var parts = line.split(':')
var key = parts.shift().trim() var key = parts.shift().trim()
if (key) { if (key) {

File diff suppressed because one or more lines are too long