mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 01:56:55 +00:00
4.19.2
* Fixed: FrankerFaceZ failing to load after today's Twitch update.
This commit is contained in:
parent
0507300387
commit
f48ed62454
3 changed files with 55 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "frankerfacez",
|
"name": "frankerfacez",
|
||||||
"author": "Dan Salvato LLC",
|
"author": "Dan Salvato LLC",
|
||||||
"version": "4.19.1",
|
"version": "4.19.2",
|
||||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -50,8 +50,8 @@ export default class Twilight extends BaseSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnable() {
|
onEnable() {
|
||||||
const thing = this.fine.searchTree(null, n => n.props && n.props.store),
|
const thing = this.fine.searchNode(null, n => n?.pendingProps?.store?.getState),
|
||||||
store = this.store = thing && thing.props && thing.props.store;
|
store = this.store = thing?.pendingProps?.store;
|
||||||
|
|
||||||
if ( ! store )
|
if ( ! store )
|
||||||
return new Promise(r => setTimeout(r, 50)).then(() => this.onEnable());
|
return new Promise(r => setTimeout(r, 50)).then(() => this.onEnable());
|
||||||
|
|
|
@ -195,6 +195,57 @@ export default class Fine extends Module {
|
||||||
return null;
|
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) {
|
searchTree(node, criteria, max_depth=15, depth=0, traverse_roots = true) {
|
||||||
if ( ! node )
|
if ( ! node )
|
||||||
node = this.react;
|
node = this.react;
|
||||||
|
@ -218,7 +269,7 @@ export default class Fine extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
const inst = node.stateNode;
|
const inst = node.stateNode;
|
||||||
if ( inst && criteria(inst) )
|
if ( inst && criteria(inst, node) )
|
||||||
return inst;
|
return inst;
|
||||||
|
|
||||||
if ( node.child ) {
|
if ( node.child ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue