-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
82 lines (72 loc) · 2.83 KB
/
Copy pathmain.js
File metadata and controls
82 lines (72 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const { app, BrowserWindow, session, ipcMain, desktopCapturer } = require('electron');
const path = require('path');
// حالة وضع الشبح
let ghostModeEnabled = true;
// ---------------------------------------------------------
// IPC Bridge: Custom RPC Spoofer
// ---------------------------------------------------------
ipcMain.on('set-rpc', (event, data) => {
console.log('[Nova Main] Received RPC Update Request:');
console.log(`- Game Name: ${data.gameName}`);
console.log(`- Status: ${data.status}`);
console.log('[Nova Main] Mock RPC Updated Successfully!');
});
ipcMain.on('toggle-ghost-mode', (event, enabled) => {
ghostModeEnabled = enabled;
});
function createWindow () {
const win = new BrowserWindow({
width: 1200,
height: 800,
frame: false, // Frameless window
backgroundColor: '#000000',
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
contextIsolation: false // Required for DOM manipulation in Main World
}
});
// 1. User-Agent Spoofing
// خدعة لتجاوز حظر ديسكورد لمشاركة الشاشة عبر Electron
const chromeUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
win.webContents.userAgent = chromeUserAgent;
// Backend Network Interception for Ghost Mode
session.defaultSession.webRequest.onBeforeRequest(
{ urls: ['*://*.discord.com/*/typing'] },
(details, callback) => {
if (ghostModeEnabled) {
console.log('[Nova Main] Blocked typing indicator!');
callback({ cancel: true });
} else {
callback({ cancel: false });
}
}
);
win.loadURL('https://discord.com/app', { userAgent: chromeUserAgent });
win.removeMenu();
}
app.whenReady().then(() => {
// 2. Electron Screen Share Handler (WebRTC Override)
// التقاط طلب مشاركة الشاشة من المتصفح والتعامل معه برمجياً
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
desktopCapturer.getSources({ types: ['screen', 'window'] }).then((sources) => {
// اختيار أول شاشة كاملة تلقائياً أو أول نافذة متاحة
const screenSource = sources.find(s => s.id.startsWith('screen')) || sources[0];
if (screenSource) {
callback({ video: screenSource, audio: 'loopback' });
} else {
callback(); // رفض الطلب إن لم يجد شيء
}
}).catch(err => {
console.error('[Nova Main] Error fetching desktop sources:', err);
callback();
});
});
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});