refactor: remove unused anti-detection code

This commit is contained in:
Xmader 2020-11-10 13:47:19 -05:00
parent 1f44fcf449
commit 1cfb417c66
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
1 changed files with 3 additions and 16 deletions

View File

@ -50,22 +50,6 @@ export class BtnList {
return txt.includes('Download') || txt.includes('Print') return txt.includes('Download') || txt.includes('Print')
}) as HTMLSpanElement }) as HTMLSpanElement
// Anti-detection:
// musescore will send a track event "MSCZDOWNLOADER_INSTALLED" to its backend
// if detected "Download MSCZ"
['textContent', 'innerHTML'].forEach((_property) => {
const _set = textNode['__lookupSetter__'](_property)
Object.defineProperty(textNode, _property, {
set (v) { _set.call(textNode, v) },
get: () => {
// first time only
const t = this.antiDetectionText
this.antiDetectionText = ' '
return t
},
})
})
const setText = (str: string): void => { const setText = (str: string): void => {
textNode.textContent = str textNode.textContent = str
} }
@ -112,7 +96,10 @@ export class BtnList {
commit (): void { commit (): void {
let el = this._commit() let el = this._commit()
const observer = new MutationObserver(() => { const observer = new MutationObserver(() => {
// check if the buttons are still in document when dom updates
if (!document.contains(el)) { if (!document.contains(el)) {
// re-commit
// performance issue?
el = this._commit() el = this._commit()
} }
}) })