1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 01:56:55 +00:00
* Fixed: FrankerFaceZ failing to load after today's Twitch update.
This commit is contained in:
SirStendec 2020-03-09 16:30:38 -04:00
parent 0507300387
commit f48ed62454
3 changed files with 55 additions and 4 deletions

View file

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

View file

@ -50,8 +50,8 @@ export default class Twilight extends BaseSite {
}
onEnable() {
const thing = this.fine.searchTree(null, n => n.props && n.props.store),
store = this.store = thing && thing.props && thing.props.store;
const thing = this.fine.searchNode(null, n => n?.pendingProps?.store?.getState),
store = this.store = thing?.pendingProps?.store;
if ( ! store )
return new Promise(r => setTimeout(r, 50)).then(() => this.onEnable());

View file

@ -195,6 +195,57 @@ export default class Fine extends Module {
return null;
}
searchNode(node, criteria, max_depth=15, depth=0, traverse_roots = true) {
if ( ! node )
node = this.react;
else if ( node._reactInternalFiber )
node = node._reactInternalFiber;
else if ( node instanceof Node )
node = this.getReactInstance(node);
if ( ! node || node._ffz_no_scan || depth > max_depth )
return null;
if ( typeof criteria === 'string' ) {
const wrapper = this._wrappers.get(criteria);
if ( ! wrapper )
throw new Error('invalid critera');
if ( ! wrapper._class )
return null;
criteria = n => n && n.constructor === wrapper._class;
}
if ( node && criteria(node) )
return node;
if ( node.child ) {
let child = node.child;
while(child) {
const result = this.searchNode(child, criteria, max_depth, depth+1, traverse_roots);
if ( result )
return result;
child = child.sibling;
}
}
const inst = node.stateNode;
if ( traverse_roots && inst && inst.props && inst.props.root ) {
const root = inst.props.root._reactRootContainer;
if ( root ) {
let child = root._internalRoot && root._internalRoot.current || root.current;
while(child) {
const result = this.searchNode(child, criteria, max_depth, depth+1, traverse_roots);
if ( result )
return result;
child = child.sibling;
}
}
}
}
searchTree(node, criteria, max_depth=15, depth=0, traverse_roots = true) {
if ( ! node )
node = this.react;
@ -218,7 +269,7 @@ export default class Fine extends Module {
}
const inst = node.stateNode;
if ( inst && criteria(inst) )
if ( inst && criteria(inst, node) )
return inst;
if ( node.child ) {