sensivity 2.5.42 → 2.5.43

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/public/js/app.js CHANGED
@@ -1,537 +1,107 @@
1
1
  const SOCKET = (typeof io !== 'undefined') ? io() : null;
2
2
  let state = {}, currentSection = 0, currentSub = 0;
3
3
  let licenseAccepted = false, cheatRunning = false, listeningKeybind = null;
4
- let espSyncTimer = null;
5
- let startWatchTimer = null, startPending = false;
6
4
 
7
- const SECTION_GROUPS = [
8
- { label: 'AIMBOT', ids: ['aim'] },
9
- { label: 'TOOLS', ids: ['misc'] },
10
- { label: 'VISUALS', ids: ['visuals'] },
11
- { label: 'PLAYERS', ids: ['playerlist', 'vehiclelist'] },
12
- { label: 'WORLD', ids: ['world', 'settings'] }
13
- ];
14
-
15
- function svgIcon(id, size) {
16
- size = size || 18;
17
- return `<svg width="${size}" height="${size}"><use href="#ic-${id}"></use></svg>`;
18
- }
5
+ function svgIcon(id, size) { size = size || 18; return `<svg width="${size}" height="${size}"><use href="#ic-${id}"></use></svg>`; }
19
6
 
20
7
  function initState() {
21
8
  if (!SCHEMA) return;
22
- SCHEMA.sections.forEach(s => (s.subs || []).forEach(sub => (sub.children || []).forEach(ch => (ch.controls || []).forEach(c => {
23
- if (!(c.key in state)) state[c.key] = c.type === 'color_checkbox' ? { value: c.def, color: [...(c.color || [1, 1, 1, 1])] } : c.def;
24
- }))));
25
- }
26
-
27
- function sectionById(id) {
28
- return SCHEMA.sections.findIndex(s => s.id === id);
29
- }
30
-
31
- function currentSubData() {
32
- const s = SCHEMA.sections[currentSection];
33
- return ((s && s.subs) || [])[currentSub] || ((s && s.subs) || [])[0];
9
+ SCHEMA.sections.forEach(s => { (s.subs || []).forEach(sub => { (sub.children || []).forEach(ch => { (ch.controls || []).forEach(c => {
10
+ if (!(c.key in state)) state[c.key] = c.type === 'color_checkbox' ? { value: c.def, color: [...(c.color || [1,1,1,1])] } : c.def;
11
+ });});});});
34
12
  }
35
13
 
36
14
  function renderSidebar() {
37
15
  const el = document.getElementById('sidebar');
38
16
  if (!SCHEMA) return;
39
- const grouped = SECTION_GROUPS.map(group => {
40
- const items = group.ids.map(id => {
41
- const index = sectionById(id);
42
- if (index < 0) return '';
43
- const s = SCHEMA.sections[index];
44
- return `<button class="tab-btn${index === currentSection ? ' active' : ''}" onclick="setSection(${index})" title="${s.label}">
45
- <span class="tab-ico">${svgIcon(s.icon, 18)}</span>
46
- <span class="tab-label">${s.label}</span>
47
- </button>`;
48
- }).join('');
49
- return items ? `<div class="nav-group"><div class="nav-heading">${group.label}</div>${items}</div>` : '';
50
- }).join('');
51
-
52
- el.innerHTML = `
53
- <div class="brand"><img src="/assets/logo.png" alt="Sensivity"><span>SENSIVITY</span></div>
54
- <div class="nav-scroll">${grouped}</div>`;
17
+ el.innerHTML = SCHEMA.sections.map((s, i) =>
18
+ `<button class="tab-btn${i===currentSection?' active':''}" onclick="setSection(${i})" title="${s.label}">${svgIcon(s.icon,19)}</button>`
19
+ ).join('');
55
20
  }
56
21
 
