1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-25 03:58:30 +00:00
* Experiment Changed: This release just changes the parameters of the MQTT pubsub experiment, but otherwise has no changes.
This commit is contained in:
SirStendec 2023-10-30 14:01:28 -04:00
parent f1be0ea60c
commit 0460c02994
8 changed files with 20 additions and 13 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "frankerfacez", "name": "frankerfacez",
"author": "Dan Salvato LLC", "author": "Dan Salvato LLC",
"version": "4.56.0", "version": "4.56.1",
"description": "FrankerFaceZ is a Twitch enhancement suite.", "description": "FrankerFaceZ is a Twitch enhancement suite.",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",

View file

@ -164,8 +164,8 @@ export default class ExperimentManager extends Module {
onEnable() { onEnable() {
this.on('socket:command:reload_experiments', this.loadExperiments, this); this.on('pubsub:command:reload_experiments', this.loadExperiments, this);
this.on('socket:command:update_experiment', this.updateExperiment, this); this.on('pubsub:command:update_experiment', this.updateExperiment, this);
} }

View file

@ -638,7 +638,9 @@ export default class Emotes extends Module {
} }
} }
this.on('socket:command:follow_sets', this.updateFollowSets, this); this.on('pubsub:command:follow_sets', this.updateFollowSets, this);
// TODO: Implement emote updates.
this.on('chat:reload-data', flags => { this.on('chat:reload-data', flags => {
if ( ! flags || flags.emotes ) if ( ! flags || flags.emotes )

View file

@ -33,7 +33,7 @@ export default class Room {
this.manager.room_ids[id] = this; this.manager.room_ids[id] = this;
if ( id && this.manager.pubsub ) if ( id && this.manager.pubsub )
this.manager.pubsub.subscribe(this, `twitch/${id}/chat`); this.manager.pubsub.subscribe(this, `twitch/${id}`);
this.manager.emit(':room-add', this); this.manager.emit(':room-add', this);
this.load_data(); this.load_data();
@ -85,7 +85,7 @@ export default class Room {
} }
if ( this._id && this.manager.pubsub ) if ( this._id && this.manager.pubsub )
this.manager.pubsub.unsubscribe(this, `twitch/${this._id}/chat`); this.manager.pubsub.unsubscribe(this, `twitch/${this._id}`);
if ( this.manager.room_ids[this._id] === this ) if ( this.manager.room_ids[this._id] === this )
this.manager.room_ids[this._id] = null; this.manager.room_ids[this._id] = null;

View file

@ -232,7 +232,7 @@ export default class MainMenu extends Module {
this.scheduleUpdate(); this.scheduleUpdate();
}); });
this.on('socket:command:new_version', version => { this.on('pubsub:command:new_version', version => {
if ( version === window.FrankerFaceZ.version_info.commit ) if ( version === window.FrankerFaceZ.version_info.commit )
return; return;

View file

@ -64,12 +64,16 @@ export default class PubSub extends Module {
onEnable() { onEnable() {
this.on('experiments:changed:cf_pubsub', this._updateSetting, this); this.on('experiments:changed:cf_pubsub', this._updateSetting, this);
this.subscribe(null, 'global');
this.connect(); this.connect();
} }
onDisable() { onDisable() {
this.disconnect(); this.disconnect();
this.unsubscribe(null, 'global');
this.off('experiments:changed:cf_pubsub', this._updateSetting, this); this.off('experiments:changed:cf_pubsub', this._updateSetting, this);
} }
@ -159,14 +163,15 @@ export default class PubSub extends Module {
data = event.data; data = event.data;
if ( ! data?.cmd ) { if ( ! data?.cmd ) {
this.log.warn(`Received invalid PubSub message on topic "${topic}":`, data); this.log.debug(`Received message on topic "${topic}":`, data);
this.emit(`pubsub:message`, topic, data);
return; return;
} }
data.topic = topic; data.topic = topic;
this.log.debug(`Received command on topic "${topic}" for command "${data.cmd}":`, data.data); this.log.debug(`Received command on topic "${topic}" for command "${data.cmd}":`, data.data);
this.emit(`socket:command:${data.cmd}`, data.data, data); this.emit(`pubsub:command:${data.cmd}`, data.data, data);
}); });
// Subscribe to topics. // Subscribe to topics.

View file

@ -307,7 +307,7 @@ export default class Channel extends Module {
return; return;
if ( this._subbed_id ) { if ( this._subbed_id ) {
this.pubsub.unsubscribe(this, `twitch/${this._subbed_id}/channel`); this.pubsub.unsubscribe(this, `twitch/${this._subbed_id}`);
this._subbed_id = null; this._subbed_id = null;
} }
@ -317,7 +317,7 @@ export default class Channel extends Module {
} }
if ( id ) { if ( id ) {
this.pubsub.subscribe(this, `twitch/${id}/channel`); this.pubsub.subscribe(this, `twitch/${id}`);
this._subbed_id = id; this._subbed_id = id;
} }

View file

@ -66,7 +66,7 @@ export default class ModView extends Module {
return; return;
if ( this._subbed_id ) { if ( this._subbed_id ) {
this.pubsub.unsubscribe(this, `twitch/${this._subbed_id}/channel/#`); this.pubsub.unsubscribe(this, `twitch/${this._subbed_id}`);
this._subbed_id = null; this._subbed_id = null;
} }
@ -76,7 +76,7 @@ export default class ModView extends Module {
} }
if ( id ) { if ( id ) {
this.pubsub.subscribe(this, `twitch/${id}/channel`); this.pubsub.subscribe(this, `twitch/${id}`);
this._subbed_id = id; this._subbed_id = id;
} }