vortexa64 commited on
Commit
0af4820
·
verified ·
1 Parent(s): b1fa237

Update public/index.html

Browse files
Files changed (1) hide show
  1. public/index.html +48 -12
public/index.html CHANGED
@@ -1,51 +1,87 @@
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
- <title>VPC Real Terminal</title>
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <link rel="stylesheet" href="https://unpkg.com/xterm/css/xterm.css" />
7
  <style>
8
  body {
9
- background-color: black;
10
  margin: 0;
11
- height: 100vh;
12
- overflow: hidden;
 
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  #terminal {
15
  width: 100%;
16
- height: 100vh;
 
17
  }
 
18
  #input-hack {
19
  opacity: 0;
20
  position: absolute;
 
 
21
  z-index: -1;
 
 
22
  }
23
  </style>
24
  </head>
25
  <body>
26
- <div id="terminal"></div>
27
- <textarea id="input-hack" autofocus></textarea>
 
 
 
 
 
 
 
 
 
 
28
  <script src="https://unpkg.com/xterm/lib/xterm.js"></script>
29
  <script>
30
- const term = new Terminal();
31
  const socket = new WebSocket("ws://" + location.host);
32
  const inputHack = document.getElementById("input-hack");
33
 
34
  term.open(document.getElementById('terminal'));
35
 
36
- // Focus trigger on touch
37
  term.element.addEventListener('touchstart', () => {
38
  inputHack.focus();
39
  });
40
 
41
- // Forward keypress
 
 
 
 
 
42
  inputHack.addEventListener('input', (e) => {
43
  const value = e.target.value;
44
  socket.send(value);
45
- term.write(value);
46
- e.target.value = '';
47
  });
48
 
 
49
  socket.onmessage = (event) => {
50
  term.write(event.data);
51
  };
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
4
+ <title>VPC - Virtual Private Console</title>
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <link rel="stylesheet" href="https://unpkg.com/xterm/css/xterm.css" />
7
  <style>
8
  body {
 
9
  margin: 0;
10
+ font-family: monospace;
11
+ background-color: #1e1e1e;
12
+ color: white;
13
  }
14
+
15
+ #fileManager {
16
+ background-color: #282828;
17
+ padding: 10px;
18
+ height: 20vh;
19
+ border-bottom: 2px solid #444;
20
+ }
21
+
22
+ #console {
23
+ padding: 10px;
24
+ height: 80vh;
25
+ background-color: #111;
26
+ position: relative;
27
+ }
28
+
29
  #terminal {
30
  width: 100%;
31
+ height: 100%;
32
+ border-radius: 8px;
33
  }
34
+
35
  #input-hack {
36
  opacity: 0;
37
  position: absolute;
38
+ top: 0;
39
+ left: 0;
40
  z-index: -1;
41
+ height: 1px;
42
+ width: 1px;
43
  }
44
  </style>
45
  </head>
46
  <body>
47
+ <div id="fileManager">
48
+ 📁 File Manager Panel<br/>
49
+ - secret.txt<br/>
50
+ - main.py<br/>
51
+ - vpc.log
52
+ </div>
53
+
54
+ <div id="console">
55
+ <div id="terminal"></div>
56
+ <textarea id="input-hack" autofocus></textarea>
57
+ </div>
58
+
59
  <script src="https://unpkg.com/xterm/lib/xterm.js"></script>
60
  <script>
61
+ const term = new Terminal({ fontSize: 16 });
62
  const socket = new WebSocket("ws://" + location.host);
63
  const inputHack = document.getElementById("input-hack");
64
 
65
  term.open(document.getElementById('terminal'));
66
 
67
+ // Biarkan sentuhan di terminal fokusin input textarea (buat munculin keyboard)
68
  term.element.addEventListener('touchstart', () => {
69
  inputHack.focus();
70
  });
71
 
72
+ // Atau klik manual
73
+ term.element.addEventListener('click', () => {
74
+ inputHack.focus();
75
+ });
76
+
77
+ // Saat ngetik di textarea, kirim ke server & terminal
78
  inputHack.addEventListener('input', (e) => {
79
  const value = e.target.value;
80
  socket.send(value);
81
+ e.target.value = ''; // kosongin setelah dikirim
 
82
  });
83
 
84
+ // Terima output dari backend
85
  socket.onmessage = (event) => {
86
  term.write(event.data);
87
  };