1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-03 00:18:31 +00:00

Merge branch 'master' into patch-4

This commit is contained in:
Kane York 2017-09-18 14:35:46 -07:00
commit bd1051b4c1
11 changed files with 96 additions and 39 deletions

View file

@ -1,3 +1,19 @@
<div class="list-header">3.5.524 <time datetime="2017-09-15">(2017-09-15)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Tooltips for global emotes not saying where they're from.</li>
</ul>
<div class="list-header">3.5.523 <time datetime="2017-09-15">(2017-09-15)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Socket server status to the Debug menu.</li>
</ul>
<div class="list-header">3.5.522 <time datetime="2017-09-15">(2017-09-15)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Emote data should be loading properly now with the socket servers under control.</li>
<li>Fixed: Update the emoji parsing regular expression.</li>
</ul>
<div class="list-header">3.5.521 <time datetime="2017-09-15">(2017-09-15)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Changed: Hopefully a more resilient way of grabbing emote data.</li>
@ -55,16 +71,5 @@
<li>Fixed: Dark CSS tweaks for the dashboard.</li>
</ul>
<div class="list-header">3.5.511 <time datetime="2017-08-12">(2017-08-12)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Bits rendering after Twitch removed the Ember bits-tags service.</li>
</ul>
<div class="list-header">3.5.510 <time datetime="2017-08-10">(2017-08-10)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: <code>Chat Appearance > Enable Custom Badge Images</code> setting that can be used to disable custom mod badges for channels.</li>
<li>Fixed: Re-sub messages not showing in channels without custom sub badges and with <code>Chat Appearance > Old-Style Subscriber Notices</code> enabled.</li>
</ul>
<div class="list-header" id="ffz-old-news-button"><a href="#">View Older</a></div>
<div id="ffz-old-news"></div>

View file

@ -1,3 +1,14 @@
<div class="list-header">3.5.511 <time datetime="2017-08-12">(2017-08-12)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Bits rendering after Twitch removed the Ember bits-tags service.</li>
</ul>
<div class="list-header">3.5.510 <time datetime="2017-08-10">(2017-08-10)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: <code>Chat Appearance > Enable Custom Badge Images</code> setting that can be used to disable custom mod badges for channels.</li>
<li>Fixed: Re-sub messages not showing in channels without custom sub badges and with <code>Chat Appearance > Old-Style Subscriber Notices</code> enabled.</li>
</ul>
<div class="list-header">3.5.509 <time datetime="2017-08-07">(2017-08-07)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>API Changed: Throw the <code>room-recent-highlights</code> event even if the Recent Highlights feature is disabled.</li>

View file

@ -140,7 +140,14 @@ func (backend *backendInfo) SendRemoteCommand(remoteCommand, data string, auth A
if resp.StatusCode == 401 {
return "", ErrAuthorizationNeeded
} else if resp.StatusCode < 200 || resp.StatusCode > 299 { // any non-2xx
if resp.Header.Get("Content-Type") == "application/json" {
// If the Content-Type header includes a charset, ignore it.
typeStr := resp.Header.Get("Content-Type")
splitIdx := strings.IndexRune(typeStr, ';')
if ( splitIdx != -1 ) {
typeStr = strings.TrimSpace(typeStr[0:splitIdx])
}
if typeStr == "application/json" {
var err2 ErrForwardedFromBackend
err := json.Unmarshal(respBytes, &err2.JSONError)
if err != nil {

View file

@ -108,31 +108,20 @@ func callHandler(handler CommandHandler, conn *websocket.Conn, client *ClientInf
return handler(conn, client, cmsg)
}
var DebugHello = ""
// C2SHello implements the `hello` C2S Command.
// It calls SubscribeGlobal() and SubscribeDefaults() with the client, and fills out ClientInfo.Version and ClientInfo.ClientID.
func C2SHello(_ *websocket.Conn, client *ClientInfo, msg ClientMessage) (_ ClientMessage, err error) {
ary, ok := msg.Arguments.([]interface{})
if !ok {
if DebugHello != "" {
fmt.Println("Hello error: was not an array:", ary)
}
err = ErrExpectedTwoStrings
return
}
if len(ary) != 2 {
if DebugHello != "" {
fmt.Println("Hello error: array wrong length:", ary)
}
err = ErrExpectedTwoStrings
return
}
version, ok := ary[0].(string)
if !ok {
if DebugHello != "" {
fmt.Println("Hello error: version not a string:", ary)
}
err = ErrExpectedTwoStrings
return
}
@ -149,9 +138,6 @@ func C2SHello(_ *websocket.Conn, client *ClientInfo, msg ClientMessage) (_ Clien
} else if ary[1] == nil {
clientID = uuid.NewV4()
} else {
if DebugHello != "" {
fmt.Println("Hello error: client id not acceptable:", ary)
}
err = ErrExpectedTwoStrings
return
}

View file

@ -528,6 +528,7 @@ func UnmarshalClientMessage(data []byte, _ int, v interface{}) (err error) {
if spaceIdx == -1 {
out.Command = CommandPool.InternCommand(dataStr)
out.Arguments = nil
out.origArguments = ""
return nil
} else {
out.Command = CommandPool.InternCommand(dataStr[:spaceIdx])

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 )