mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-28 05:15:54 +00:00
4.31.6
* Fixed: Chat crashing due to Twitch's new introduction feature. This is currently done with a patch that converts such messages to the old style 'First Time Chat'. * Changed: The rich embed testing tool now supports automatic refresh when using a local development server.
This commit is contained in:
parent
dfb16c8483
commit
82878522db
4 changed files with 78 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "frankerfacez",
|
||||
"author": "Dan Salvato LLC",
|
||||
"version": "4.31.5",
|
||||
"version": "4.31.6",
|
||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
|
||||
<button
|
||||
class="tw-mg-l-1 tw-button tw-button--text"
|
||||
:class="es_waiting && 'tw-button--disabled'"
|
||||
:disabled="es_waiting"
|
||||
@click="refresh"
|
||||
>
|
||||
<span class="tw-button__text ffz-i-arrows-cw">
|
||||
|
@ -257,6 +259,7 @@ export default {
|
|||
is_custom: stuff[1],
|
||||
rich_data: null,
|
||||
raw_loading: false,
|
||||
es_waiting: false,
|
||||
raw_data: null,
|
||||
length: 0,
|
||||
|
||||
|
@ -330,14 +333,17 @@ export default {
|
|||
this.chat = this.item.getChat();
|
||||
this.settings = this.chat.resolve('settings');
|
||||
|
||||
this.chat.on('chat:update-link-resolver', this.checkRefreshRaw, this);
|
||||
this.settings.on(':changed:debug.link-resolver.source', this.updateExamples, this);
|
||||
this.updateExamples();
|
||||
|
||||
this.refreshES = debounce(this.refresh, 1000, true);
|
||||
this.rebuildData = debounce(this.rebuildData, 250);
|
||||
this.refreshRaw = debounce(this.refreshRaw, 250);
|
||||
this.onTextChange = debounce(this.onTextChange, 500);
|
||||
this.updateExamples = debounce(this.updateExamples, 500);
|
||||
this.updateEventSource = debounce(this.updateEventSource, 500);
|
||||
|
||||
this.chat.on('chat:update-link-resolver', this.checkRefreshRaw, this);
|
||||
this.settings.on(':changed:debug.link-resolver.source', this.changeProvider, this);
|
||||
this.updateExamples();
|
||||
this.updateEventSource();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
@ -361,12 +367,44 @@ export default {
|
|||
|
||||
beforeDestroy() {
|
||||
this.chat.off('chat:update-link-resolver', this.checkRefreshRaw, this);
|
||||
this.settings.off(':changed:debug.link-resolver.source', this.updateExamples, this);
|
||||
this.settings.off(':changed:debug.link-resolver.source', this.changeProvider, this);
|
||||
this.chat = null;
|
||||
this.settings = null;
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeProvider() {
|
||||
this.updateEventSource();
|
||||
this.updateExamples();
|
||||
},
|
||||
|
||||
updateEventSource() {
|
||||
const provider = this.settings.get('debug.link-resolver.source');
|
||||
if ( provider !== 'dev' ) {
|
||||
if ( this.es ) {
|
||||
this.es.close();
|
||||
this.es = null;
|
||||
}
|
||||
|
||||
this.es_waiting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.es )
|
||||
return;
|
||||
|
||||
this.es = new EventSource('https://localhost:8002/sse');
|
||||
this.es.addEventListener('error', () => {
|
||||
this.es_waiting = true;
|
||||
});
|
||||
this.es.addEventListener('message', () => {
|
||||
if ( this.es_waiting ) {
|
||||
this.es_waiting = false;
|
||||
this.refreshES();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
saveState() {
|
||||
try {
|
||||
window.history.replaceState({
|
||||
|
|
|
@ -1534,6 +1534,30 @@ export default class ChatHook extends Module {
|
|||
if ( msg.type === types.RewardGift && ! t.chat.context.get('chat.bits.show-rewards') )
|
||||
return;
|
||||
|
||||
if ( msg.type === types.CommunityIntroduction ) {
|
||||
// TODO: Make this better.
|
||||
msg = {
|
||||
type: types.Message,
|
||||
badgeDynamicData: {},
|
||||
badges: {},
|
||||
id: msg.id,
|
||||
isFirstMsg: true,
|
||||
message: msg.message,
|
||||
messageBody: msg.message,
|
||||
messageParts: [
|
||||
{type: 0, content: msg.message}
|
||||
],
|
||||
messageType: 0,
|
||||
channel: msg.channel,
|
||||
timestamp: new Date(),
|
||||
user: {
|
||||
userDisplayName: msg.displayName,
|
||||
userLogin: msg.login,
|
||||
userID: msg.userID
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if ( msg.type === types.Message ) {
|
||||
const m = t.chat.standardizeMessage(msg),
|
||||
cont = inst._ffz_connector ?? inst.ffzGetConnector();
|
||||
|
@ -2257,6 +2281,15 @@ export default class ChatHook extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
/*this.onCommunityIntroductionEvent = function(e) {
|
||||
try {
|
||||
|
||||
|
||||
} catch(err) {
|
||||
t.log.capture(err, {extra: e});
|
||||
}
|
||||
}*/
|
||||
|
||||
const old_anonsubgift = this.onAnonSubscriptionGiftEvent;
|
||||
this.onAnonSubscriptionGiftEvent = function(e) {
|
||||
try {
|
||||
|
|
|
@ -340,7 +340,7 @@ export default class Input extends Module {
|
|||
if ( inst.chatInputRef instanceof Element ) {
|
||||
const style = getComputedStyle(inst.chatInputRef),
|
||||
height = style && parseFloat(style.lineHeight || 18) || 18,
|
||||
t = height * 1 + 20,
|
||||
t = height * 1 + 20.5,
|
||||
i = Math.ceil((inst.chatInputRef.scrollHeight - t) / height),
|
||||
a = Math.min(1 + i, 4);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue