File size: 8,195 Bytes
086a349 826d11e 086a349 e5a1652 086a349 e5a1652 4ba5223 e5a1652 34986d1 e5a1652 826d11e e5a1652 34986d1 e5a1652 34986d1 e5a1652 4ba5223 e5a1652 4ba5223 e5a1652 4ba5223 e5a1652 34986d1 e5a1652 34986d1 e5a1652 34986d1 e5a1652 34986d1 e5a1652 086a349 e5a1652 086a349 e5a1652 086a349 | 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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>VPS KW Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
:root {
--bg: #f7f8fa;
--card: #ffffff;
--accent: #3b82f6;
--text: #1e293b;
--muted: #94a3b8;
--border: #e2e8f0;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg);
color: var(--text);
margin: 0;
padding: 0;
}
header {
text-align: center;
padding: 1.2rem;
font-size: 1.4rem;
font-weight: 600;
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
nav {
display: flex;
justify-content: center;
gap: 1rem;
background-color: #ffffff;
padding: 0.8rem;
border-bottom: 1px solid var(--border);
}
nav button {
background: none;
border: none;
font-weight: 600;
color: var(--muted);
padding: 0.5rem 1rem;
border-radius: 0.5rem;
transition: all 0.2s ease;
cursor: pointer;
}
nav button.active,
nav button:hover {
background-color: var(--accent);
color: white;
}
.tab {
display: none;
max-width: 600px;
margin: 2rem auto;
padding: 1rem;
background: var(--card);
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.tab.active {
display: block;
}
input, textarea, button {
width: 100%;
padding: 0.75rem;
margin: 0.5rem 0;
font-size: 1rem;
border: 1px solid var(--border);
border-radius: 8px;
transition: 0.2s;
}
input:focus, textarea:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
button {
background-color: var(--accent);
color: white;
font-weight: 600;
border: none;
cursor: pointer;
}
button:hover {
background-color: #2563eb;
}
.console-box {
background: #0f172a;
color: #38bdf8;
font-family: monospace;
padding: 1rem;
border-radius: 8px;
height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
.file-entry {
display: flex;
justify-content: space-between;
background: #f1f5f9;
border: 1px solid #e2e8f0;
padding: 0.5rem;
margin: 0.25rem 0;
border-radius: 6px;
}
</style>
</head>
<body>
<header>VPS KW Panel</header>
<nav>
<button onclick="showTab('setup')" id="tab-setup" class="active">Setup</button>
<button onclick="showTab('console')" id="tab-console">Console</button>
<button onclick="showTab('filemanager')" id="tab-filemanager">File Manager</button>
</nav>
<div id="setup" class="tab active">
<h2>Setup</h2>
<input id="username" placeholder="Username">
<input id="password" type="password" placeholder="Password">
<input id="filename" placeholder="Start command (e.g. python main.py)">
<button onclick="saveSetup()">Save</button>
</div>
<div id="console" class="tab">
<h2>Console</h2>
<div class="console-box" id="output">Output will appear here...</div>
<input id="consoleInput" placeholder="Your input here...">
<button onclick="sendInput()">Send</button>
<button onclick="startConsole()">Start</button>
<button onclick="stopConsole()">Stop</button>
</div>
<div id="filemanager" class="tab">
<h2>File Manager</h2>
<input type="file" id="uploadFile" />
<button onclick="uploadFile()">Upload</button>
<input id="newName" placeholder="New file or folder name">
<button onclick="createFile()">Create File</button>
<button onclick="createFolder()">Create Folder</button>
<div id="fileList">
<!-- List of files will appear here -->
</div>
</div>
<script>
function showTab(id) {
document.querySelectorAll(".tab").forEach(tab => tab.classList.remove("active"));
document.querySelectorAll("nav button").forEach(btn => btn.classList.remove("active"));
document.getElementById(id).classList.add("active");
document.getElementById("tab-" + id).classList.add("active");
if (id === "filemanager") refreshFileList();
}
function saveSetup() {
const data = {
username: document.getElementById("username").value,
password: document.getElementById("password").value,
startcmd: document.getElementById("startcmd").value
};
fetch("/setup", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
}).then(res => res.json())
.then(res => alert("Saved!"))
.catch(err => alert("Error saving setup."));
}
function startConsole() {
const filename = document.getElementById("filename").value;
if (!filename) {
document.getElementById("output").textContent += ">>> No file selected.\n";
return;
}
fetch("/run", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ filename: filename })
})
.then(res => res.json())
.then(data => {
document.getElementById("output").textContent += `>>> Console started\n${data.output}\n`;
})
.catch(err => {
document.getElementById("output").textContent += `>>> Error: ${err}\n`;
});
}
function stopConsole() {
fetch("/console/stop", { method: "POST" })
.then(res => res.json())
.then(data => {
document.getElementById("output").textContent += ">>> Console stopped\n";
});
}
function sendInput() {
const input = document.getElementById("consoleInput").value;
fetch("/console/input", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ input })
})
.then(res => res.json())
.then(data => {
document.getElementById("output").textContent += data.output + "\n";
document.getElementById("consoleInput").value = "";
});
}
function refreshFileList() {
fetch("/files")
.then(res => res.json())
.then(files => {
const list = document.getElementById("fileList");
list.innerHTML = "";
files.forEach(name => {
const entry = document.createElement("div");
entry.className = "file-entry";
entry.textContent = name;
list.appendChild(entry);
});
});
}
function createFile() {
const name = prompt("File name:");
if (!name) return;
fetch("/file/create", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name })
}).then(() => refreshFileList());
}
function createFolder() {
const name = prompt("Folder name:");
if (!name) return;
fetch("/folder/create", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name })
}).then(() => refreshFileList());
}
function deleteItem() {
const name = prompt("File/Folder name to delete:");
if (!name) return;
fetch("/delete", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name })
}).then(() => refreshFileList());
}
function renameItem() {
const oldName = prompt("Old name:");
const newName = prompt("New name:");
if (!oldName || !newName) return;
fetch("/rename", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ old_name: oldName, new_name: newName })
}).then(() => refreshFileList());
}
function uploadFile() {
const fileInput = document.getElementById("uploadFile");
const file = fileInput.files[0];
if (!file) return;
const formData = new FormData();
formData.append("file", file);
fetch("/upload", {
method: "POST",
body: formData
}).then(() => {
alert("Uploaded!");
refreshFileList();
fileInput.value = "";
});
}
window.onload = () => {
refreshFileList();
};
</script>
</body>
</html> |