fix: anti-detection hook
This commit is contained in:
parent
abd2498030
commit
a302a1df24
1 changed files with 11 additions and 8 deletions
13
src/btn.ts
13
src/btn.ts
|
@ -45,17 +45,20 @@ export class BtnList {
|
||||||
const textNode = [...btn.childNodes].find((x) => {
|
const textNode = [...btn.childNodes].find((x) => {
|
||||||
const txt = x.textContent as string
|
const txt = x.textContent as string
|
||||||
return txt.includes('Download') || txt.includes('Print')
|
return txt.includes('Download') || txt.includes('Print')
|
||||||
}) as Node
|
}) as HTMLSpanElement
|
||||||
|
|
||||||
const setText = (str: string): void => {
|
|
||||||
textNode.textContent = str
|
|
||||||
|
|
||||||
// Anti-detection:
|
// Anti-detection:
|
||||||
// musescore will send a track event "MSCZDOWNLOADER_INSTALLED" to its backend
|
// musescore will send a track event "MSCZDOWNLOADER_INSTALLED" to its backend
|
||||||
// if detected "Download MSCZ"
|
// if detected "Download MSCZ"
|
||||||
Object.defineProperty(textNode, 'textContent', {
|
const _property = 'textContent'
|
||||||
|
const _set = textNode['__lookupSetter__'](_property)
|
||||||
|
Object.defineProperty(textNode, _property, {
|
||||||
|
set (v) { _set.call(textNode, v) },
|
||||||
get () { return 'Download' },
|
get () { return 'Download' },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const setText = (str: string): void => {
|
||||||
|
textNode.textContent = str
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(options.name)
|
setText(options.name)
|
||||||
|
|
Loading…
Reference in a new issue