userbymahadi commited on
Commit
204d778
·
verified ·
1 Parent(s): a8d0130

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +173 -103
index.html CHANGED
@@ -2,174 +2,244 @@
2
  <html lang="bn">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>DevOps Mobile Pro</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://unpkg.com/lucide@latest"></script>
9
  <style>
10
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Fira+Code&display=swap');
11
- body { font-family: 'Inter', sans-serif; background: #0f172a; color: #f8fafc; }
12
- .sidebar { transition: transform 0.3s ease-in-out; }
13
- .glass { background: rgba(30, 41, 59, 0.7); backdrop-filter: blur(10px); }
14
- .terminal-font { font-family: 'Fira Code', monospace; }
 
15
  </style>
16
  </head>
17
- <body class="overflow-hidden h-screen flex flex-col">
18
 
19
- <!-- Mobile Header -->
20
- <header class="h-16 glass border-b border-white/10 flex items-center justify-between px-4 z-40">
21
- <button onclick="toggleSidebar()" class="p-2 hover:bg-white/10 rounded-lg">
22
- <i data-lucide="menu"></i>
 
 
 
23
  </button>
24
- <h1 class="font-bold text-indigo-400">ULTRA DASHBOARD</h1>
25
- <div class="w-8"></div> <!-- Spacer -->
26
  </header>
27
 
28
  <div class="flex flex-1 relative overflow-hidden">
29
- <!-- Sidebar Menu -->
30
- <aside id="sidebar" class="sidebar absolute inset-y-0 left-0 w-64 glass border-r border-white/10 z-50 -translate-x-full lg:translate-x-0">
31
- <div class="p-6 space-y-4">
32
- <button onclick="showPage('terminal')" class="w-full flex items-center gap-3 p-3 rounded-xl hover:bg-indigo-600 transition-all">
33
- <i data-lucide="terminal"></i> Terminal
34
  </button>
35
- <button onclick="showPage('files')" class="w-full flex items-center gap-3 p-3 rounded-xl hover:bg-indigo-600 transition-all">
36
- <i data-lucide="folder"></i> File Manager
37
  </button>
38
- <button onclick="showPage('proxy')" class="w-full flex items-center gap-3 p-3 rounded-xl hover:bg-indigo-600 transition-all">
39
- <i data-lucide="globe"></i> Web Preview
40
  </button>
41
  </div>
42
  </aside>
43
 
44
- <!-- Main Content Area -->
45
- <main class="flex-1 overflow-y-auto p-4 relative">
46
 
47
- <!-- 1. Terminal Page -->
48
- <div id="page-terminal" class="page-content space-y-4">
49
- <div id="output" class="h-[60vh] glass rounded-2xl p-4 overflow-y-auto terminal-font text-xs leading-relaxed">
50
- <div class="text-indigo-400">System Ready...</div>
51
- </div>
52
- <div class="flex gap-2">
53
- <input type="text" id="cmd" class="flex-1 bg-slate-900 border border-slate-700 rounded-xl p-3 outline-none focus:border-indigo-500" placeholder="Type command...">
54
- <button onclick="runCmd()" class="bg-indigo-600 p-3 rounded-xl"><i data-lucide="play"></i></button>
55
  </div>
56
  </div>
57
 
58
- <!-- 2. File Manager Page -->
59
  <div id="page-files" class="page-content hidden">
60
- <div class="flex justify-between items-center mb-4">
61
- <h2 class="text-xl font-bold">Files</h2>
62
- <input type="file" id="uploadInput" onchange="uploadFile()" class="hidden">
63
- <button onclick="document.getElementById('uploadInput').click()" class="bg-emerald-600 px-4 py-2 rounded-lg text-sm">Upload</button>
64
- </div>
65
- <div id="file-list" class="glass rounded-2xl divide-y divide-white/5">
66
- <!-- Files will load here -->
67
  </div>
 
68
  </div>
69
 
70
- <!-- 3. Web Preview Page -->
71
- <div id="page-proxy" class="page-content hidden h-full flex flex-col">
72
- <div class="flex gap-2 mb-4">
73
- <input type="text" id="proxyUrl" value="http://localhost:8080" class="flex-1 bg-slate-900 border border-slate-700 rounded-lg p-2 text-sm">
74
- <button onclick="loadProxy()" class="bg-indigo-600 px-4 py-2 rounded-lg text-sm">Load</button>
75
  </div>
76
- <iframe id="proxyFrame" class="flex-1 w-full bg-white rounded-xl border-none"></iframe>
77
  </div>
78
 
79
  </main>
80
  </div>
81
 
82
- <!-- Auth Modal (Overlay) -->
83
- <div id="authBox" class="fixed inset-0 z-[100] flex items-center justify-center bg-black/90 p-6">
84
- <div class="glass p-8 rounded-3xl w-full max-w-sm text-center">
85
- <h2 class="text-xl font-bold mb-6">Enter Password</h2>
86
- <input type="password" id="key" class="w-full bg-slate-900 border border-slate-700 p-4 rounded-xl mb-4 text-center outline-none focus:border-indigo-500">
87
- <button onclick="initAuth()" class="w-full bg-indigo-600 py-4 rounded-xl font-bold">Login</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  </div>
89
  </div>
90
 
91
  <script>
92
  lucide.createIcons();
93
- let ws;
94
-
95
- function toggleSidebar() {
96
- const sidebar = document.getElementById('sidebar');
97
- sidebar.classList.toggle('-translate-x-full');
 
 
 
 
 
 
 
98
  }
99
 
100
- function showPage(pageId) {
101
- document.querySelectorAll('.page-content').forEach(p => p.classList.add('hidden'));
102
- document.getElementById('page-' + pageId).classList.remove('hidden');
103
- if (window.innerWidth < 1024) toggleSidebar();
104
- if (pageId === 'files') loadFiles();
105
  }
106
 
107
- // --- Auth & Terminal ---
108
- function initAuth() {
109
- const key = document.getElementById('key').value;
110
- const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
111
- ws = new WebSocket(`${protocol}//${window.location.host}/ws`);
112
- ws.onopen = () => ws.send(key);
113
  ws.onmessage = (e) => {
114
- if(e.data === "AUTH_SUCCESS") document.getElementById('authBox').style.display = 'none';
115
- else if(e.data === "AUTH_FAILED") alert("Wrong!");
116
- else appendToTerminal(e.data);
 
 
 
 
 
117
  };
 
118
  }
119
 
120
- function appendToTerminal(txt) {
121
- const out = document.getElementById('output');
122
- const div = document.createElement('div');
123
- div.className = "bg-black/20 p-2 rounded mb-2 whitespace-pre-wrap border-l border-indigo-500";
124
- div.innerText = txt;
125
- out.appendChild(div);
126
- out.scrollTop = out.scrollHeight;
127
  }
128
 
129
- function runCmd() {
130
- const input = document.getElementById('cmd');
131
- if(input.value) {
132
- ws.send(input.value);
133
- input.value = '';
134
- }
135
  }
136
 
137
  // --- File Manager ---
138
- async function loadFiles() {
139
- const res = await fetch('/api/files');
 
 
 
 
140
  const files = await res.json();
141
  const list = document.getElementById('file-list');
142
  list.innerHTML = files.map(f => `
143
- <div class="flex items-center justify-between p-4 hover:bg-white/5">
144
  <div class="flex items-center gap-3">
145
- <i data-lucide="${f.is_dir ? 'folder' : 'file'}" class="w-5 h-5 text-indigo-400"></i>
146
- <span class="text-sm">${f.name}</span>
147
  </div>
148
- <button onclick="deleteFile('${f.path}')" class="text-red-400 p-2"><i data-lucide="trash-2" class="w-4 h-4"></i></button>
149
  </div>
150
  `).join('');
151
  lucide.createIcons();
152
  }
153
 
154
- async function uploadFile() {
155
- const file = document.getElementById('uploadInput').files[0];
156
- const formData = new FormData();
157
- formData.append('file', file);
158
- await fetch('/api/upload', { method: 'POST', body: formData });
159
- loadFiles();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
161
 
162
- async function deleteFile(path) {
163
  if(confirm('Delete?')) {
164
- await fetch(`/api/delete?path=${path}`, { method: 'DELETE' });
165
- loadFiles();
166
  }
167
  }
168
 
169
- // --- Proxy ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  function loadProxy() {
171
- const url = document.getElementById('proxyUrl').value;
172
- document.getElementById('proxyFrame').src = `/proxy?url=${encodeURIComponent(url)}`;
173
  }
174
  </script>
175
  </body>
 
2
  <html lang="bn">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>Elite Mobile DevOps</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://unpkg.com/lucide@latest"></script>
9
  <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
11
+ body { background: #020617; color: #f1f5f9; -webkit-tap-highlight-color: transparent; }
12
+ .glass { background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.05); }
13
+ .sidebar { transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; }
14
+ .mono { font-family: 'JetBrains Mono', monospace; }
15
+ input, button { outline: none !important; }
16
  </style>
17
  </head>
18
+ <body class="h-screen flex flex-col overflow-hidden">
19
 
20
+ <!-- Sidebar Overlay -->
21
+ <div id="overlay" onclick="toggleSidebar()" class="fixed inset-0 bg-black/60 hidden z-[90]"></div>
22
+
23
+ <!-- Header -->
24
+ <header class="h-14 glass flex items-center justify-between px-4 sticky top-0 z-[80]">
25
+ <button onclick="toggleSidebar()" class="p-2 active:scale-90 transition-transform">
26
+ <i data-lucide="menu" class="w-6 h-6"></i>
27
  </button>
28
+ <span class="text-xs font-bold tracking-[0.2em] text-indigo-400">ULTRA V4</span>
29
+ <button onclick="logout()" class="p-2"><i data-lucide="log-out" class="w-5 h-5 text-slate-500"></i></button>
30
  </header>
31
 
32
  <div class="flex flex-1 relative overflow-hidden">
33
+ <!-- Sidebar -->
34
+ <aside id="sidebar" class="sidebar fixed inset-y-0 left-0 w-72 glass -translate-x-full shadow-2xl">
35
+ <div class="p-6 pt-20 space-y-2">
36
+ <button onclick="showPage('terminal')" class="w-full flex items-center gap-4 p-4 rounded-2xl hover:bg-indigo-500/20 active:bg-indigo-500 transition-all">
37
+ <i data-lucide="terminal" class="w-5 h-5"></i> Terminal
38
  </button>
39
+ <button onclick="showPage('files')" class="w-full flex items-center gap-4 p-4 rounded-2xl hover:bg-indigo-500/20 active:bg-indigo-500 transition-all">
40
+ <i data-lucide="folder" class="w-5 h-5"></i> File Manager
41
  </button>
42
+ <button onclick="showPage('proxy')" class="w-full flex items-center gap-4 p-4 rounded-2xl hover:bg-indigo-500/20 active:bg-indigo-500 transition-all">
43
+ <i data-lucide="monitor" class="w-5 h-5"></i> Web Preview
44
  </button>
45
  </div>
46
  </aside>
47
 
48
+ <!-- Main Views -->
49
+ <main class="flex-1 p-3 overflow-y-auto">
50
 
51
+ <!-- Terminal -->
52
+ <div id="page-terminal" class="page-content h-full flex flex-col gap-3">
53
+ <div id="output" class="flex-1 glass rounded-2xl p-4 overflow-y-auto mono text-[11px] leading-relaxed border border-indigo-500/10"></div>
54
+ <div class="flex gap-2 pb-2">
55
+ <input type="text" id="cmd" class="flex-1 bg-slate-900 border border-slate-700 rounded-xl px-4 py-3 text-sm focus:border-indigo-500" placeholder="Type command...">
56
+ <button onclick="runCmd()" class="bg-indigo-600 px-5 rounded-xl shadow-lg shadow-indigo-500/20"><i data-lucide="send" class="w-5 h-5"></i></button>
 
 
57
  </div>
58
  </div>
59
 
60
+ <!-- File Manager -->
61
  <div id="page-files" class="page-content hidden">
62
+ <div class="flex items-center gap-2 mb-4">
63
+ <button id="backBtn" onclick="goBack()" class="p-2 glass rounded-lg hidden"><i data-lucide="chevron-left"></i></button>
64
+ <div class="flex-1 glass px-3 py-2 rounded-lg text-[10px] truncate opacity-60 mono" id="currentPath">/home/user/app</div>
65
+ <button onclick="document.getElementById('fileUp').click()" class="p-2 bg-indigo-600 rounded-lg"><i data-lucide="upload" class="w-4 h-4"></i></button>
66
+ <input type="file" id="fileUp" class="hidden" onchange="handleUpload()">
 
 
67
  </div>
68
+ <div id="file-list" class="space-y-2"></div>
69
  </div>
70
 
71
+ <!-- Proxy -->
72
+ <div id="page-proxy" class="page-content hidden h-full flex flex-col gap-3">
73
+ <div class="flex gap-2">
74
+ <input type="text" id="pUrl" value="http://localhost:8080" class="flex-1 bg-slate-800 border-none rounded-lg p-2 text-xs">
75
+ <button onclick="loadProxy()" class="bg-indigo-600 px-4 rounded-lg text-xs">LOAD</button>
76
  </div>
77
+ <iframe id="pFrame" class="flex-1 bg-white rounded-2xl border-none"></iframe>
78
  </div>
79
 
80
  </main>
81
  </div>
82
 
83
+ <!-- Editor Modal -->
84
+ <div id="editorModal" class="fixed inset-0 bg-black z-[110] hidden flex flex-col p-4">
85
+ <div class="flex justify-between items-center mb-4">
86
+ <span id="editingFileName" class="text-xs mono">file.txt</span>
87
+ <div class="flex gap-2">
88
+ <button onclick="closeEditor()" class="px-4 py-2 text-xs">Cancel</button>
89
+ <button onclick="saveFileContent()" class="bg-indigo-600 px-4 py-2 rounded text-xs">Save</button>
90
+ </div>
91
+ </div>
92
+ <textarea id="editorArea" class="flex-1 bg-slate-900 p-4 rounded-xl mono text-sm outline-none border border-white/5"></textarea>
93
+ </div>
94
+
95
+ <!-- Login Modal -->
96
+ <div id="loginBox" class="fixed inset-0 bg-slate-950 z-[200] flex items-center justify-center p-6 hidden">
97
+ <div class="w-full max-w-xs space-y-6 text-center">
98
+ <div class="bg-indigo-500/10 w-20 h-20 rounded-full flex items-center justify-center mx-auto border border-indigo-500/20">
99
+ <i data-lucide="shield-check" class="w-10 h-10 text-indigo-500"></i>
100
+ </div>
101
+ <h1 class="text-xl font-bold">Secure Access</h1>
102
+ <input type="password" id="pass" class="w-full bg-slate-900 border border-slate-800 p-4 rounded-2xl text-center outline-none focus:border-indigo-500" placeholder="Enter Password">
103
+ <button onclick="login()" class="w-full bg-indigo-600 py-4 rounded-2xl font-bold shadow-xl shadow-indigo-600/20">Authorize</button>
104
  </div>
105
  </div>
106
 
107
  <script>
108
  lucide.createIcons();
109
+ let ws, currentPath = ".", history = [];
110
+
111
+ // --- Auth & Auto-connect ---
112
+ window.onload = () => {
113
+ const savedPass = localStorage.getItem('ultra_pass');
114
+ if (savedPass) connectWS(savedPass);
115
+ else document.getElementById('loginBox').classList.remove('hidden');
116
+ };
117
+
118
+ function login() {
119
+ const p = document.getElementById('pass').value;
120
+ connectWS(p);
121
  }
122
 
123
+ function logout() {
124
+ localStorage.removeItem('ultra_pass');
125
+ location.reload();
 
 
126
  }
127
 
128
+ function connectWS(p) {
129
+ const protocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
130
+ ws = new WebSocket(`${protocol}//${location.host}/ws`);
131
+ ws.onopen = () => ws.send(p);
 
 
132
  ws.onmessage = (e) => {
133
+ if (e.data === "AUTH_SUCCESS") {
134
+ localStorage.setItem('ultra_pass', p);
135
+ document.getElementById('loginBox').classList.add('hidden');
136
+ lucide.createIcons();
137
+ } else if (e.data === "AUTH_FAILED") {
138
+ alert("Invalid Password");
139
+ logout();
140
+ } else appendToTerminal(e.data);
141
  };
142
+ ws.onclose = () => setTimeout(() => connectWS(p), 2000);
143
  }
144
 
145
+ // --- Sidebar ---
146
+ function toggleSidebar() {
147
+ const s = document.getElementById('sidebar');
148
+ const o = document.getElementById('overlay');
149
+ s.classList.toggle('-translate-x-full');
150
+ o.classList.toggle('hidden');
 
151
  }
152
 
153
+ function showPage(p) {
154
+ document.querySelectorAll('.page-content').forEach(el => el.classList.add('hidden'));
155
+ document.getElementById('page-' + p).classList.remove('hidden');
156
+ if(p === 'files') loadFiles('.');
157
+ toggleSidebar();
 
158
  }
159
 
160
  // --- File Manager ---
161
+ async function loadFiles(path) {
162
+ currentPath = path;
163
+ document.getElementById('currentPath').innerText = path;
164
+ document.getElementById('backBtn').style.display = path === '.' ? 'none' : 'block';
165
+
166
+ const res = await fetch(`/api/files?path=${path}`);
167
  const files = await res.json();
168
  const list = document.getElementById('file-list');
169
  list.innerHTML = files.map(f => `
170
+ <div class="flex items-center justify-between p-4 glass rounded-xl active:scale-95 transition-transform" onclick="${f.is_dir ? `loadFiles('${f.path}')` : `editFile('${f.path}')`}">
171
  <div class="flex items-center gap-3">
172
+ <i data-lucide="${f.is_dir ? 'folder' : 'file-text'}" class="w-5 h-5 ${f.is_dir ? 'text-indigo-400' : 'text-slate-500'}"></i>
173
+ <span class="text-sm font-medium">${f.name}</span>
174
  </div>
175
+ <button onclick="event.stopPropagation(); deleteF('${f.path}')" class="p-2 text-rose-500"><i data-lucide="trash-2" class="w-4 h-4"></i></button>
176
  </div>
177
  `).join('');
178
  lucide.createIcons();
179
  }
180
 
181
+ function goBack() {
182
+ const parts = currentPath.split('/');
183
+ parts.pop();
184
+ loadFiles(parts.length ? parts.join('/') : '.');
185
+ }
186
+
187
+ async function editFile(path) {
188
+ const res = await fetch(`/api/read?path=${path}`);
189
+ const data = await res.json();
190
+ document.getElementById('editingFileName').innerText = path;
191
+ document.getElementById('editorArea').value = data.content;
192
+ document.getElementById('editorModal').classList.remove('hidden');
193
+ }
194
+
195
+ async function saveFileContent() {
196
+ const path = document.getElementById('editingFileName').innerText;
197
+ const content = document.getElementById('editorArea').value;
198
+ await fetch('/api/save', {
199
+ method: 'POST',
200
+ headers: {'Content-Type': 'application/json'},
201
+ body: JSON.stringify({path, content})
202
+ });
203
+ closeEditor();
204
+ }
205
+
206
+ function closeEditor() { document.getElementById('editorModal').classList.add('hidden'); }
207
+
208
+ async function handleUpload() {
209
+ const file = document.getElementById('fileUp').files[0];
210
+ const fd = new FormData();
211
+ fd.append('file', file);
212
+ await fetch(`/api/upload?path=${currentPath}`, {method: 'POST', body: fd});
213
+ loadFiles(currentPath);
214
  }
215
 
216
+ async function deleteF(path) {
217
  if(confirm('Delete?')) {
218
+ await fetch(`/api/delete?path=${path}`, {method: 'DELETE'});
219
+ loadFiles(currentPath);
220
  }
221
  }
222
 
223
+ // --- Terminal ---
224
+ function runCmd() {
225
+ const i = document.getElementById('cmd');
226
+ if(i.value) {
227
+ ws.send(i.value);
228
+ i.value = '';
229
+ }
230
+ }
231
+
232
+ function appendToTerminal(t) {
233
+ const o = document.getElementById('output');
234
+ const d = document.createElement('div');
235
+ d.className = "mb-2 text-slate-300 break-all";
236
+ d.innerText = t;
237
+ o.appendChild(d);
238
+ o.scrollTop = o.scrollHeight;
239
+ }
240
+
241
  function loadProxy() {
242
+ document.getElementById('pFrame').src = `/proxy?url=${encodeURIComponent(document.getElementById('pUrl').value)}`;
 
243
  }
244
  </script>
245
  </body>