-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
92 lines (87 loc) · 2.4 KB
/
dashboard.html
File metadata and controls
92 lines (87 loc) · 2.4 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<title>C++ Server Manager</title>
<style>
body {
font-family: sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.box {
border: 1px solid #ccc;
padding: 20px;
margin-bottom: 20px;
border-radius: 8px;
}
h1 {
color: #2c3e50;
}
button {
cursor: pointer;
padding: 5px 10px;
background: #e74c3c;
color: white;
border: none;
border-radius: 4px;
}
button:hover {
background: #c0392b;
}
</style>
</head>
<body>
<h1>🚀 Server Interface</h1>
<div class="box">
<h2>📂 Upload File</h2>
<form action="/upload" method="POST">
<textarea
name="file_content"
rows="4"
style="width: 100%"
placeholder="Type text content here..."
></textarea
><br /><br />
<button type="submit" value="Save as uploaded_data.txt">Upload</button>
</form>
</div>
<div class="box">
<h2>🗑️ Delete File</h2>
<p>Target: <code>uploaded_data.txt</code></p>
<button type="button" onclick="deleteFile()">DELETE NOW</button>
<p id="status" style="font-weight: bold; color: #555"></p>
</div>
<div class="box">
<h2>🍪 Cookie Status</h2>
<button type="button" onclick="checkCookie()">Check My Session</button>
<p id="cookie_display"></p>
</div>
<script>
function deleteFile() {
fetch("/uploaded_data.txt", { method: "DELETE" })
.then((response) => {
if (response.ok) return response.text();
throw new Error("Delete failed (404?)");
})
.then(
(msg) =>
(document.getElementById("status").innerText =
"✅ Server says: " + msg)
)
.catch(
(err) =>
(document.getElementById("status").innerText =
"❌ Error: " + err.message)
);
}
function checkCookie() {
document.getElementById("cookie_display").innerText = document.cookie
? "Found: " + document.cookie
: "No cookies found (Did you enable them in server.cpp?)";
}
</script>
</body>
</html>