deepak191z commited on
Commit
9dae746
·
verified ·
1 Parent(s): ce6c0f3

Create view/index.html

Browse files
Files changed (1) hide show
  1. view/index.html +320 -0
view/index.html ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>APK Debug</title>
7
+ <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
8
+ <style>
9
+ #dropZone:hover {
10
+ background-color: #2d3748;
11
+ border-color: #d69e2e;
12
+ }
13
+
14
+ #progressBar {
15
+ transition: width 0.3s ease-in-out;
16
+ }
17
+
18
+ .loader {
19
+ border: 4px solid #f3f3f3;
20
+ border-top: 4px solid #d69e2e;
21
+ border-radius: 50%;
22
+ width: 48px;
23
+ height: 48px;
24
+ animation: spin 1s linear infinite;
25
+ }
26
+
27
+ @keyframes spin {
28
+ 0% { transform: rotate(0deg); }
29
+ 100% { transform: rotate(360deg); }
30
+ }
31
+
32
+ .container {
33
+ max-width: 1200px;
34
+ width: 100%;
35
+ }
36
+
37
+ @media (max-width: 640px) {
38
+ .container {
39
+ padding-left: 1rem;
40
+ padding-right: 1rem;
41
+ }
42
+
43
+ #dropZone {
44
+ padding: 1.5rem;
45
+ }
46
+ }
47
+ </style>
48
+ </head>
49
+ <body class="bg-gray-900 text-white min-h-screen flex flex-col">
50
+ <!-- Header -->
51
+ <header class="bg-gray-800 p-4 shadow-md">
52
+ <div class="container mx-auto flex justify-between items-center">
53
+ <h1 class="text-xl font-bold">APKDebug</h1>
54
+ <div class="text-sm bg-gray-700 px-3 py-1 rounded">VIP User</div>
55
+ </div>
56
+ </header>
57
+
58
+ <!-- Main Content -->
59
+ <main class="flex-1 container mx-auto p-4">
60
+ <!-- Tabs -->
61
+ <div class="flex space-x-2 mb-4">
62
+ <button id="uploadTab" class="flex-1 bg-yellow-600 text-white py-2 rounded-t-lg">Upload</button>
63
+ <button id="howItWorksTab" class="flex-1 bg-gray-700 text-white py-2 rounded-t-lg">How It Works</button>
64
+ </div>
65
+
66
+ <!-- Upload Section -->
67
+ <section id="uploadSection" class="bg-gray-800 p-6 rounded-b-lg rounded-tr-lg">
68
+ <div id="dropZone" class="border-2 border-dashed border-gray-500 p-6 text-center cursor-pointer">
69
+ <div class="flex justify-center mb-2">
70
+ <svg class="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
71
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path>
72
+ </svg>
73
+ </div>
74
+ <p class="text-gray-400">Click to upload or drag and drop</p>
75
+ <p class="text-gray-500 text-sm">Supported file: .APK</p>
76
+ <input type="file" id="fileInput" class="hidden" accept=".apk">
77
+ </div>
78
+ <p id="fileNameDisplay" class="mt-2 text-sm text-gray-400 text-center"></p>
79
+
80
+ <button id="submitBtn" class="mt-4 w-full bg-yellow-600 text-white py-2 rounded flex items-center justify-center">
81
+ <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
82
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
83
+ </svg>
84
+ Debug APK
85
+ </button>
86
+
87
+ <div id="progressContainer" class="mt-4 hidden">
88
+ <div class="w-full bg-gray-600 rounded-full h-2.5">
89
+ <div id="progressBar" class="bg-yellow-600 h-2.5 rounded-full transition-all duration-300" style="width: 0%"></div>
90
+ </div>
91
+ <p id="progressText" class="text-sm text-gray-400 mt-1 text-center"></p>
92
+ </div>
93
+ </section>
94
+
95
+ <!-- Overlay for Processing -->
96
+ <div id="processingOverlay" class="fixed inset-0 bg-black bg-opacity-50 backdrop-blur-sm flex items-center justify-center hidden">
97
+ <div class="text-center">
98
+ <div class="loader border-t-4 border-yellow-600 rounded-full w-12 h-12 animate-spin mx-auto"></div>
99
+ <p class="mt-4 text-gray-300">Processing... Time remaining: <span id="timeLeft">2:00</span></p>
100
+ </div>
101
+ </div>
102
+
103
+ <!-- How It Works Section -->
104
+ <section id="howItWorksSection" class="bg-gray-800 p-6 rounded-b-lg rounded-tr-lg hidden">
105
+ <h3 class="text-lg font-semibold text-gray-300">How It Works</h3>
106
+ <p class="mt-2 text-gray-400">1. Upload your APK file by dragging it into the box or clicking to select.</p>
107
+ <p class="mt-1 text-gray-400">2. Click "Debug APK" and wait for the processing to complete.</p>
108
+ <p class="mt-1 text-gray-400">3. Download your debugged file from the Recent App Uploads section.</p>
109
+ </section>
110
+
111
+ <!-- Recent Uploads -->
112
+ <section class="mt-6">
113
+ <h3 class="text-lg font-semibold text-gray-300">Recent App Uploads</h3>
114
+ <div class="mt-2">
115
+ <input type="text" id="searchUploads" placeholder="Search uploads..." class="w-full bg-gray-700 text-gray-300 p-2 rounded">
116
+ </div>
117
+ <div id="recentUploads" class="mt-2 space-y-2">
118
+ <!-- Recent uploads will be populated by JavaScript -->
119
+ </div>
120
+ </section>
121
+
122
+ <!-- Error Alert -->
123
+ <div id="errorAlert" class="fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-red-900 border border-red-700 text-red-300 px-4 py-3 rounded hidden">
124
+ <span id="errorMessage"></span>
125
+ </div>
126
+
127
+ <script>
128
+ document.addEventListener('DOMContentLoaded', () => {
129
+ const dropZone = document.getElementById('dropZone');
130
+ const fileInput = document.getElementById('fileInput');
131
+ const submitBtn = document.getElementById('submitBtn');
132
+ const progressContainer = document.getElementById('progressContainer');
133
+ const progressBar = document.getElementById('progressBar');
134
+ const progressText = document.getElementById('progressText');
135
+ const processingOverlay = document.getElementById('processingOverlay');
136
+ const timeLeft = document.getElementById('timeLeft');
137
+ const errorAlert = document.getElementById('errorAlert');
138
+ const errorMessage = document.getElementById('errorMessage');
139
+ const fileNameDisplay = document.getElementById('fileNameDisplay');
140
+ const uploadTab = document.getElementById('uploadTab');
141
+ const howItWorksTab = document.getElementById('howItWorksTab');
142
+ const uploadSection = document.getElementById('uploadSection');
143
+ const howItWorksSection = document.getElementById('howItWorksSection');
144
+ const recentUploads = document.getElementById('recentUploads');
145
+ const searchUploads = document.getElementById('searchUploads');
146
+
147
+ // Tab Switching
148
+ uploadTab.addEventListener('click', () => {
149
+ uploadTab.classList.add('bg-yellow-600');
150
+ uploadTab.classList.remove('bg-gray-700');
151
+ howItWorksTab.classList.add('bg-gray-700');
152
+ howItWorksTab.classList.remove('bg-yellow-600');
153
+ uploadSection.classList.remove('hidden');
154
+ howItWorksSection.classList.add('hidden');
155
+ });
156
+
157
+ howItWorksTab.addEventListener('click', () => {
158
+ howItWorksTab.classList.add('bg-yellow-600');
159
+ howItWorksTab.classList.remove('bg-gray-700');
160
+ uploadTab.classList.add('bg-gray-700');
161
+ uploadTab.classList.remove('bg-yellow-600');
162
+ howItWorksSection.classList.remove('hidden');
163
+ uploadSection.classList.add('hidden');
164
+ });
165
+
166
+ // Drag and Drop
167
+ dropZone.addEventListener('click', () => fileInput.click());
168
+ dropZone.addEventListener('dragover', (e) => {
169
+ e.preventDefault();
170
+ dropZone.classList.add('border-yellow-600');
171
+ });
172
+ dropZone.addEventListener('dragleave', () => dropZone.classList.remove('border-yellow-600'));
173
+ dropZone.addEventListener('drop', (e) => {
174
+ e.preventDefault();
175
+ dropZone.classList.remove('border-yellow-600');
176
+ fileInput.files = e.dataTransfer.files;
177
+ displayFileName();
178
+ });
179
+
180
+ fileInput.addEventListener('change', () => {
181
+ displayFileName();
182
+ });
183
+
184
+ // Submit Handler
185
+ submitBtn.addEventListener('click', () => {
186
+ if (!fileInput.files.length) {
187
+ showError('Please select a file');
188
+ return;
189
+ }
190
+
191
+ const file = fileInput.files[0];
192
+ if (file.size > 500 * 1024 * 1024) {
193
+ showError('File size exceeds 500MB limit');
194
+ return;
195
+ }
196
+
197
+ const formData = new FormData();
198
+ formData.append('file', file);
199
+
200
+ progressContainer.classList.remove('hidden');
201
+ progressText.textContent = 'Uploading...';
202
+
203
+ const xhr = new XMLHttpRequest();
204
+ xhr.open('POST', '/process/debug', true);
205
+
206
+ xhr.upload.onprogress = (event) => {
207
+ if (event.lengthComputable) {
208
+ const percent = Math.round((event.loaded * 100) / event.total);
209
+ progressBar.style.width = `${percent}%`;
210
+ progressText.textContent = `Uploading: ${percent}%`;
211
+
212
+ if (percent === 100) {
213
+ setTimeout(() => {
214
+ progressContainer.classList.add('hidden');
215
+ processingOverlay.classList.remove('hidden');
216
+ startTimer();
217
+ }, 500);
218
+ }
219
+ }
220
+ };
221
+
222
+ xhr.onload = () => {
223
+ if (xhr.status === 200) {
224
+ clearInterval(timerInterval);
225
+ processingOverlay.classList.add('hidden');
226
+
227
+ const blob = new Blob([xhr.response], { type: 'application/vnd.android.package-archive' });
228
+ const url = window.URL.createObjectURL(blob);
229
+ const filename = xhr.getResponseHeader('content-disposition')?.split('filename=')[1]?.replace(/"/g, '') || `${file.name}_debugged.apk`;
230
+ addRecentUpload(file.name, filename, url);
231
+ } else {
232
+ const error = JSON.parse(xhr.responseText || '{}');
233
+ showError(error.error || 'Failed to debug APK');
234
+ resetUI();
235
+ }
236
+ };
237
+
238
+ xhr.onerror = () => {
239
+ showError('An error occurred while uploading the file');
240
+ resetUI();
241
+ };
242
+
243
+ xhr.responseType = 'blob';
244
+ xhr.send(formData);
245
+ });
246
+
247
+ // Timer function
248
+ let timerInterval;
249
+ function startTimer() {
250
+ let time = 120; // 2 minutes
251
+ timerInterval = setInterval(() => {
252
+ const minutes = Math.floor(time / 60);
253
+ const seconds = time % 60;
254
+ timeLeft.textContent = `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
255
+ time--;
256
+ if (time < 0) clearInterval(timerInterval);
257
+ }, 1000);
258
+ }
259
+
260
+ // Display file name
261
+ function displayFileName() {
262
+ if (fileInput.files.length > 0) {
263
+ fileNameDisplay.textContent = `Selected file: ${fileInput.files[0].name}`;
264
+ } else {
265
+ fileNameDisplay.textContent = '';
266
+ }
267
+ }
268
+
269
+ // Add to recent uploads
270
+ function addRecentUpload(originalName, processedName, downloadUrl) {
271
+ const uploadItem = document.createElement('div');
272
+ uploadItem.className = 'bg-gray-700 p-3 rounded flex justify-between items-center';
273
+ const date = new Date().toLocaleDateString('en-US', { month: 'numeric', day: 'numeric', year: 'numeric' });
274
+ uploadItem.innerHTML = `
275
+ <div class="flex items-center">
276
+ <img src="https://img.icons8.com/color/40/000000/android-os.png" alt="Android Icon" class="w-10 h-10 mr-3">
277
+ <div>
278
+ <p class="text-gray-300">${originalName}</p>
279
+ <p class="text-gray-500 text-sm">Uploaded on ${date}</p>
280
+ </div>
281
+ </div>
282
+ <a href="${downloadUrl}" download="${processedName}" class="bg-yellow-600 text-white px-3 py-1 rounded text-sm">
283
+ Download
284
+ </a>
285
+ `;
286
+ recentUploads.prepend(uploadItem);
287
+
288
+ if (recentUploads.children.length > 5) {
289
+ recentUploads.removeChild(recentUploads.children[recentUploads.children.length - 1]);
290
+ }
291
+ }
292
+
293
+ // Search uploads
294
+ searchUploads.addEventListener('input', (e) => {
295
+ const searchTerm = e.target.value.toLowerCase();
296
+ const items = recentUploads.children;
297
+ for (let item of items) {
298
+ const fileName = item.querySelector('p').textContent.toLowerCase();
299
+ item.style.display = fileName.includes(searchTerm) ? '' : 'none';
300
+ }
301
+ });
302
+
303
+ // UI Helpers
304
+ function showError(message) {
305
+ errorAlert.classList.remove('hidden');
306
+ errorMessage.textContent = message;
307
+ setTimeout(() => errorAlert.classList.add('hidden'), 5000);
308
+ }
309
+
310
+ function resetUI() {
311
+ progressContainer.classList.add('hidden');
312
+ processingOverlay.classList.add('hidden');
313
+ progressBar.style.width = '0%';
314
+ progressText.textContent = '';
315
+ fileNameDisplay.textContent = '';
316
+ }
317
+ });
318
+ </script>
319
+ </body>
320
+ </html>