Comparing version 1.1.1 to 1.1.2
12
index.js
@@ -0,3 +1,13 @@ | ||
// Provide support for < Chrome 41 mainly due to CLR Browser.. | ||
String.prototype.includes || (String.prototype.includes = function() { | ||
return -1 !== String.prototype.indexOf.apply(this, arguments) | ||
}), String.prototype.startsWith || (String.prototype.startsWith = function(a, b) { | ||
return b = b || 0, this.indexOf(a, b) === b | ||
}), Object.setPrototypeOf || (Object.setPrototypeOf = function(obj, proto) { | ||
obj.__proto__ = proto; | ||
return obj; | ||
}); | ||
module.exports={ | ||
client:require("./lib/client") | ||
}; | ||
}; |
@@ -17,2 +17,25 @@ var request = require("request"); | ||
} | ||
// Inside an extension -> we cannot use jsonp! | ||
else if (_.isExtension()) { | ||
options = _.merge(options, { url: url, method: "GET", headers: {} }) | ||
// prepare request | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open(options.method, options.url, true); | ||
for(var name in options.headers) { | ||
xhr.setRequestHeader(name, options.headers[name]); | ||
} | ||
xhr.responseType = "json"; | ||
// set request handler | ||
xhr.addEventListener("load", (ev) => { | ||
if(xhr.readyState == 4) { | ||
if(xhr.status != 200) { | ||
callback(xhr.status, null, null); | ||
} else { | ||
callback(null, null, xhr.response); | ||
} | ||
} | ||
}); | ||
// submit | ||
xhr.send(); | ||
} | ||
// Inside a web application, use jsonp.. | ||
@@ -19,0 +42,0 @@ else { |
@@ -21,2 +21,4 @@ var api = require("./api"); | ||
this.clientId = _.get(this.opts.options.clientId, null); | ||
this.maxReconnectAttempts = _.get(this.opts.connection.maxReconnectAttempts, Infinity); | ||
@@ -76,12 +78,2 @@ this.maxReconnectInterval = _.get(this.opts.connection.maxReconnectInterval, 30000); | ||
// Provide support for < Chrome 41 mainly due to CLR Browser.. | ||
String.prototype.includes || (String.prototype.includes = function() { | ||
return -1 !== String.prototype.indexOf.apply(this, arguments) | ||
}), String.prototype.startsWith || (String.prototype.startsWith = function(a, b) { | ||
return b = b || 0, this.indexOf(a, b) === b | ||
}), Object.setPrototypeOf || (Object.setPrototypeOf = function(obj, proto) { | ||
obj.__proto__ = proto; | ||
return obj; | ||
}); | ||
// Handle parsed chat server message.. | ||
@@ -509,3 +501,5 @@ client.prototype.handleMessage = function handleMessage(message) { | ||
case "host_target_went_offline": | ||
case "msg_censored_broadcaster": | ||
case "msg_duplicate": | ||
case "msg_emoteonly": | ||
case "msg_verified_email": | ||
@@ -795,5 +789,5 @@ case "msg_ratelimit": | ||
} | ||
else if (msg.includes("just subscribed")) { | ||
this.emit("subscription", channel, msg.split(" ")[0]); | ||
this.emit("subscription", channel, msg.split(" ")[0], { prime: msg.includes("Twitch Prime!") }); | ||
} | ||
@@ -1083,9 +1077,14 @@ } | ||
this.emotes = sets; | ||
this.emit("emotesets", sets); | ||
this.api({ | ||
url: `/chat/emoticon_images?emotesets=${sets}`, | ||
headers: { "Authorization": `OAuth ${_.password(_.get(this.opts.identity.password, "")).replace("oauth:", "")}` } | ||
headers: { | ||
"Authorization": `OAuth ${_.password(_.get(this.opts.identity.password, "")).replace("oauth:", "")}`, | ||
"Client-ID": this.clientId | ||
} | ||
}, (err, res, body) => { | ||
if (!err) { return this.emotesets = body["emoticon_sets"] || {}; } | ||
if (!err) { | ||
this.emotesets = body["emoticon_sets"] || {}; | ||
return this.emit("emotesets", sets, this.emotesets); | ||
} | ||
setTimeout(() => { this._updateEmoteset(sets); }, 60000); | ||
@@ -1092,0 +1091,0 @@ }); |
@@ -71,3 +71,3 @@ /* | ||
var space = /\S+/g; | ||
var regex = new RegExp(_.unescapeHtml(code)); | ||
var regex = new RegExp("(\\b|^|\s)"+_.unescapeHtml(code)+"(\\b|$|\s)"); | ||
var match; | ||
@@ -74,0 +74,0 @@ |
@@ -6,3 +6,3 @@ var self = module.exports = { | ||
// Value is a boolean.. | ||
isBoolean: (obj) => { return obj === true || obj === false || toString.call(obj) === "[object Boolean]"; }, | ||
isBoolean: (obj) => { return typeof(obj) === "boolean"; }, | ||
@@ -90,4 +90,7 @@ // Value is a finite number.. | ||
inherits: (ctor, superCtor) => { | ||
ctor.super_ = superCtor; | ||
Object.setPrototypeOf(ctor.prototype, superCtor.prototype); | ||
ctor.super_ = superCtor | ||
var TempCtor = function () {}; | ||
TempCtor.prototype = superCtor.prototype; | ||
ctor.prototype = new TempCtor(); | ||
ctor.prototype.constructor = ctor; | ||
}, | ||
@@ -105,2 +108,11 @@ | ||
isExtension: () => { | ||
try { | ||
if (window.chrome && chrome.runtime && chrome.runtime.id) { return true; } | ||
return false; | ||
} catch(e) { | ||
return false; | ||
} | ||
}, | ||
// Merge two objects.. | ||
@@ -107,0 +119,0 @@ merge: (obj1, obj2) => { |
{ | ||
"name": "tmi.js", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Javascript library for the Twitch Messaging Interface.", | ||
@@ -56,3 +56,6 @@ "keywords": [ | ||
"dependencies": { | ||
"request": "2.60.0", | ||
"convert-source-map": "1.1.3", | ||
"lru-cache": "4.0.1", | ||
"punycode": "1.3.2", | ||
"request": "2.74.0", | ||
"ws": "1.0.1" | ||
@@ -59,0 +62,0 @@ }, |
@@ -29,4 +29,4 @@ # tmi.js | ||
~~~ html | ||
<!--Sourcemap: //cdn.tmijs.org/js/1.1.0/tmi.js.map--> | ||
<script src="//cdn.tmijs.org/js/1.1.1/tmi.min.js" integrity="sha384-8Q+qSu52Px9pRIc72XaZ9pFAFWO/bidhybR512f3TwwFKkdwyvF/lVKixrhp4u3h" crossorigin="anonymous"></script> | ||
<!--Sourcemap: //cdn.tmijs.org/js/1.1.2/tmi.js.map--> | ||
<script src="//cdn.tmijs.org/js/1.1.2/tmi.min.js" integrity="sha384-GONdkSqsv77zHY1cs3aAZoQJP/9wq2YBmES4prk2ZG1rUvrv3IKLFRbHqk/0CR1b" crossorigin="anonymous"></script> | ||
~~~ | ||
@@ -52,14 +52,17 @@ | ||
- Schmoopiie - [https://github.com/Schmoopiie](https://github.com/Schmoopiie) | ||
- AlcaDesign - [https://github.com/AlcaDesign](https://github.com/AlcaDesign) | ||
- ben-eb - [https://github.com/ben-eb](https://github.com/ben-eb) | ||
- AlcaDesign - [https://github.com/AlcaDesign](https://github.com/AlcaDesign) | ||
- celluj34 - [https://github.com/celluj34](https://github.com/celluj34) | ||
- d-4-ni - [https://github.com/d-4-ni](https://github.com/d-4-ni) | ||
- subperks - [https://github.com/subperks](https://github.com/subperks) | ||
- roberthartung - [https://github.com/roberthartung](https://github.com/roberthartung) | ||
- Hatsuney - [https://github.com/Hatsuney](https://github.com/Hatsuney) | ||
- UnwrittenFun - [https://github.com/UnwrittenFun](https://github.com/UnwrittenFun) | ||
- Hatsuney - [https://github.com/Hatsuney](https://github.com/Hatsuney) | ||
- Jonliney - [https://github.com/Jonliney](https://github.com/Jonliney) | ||
- justinsacbibit - [https://github.com/justinsacbibit](https://github.com/justinsacbibit) | ||
- joein3d - [https://github.com/joein3d](https://github.com/joein3d) | ||
- mertzt89 - [https://github.com/mertzt89](https://github.com/mertzt89) | ||
- artemisbot - [https://github.com/artemisbot](https://github.com/artemisbot) | ||
- egonny - [https://github.com/egonny](https://github.com/egonny) | ||
- smalls89 - [https://github.com/smalls89](https://github.com/smalls89) | ||
- subperks - [https://github.com/subperks](https://github.com/subperks) | ||
- mertzt89 - [https://github.com/mertzt89](https://github.com/mertzt89) | ||
- joein3d - [https://github.com/joein3d](https://github.com/joein3d) | ||
@@ -66,0 +69,0 @@ ## Contributing guidelines |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111170
2186
70
5
+ Addedconvert-source-map@1.1.3
+ Addedlru-cache@4.0.1
+ Addedpunycode@1.3.2
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedconvert-source-map@1.1.3(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlru-cache@4.0.1(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedpunycode@1.3.21.4.1(transitive)
+ Addedqs@6.2.4(transitive)
+ Addedrequest@2.74.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.3.4(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedyallist@2.1.2(transitive)
- Removedasn1@0.1.11(transitive)
- Removedassert-plus@0.1.5(transitive)
- Removedaws-sign2@0.5.0(transitive)
- Removedbl@1.0.3(transitive)
- Removedbluebird@2.11.0(transitive)
- Removedctype@0.5.3(transitive)
- Removedhar-validator@1.8.0(transitive)
- Removedhttp-signature@0.11.0(transitive)
- Removedqs@4.0.0(transitive)
- Removedrequest@2.60.0(transitive)
- Removedtldts@6.1.61(transitive)
- Removedtldts-core@6.1.61(transitive)
- Removedtough-cookie@5.0.0(transitive)
Updatedrequest@2.74.0