1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-11 00:20:54 +00:00
* Added: Better support for settings profiles on the dashboard.
* Fixed: Bug with the new title-based filtering for settings profiles frequently toggling on and off.
* Fixed: Bug with settings context inheritance.
This commit is contained in:
SirStendec 2019-12-31 19:32:55 -05:00
parent 4e0ed7ddcb
commit c91822cdc9
4 changed files with 66 additions and 12 deletions

View file

@ -1,7 +1,7 @@
{
"name": "frankerfacez",
"author": "Dan Salvato LLC",
"version": "4.17.11",
"version": "4.17.12",
"description": "FrankerFaceZ is a Twitch enhancement suite.",
"license": "Apache-2.0",
"scripts": {

View file

@ -104,7 +104,7 @@ export default class SettingsContext extends EventEmitter {
_rebuildContext() {
this.__context = this.parent ?
Object.assign({}, this.parent._context, this._context) :
Object.assign({}, this.parent.__context || this.parent._context, this._context) :
this._context;
// Make sure we re-build the cache. Dependency hell.

View file

@ -313,7 +313,10 @@ export const Title = {
return () => false;
}
return ctx => ctx.title && regex.test(ctx.title)
return ctx => {
regex.lastIndex = 0;
return ctx.title && regex.test(ctx.title);
}
},
title: 'Current Title',

View file

@ -7,6 +7,8 @@
import Module from 'utilities/module';
import { get } from 'utilities/object';
import Twilight from 'site';
export default class Dashboard extends Module {
constructor(...args) {
super(...args);
@ -15,36 +17,85 @@ export default class Dashboard extends Module {
this.inject('settings');
this.inject('site.fine');
this.inject('site.channel');
this.HostBar = this.fine.define(
'sunlight-host-bar',
n => n.props && n.props.channel && n.props.hostedChannel !== undefined,
Twilight.SUNLIGHT_ROUTES
)
this.Dashboard = this.fine.define(
'dashboard',
n => n.cards && n.defaultCards && n.saveCardsConfig,
['dash']
'sunlight-dash',
n => n.getIsChannelEditor && n.getIsChannelModerator && n.getIsAdsEnabled && n.getIsSquadStreamsEnabled,
Twilight.SUNLIGHT_ROUTES
);
}
onEnable() {
this.Dashboard.on('mount', this.onUpdate, this);
this.Dashboard.on('update', this.onUpdate, this);
this.Dashboard.on('unmount', this.onUnmount, this);
this.Dashboard.on('mount', this.onDashUpdate, this);
this.Dashboard.on('update', this.onDashUpdate, this);
this.Dashboard.on('unmount', this.onDashUnmount, this);
this.HostBar.on('mount', this.onHostBarUpdate, this);
this.HostBar.on('update', this.onHostBarUpdate, this);
this.HostBar.on('unmount', this.onHostBarUnmount, this);
this.Dashboard.ready((cls, instances) => {
for(const inst of instances)
this.onUpdate(inst);
this.onDashUpdate(inst);
});
this.HostBar.ready((cls, instances) => {
for(const inst of instances)
this.onHostBarUpdate(inst);
});
}
onUpdate(inst) {
onDashUpdate(inst) {
this.settings.updateContext({
channel: get('props.channelLogin', inst),
channelID: get('props.channelID', inst)
});
}
onUnmount() {
onDashUnmount() {
this.settings.updateContext({
channel: null,
channelID: null
});
}
onHostBarUpdate(inst) {
const channel = inst.props?.channel,
source = channel?.stream || channel?.broadcastSettings;
const game = source?.game,
title = source?.title || null,
color = channel?.primaryColorHex || null;
this.channel.updateChannelColor(color);
this.settings.updateContext({
/*channel: channel?.login,
channelID: channel?.id,*/
category: game?.name,
categoryID: game?.id,
title,
channelColor: color,
hosting: !! inst.props?.hostedChannel
});
}
onHostBarUnmount() {
this.settings.updateContext({
/*channel: null,
channelID: null,*/
channelColor: null,
category: null,
categoryID: null,
title: null,
hosting: false
});
}
}