fix: auth magic
This commit is contained in:
parent
a3b982be4b
commit
5003e6572f
1 changed files with 12 additions and 8 deletions
20
src/file.ts
20
src/file.ts
|
@ -1,9 +1,10 @@
|
||||||
/* eslint-disable no-extend-native */
|
/* eslint-disable no-extend-native */
|
||||||
|
|
||||||
import scoreinfo from './scoreinfo'
|
import scoreinfo from './scoreinfo'
|
||||||
import { webpackHook, webpackGlobalOverride } from './webpack-hook'
|
import { webpackHook, webpackGlobalOverride, ALL } from './webpack-hook'
|
||||||
|
|
||||||
const AUTH_MODULE_ID = 'UeBv'
|
let AUTH_MODULE_ID: string
|
||||||
|
const AUTH_FN = '+3],22,-1044525330)'
|
||||||
const MAGIC_ARG_INDEX = 1
|
const MAGIC_ARG_INDEX = 1
|
||||||
|
|
||||||
type FileType = 'img' | 'mp3' | 'midi'
|
type FileType = 'img' | 'mp3' | 'midi'
|
||||||
|
@ -13,14 +14,17 @@ type FileType = 'img' | 'mp3' | 'midi'
|
||||||
*/
|
*/
|
||||||
let magic: Promise<string> | string = new Promise((resolve) => {
|
let magic: Promise<string> | string = new Promise((resolve) => {
|
||||||
// todo: hook module by what it does, not what it is called
|
// todo: hook module by what it does, not what it is called
|
||||||
webpackGlobalOverride(AUTH_MODULE_ID, (n, r, t) => { // override
|
webpackGlobalOverride(ALL, (n, r, t) => { // override
|
||||||
const fn = n.exports
|
const fn = n.exports
|
||||||
n.exports = (...args) => {
|
if (typeof fn === 'function' && fn.toString().includes(AUTH_FN)) {
|
||||||
if (magic instanceof Promise) {
|
AUTH_MODULE_ID = n.i
|
||||||
magic = args[MAGIC_ARG_INDEX]
|
n.exports = (...args) => {
|
||||||
resolve(magic)
|
if (magic instanceof Promise) {
|
||||||
|
magic = args[MAGIC_ARG_INDEX]
|
||||||
|
resolve(magic)
|
||||||
|
}
|
||||||
|
return fn(...args) as string
|
||||||
}
|
}
|
||||||
return fn(...args) as string
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue