-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdashboard.html
107 lines (103 loc) · 4.97 KB
/
dashboard.html
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="dashboardStyle.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
<link href="https://unpkg.com/xterm/css/xterm.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/xterm@4.11.0/lib/xterm.js"></script>
<title>Auto Sniper</title>
<style>
#terminal {
width: 90%;
height: 90%;
font-size: 20px;
font-family: "VT323";
overflow: hidden;
}
.xterm-viewport{
overflow: hidden;
display:none;
}
</style>
</head>
<body>
<div class="outer-container">
<div class="container">
<div class="section" id="section1">
<h2>Current Positions</h2>
<div class="content">
Coin Price:
<div class="sub-content">Marketcap: </div>
</div>
</div>
<div class="section" id="section2">
<h2>Chart</h2>
<div class="content"></div>
</div>
<div class="section" id="section3">
<h2>P&L</h2>
<div class="content">
Total SOL Gained/Lost:
<div class="sub-content">Total SOL in: </div>
</div>
</div>
<div class="section" id="section4">
<h2>Terminal</h2>
<div id="terminal"></div>
<link href="https://cdn.jsdelivr.net/npm/meslo@1.0.0/meslo.min.css" rel="stylesheet">
<script>
const term = new Terminal({
theme: {
background: '#121212', // Ensure this matches the CSS background color
foreground: '#038901' // Optional: Ensure text color matches CSS
}
});
const shellprompt = 'root@XTerm:~# ';
let inputBuffer = ''; // Buffer to store terminal input
function handleCommand(input) {
let output = '';
// Check for specific commands
switch (input.trim()) {
case 'help':
output = 'Available commands: help, greet';
break;
case 'greet':
output = 'Hello, welcome to the terminal!';
break;
default:
output = `Command not found: ${input}`;
}
return output;
}
term.onKey(({ key, domEvent }) => {
console.log(key.charCodeAt(0)); // Debugging: log ASCII value of each keypress
if (domEvent.key === 'Enter') {
const commandOutput = handleCommand(inputBuffer);
term.write('\r\n' + commandOutput + '\r\n' + shellprompt);
inputBuffer = ''; // Clear the input buffer after processing
} else if (domEvent.key === 'Backspace') {
// Remove last character from inputBuffer
if (term._core.buffer.x > shellprompt.length) {
term.write('\b \b');
inputBuffer = inputBuffer.slice(0, -1);
}
} else {
term.write(key);
inputBuffer += key; // Append pressed key to input buffer
}
});
term.open(document.getElementById('terminal'));
term.writeln('AT: localHost\n');
term.write(shellprompt);
</script>
</div>
</div>
</div>
<script src="../dist/renderer.js"></script>
</body>
</html>