57
22
  function renderTopbar() {
58
- const s = SCHEMA.sections[currentSection];
59
- const subs = s.subs || [];
60
- const sub = currentSubData();
23
+ const s = SCHEMA.sections[currentSection], subs = s.subs || [], sub = subs[currentSub] || subs[0];
61
24
  document.getElementById('topbar').innerHTML = `
62
- <div class="top-title">
63
- <span class="tb-icon">${svgIcon((sub && sub.icon) || s.icon, 17)}</span>
64
- <div>
65
- <span class="top-primary">${s.label}</span>
66
- <span class="top-secondary">${sub ? sub.label : ''}</span>
67
- </div>
68
- </div>
69
- <div class="sub-tabs">
70
- ${subs.map((x, i) => `<button class="sub-tab${i === currentSub ? ' active' : ''}" onclick="setSub(${i})">${x.label}</button>`).join('')}
71
- </div>
72
- <div class="profile-dot"><img src="/assets/logo.png" alt=""></div>`;
25
+ ${sub&&sub.icon?`<span class="tb-icon">${svgIcon(sub.icon,16)}</span>`:''}
26
+ <span class="title">${s.label}</span><span class="sep">/</span><span class="sub">${sub?sub.label:''}</span>
27
+ ${subs.length>1?`<select onchange="setSub(this.value)">${subs.map((x,i)=>`<option value="${i}"${i===currentSub?' selected':''}>${x.label}</option>`).join('')}</select>`:''}`;
73
28
  }
74
29
 
75
30
  function renderPage() {
76
- const sub = currentSubData();
31
+ const sub = (SCHEMA.sections[currentSection].subs||[])[currentSub];
77
32
  const pg = document.getElementById('pages');
78
- const showPreview = shouldShowEspPreview();
79
- const workspace = document.getElementById('workspace');
80
- if (workspace) workspace.classList.toggle('has-preview', showPreview);
81
- if (!sub || !sub.children || !sub.children.length) {
82
- pg.innerHTML = '<div class="child empty-state">No settings</div>';
83
- renderEspPreviewShell(false);
84
- return;
85
- }
86
-
87
- const children = sub.children.map(renderChild).join('');
88
- pg.innerHTML = children;
89
- renderEspPreviewShell(showPreview);
90
- }
91
-
92
- function renderChild(ch) {
93
- const controls = ch.controls || [];
94
- if (ch.id === 'worldTeleport') {
95
- const left = controls.slice(0, 3);
96
- const right = controls.slice(3);
97
- return `<div class="child split-child world-teleport-card"><h3>${ch.label}</h3><div class="split-controls"><div class="split-left">${left.map(ctrl).join('')}</div><div class="split-right">${right.map(ctrl).join('')}</div></div></div>`;
98
- }
99
- return `<div class="child"><h3>${ch.label}</h3>${controls.map(ctrl).join('')}</div>`;
100
- }
101
-
102
- function prettyLabel(key) {
103
- return String(key).replace(/^Enable\s+/i, '').replace(/\s+ESP$/i, ' ESP');
33
+ if (!sub||!sub.children||!sub.children.length) { pg.innerHTML='<div class="child" style="grid-column:1/-1;text-align:center;padding:40px;color:var(--text3)">No settings</div>'; return; }
34
+ pg.innerHTML = sub.children.map(ch=>`<div class="child"><h3>${ch.label}</h3>${(ch.controls||[]).map(ctrl).join('')}</div>`).join('');
104
35
  }
105
36
 
106
37
  function ctrl(c) {
107
- const v = state[c.key];
108
- const vs = c.type === 'color_checkbox' ? v?.value : v;
109
- const id = 'c_' + c.key.replace(/[^a-zA-Z0-9]/g, '_');
110
- switch (c.type) {
38
+ const v = state[c.key], vs = c.type==='color_checkbox'?v?.value:v, id = 'c_'+c.key.replace(/[^a-zA-Z0-9]/g,'_');
39
+ switch(c.type) {
111
40
  case 'checkbox':
112
- return `<div class="ctrl"><label>${prettyLabel(c.key)}</label><label class="tgl"><input type="checkbox" id="${id}"${vs ? ' checked' : ''} onchange="set('${c.key}','checkbox',this.checked)"><span class="track"><span class="knob"></span></span></label></div>`;
41
+ return `<div class="ctrl"><label>${c.key}</label><label class="tgl"><input type="checkbox" id="${id}"${vs?' checked':''} onchange="set('${c.key}','checkbox',this.checked)"><span class="track"><span class="knob"></span></span></label></div>`;
113
42
  case 'slider_int':
114
- return `<div class="ctrl range-ctrl"><label>${prettyLabel(c.key)}</label><div class="rng"><span class="rng-val">${vs || 0}</span><input type="range" id="${id}" min="${c.min || 0}" max="${c.max || 100}" value="${vs || 0}" style="--range-percent:${rangePercent(c, vs || 0)}%" oninput="sliderUp('${c.key}','slider_int',this)"></div></div>`;
43
+ return `<div class="ctrl"><label>${c.key}</label><div class="rng"><input type="range" id="${id}" min="${c.min||0}" max="${c.max||100}" value="${vs||0}" oninput="sliderUp('${c.key}','slider_int',this)"><span class="rng-val">${vs||0}</span></div></div>`;
115
44
  case 'slider_float':
116
- return `<div class="ctrl range-ctrl"><label>${prettyLabel(c.key)}</label><div class="rng"><span class="rng-val">${parseFloat(vs || 0).toFixed(1)}</span><input type="range" id="${id}" min="${c.min || 0}" max="${c.max || 100}" step="${c.step || 0.1}" value="${vs || 0}" style="--range-percent:${rangePercent(c, vs || 0)}%" oninput="sliderUp('${c.key}','slider_float',this)"></div></div>`;
45
+ return `<div class="ctrl"><label>${c.key}</label><div class="rng"><input type="range" id="${id}" min="${c.min||0}" max="${c.max||100}" step="${c.step||0.1}" value="${vs||0}" oninput="sliderUp('${c.key}','slider_float',this)"><span class="rng-val">${parseFloat(vs||0).toFixed(1)}</span></div></div>`;
117
46
  case 'dropdown':
118
- return `<div class="ctrl"><label>${prettyLabel(c.key)}</label><select id="${id}" onchange="set('${c.key}','dropdown',this.selectedIndex)">${(c.items || []).map((x, i) => `<option value="${i}"${i === vs ? ' selected' : ''}>${x}</option>`).join('')}</select></div>`;
119
- case 'color_checkbox': {
120
- const clr = v?.color || [1, 1, 1, 1], hex = colorToHex(clr);
121
- return `<div class="ctrl color-row"><label>${prettyLabel(c.key)}</label><div class="color-actions"><label class="tgl"><input type="checkbox"${v?.value ? ' checked' : ''} onchange="set('${c.key}','color_checkbox',{value:this.checked,color:(state['${c.key}']?.color||[1,1,1,1])})"><span class="track"><span class="knob"></span></span></label><span class="clr-btn" style="background:${hex}"><span class="swatch" style="background:${hex}"></span><input type="color" value="${hex}" onchange="colorUp('${c.key}',this.value)"></span></div></div>`;
122
- }
47
+ return `<div class="ctrl"><label>${c.key}</label><select id="${id}" onchange="set('${c.key}','dropdown',this.selectedIndex)">${(c.items||[]).map((x,i)=>`<option value="${i}"${i===vs?' selected':''}>${x}</option>`).join('')}</select></div>`;
48
+ case 'color_checkbox':{
49
+ const clr = v?.color||[1,1,1,1], hex = '#'+clr.slice(0,3).map(x=>('0'+Math.round(x*255).toString(16)).slice(-2)).join('');
50
+ return `<div class="ctrl"><label>${c.key}</label><label class="tgl"><input type="checkbox"${v?.value?' checked':''} onchange="set('${c.key}','color_checkbox',{value:this.checked,color:(state['${c.key}']?.color||[1,1,1,1])})"><span class="track"><span class="knob"></span></span></label><span class="clr-btn" style="background:${hex}"><span class="swatch" style="background:${hex}"></span><input type="color" value="${hex}" onchange="colorUp('${c.key}',this.value)"></span></div>`;}
123
51
  case 'keybind':
124
- return `<div class="ctrl"><label>${prettyLabel(c.key)}</label><button class="key-btn${listeningKeybind === c.key ? ' listening' : ''}" id="${id}" onclick="keyStart('${c.key}')">${vkName(vs || 0)}</button></div>`;
125
- case 'action':
126
- return `<div class="ctrl action-row"><label>${c.label || prettyLabel(c.key)}</label><button class="key-btn action-btn" id="${id}" onclick="runAction('${c.action || c.key}')">${c.button || 'Run'}</button></div>`;
127
- }
128
- return '';
52
+ return `<div class="ctrl"><label>${c.key}</label><button class="key-btn${listeningKeybind===c.key?' listening':''}" id="${id}" onclick="keyStart('${c.key}')">${vkName(vs||0)}</button></div>`;
53
+ }return '';
129
54
  }
130
55
 
131
- function set(k, t, v) {
132
- if (t === 'color_checkbox') {
133
- state[k] = state[k] || { value: false, color: [1, 1, 1, 1] };
134
- if (typeof v === 'object') state[k] = v;
135
- } else state[k] = v;
136
- if (shouldAutoEnablePlayerEsp(k, t, state[k])) {
137
- state['Enable ESP'] = true;
138
- emit('Enable ESP', 'checkbox', true);
139
- }
140
- emit(k, t, state[k]);
141
- queuePlayerEspSync(k);
142
- rerender();
143
- }
56
+ function set(k,t,v){ if(t==='color_checkbox'){state[k]=state[k]||{value:false,color:[1,1,1,1]};if(typeof v==='object')state[k]=v;}else state[k]=v; emit(k,t,state[k]); rerender(); }
57
+ function sliderUp(k,t,el){ const v=t==='slider_int'?parseInt(el.value):parseFloat(el.value); state[k]=v; el.nextElementSibling.textContent=t==='slider_int'?v:v.toFixed(1); emit(k,t,v); }
58
+ function colorUp(k,hex){ const r=parseInt(hex.slice(1,3),16)/255,g=parseInt(hex.slice(3,5),16)/255,b=parseInt(hex.slice(5,7),16)/255; const cur=state[k]||{value:false,color:[1,1,1,1]}; cur.color=[r,g,b,cur.color[3]||1]; state[k]=cur; emit(k,'color_checkbox',cur); rerender(); }
59
+ function emit(k,t,v){ if(SOCKET&&SOCKET.connected) SOCKET.emit('setConfig',{key:k,type:t,value:v}); }
60
+ function setSection(i){ currentSection=i;currentSub=0;rerender(); } function setSub(i){ currentSub=parseInt(i);rerender(); }
144
61
 
145
- function sliderUp(k, t, el) {
146
- const v = t === 'slider_int' ? parseInt(el.value) : parseFloat(el.value);
147
- state[k] = v;
148
- el.previousElementSibling.textContent = t === 'slider_int' ? v : v.toFixed(1);
149
- updateRangeFill(el);
150
- emit(k, t, v);
151
- queuePlayerEspSync(k);
152
- if (shouldShowEspPreview()) updateEspPreview();
153
- }
62
+ function rerender(){ renderSidebar();renderTopbar();renderPage(); }
154
63
 
155
- function colorUp(k, hex) {
156
- const r = parseInt(hex.slice(1, 3), 16) / 255, g = parseInt(hex.slice(3, 5), 16) / 255, b = parseInt(hex.slice(5, 7), 16) / 255;
157
- const cur = state[k] || { value: false, color: [1, 1, 1, 1] };
158
- cur.color = [r, g, b, cur.color[3] || 1];
159
- state[k] = cur;
160
- emit(k, 'color_checkbox', cur);
161
- queuePlayerEspSync(k);
162
- rerender();
64
+ function vkName(vk){
65
+ const m={0:'None',1:'LMB',2:'RMB',4:'MMB',5:'XB1',6:'XB2',8:'Back',9:'Tab',13:'Enter',16:'Shift',17:'Ctrl',18:'Alt',20:'Caps',27:'Esc',32:'Space',33:'PgUp',34:'PgDn',37:'Left',38:'Up',39:'Right',40:'Down',44:'PrtSc',45:'Ins',46:'Del',160:'LShift',161:'RShift',162:'LCtrl',163:'RCtrl',164:'LAlt',165:'RAlt'};
66
+ for(let i=48;i<=57;i++)m[i]=String(i-48); for(let i=65;i<=90;i++)m[i]=String.fromCharCode(i);
67
+ for(let i=96;i<=105;i++)m[i]='Num'+String(i-96); for(let i=112;i<=135;i++)m[i]='F'+(i-111);
68
+ return m[vk]||('VK'+vk);
163
69
  }
164
70
 
165
- function emit(k, t, v) {
166
- if (SOCKET && SOCKET.connected) SOCKET.emit('setConfig', { key: k, type: t, value: v });
167
- }
71
+ function keyStart(key){ if(listeningKeybind===key){listeningKeybind=null;rerender();return;} listeningKeybind=key;rerender(); }
72
+ function submitLicense(){ const k=document.getElementById('license-key').value.trim(); if(!k)return; const b=document.getElementById('license-btn'),m=document.getElementById('license-msg'); b.disabled=true;b.textContent='Checking...';m.textContent='';m.className='msg'; if(SOCKET)SOCKET.emit('checkLicense',k); }
168
73
 
169
- function runAction(action) {
170
- if (!SOCKET || !SOCKET.connected) {
171
- showPanelDebug('Panel connection unavailable');
172
- return;
173
- }
174
- SOCKET.emit('performAction', { action });
175
- }
74
+ document.addEventListener('keydown',function(e){ if(!listeningKeybind)return; e.preventDefault(); set(listeningKeybind,'keybind',e.keyCode); listeningKeybind=null;rerender(); });
75
+ document.addEventListener('mousedown',function(e){ if(!listeningKeybind)return; e.preventDefault(); set(listeningKeybind,'keybind',{0:1,1:4,2:2}[e.button]||0); listeningKeybind=null;rerender(); });
176
76
 
177
- function rangePercent(c, value) {
178
- const min = Number(c.min || 0);
179
- const max = Number(c.max || 100);
180
- const val = Number(value || 0);
181
- if (max <= min) return 0;
182
- return Math.max(0, Math.min(100, ((val - min) / (max - min)) * 100)).toFixed(2);
183
- }
184
-
185
- function updateRangeFill(el) {
186
- const min = Number(el.min || 0);
187
- const max = Number(el.max || 100);
188
- const val = Number(el.value || 0);
189
- const pct = max <= min ? 0 : Math.max(0, Math.min(100, ((val - min) / (max - min)) * 100));
190
- el.style.setProperty('--range-percent', pct.toFixed(2) + '%');
191
- }
192
-
193
- function visualPlayerControls() {
194
- const visuals = SCHEMA.sections.find(s => s.id === 'visuals');
195
- const player = visuals && (visuals.subs || []).find(sub => sub.id === 'vplayer');
196
- if (!player) return [];
197
- return (player.children || []).flatMap(ch => ch.controls || []);
198
- }
199
-
200
- function shouldAutoEnablePlayerEsp(key, type, value) {
201
- if (key === 'Enable ESP' || type !== 'color_checkbox') return false;
202
- if (!visualPlayerControls().some(c => c.key === key)) return false;
203
- return !!(value && value.value) && !state['Enable ESP'];
204
- }
205
-
206
- function queuePlayerEspSync(changedKey) {
207
- const controls = visualPlayerControls();
208
- if (!controls.some(c => c.key === changedKey)) return;
209
- clearTimeout(espSyncTimer);
210
- espSyncTimer = setTimeout(() => {
211
- controls.forEach(c => {
212
- if (state[c.key] !== undefined) emit(c.key, c.type, state[c.key]);
213
- });
214
- }, 35);
215
- }
216
-
217
- function setSection(i) {
218
- currentSection = i;
219
- currentSub = 0;
220
- rerender();
221
- }
77
+ function toggleCheat(){ if(!SOCKET||!SOCKET.connected)return; SOCKET.emit(cheatRunning?'stopCheat':'startCheat'); }
78
+ function updateStatus(){ const d=document.getElementById('status-dot'),t=document.getElementById('status-text'),b=document.getElementById('cheat-btn'); if(cheatRunning){ d.className='s-dot live';t.textContent='Cheat running';b.textContent='Stop';b.className='s-btn stop';}else{ d.className='s-dot';t.textContent='Ready';b.textContent='Start Cheat';b.className='s-btn';} }
222
79
 
223
- function setSub(i) {
224
- currentSub = parseInt(i, 10);
225
- rerender();
226
- }
227
-
228
- function rerender() {
229
- renderSidebar();
230
- renderTopbar();
231
- renderPage();
232
- }
233
-
234
- function vkName(vk) {
235
- const m = { 0: 'None', 1: 'LMB', 2: 'RMB', 4: 'MMB', 5: 'XB1', 6: 'XB2', 8: 'Back', 9: 'Tab', 13: 'Enter', 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 20: 'Caps', 27: 'Esc', 32: 'Space', 33: 'PgUp', 34: 'PgDn', 37: 'Left', 38: 'Up', 39: 'Right', 40: 'Down', 44: 'PrtSc', 45: 'Ins', 46: 'Del', 160: 'LShift', 161: 'RShift', 162: 'LCtrl', 163: 'RCtrl', 164: 'LAlt', 165: 'RAlt' };
236
- for (let i = 48; i <= 57; i++) m[i] = String(i - 48);
237
- for (let i = 65; i <= 90; i++) m[i] = String.fromCharCode(i);
238
- for (let i = 96; i <= 105; i++) m[i] = 'Num' + String(i - 96);
239
- for (let i = 112; i <= 135; i++) m[i] = 'F' + (i - 111);
240
- return m[vk] || ('VK' + vk);
241
- }
242
-
243
- function keyStart(key) {
244
- if (listeningKeybind === key) {
245
- listeningKeybind = null;
246
- rerender();
247
- return;
248
- }
249
- listeningKeybind = key;
250
- rerender();
251
- }
252
-
253
- function submitLicense() {
254
- const k = document.getElementById('license-key').value.trim();
255
- if (!k) return;
256
- const b = document.getElementById('license-btn'), m = document.getElementById('license-msg');
257
- b.disabled = true;
258
- b.textContent = 'Checking...';
259
- m.textContent = '';
260
- m.className = 'msg';
261
- if (SOCKET) SOCKET.emit('checkLicense', k);
262
- }
80
+ if(SOCKET){ SOCKET.on('connect',()=>{fetch('/api/url').then(r=>r.json()).then(d=>{if(d.url)document.getElementById('s-url').textContent=d.url}).catch(()=>{});}); SOCKET.on('licenseResult',(r)=>{ const b=document.getElementById('license-btn'),m=document.getElementById('license-msg'); b.disabled=false;b.textContent='Authenticate'; if(r.ok){ licenseAccepted=true; m.textContent=r.message||'Accepted';m.className='msg ok'; document.getElementById('cheat-btn').disabled=false; setTimeout(()=>{document.getElementById('license-overlay').style.display='none';rerender();},300); }else{ m.textContent=r.message||'Invalid key';m.className='msg err'; } }); SOCKET.on('configSync',(c)=>{Object.assign(state,c);rerender();}); SOCKET.on('status',(s)=>{cheatRunning=s.running;updateStatus();}); SOCKET.on('killed',()=>{document.body.innerHTML='<div style="display:flex;align-items:center;justify-content:center;height:100vh;color:var(--danger);font-size:18px;font-family:var(--font)">Sensivity Terminated</div>';}); SOCKET.on('ytTrigger',(d)=>{const el=document.getElementById('qr-overlay');if(d.active){el.classList.add('show');document.getElementById('qr-url').textContent=d.url;document.getElementById('qr-img').src='/api/qr.png?'+Date.now();}else{el.classList.remove('show');}}); }
263
81
 
264
- document.addEventListener('keydown', function(e) {
265
- if (!listeningKeybind) return;
266
- e.preventDefault();
267
- set(listeningKeybind, 'keybind', e.keyCode);
268
- listeningKeybind = null;
269
- rerender();
270
- });
271
-
272
- document.addEventListener('mousedown', function(e) {
273
- if (!listeningKeybind) return;
274
- e.preventDefault();
275
- set(listeningKeybind, 'keybind', { 0: 1, 1: 4, 2: 2 }[e.button] || 0);
276
- listeningKeybind = null;
277
- rerender();
278
- });
279
-
280
- function toggleCheat() {
281
- if (!SOCKET) return;
282
- const eventName = cheatRunning ? 'stopCheat' : 'startCheat';
283
- if (eventName === 'startCheat') beginPanelStartWatch();
284
- else clearPanelStartWatch();
285
- SOCKET.emit(eventName);
286
- if (!SOCKET.connected && typeof SOCKET.connect === 'function') {
287
- showPanelDebug('Panel reconnecting before start');
288
- SOCKET.connect();
289
- }
290
- }
291
-
292
- function beginPanelStartWatch() {
293
- startPending = true;
294
- clearTimeout(startWatchTimer);
295
- clearPanelDebug();
296
- updateStatus();
297
- startWatchTimer = setTimeout(() => {
298
- if (startPending && !cheatRunning) showPanelDebug('Program start did not confirm');
299
- }, 90000);
300
- }
301
-
302
- function clearPanelStartWatch() {
303
- startPending = false;
304
- clearTimeout(startWatchTimer);
305
- startWatchTimer = null;
306
- }
307
-
308
- function showPanelDebug(message) {
309
- const el = document.getElementById('debug-toast');
310
- if (!el) return;
311
- el.textContent = message;
312
- el.classList.add('show');
313
- }
314
-
315
- function clearPanelDebug() {
316
- const el = document.getElementById('debug-toast');
317
- if (!el) return;
318
- el.textContent = '';
319
- el.classList.remove('show');
320
- }
321
-
322
- function updateStatus() {
323
- const d = document.getElementById('status-dot'), t = document.getElementById('status-text'), b = document.getElementById('cheat-btn');
324
- if (startPending && !cheatRunning) {
325
- d.className = 's-dot live';
326
- t.textContent = 'Sensivity Starting...';
327
- b.textContent = 'Starting...';
328
- b.className = 's-btn';
329
- b.disabled = true;
330
- } else if (cheatRunning) {
331
- d.className = 's-dot live';
332
- t.textContent = 'Running';
333
- b.textContent = 'Stop';
334
- b.className = 's-btn stop';
335
- b.disabled = false;
336
- } else {
337
- d.className = 's-dot';
338
- t.textContent = 'Ready';
339
- b.textContent = 'Start';
340
- b.className = 's-btn';
341
- b.disabled = !licenseAccepted;
342
- }
343
- }
344
-
345
- function colorToHex(color) {
346
- return '#' + (color || [1, 1, 1]).slice(0, 3).map(x => ('0' + Math.round(Math.max(0, Math.min(1, x)) * 255).toString(16)).slice(-2)).join('');
347
- }
348
-
349
- function ctrlValue(key) {
350
- const v = state[key];
351
- return v && typeof v === 'object' && 'value' in v ? v.value : v;
352
- }
353
-
354
- function ctrlColor(key, fallback) {
355
- return colorToHex((state[key] && state[key].color) || fallback || [1, 1, 1, 1]);
356
- }
357
-
358
- function shouldShowEspPreview() {
359
- const section = SCHEMA.sections[currentSection];
360
- const sub = currentSubData();
361
- return section && section.id === 'visuals' && sub && sub.id === 'vplayer';
362
- }
363
-
364
- function renderEspPreviewCard() {
365
- return `<div class="esp-preview-panel"><h3>Live Preview</h3><div class="esp-stage" id="esp-stage">${espPreviewMarkup()}</div></div>`;
366
- }
367
-
368
- function renderEspPreviewShell(showPreview) {
369
- const shell = document.getElementById('esp-preview-shell');
370
- if (!shell) return;
371
- shell.innerHTML = showPreview ? renderEspPreviewCard() : '';
372
- }
373
-
374
- function updateEspPreview() {
375
- const stage = document.getElementById('esp-stage');
376
- if (stage) stage.innerHTML = espPreviewMarkup();
377
- }
378
-
379
- function placementClass(key) {
380
- const map = ['bottom', 'top', 'left-upper', 'right-upper', 'left-lower', 'right-lower'];
381
- return map[Number(state[key] || 0)] || 'bottom';
382
- }
383
-
384
- function espPreviewMarkup() {
385
- const espOn = !!ctrlValue('Enable ESP');
386
- const boxOn = !!ctrlValue('Enable Box ESP');
387
- const skeletonOn = !!ctrlValue('Enable Skeleton ESP');
388
- const headOn = !!ctrlValue('Enable Head ESP');
389
- const lineOn = !!ctrlValue('Enable Line ESP');
390
- const healthOn = !!ctrlValue('Enable Health Bar ESP');
391
- const armorOn = !!ctrlValue('Enable Armor Bar ESP');
392
- const tracerOn = !!ctrlValue('Enable Tracer ESP');
393
- const offscreenOn = !!ctrlValue('Enable Offscreen ESP');
394
- const nameOn = !!ctrlValue('Enable Name ESP');
395
- const idOn = !!ctrlValue('Enable ID ESP');
396
- const distOn = !!ctrlValue('Enable Distance ESP');
397
- const weaponOn = !!ctrlValue('Enable Weapon ESP');
398
- const boxColor = ctrlColor('Enable Box ESP');
399
- const skelColor = ctrlColor('Enable Skeleton ESP');
400
- const headColor = ctrlColor('Enable Head ESP');
401
- const lineColor = ctrlColor('Enable Line ESP');
402
- const healthColor = ctrlColor('Enable Health Bar ESP', [0, 1, 0, 1]);
403
- const armorColor = ctrlColor('Enable Armor Bar ESP', [0, 0.45, 1, 1]);
404
- const tracerColor = ctrlColor('Enable Tracer ESP');
405
- const offscreenColor = ctrlColor('Enable Offscreen ESP', [1, 0, 0, 1]);
406
- const boxType = Number(state['Box Type'] || 0);
407
- const boxLine = Number(state['Box Line Type'] || 0);
408
- const skeletonLine = Number(state['Skeleton Line Type'] || 0);
409
- const linePlacement = Number(state['Line Placement'] || 0);
410
- const boxThickness = Number(state['Box Line Thickness'] || 1);
411
- const skeletonThickness = Number(state['Skeleton Line Thickness'] || 1);
412
- const headSize = Number(state['Head Size'] || 10);
413
- const lineThickness = Number(state['Line Thickness'] || 1);
414
- const tracerThickness = Number(state['Tracer Thickness'] || 2);
415
-
416
- return `
417
- <div class="esp-grid-bg"></div>
418
- <div class="esp-horizon"></div>
419
- <div class="esp-crosshair"></div>
420
- <div class="esp-target ${espOn ? 'is-on' : 'is-off'}">
421
- ${boxOn ? `<div class="esp-box ${boxType ? 'corner' : 'full'} ${boxLine ? 'solid' : 'dashed'}" style="--esp-color:${boxColor};--esp-thick:${Math.max(1, Math.min(6, boxThickness))}px"></div>` : ''}
422
- ${healthOn ? `<div class="esp-bar health" style="--esp-color:${healthColor}"><span></span></div>` : ''}
423
- ${armorOn ? `<div class="esp-bar armor" style="--esp-color:${armorColor}"><span></span></div>` : ''}
424
- ${headOn ? `<div class="esp-head" style="--esp-color:${headColor};--head-size:${Math.max(8, Math.min(42, headSize))}px"></div>` : ''}
425
- ${skeletonOn ? `<div class="esp-skeleton ${skeletonLine ? 'solid' : 'dashed'}" style="--esp-color:${skelColor};--esp-thick:${Math.max(1, Math.min(6, skeletonThickness))}px"><span class="spine"></span><span class="arms"></span><span class="leg left"></span><span class="leg right"></span></div>` : ''}
426
- ${nameOn ? `<span class="esp-text ${placementClass('Name Placement')}" style="--esp-color:${ctrlColor('Enable Name ESP')}">Player_24</span>` : ''}
427
- ${idOn ? `<span class="esp-text ${placementClass('ID Placement')}" style="--esp-color:${ctrlColor('Enable ID ESP')}">ID 182</span>` : ''}
428
- ${distOn ? `<span class="esp-text ${placementClass('Distance Placement')}" style="--esp-color:${ctrlColor('Enable Distance ESP')}">128m</span>` : ''}
429
- ${weaponOn ? `<span class="esp-text ${placementClass('Weapon Placement')}" style="--esp-color:${ctrlColor('Enable Weapon ESP')}">Rifle</span>` : ''}
430
- </div>
431
- ${lineOn ? `<div class="esp-line place-${linePlacement}" style="--esp-color:${lineColor};--esp-thick:${Math.max(1, Math.min(8, lineThickness))}px"></div>` : ''}
432
- ${tracerOn ? `<div class="esp-tracer" style="--esp-color:${tracerColor};--esp-thick:${Math.max(1, Math.min(8, tracerThickness))}px"></div>` : ''}
433
- ${offscreenOn ? `<div class="esp-offscreen" style="--esp-color:${offscreenColor}"></div>` : ''}
434
- <div class="esp-caption">${espOn ? 'ESP Enabled' : 'ESP Disabled'}</div>`;
435
- }
436
-
437
- if (SOCKET) {
438
- SOCKET.on('connect', () => {
439
- fetch('/api/url').then(r => r.json()).then(d => {
440
- if (d.url) document.getElementById('s-url').textContent = d.url;
441
- }).catch(() => {});
442
- });
443
- SOCKET.on('licenseResult', (r) => {
444
- const b = document.getElementById('license-btn'), m = document.getElementById('license-msg');
445
- b.disabled = false;
446
- b.textContent = 'Authenticate';
447
- if (r.ok) {
448
- licenseAccepted = true;
449
- m.textContent = r.message || 'Accepted';
450
- m.className = 'msg ok';
451
- document.getElementById('cheat-btn').disabled = false;
452
- setTimeout(() => {
453
- document.getElementById('license-overlay').style.display = 'none';
454
- rerender();
455
- }, 300);
456
- } else {
457
- m.textContent = r.message || 'Invalid key';
458
- m.className = 'msg err';
459
- }
460
- });
461
- SOCKET.on('configSync', (c) => { Object.assign(state, c); rerender(); });
462
- SOCKET.on('actionResult', (r) => {
463
- if (r && r.config) Object.assign(state, r.config);
464
- if (r && r.ok) {
465
- clearPanelDebug();
466
- } else {
467
- showPanelDebug((r && r.message) || 'Action failed');
468
- }
469
- rerender();
470
- });
471
- SOCKET.on('status', (s) => {
472
- cheatRunning = s.running;
473
- const debugMessage = s.debug || s.error || s.message || '';
474
- if (s.starting) {
475
- startPending = true;
476
- clearPanelDebug();
477
- } else if (cheatRunning) {
478
- clearPanelStartWatch();
479
- clearPanelDebug();
480
- } else if (debugMessage) {
481
- clearPanelStartWatch();
482
- showPanelDebug(debugMessage);
483
- } else if (startPending) {
484
- showPanelDebug('Program inactive after start');
485
- }
486
- updateStatus();
487
- });
488
- SOCKET.on('disconnect', () => {
489
- if (startPending) showPanelDebug('Panel connection lost during start');
490
- });
491
- SOCKET.on('connect_error', () => {
492
- if (startPending) showPanelDebug('Panel connection failed during start');
493
- });
494
- SOCKET.on('killed', () => { document.body.innerHTML = '<div style="display:flex;align-items:center;justify-content:center;height:100vh;color:var(--danger);font-size:18px;font-family:var(--font)">Sensivity Terminated</div>'; });
495
- SOCKET.on('ytTrigger', (d) => {
496
- const el = document.getElementById('qr-overlay');
497
- if (d.active) {
498
- el.classList.add('show');
499
- document.getElementById('qr-url').textContent = d.url;
500
- document.getElementById('qr-img').src = '/api/qr.png?' + Date.now();
501
- } else {
502
- el.classList.remove('show');
503
- }
504
- });
505
- }
506
-
507
- function killSensivity() {
508
- if (!SOCKET || !SOCKET.connected) return;
509
- SOCKET.emit('killSensivity');
510
- }
82
+ function killSensivity(){ if(!SOCKET||!SOCKET.connected)return; SOCKET.emit('killSensivity'); }
511
83
 
512
84
  function drawQR(url) {
513
- const c = document.getElementById('qr-canvas');
514
- if (!c) return;
515
- const ctx = c.getContext('2d');
516
- const s = 8, m = 4, qrSize = 21;
517
- c.width = c.height = (qrSize + 2 * m) * s;
518
- ctx.fillStyle = '#fff';
519
- ctx.fillRect(0, 0, c.width, c.height);
520
- const hash = Array.from(url).reduce((a, ch) => ((a << 5) - a) + ch.charCodeAt(0), 0);
521
- ctx.fillStyle = '#000';
522
- for (let y = 0; y < qrSize; y++) for (let x = 0; x < qrSize; x++) {
523
- const v = (hash >> ((x * y) % 31)) & 1;
524
- const fx = x < 7 && y < 7, f2 = x > qrSize - 8 && y < 7, f3 = x < 7 && y > qrSize - 8;
525
- if (fx || f2 || f3) {
526
- const ix = fx ? x : f2 ? x - (qrSize - 7) : x, iy = fx ? y : f2 ? y : y - (qrSize - 7);
527
- if (!(ix === 0 || ix === 6 || iy === 0 || iy === 6 || (ix >= 2 && ix <= 4 && iy >= 2 && iy <= 4) || ix === 1 || ix === 5 || iy === 1 || iy === 5)) {
528
- ctx.fillRect((x + m) * s, (y + m) * s, s, s);
85
+ const c=document.getElementById('qr-canvas'),ctx=c.getContext('2d');
86
+ const s=8,m=4,qrSize=21;
87
+ c.width=c.height=(qrSize+2*m)*s;
88
+ ctx.fillStyle='#fff';ctx.fillRect(0,0,c.width,c.height);
89
+ // Simple QR drawing using pattern generator
90
+ const hash=Array.from(url).reduce((a,c)=>((a<<5)-a)+c.charCodeAt(0),0);
91
+ ctx.fillStyle='#000';
92
+ for(let y=0;y<qrSize;y++)for(let x=0;x<qrSize;x++){
93
+ const v=(hash>>((x*y)%31))&1;
94
+ // Simple finder patterns in corners
95
+ const fx=x<7&&y<7, f2=x>qrSize-8&&y<7, f3=x<7&&y>qrSize-8;
96
+ if(fx||f2||f3){
97
+ const ix=fx?x:f2?x-(qrSize-7):x, iy=fx?y:f2?y:y-(qrSize-7);
98
+ if(!(ix===0||ix===6||iy===0||iy===6||(ix>=2&&ix<=4&&iy>=2&&iy<=4)||ix===1||ix===5||iy===1||iy===5)){
99
+ ctx.fillRect((x+m)*s,(y+m)*s,s,s);
529
100
  }
530
- } else if (v && x > 0 && y > 0) {
531
- ctx.fillRect((x + m) * s, (y + m) * s, s, s);
101
+ } else if(v&&x>0&&y>0){
102
+ ctx.fillRect((x+m)*s,(y+m)*s,s,s);
532
103
  }
533
104
  }
534
105
  }
535
106
 
536
- initState();
537
- rerender();
107
+ initState(); rerender();