1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 18:26:57 +00:00

3.5.524. Add socket server status to the Debug menu. Update the emoji regex. Fix global emote tooltips.

This commit is contained in:
SirStendec 2017-09-17 14:21:49 -04:00
parent d208fcb3b6
commit 35ce17e3ee
8 changed files with 87 additions and 24 deletions

File diff suppressed because one or more lines are too long

View file

@ -61,7 +61,7 @@ FFZ.channel_metadata = {};
// Version
var VER = FFZ.version_info = {
major: 3, minor: 5, revision: 521,
major: 3, minor: 5, revision: 524,
toString: function() {
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
}

View file

@ -165,6 +165,7 @@ FFZ.prototype.ws_create = function() {
ws.onopen = function(e) {
f._ws_open = true;
f._ws_authenticated = false;
f._ws_delay = 0;
f.log("Socket Connected.");

View file

@ -399,8 +399,14 @@ FFZ.prototype.get_twitch_set_for = function(emote_id, callback) {
this._twitch_emote_to_set[emote_id] = null;
var f = this,
use_ss = this._ws_open && Math.random() > .5,
use_ss = this._ws_open,
timer = null,
cb = function(success, data) {
if ( timer ) {
clearTimeout(timer);
timer = null;
}
if ( ! success ) {
f._twitch_emote_to_set[emote_id] = UNSET;
return;
@ -417,9 +423,10 @@ FFZ.prototype.get_twitch_set_for = function(emote_id, callback) {
callback(set_id);
};
if ( use_ss )
if ( use_ss ) {
this.ws_send("get_emote", emote_id, cb);
else
timer = setTimeout(cb.bind(this, false, null), 1000);
} else
fetch(constants.API_SERVER = "ed/emote/" + emote_id)
.then(function(resp) {
if ( ! resp.ok )
@ -428,6 +435,8 @@ FFZ.prototype.get_twitch_set_for = function(emote_id, callback) {
cb(true, data);
})
});
return null;
}
@ -444,8 +453,14 @@ FFZ.prototype.get_twitch_set = function(set_id, callback) {
this._twitch_set_to_channel[set_id] = null;
var f = this,
use_ss = this._ws_open && Math.random() > .5,
use_ss = this._ws_open,
timer = null,
cb = function(success, data) {
if ( timer ) {
clearTimeout(timer);
timer = null;
}
if ( ! success ) {
f._twitch_set_to_channel[set_id] = UNSET;
return;
@ -456,9 +471,10 @@ FFZ.prototype.get_twitch_set = function(set_id, callback) {
callback(data || null);
};
if ( use_ss )
if ( use_ss ) {
this.ws_send("get_emote_set", set_id, cb);
else
timer = setTimeout(cb.bind(this, false, null), 1000);
} else
fetch(constants.API_SERVER + "ed/set/" + set_id)
.then(function(resp) {
if ( ! resp.ok )
@ -467,6 +483,8 @@ FFZ.prototype.get_twitch_set = function(set_id, callback) {
cb(true, data);
})
});
return null;
}
@ -568,8 +586,8 @@ FFZ.prototype.render_tooltip = function(el) {
emote_id = this.getAttribute('data-emote');
if ( emote_id ) {
set_id = f._twitch_emote_to_set[emote_id];
var set_data = set_id && f.get_twitch_set(set_id);
set_id = f.get_twitch_set_for(emote_id);
var set_data = set_id !== null && f.get_twitch_set(set_id);
emote_set = set_data && set_data.c_name;
var set_type = "Channel",

View file

@ -115,12 +115,38 @@ FFZ.debugging_blocks = {
return [
['Client ID', localStorage.ffzClientId || '<i>not set</i>'],
['Socket Server', this._ws_sock && this._ws_sock.url || '<i>disconnected</i>'],
['Authenticated', this._ws_open && this._ws_authenticated],
['Server Ping', last_ping || '<i>unknown</i>'],
['Time Offset', offset || '<i>unknown</i>']
]
}
},
socket_servers: {
order: 3,
title: 'WS Server Status',
refresh: 5000,
type: 'list',
render: function() {
var f = this;
return new Promise(function(succeed, fail) {
f.ws_send("get_server_status", null, function(s,data) {
if ( ! s )
return fail();
f._ws_authenticated = data['authenticated'];
var output = [];
for(var key in data)
if ( key !== 'authenticated' )
output.push([key, data[key]]);
succeed(output);
})
});
}
},
logviewer: {
order: 4,
title: "Logviewer Status",

View file

@ -103,9 +103,11 @@ FFZ.prototype.modify_user_emotes = function(service) {
for(var set_id in emotes) {
f.get_twitch_set(set_id);
var es = emotes[set_id] || [],
esl = es.length;
esl = es.length,
sid = typeof set_id === "number" ? set_id : parseInt(set_id);
for(var i=0; i < esl; i++)
f._twitch_emote_to_set[es[i].id] = set_id;
f._twitch_emote_to_set[es[i].id] = sid;
}
if ( f._inputv )