@@ -10,6 +10,7 @@ const menuTemplate = require('./view/menuTemplate');
10
10
11
11
import { LogMessage } from "./model/LogMessage" ;
12
12
import { winstonLogger } from "./winstonLoggerSystem" ;
13
+ import { tweaks_geoLocationOverride , tweaks_WebRTCAnoym } from "./tweaks" ;
13
14
14
15
//BOT Loader
15
16
const puppeteer = require ( 'puppeteer' ) ;
@@ -23,6 +24,11 @@ var isOpenHeadless: boolean = false; // option for open chromium in headless mod
23
24
var isBotLaunched : boolean = false ; // flag for check whether the bot is running
24
25
var puppeteerContainer : any ; // puppeteer page object
25
26
27
+ var puppeteerCustomArgs : string [ ] = [ '--no-sandbox' , '--disable-setuid-sandbox' ] ;
28
+ if ( tweaks_WebRTCAnoym === false ) { // tweaks_WebRTCAnoym : Local IP WebRTC Anonymization for the bot. MORE INFO : tweaks.ts
29
+ puppeteerCustomArgs . push ( '--disable-features=WebRtcHideLocalIpsWithMdns' ) ;
30
+ }
31
+
26
32
const MenuItemSwitch = {
27
33
announceMsg : false ,
28
34
superAdminKey : false
@@ -65,6 +71,13 @@ ipcMain.on('room-make-action', (event: any, arg: any) => { // webRender.js
65
71
arg . password = null ;
66
72
}
67
73
hostRoomConfig = arg ;
74
+ if ( tweaks_geoLocationOverride . patch === true ) { // tweaks_geoLocationOverride : GeoLocation overriding for the room. MORE INFO : tweaks.ts
75
+ hostRoomConfig . geo = {
76
+ code : tweaks_geoLocationOverride . code
77
+ , lat : tweaks_geoLocationOverride . lat
78
+ , lon : tweaks_geoLocationOverride . lon
79
+ }
80
+ }
68
81
hostRoomConfig . maxPlayers = parseInt ( arg . maxPlayers , 10 ) ; // do type casting because conveyed maxPlayers value is string type
69
82
if ( isBotLaunched != true ) {
70
83
if ( Menu . getApplicationMenu ( ) . getMenuItemById ( 'headlessModeMenuItem' ) . checked == true ) { // if headless mode checkbox is checked
@@ -186,17 +199,12 @@ async function nodeStorageInit() {
186
199
187
200
async function bot ( hostConfig : string ) {
188
201
console . log ( '\x1b[32m%s\x1b[0m' , "The headless host has started." ) ;
202
+
189
203
//await nodeStorage.init();
190
204
191
-
192
- /*
193
- If you are hosting on a VPS using Chrome version 78 or greater
194
- then it is required to disable the Local IP WebRTC Anonymization feature for the host to work.
195
- Run chrome with the command flag --disable-features=WebRtcHideLocalIpsWithMdns to disable the feature.
196
- */
197
205
const browser = await puppeteer . launch ( {
198
206
headless : isOpenHeadless ,
199
- args : [ '--no-sandbox' , '--disable-setuid-sandbox' ] // add --disable-features=WebRtcHideLocalIpsWithMdns if you are using vps
207
+ args : puppeteerCustomArgs
200
208
} ) ;
201
209
await browser . on ( 'disconnected' , ( ) => {
202
210
clearInterval ( storageLoop ) ;
0 commit comments