Fix "disableAiTrack" patch

This commit is contained in:
redphx
2025-06-24 11:36:03 +07:00
parent 153b9e0cfe
commit 1e4294746c
3 changed files with 11 additions and 9 deletions

View File

@@ -30,8 +30,10 @@ const PATCHES = {
// Disable ApplicationInsights.track() function
disableAiTrack(str: string) {
let text = '.track=function(';
const index = str.indexOf(text);
if (index < 0 || PatcherUtils.indexOf(str, '"AppInsightsCore', index, 200) < 0) {
let index = str.indexOf('"AppInsightsCore.initialize"');
(index > -1) && (index = PatcherUtils.indexOf(str, '"AppInsightsCore.track"', index));
(index > -1) && (index = PatcherUtils.lastIndexOf(str, text, index, 300));
if (index < 0) {
return false;
}