This commit is contained in:
nafer committed 2026-03-06 10:09:57 +03:00
1 parent 922dd223c4
commit fa80cc6cea
2 files changed
+96 -3

No files matched your search

+62
View File
@@ -560,6 +560,68 @@
}
} catch (e) {}
// -------------------------------------------------------------------------
// 26. AudioContext — автоматический resume для обхода autoplay policy
// -------------------------------------------------------------------------
try {
const OriginalAudioContext = window.AudioContext || window.webkitAudioContext;
if (OriginalAudioContext) {
const originalResume = OriginalAudioContext.prototype.resume;
const originalConstructor = OriginalAudioContext;
// Патчим конструктор чтобы автоматически resume
window.AudioContext = function(...args) {
const ctx = new originalConstructor(...args);
// Автоматически resume если suspended
if (ctx.state === 'suspended') {
try { ctx.resume(); } catch(e) {}
}
return ctx;
};
window.AudioContext.prototype = originalConstructor.prototype;
if (window.webkitAudioContext) {
window.webkitAudioContext = window.AudioContext;
}
}
} catch (e) {}
// -------------------------------------------------------------------------
// 27. Скрываем факт использования расширений от content scripts detection
// -------------------------------------------------------------------------
try {
// Некоторые антифроды проверяют chrome.runtime.id — если он есть, значит расширение
// Мы уже определили chrome.runtime выше, но убедимся что id = undefined
if (window.chrome && window.chrome.runtime) {
Object.defineProperty(window.chrome.runtime, 'id', {
get: () => undefined,
configurable: true,
});
}
} catch (e) {}
// -------------------------------------------------------------------------
// 28. Скрываем sourceURL в стеке вызовов (anti-extension detection)
// -------------------------------------------------------------------------
try {
const originalError = Error;
const originalPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = function(error, stack) {
// Фильтруем фреймы, содержащие chrome-extension://
const filteredStack = stack.filter(frame => {
const fileName = frame.getFileName();
return !fileName || !fileName.startsWith('chrome-extension://');
});
if (originalPrepareStackTrace) {
return originalPrepareStackTrace(error, filteredStack);
}
return filteredStack.map(frame => ` at ${frame}`).join('\n');
};
} catch (e) {}
// -------------------------------------------------------------------------
// Готово — все патчи применены
// -------------------------------------------------------------------------