minimax-start

This commit is contained in:
nafer committed 2026-03-06 17:39:18 +03:00
1 parent fc889c46a8
commit 5522dc5d1d
2 files changed
+18 -51

No files matched your search

+10 -50
View File
@@ -565,63 +565,23 @@
// -------------------------------------------------------------------------
try {
const OriginalAudioContext = window.AudioContext || window.webkitAudioContext;
if (OriginalAudioContext) {
if (OriginalAudioContext && OriginalAudioContext.prototype && OriginalAudioContext.prototype.resume) {
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) {}
// Патчим prototype resume
OriginalAudioContext.prototype.resume = function() {
try {
if (this.state === 'suspended') {
return originalResume.call(this).catch(function() {});
}
return Promise.resolve();
} catch(e) {
return Promise.resolve();
}
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) {}
// -------------------------------------------------------------------------
// Готово — все патчи применены
// -------------------------------------------------------------------------