fix: download pdf
This commit is contained in:
parent
125013d455
commit
7705320ce9
1 changed files with 10 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
import scoreinfo from './scoreinfo'
|
import scoreinfo from './scoreinfo'
|
||||||
import { webpackHook, webpackGlobalOverride, ALL } from './webpack-hook'
|
import { webpackHook, webpackGlobalOverride, ALL } from './webpack-hook'
|
||||||
|
|
||||||
let AUTH_MODULE_ID: string
|
let authModuleId: string
|
||||||
const AUTH_FN = '+3],22,-1044525330)'
|
const AUTH_FN = '+3],22,-1044525330)'
|
||||||
const MAGIC_ARG_INDEX = 1
|
const MAGIC_ARG_INDEX = 1
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ let magic: Promise<string> | string = new Promise((resolve) => {
|
||||||
webpackGlobalOverride(ALL, (n, r, t) => { // override
|
webpackGlobalOverride(ALL, (n, r, t) => { // override
|
||||||
const fn = n.exports
|
const fn = n.exports
|
||||||
if (typeof fn === 'function' && fn.toString().includes(AUTH_FN)) {
|
if (typeof fn === 'function' && fn.toString().includes(AUTH_FN)) {
|
||||||
AUTH_MODULE_ID = n.i
|
if (!authModuleId && n.i) {
|
||||||
|
authModuleId = n.i
|
||||||
n.exports = (...args) => {
|
n.exports = (...args) => {
|
||||||
if (magic instanceof Promise) {
|
if (magic instanceof Promise) {
|
||||||
magic = args[MAGIC_ARG_INDEX]
|
magic = args[MAGIC_ARG_INDEX]
|
||||||
|
@ -26,6 +27,7 @@ let magic: Promise<string> | string = new Promise((resolve) => {
|
||||||
return fn(...args) as string
|
return fn(...args) as string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ const getApiAuth = async (type: FileType, index: number): Promise<string> => {
|
||||||
|
|
||||||
const str = String(scoreinfo.id) + type + String(index)
|
const str = String(scoreinfo.id) + type + String(index)
|
||||||
|
|
||||||
const fn: (str: string, magic: string) => string = webpackHook(AUTH_MODULE_ID)
|
const fn: (str: string, magic: string) => string = webpackHook(authModuleId)
|
||||||
|
|
||||||
return fn(str, magic)
|
return fn(str, magic)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue