Merge pull request #856 from glowing-bear/regex-escaping
Escape dots in plugin regexes
This commit is contained in:
commit
15131dd1d0
1 changed files with 14 additions and 14 deletions
|
@ -196,7 +196,7 @@ plugins.factory('userPlugins', function() {
|
|||
}
|
||||
};
|
||||
addMatch(message.match(/spotify:track:([a-zA-Z-0-9]{22})/g));
|
||||
addMatch(message.match(/open.spotify.com\/track\/([a-zA-Z-0-9]{22})/g));
|
||||
addMatch(message.match(/open\.spotify\.com\/track\/([a-zA-Z-0-9]{22})/g));
|
||||
return content;
|
||||
});
|
||||
|
||||
|
@ -206,7 +206,7 @@ plugins.factory('userPlugins', function() {
|
|||
* See: https://developers.google.com/youtube/player_parameters
|
||||
*/
|
||||
var youtubePlugin = new UrlPlugin('YouTube video', function(url) {
|
||||
var regex = /(?:youtube.com|youtu.be)\/(?:v\/|embed\/|watch(?:\?v=|\/))?([a-zA-Z0-9_-]+)/i,
|
||||
var regex = /(?:youtube\.com|youtu\.be)\/(?:v\/|embed\/|watch(?:\?v=|\/))?([a-zA-Z0-9_-]+)/i,
|
||||
match = url.match(regex);
|
||||
|
||||
if (match){
|
||||
|
@ -228,9 +228,9 @@ plugins.factory('userPlugins', function() {
|
|||
* See: http://www.dailymotion.com/doc/api/player.html
|
||||
*/
|
||||
var dailymotionPlugin = new Plugin('Dailymotion video', function(message) {
|
||||
var rPath = /dailymotion.com\/.*video\/([^_?# ]+)/;
|
||||
var rAnchor = /dailymotion.com\/.*#video=([^_& ]+)/;
|
||||
var rShorten = /dai.ly\/([^_?# ]+)/;
|
||||
var rPath = /dailymotion\.com\/.*video\/([^_?# ]+)/;
|
||||
var rAnchor = /dailymotion\.com\/.*#video=([^_& ]+)/;
|
||||
var rShorten = /dai\.ly\/([^_?# ]+)/;
|
||||
|
||||
var match = message.match(rPath) || message.match(rAnchor) || message.match(rShorten);
|
||||
if (match) {
|
||||
|
@ -251,8 +251,8 @@ plugins.factory('userPlugins', function() {
|
|||
* AlloCine Embedded Player
|
||||
*/
|
||||
var allocinePlugin = new Plugin('AlloCine video', function(message) {
|
||||
var rVideokast = /allocine.fr\/videokast\/video-(\d+)/;
|
||||
var rCmedia = /allocine.fr\/.*cmedia=(\d+)/;
|
||||
var rVideokast = /allocine\.fr\/videokast\/video-(\d+)/;
|
||||
var rCmedia = /allocine\.fr\/.*cmedia=(\d+)/;
|
||||
|
||||
var match = message.match(rVideokast) || message.match(rCmedia);
|
||||
if (match) {
|
||||
|
@ -359,7 +359,7 @@ plugins.factory('userPlugins', function() {
|
|||
var cloudmusicPlugin = new UrlPlugin('cloud music', function(url) {
|
||||
/* SoundCloud http://help.soundcloud.com/customer/portal/articles/247785-what-widgets-can-i-use-from-soundcloud- */
|
||||
var element;
|
||||
if (url.match(/^https?:\/\/soundcloud.com\//)) {
|
||||
if (url.match(/^https?:\/\/soundcloud\.com\//)) {
|
||||
element = angular.element('<iframe></iframe>')
|
||||
.attr('width', '100%')
|
||||
.attr('height', '120')
|
||||
|
@ -370,7 +370,7 @@ plugins.factory('userPlugins', function() {
|
|||
}
|
||||
|
||||
/* MixCloud */
|
||||
if (url.match(/^https?:\/\/([a-z]+\.)?mixcloud.com\//)) {
|
||||
if (url.match(/^https?:\/\/([a-z]+\.)?mixcloud\.com\//)) {
|
||||
element = angular.element('<iframe></iframe>')
|
||||
.attr('width', '480')
|
||||
.attr('height', '60')
|
||||
|
@ -400,7 +400,7 @@ plugins.factory('userPlugins', function() {
|
|||
* Asciinema plugin
|
||||
*/
|
||||
var asciinemaPlugin = new UrlPlugin('ascii cast', function(url) {
|
||||
var regexp = /^https?:\/\/(?:www\.)?asciinema.org\/a\/([0-9a-z]+)/i,
|
||||
var regexp = /^https?:\/\/(?:www\.)?asciinema\.org\/a\/([0-9a-z]+)/i,
|
||||
match = url.match(regexp);
|
||||
if (match) {
|
||||
var id = match[1];
|
||||
|
@ -436,7 +436,7 @@ plugins.factory('userPlugins', function() {
|
|||
// Embed GitHub gists
|
||||
var gistPlugin = new UrlPlugin('Gist', function(url) {
|
||||
// ignore trailing slashes and anchors
|
||||
var regexp = /^(https:\/\/gist\.github.com\/(?:.*?))[\/]?(?:\#.*)?$/i;
|
||||
var regexp = /^(https:\/\/gist\.github\.com\/(?:.*?))[\/]?(?:\#.*)?$/i;
|
||||
var match = url.match(regexp);
|
||||
if (match) {
|
||||
// get the URL from the match to trim away pseudo file endings and request parameters
|
||||
|
@ -457,7 +457,7 @@ plugins.factory('userPlugins', function() {
|
|||
});
|
||||
|
||||
var pastebinPlugin = new UrlPlugin('Pastebin', function(url) {
|
||||
var regexp = /^https?:\/\/pastebin.com\/([^.?]+)/i;
|
||||
var regexp = /^https?:\/\/pastebin\.com\/([^.?]+)/i;
|
||||
var match = url.match(regexp);
|
||||
if (match) {
|
||||
var id = match[1],
|
||||
|
@ -475,7 +475,7 @@ plugins.factory('userPlugins', function() {
|
|||
* sample output: https://media.giphy.com/media/feqkVgjJpYtjy/giphy.gif
|
||||
*/
|
||||
var giphyPlugin = new UrlPlugin('Giphy', function(url) {
|
||||
var regex = /^https?:\/\/giphy.com\/gifs\/.*-(.*)\/?/i;
|
||||
var regex = /^https?:\/\/giphy\.com\/gifs\/.*-(.*)\/?/i;
|
||||
// on match, id will contain the entire url in [0] and the giphy id in [1]
|
||||
var id = url.match(regex);
|
||||
if (id) {
|
||||
|
@ -522,7 +522,7 @@ plugins.factory('userPlugins', function() {
|
|||
* Vine plugin
|
||||
*/
|
||||
var vinePlugin = new UrlPlugin('Vine', function (url) {
|
||||
var regexp = /^https?:\/\/(www\.)?vine.co\/v\/([a-zA-Z0-9]+)(\/.*)?/i,
|
||||
var regexp = /^https?:\/\/(www\.)?vine\.co\/v\/([a-zA-Z0-9]+)(\/.*)?/i,
|
||||
match = url.match(regexp);
|
||||
if (match) {
|
||||
var id = match[2], embedurl = "https://vine.co/v/" + id + "/embed/simple?audio=1";
|
||||
|
|
Loading…
Reference in a new issue