lea97338 commited on
Commit
b266b9e
·
verified ·
1 Parent(s): 4d904c6

Upload 2 files

Browse files
Files changed (2) hide show
  1. templates/index.html +1386 -0
  2. templates/login.html +387 -0
templates/index.html ADDED
@@ -0,0 +1,1386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="fr">
4
+ <head>
5
+ <meta charset="utf-8"/>
6
+ <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
7
+ <title>📁 Gestionnaire de Fichiers Pro</title>
8
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"/>
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
19
+ min-height: 100vh;
20
+ padding: 20px;
21
+ }
22
+
23
+ .container {
24
+ max-width: 1200px;
25
+ margin: 0 auto;
26
+ background: white;
27
+ border-radius: 20px;
28
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
29
+ overflow: hidden;
30
+ }
31
+
32
+ .header {
33
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
34
+ color: white;
35
+ padding: 30px;
36
+ text-align: center;
37
+ position: relative;
38
+ }
39
+
40
+ .header h1 {
41
+ font-size: 2.5em;
42
+ margin-bottom: 10px;
43
+ text-shadow: 0 2px 4px rgba(0,0,0,0.3);
44
+ }
45
+
46
+ .header p {
47
+ font-size: 1.2em;
48
+ opacity: 0.9;
49
+ }
50
+
51
+ .user-info {
52
+ position: absolute;
53
+ top: 20px;
54
+ right: 20px;
55
+ background: rgba(255,255,255,0.2);
56
+ padding: 10px 15px;
57
+ border-radius: 20px;
58
+ color: white;
59
+ font-size: 0.9em;
60
+ display: flex;
61
+ align-items: center;
62
+ gap: 10px;
63
+ }
64
+
65
+ .admin-badge {
66
+ background: #dc3545;
67
+ color: white;
68
+ font-size: 0.7em;
69
+ padding: 2px 6px;
70
+ border-radius: 10px;
71
+ margin-left: 5px;
72
+ }
73
+
74
+ .logout-btn, .admin-btn {
75
+ background: rgba(255,255,255,0.2);
76
+ color: white;
77
+ border: 1px solid rgba(255,255,255,0.3);
78
+ padding: 5px 10px;
79
+ border-radius: 15px;
80
+ text-decoration: none;
81
+ font-size: 0.8em;
82
+ transition: all 0.3s ease;
83
+ cursor: pointer;
84
+ }
85
+
86
+ .logout-btn:hover, .admin-btn:hover {
87
+ background: rgba(255,255,255,0.3);
88
+ }
89
+
90
+ .stats {
91
+ display: flex;
92
+ justify-content: space-around;
93
+ background: #f8f9fa;
94
+ padding: 20px;
95
+ border-bottom: 1px solid #e9ecef;
96
+ }
97
+
98
+ .stat-item {
99
+ text-align: center;
100
+ }
101
+
102
+ .stat-number {
103
+ font-size: 2em;
104
+ font-weight: bold;
105
+ color: #4facfe;
106
+ }
107
+
108
+ .stat-label {
109
+ color: #6c757d;
110
+ font-size: 0.9em;
111
+ }
112
+
113
+ .upload-section {
114
+ padding: 40px;
115
+ text-align: center;
116
+ }
117
+
118
+ .upload-area {
119
+ border: 3px dashed #4facfe;
120
+ border-radius: 15px;
121
+ padding: 60px 20px;
122
+ background: #f8f9ff;
123
+ transition: all 0.3s ease;
124
+ cursor: pointer;
125
+ position: relative;
126
+ overflow: hidden;
127
+ }
128
+
129
+ .upload-area:hover {
130
+ border-color: #00f2fe;
131
+ background: #f0f8ff;
132
+ transform: translateY(-2px);
133
+ }
134
+
135
+ .upload-area.dragover {
136
+ border-color: #00f2fe;
137
+ background: #e6f3ff;
138
+ transform: scale(1.02);
139
+ }
140
+
141
+ .upload-icon {
142
+ font-size: 4em;
143
+ color: #4facfe;
144
+ margin-bottom: 20px;
145
+ }
146
+
147
+ .upload-text {
148
+ font-size: 1.3em;
149
+ color: #333;
150
+ margin-bottom: 15px;
151
+ }
152
+
153
+ .upload-subtext {
154
+ color: #6c757d;
155
+ font-size: 1em;
156
+ }
157
+
158
+ #fileInput {
159
+ display: none;
160
+ }
161
+
162
+ .btn {
163
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
164
+ color: white;
165
+ border: none;
166
+ padding: 15px 30px;
167
+ border-radius: 50px;
168
+ font-size: 1.1em;
169
+ cursor: pointer;
170
+ transition: all 0.3s ease;
171
+ margin: 10px;
172
+ box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
173
+ }
174
+
175
+ .btn:hover {
176
+ transform: translateY(-2px);
177
+ box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
178
+ }
179
+
180
+ .btn:active {
181
+ transform: translateY(0);
182
+ }
183
+
184
+ .progress-container {
185
+ margin: 20px 0;
186
+ display: none;
187
+ }
188
+
189
+ .progress-bar {
190
+ width: 100%;
191
+ height: 20px;
192
+ background: #e9ecef;
193
+ border-radius: 10px;
194
+ overflow: hidden;
195
+ box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
196
+ }
197
+
198
+ .progress-fill {
199
+ height: 100%;
200
+ background: linear-gradient(90deg, #4facfe, #00f2fe);
201
+ width: 0%;
202
+ transition: width 0.3s ease;
203
+ border-radius: 10px;
204
+ }
205
+
206
+ .progress-text {
207
+ text-align: center;
208
+ margin-top: 10px;
209
+ font-weight: bold;
210
+ color: #333;
211
+ }
212
+
213
+ .files-section {
214
+ padding: 40px;
215
+ background: #f8f9fa;
216
+ }
217
+
218
+ .files-header {
219
+ display: flex;
220
+ justify-content: space-between;
221
+ align-items: center;
222
+ margin-bottom: 30px;
223
+ }
224
+
225
+ .files-title {
226
+ font-size: 1.8em;
227
+ color: #333;
228
+ }
229
+
230
+ .refresh-btn {
231
+ background: #28a745;
232
+ font-size: 0.9em;
233
+ padding: 10px 20px;
234
+ }
235
+
236
+ .files-grid {
237
+ display: grid;
238
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
239
+ gap: 20px;
240
+ }
241
+
242
+ .file-card {
243
+ background: white;
244
+ border-radius: 15px;
245
+ padding: 20px;
246
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
247
+ transition: all 0.3s ease;
248
+ border: 1px solid #e9ecef;
249
+ position: relative;
250
+ overflow: hidden;
251
+ }
252
+
253
+ .file-card:hover {
254
+ transform: translateY(-5px);
255
+ box-shadow: 0 8px 25px rgba(0,0,0,0.15);
256
+ }
257
+
258
+ .file-preview {
259
+ width: 100%;
260
+ height: 150px;
261
+ background: #f8f9fa;
262
+ border-radius: 10px;
263
+ margin-bottom: 15px;
264
+ display: flex;
265
+ align-items: center;
266
+ justify-content: center;
267
+ overflow: hidden;
268
+ position: relative;
269
+ cursor: pointer;
270
+ }
271
+
272
+ .file-preview img {
273
+ max-width: 100%;
274
+ max-height: 100%;
275
+ object-fit: cover;
276
+ border-radius: 8px;
277
+ }
278
+
279
+ .file-preview video {
280
+ max-width: 100%;
281
+ max-height: 100%;
282
+ object-fit: cover;
283
+ border-radius: 8px;
284
+ }
285
+
286
+ .file-preview-icon {
287
+ font-size: 3em;
288
+ color: #dee2e6;
289
+ }
290
+
291
+ .video-overlay {
292
+ position: absolute;
293
+ top: 50%;
294
+ left: 50%;
295
+ transform: translate(-50%, -50%);
296
+ background: rgba(0,0,0,0.7);
297
+ color: white;
298
+ border-radius: 50%;
299
+ width: 50px;
300
+ height: 50px;
301
+ display: flex;
302
+ align-items: center;
303
+ justify-content: center;
304
+ font-size: 1.2em;
305
+ cursor: pointer;
306
+ transition: all 0.3s ease;
307
+ }
308
+
309
+ .video-overlay:hover {
310
+ background: rgba(0,0,0,0.9);
311
+ transform: translate(-50%, -50%) scale(1.1);
312
+ }
313
+
314
+ .preview-modal {
315
+ display: none;
316
+ position: fixed;
317
+ z-index: 1000;
318
+ left: 0;
319
+ top: 0;
320
+ width: 100%;
321
+ height: 100%;
322
+ background: rgba(0,0,0,0.9);
323
+ backdrop-filter: blur(5px);
324
+ }
325
+
326
+ .modal-content {
327
+ position: absolute;
328
+ top: 50%;
329
+ left: 50%;
330
+ transform: translate(-50%, -50%);
331
+ max-width: 90vw;
332
+ max-height: 90vh;
333
+ background: white;
334
+ border-radius: 15px;
335
+ overflow: hidden;
336
+ box-shadow: 0 20px 40px rgba(0,0,0,0.3);
337
+ }
338
+
339
+ .modal-header {
340
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
341
+ color: white;
342
+ padding: 15px 20px;
343
+ display: flex;
344
+ justify-content: space-between;
345
+ align-items: center;
346
+ }
347
+
348
+ .modal-title {
349
+ font-size: 1.2em;
350
+ font-weight: 600;
351
+ }
352
+
353
+ .modal-close {
354
+ background: none;
355
+ border: none;
356
+ color: white;
357
+ font-size: 1.5em;
358
+ cursor: pointer;
359
+ padding: 5px;
360
+ border-radius: 5px;
361
+ transition: background 0.3s ease;
362
+ }
363
+
364
+ .modal-close:hover {
365
+ background: rgba(255,255,255,0.2);
366
+ }
367
+
368
+ .modal-body {
369
+ padding: 0;
370
+ text-align: center;
371
+ }
372
+
373
+ .modal-body img,
374
+ .modal-body video {
375
+ max-width: 100%;
376
+ max-height: 70vh;
377
+ object-fit: contain;
378
+ }
379
+
380
+ .modal-body video {
381
+ width: 100%;
382
+ }
383
+
384
+ .file-info {
385
+ display: flex;
386
+ align-items: center;
387
+ margin-bottom: 15px;
388
+ }
389
+
390
+ .file-details h3 {
391
+ color: #333;
392
+ font-size: 1.1em;
393
+ margin-bottom: 5px;
394
+ word-break: break-word;
395
+ }
396
+
397
+ .file-meta {
398
+ color: #6c757d;
399
+ font-size: 0.9em;
400
+ }
401
+
402
+ .file-actions {
403
+ display: flex;
404
+ gap: 10px;
405
+ }
406
+
407
+ .btn-small {
408
+ padding: 8px 16px;
409
+ font-size: 0.9em;
410
+ border-radius: 20px;
411
+ }
412
+
413
+ .btn-download {
414
+ background: linear-gradient(135deg, #28a745, #20c997);
415
+ }
416
+
417
+ .btn-delete {
418
+ background: linear-gradient(135deg, #dc3545, #fd7e14);
419
+ }
420
+
421
+ .message {
422
+ padding: 15px;
423
+ border-radius: 10px;
424
+ margin: 20px 0;
425
+ font-weight: bold;
426
+ text-align: center;
427
+ }
428
+
429
+ .message.success {
430
+ background: #d4edda;
431
+ color: #155724;
432
+ border: 1px solid #c3e6cb;
433
+ }
434
+
435
+ .message.error {
436
+ background: #f8d7da;
437
+ color: #721c24;
438
+ border: 1px solid #f5c6cb;
439
+ }
440
+
441
+ .empty-state {
442
+ text-align: center;
443
+ padding: 60px 20px;
444
+ color: #6c757d;
445
+ }
446
+
447
+ .empty-icon {
448
+ font-size: 4em;
449
+ margin-bottom: 20px;
450
+ opacity: 0.5;
451
+ }
452
+
453
+ .loading {
454
+ display: none;
455
+ text-align: center;
456
+ padding: 40px;
457
+ }
458
+
459
+ .spinner {
460
+ border: 4px solid #f3f3f3;
461
+ border-top: 4px solid #4facfe;
462
+ border-radius: 50%;
463
+ width: 50px;
464
+ height: 50px;
465
+ animation: spin 1s linear infinite;
466
+ margin: 0 auto 20px;
467
+ }
468
+
469
+ @keyframes spin {
470
+ 0% { transform: rotate(0deg); }
471
+ 100% { transform: rotate(360deg); }
472
+ }
473
+
474
+ /* Admin Panel */
475
+ .admin-panel {
476
+ background: #f8f9fa;
477
+ border: 1px solid #dee2e6;
478
+ border-radius: 15px;
479
+ padding: 30px;
480
+ margin: 20px 40px;
481
+ display: none;
482
+ box-shadow: 0 4px 15px rgba(0,0,0,0.1);
483
+ }
484
+
485
+ .admin-panel h3 {
486
+ color: #333;
487
+ margin-bottom: 25px;
488
+ font-size: 1.5em;
489
+ text-align: center;
490
+ }
491
+
492
+ .admin-tabs {
493
+ display: flex;
494
+ gap: 10px;
495
+ margin-bottom: 25px;
496
+ justify-content: center;
497
+ }
498
+
499
+ .admin-tab {
500
+ background: #e9ecef;
501
+ color: #495057;
502
+ border: none;
503
+ padding: 10px 20px;
504
+ border-radius: 25px;
505
+ cursor: pointer;
506
+ transition: all 0.3s ease;
507
+ font-weight: 500;
508
+ }
509
+
510
+ .admin-tab.active {
511
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
512
+ color: white;
513
+ }
514
+
515
+ .admin-content {
516
+ background: white;
517
+ border-radius: 10px;
518
+ padding: 25px;
519
+ box-shadow: 0 2px 10px rgba(0,0,0,0.05);
520
+ }
521
+
522
+ .add-user-section {
523
+ display: none;
524
+ }
525
+
526
+ .add-user-section.active {
527
+ display: block;
528
+ }
529
+
530
+ .form-grid {
531
+ display: grid;
532
+ grid-template-columns: 1fr 1fr 1fr auto;
533
+ gap: 15px;
534
+ align-items: end;
535
+ margin-bottom: 20px;
536
+ }
537
+
538
+ .form-group-admin {
539
+ display: flex;
540
+ flex-direction: column;
541
+ }
542
+
543
+ .form-label-admin {
544
+ font-weight: 600;
545
+ color: #333;
546
+ margin-bottom: 5px;
547
+ font-size: 0.9em;
548
+ }
549
+
550
+ .form-input-admin {
551
+ padding: 12px 15px;
552
+ border: 2px solid #e9ecef;
553
+ border-radius: 8px;
554
+ font-size: 14px;
555
+ transition: border-color 0.3s ease;
556
+ outline: none;
557
+ }
558
+
559
+ .form-input-admin:focus {
560
+ border-color: #4facfe;
561
+ box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
562
+ }
563
+
564
+ .btn-add-user {
565
+ background: linear-gradient(135deg, #28a745, #20c997);
566
+ color: white;
567
+ border: none;
568
+ padding: 12px 20px;
569
+ border-radius: 8px;
570
+ cursor: pointer;
571
+ font-weight: 600;
572
+ transition: all 0.3s ease;
573
+ white-space: nowrap;
574
+ }
575
+
576
+ .btn-add-user:hover {
577
+ transform: translateY(-2px);
578
+ box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
579
+ }
580
+
581
+ .users-list-section {
582
+ display: block;
583
+ }
584
+
585
+ .users-list-section.active {
586
+ display: block;
587
+ }
588
+
589
+ .users-grid {
590
+ display: grid;
591
+ gap: 15px;
592
+ }
593
+
594
+ .user-card {
595
+ background: #f8f9fa;
596
+ border: 1px solid #e9ecef;
597
+ border-radius: 10px;
598
+ padding: 15px;
599
+ display: flex;
600
+ justify-content: space-between;
601
+ align-items: center;
602
+ transition: all 0.3s ease;
603
+ }
604
+
605
+ .user-card:hover {
606
+ background: #e9ecef;
607
+ transform: translateY(-2px);
608
+ }
609
+
610
+ .user-info {
611
+ display: flex;
612
+ align-items: center;
613
+ gap: 10px;
614
+ }
615
+
616
+ .user-avatar {
617
+ width: 40px;
618
+ height: 40px;
619
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
620
+ border-radius: 50%;
621
+ display: flex;
622
+ align-items: center;
623
+ justify-content: center;
624
+ color: white;
625
+ font-weight: bold;
626
+ }
627
+
628
+ .user-details h4 {
629
+ margin: 0;
630
+ color: #333;
631
+ font-size: 1.1em;
632
+ }
633
+
634
+ .user-role {
635
+ font-size: 0.8em;
636
+ color: #6c757d;
637
+ margin-top: 2px;
638
+ }
639
+
640
+ .btn-delete-user {
641
+ background: linear-gradient(135deg, #dc3545, #fd7e14);
642
+ color: white;
643
+ border: none;
644
+ padding: 8px 15px;
645
+ border-radius: 6px;
646
+ cursor: pointer;
647
+ font-size: 0.9em;
648
+ transition: all 0.3s ease;
649
+ }
650
+
651
+ .btn-delete-user:hover {
652
+ transform: translateY(-2px);
653
+ box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
654
+ }
655
+
656
+ .btn-delete-user:disabled {
657
+ opacity: 0.5;
658
+ cursor: not-allowed;
659
+ transform: none;
660
+ }
661
+
662
+ /* Responsive Design */
663
+ @media (max-width: 768px) {
664
+ body {
665
+ padding: 10px;
666
+ }
667
+
668
+ .header h1 {
669
+ font-size: 2em;
670
+ }
671
+
672
+ .header p {
673
+ font-size: 1em;
674
+ }
675
+
676
+ .user-info {
677
+ position: static;
678
+ margin-bottom: 20px;
679
+ justify-content: center;
680
+ }
681
+
682
+ .upload-section, .files-section {
683
+ padding: 20px;
684
+ }
685
+
686
+ .upload-area {
687
+ padding: 40px 15px;
688
+ }
689
+
690
+ .upload-icon {
691
+ font-size: 3em;
692
+ }
693
+
694
+ .upload-text {
695
+ font-size: 1.1em;
696
+ }
697
+
698
+ .stats {
699
+ flex-direction: column;
700
+ gap: 15px;
701
+ }
702
+
703
+ .files-header {
704
+ flex-direction: column;
705
+ gap: 15px;
706
+ text-align: center;
707
+ }
708
+
709
+ .files-grid {
710
+ grid-template-columns: 1fr;
711
+ }
712
+
713
+ .file-actions {
714
+ flex-direction: column;
715
+ }
716
+
717
+ .admin-panel {
718
+ margin: 20px;
719
+ padding: 20px;
720
+ }
721
+
722
+ .admin-tabs {
723
+ flex-direction: column;
724
+ gap: 5px;
725
+ }
726
+
727
+ .admin-tab {
728
+ padding: 8px 15px;
729
+ font-size: 0.9em;
730
+ }
731
+
732
+ .form-grid {
733
+ grid-template-columns: 1fr;
734
+ gap: 10px;
735
+ }
736
+
737
+ .form-group-admin {
738
+ margin-bottom: 15px;
739
+ }
740
+
741
+ .btn-add-user {
742
+ width: 100%;
743
+ margin-top: 10px;
744
+ }
745
+
746
+ .user-card {
747
+ flex-direction: column;
748
+ gap: 15px;
749
+ text-align: center;
750
+ }
751
+
752
+ .user-info {
753
+ justify-content: center;
754
+ }
755
+ }
756
+
757
+ @media (max-width: 480px) {
758
+ .header {
759
+ padding: 20px;
760
+ }
761
+
762
+ .header h1 {
763
+ font-size: 1.8em;
764
+ }
765
+
766
+ .upload-area {
767
+ padding: 30px 10px;
768
+ }
769
+
770
+ .btn {
771
+ padding: 12px 24px;
772
+ font-size: 1em;
773
+ }
774
+ }
775
+ </style>
776
+ </head>
777
+ <body>
778
+ <div class="container">
779
+ <!-- Header -->
780
+ <div class="header">
781
+ <div class="user-info">
782
+ <i class="fas fa-user"></i> {{ username }}
783
+ {% if is_admin %}
784
+ <span class="admin-badge">ADMIN</span>
785
+ <button class="admin-btn" onclick="toggleAdminPanel()">
786
+ <i class="fas fa-cog"></i> Admin
787
+ </button>
788
+ {% endif %}
789
+ <a class="logout-btn" href="/logout">
790
+ <i class="fas fa-sign-out-alt"></i> Déconnexion
791
+ </a>
792
+ </div>
793
+ <h1>📁 Gestionnaire de Fichiers Pro</h1>
794
+ <p>Upload, téléchargez et gérez vos fichiers facilement</p>
795
+ </div>
796
+ <!-- Admin Panel -->
797
+ {% if is_admin %}
798
+ <div class="admin-panel" id="adminPanel">
799
+ <h3><i class="fas fa-users-cog"></i> Panel d'Administration</h3>
800
+ <div class="admin-tabs">
801
+ <button class="admin-tab active" onclick="switchAdminTab('add-user')">
802
+ <i class="fas fa-user-plus"></i> Ajouter Utilisateur
803
+ </button>
804
+ <button class="admin-tab" onclick="switchAdminTab('manage-users')">
805
+ <i class="fas fa-users"></i> Gérer Utilisateurs
806
+ </button>
807
+ </div>
808
+ <div class="admin-content">
809
+ <!-- Ajouter un utilisateur -->
810
+ <div class="add-user-section active" id="add-user-section">
811
+ <h4 style="margin-bottom: 20px; color: #333;">
812
+ <i class="fas fa-user-plus"></i> Créer un nouvel utilisateur
813
+ </h4>
814
+ <div class="form-grid">
815
+ <div class="form-group-admin">
816
+ <label class="form-label-admin">Nom d'utilisateur</label>
817
+ <input class="form-input-admin" id="newUsername" placeholder="Entrez le nom d'utilisateur" type="text"/>
818
+ </div>
819
+ <div class="form-group-admin">
820
+ <label class="form-label-admin">Mot de passe</label>
821
+ <input class="form-input-admin" id="newPassword" placeholder="Entrez le mot de passe" type="password"/>
822
+ </div>
823
+ <div class="form-group-admin">
824
+ <label class="form-label-admin">Rôle</label>
825
+ <select class="form-input-admin" id="newRole">
826
+ <option value="user">Utilisateur</option>
827
+ <option value="admin">Administrateur</option>
828
+ </select>
829
+ </div>
830
+ <button class="btn-add-user" onclick="addUser()">
831
+ <i class="fas fa-plus"></i> Créer
832
+ </button>
833
+ </div>
834
+ </div>
835
+ <!-- Gérer les utilisateurs -->
836
+ <div class="users-list-section" id="manage-users-section" style="display: none;">
837
+ <h4 style="margin-bottom: 20px; color: #333;">
838
+ <i class="fas fa-users"></i> Utilisateurs existants
839
+ </h4>
840
+ <div class="users-grid" id="usersList">
841
+ <!-- Liste des utilisateurs chargée dynamiquement -->
842
+ </div>
843
+ </div>
844
+ </div>
845
+ </div>
846
+ {% endif %}
847
+
848
+ <!-- Stats -->
849
+ <div class="stats">
850
+ <div class="stat-item">
851
+ <div class="stat-number" id="totalFiles">0</div>
852
+ <div class="stat-label">Fichiers</div>
853
+ </div>
854
+ <div class="stat-item">
855
+ <div class="stat-number" id="totalSize">0 B</div>
856
+ <div class="stat-label">Taille totale</div>
857
+ </div>
858
+ <div class="stat-item">
859
+ <div class="stat-number">8 GB</div>
860
+ <div class="stat-label">Limite par fichier</div>
861
+ </div>
862
+ </div>
863
+ <!-- Upload Section -->
864
+ <div class="upload-section">
865
+ <div class="upload-area" id="uploadArea">
866
+ <div class="upload-icon">📤</div>
867
+ <div class="upload-text">Glissez-déposez vos fichiers ici</div>
868
+ <div class="upload-subtext">ou cliquez pour sélectionner</div>
869
+ <input id="fileInput" multiple="" type="file"/>
870
+ </div>
871
+ <div class="progress-container" id="progressContainer">
872
+ <div class="progress-bar">
873
+ <div class="progress-fill" id="progressFill"></div>
874
+ </div>
875
+ <div class="progress-text" id="progressText">Upload en cours...</div>
876
+ </div>
877
+ <button class="btn" onclick="document.getElementById('fileInput').click()">
878
+ 📁 Sélectionner des fichiers
879
+ </button>
880
+ </div>
881
+ <!-- Messages -->
882
+ <div id="messageContainer"></div>
883
+ <!-- Files Section -->
884
+ <div class="files-section">
885
+ <div class="files-header">
886
+ <h2 class="files-title">📂 Mes Fichiers</h2>
887
+ <button class="btn refresh-btn" onclick="loadFiles()">
888
+ 🔄 Actualiser
889
+ </button>
890
+ </div>
891
+ <div class="loading" id="loading">
892
+ <div class="spinner"></div>
893
+ <p>Chargement des fichiers...</p>
894
+ </div>
895
+ <div class="files-grid" id="filesGrid"></div>
896
+ </div>
897
+ </div>
898
+ <!-- Modal de prévisualisation -->
899
+ <div class="preview-modal" id="previewModal">
900
+ <div class="modal-content">
901
+ <div class="modal-header">
902
+ <div class="modal-title" id="modalTitle">Aperçu du fichier</div>
903
+ <button class="modal-close" onclick="closePreview()">
904
+ <i class="fas fa-times"></i>
905
+ </button>
906
+ </div>
907
+ <div class="modal-body" id="modalBody">
908
+ <!-- Contenu dynamique -->
909
+ </div>
910
+ </div>
911
+ </div>
912
+ <script>
913
+ // Variables globales
914
+ let isUploading = false;
915
+ const isAdmin = {{ 'true' if is_admin else 'false' }};
916
+
917
+ // Initialisation
918
+ document.addEventListener('DOMContentLoaded', function() {
919
+ loadFiles();
920
+ setupEventListeners();
921
+ if (isAdmin) {
922
+ loadUsers();
923
+ }
924
+ });
925
+
926
+ function setupEventListeners() {
927
+ const uploadArea = document.getElementById('uploadArea');
928
+ const fileInput = document.getElementById('fileInput');
929
+
930
+ // Drag & Drop
931
+ uploadArea.addEventListener('dragover', function(e) {
932
+ e.preventDefault();
933
+ uploadArea.classList.add('dragover');
934
+ });
935
+
936
+ uploadArea.addEventListener('dragleave', function(e) {
937
+ e.preventDefault();
938
+ uploadArea.classList.remove('dragover');
939
+ });
940
+
941
+ uploadArea.addEventListener('drop', function(e) {
942
+ e.preventDefault();
943
+ uploadArea.classList.remove('dragover');
944
+ const files = e.dataTransfer.files;
945
+ if (files.length > 0) {
946
+ handleFiles(files);
947
+ }
948
+ });
949
+
950
+ // Click to upload
951
+ uploadArea.addEventListener('click', function() {
952
+ if (!isUploading) {
953
+ fileInput.click();
954
+ }
955
+ });
956
+
957
+ // File input change
958
+ fileInput.addEventListener('change', function(e) {
959
+ if (e.target.files.length > 0) {
960
+ handleFiles(e.target.files);
961
+ }
962
+ });
963
+ }
964
+
965
+ function handleFiles(files) {
966
+ if (isUploading) {
967
+ showMessage('Un upload est déjà en cours...', 'error');
968
+ return;
969
+ }
970
+
971
+ if (files.length === 0) {
972
+ showMessage('Aucun fichier sélectionné', 'error');
973
+ return;
974
+ }
975
+
976
+ uploadFilesSequentially(Array.from(files), 0);
977
+ }
978
+
979
+ function uploadFilesSequentially(files, index) {
980
+ if (index >= files.length) {
981
+ hideProgress();
982
+ loadFiles();
983
+ return;
984
+ }
985
+
986
+ const file = files[index];
987
+ const totalFiles = files.length;
988
+
989
+ showProgress();
990
+ updateProgress(0, `Upload ${index + 1}/${totalFiles}: ${file.name}`);
991
+
992
+ uploadSingleFile(file, function(success) {
993
+ if (success) {
994
+ updateProgress(100, `✅ ${file.name} uploadé avec succès`);
995
+ } else {
996
+ updateProgress(100, `❌ Erreur lors de l'upload de ${file.name}`);
997
+ }
998
+
999
+ setTimeout(() => {
1000
+ uploadFilesSequentially(files, index + 1);
1001
+ }, 1000);
1002
+ });
1003
+ }
1004
+
1005
+ function uploadSingleFile(file, callback) {
1006
+ const formData = new FormData();
1007
+ formData.append('file', file);
1008
+
1009
+ const xhr = new XMLHttpRequest();
1010
+
1011
+ xhr.upload.addEventListener('progress', function(e) {
1012
+ if (e.lengthComputable) {
1013
+ const percentComplete = (e.loaded / e.total) * 100;
1014
+ updateProgress(percentComplete, `Upload en cours: ${file.name}`);
1015
+ }
1016
+ });
1017
+
1018
+ xhr.addEventListener('load', function() {
1019
+ isUploading = false;
1020
+ try {
1021
+ const response = JSON.parse(xhr.responseText);
1022
+ if (xhr.status === 200 && response.success) {
1023
+ showMessage(response.message, 'success');
1024
+ callback(true);
1025
+ } else {
1026
+ showMessage(response.error || 'Erreur lors de l\'upload', 'error');
1027
+ callback(false);
1028
+ }
1029
+ } catch (e) {
1030
+ showMessage('Erreur lors de l\'upload', 'error');
1031
+ callback(false);
1032
+ }
1033
+ });
1034
+
1035
+ xhr.addEventListener('error', function() {
1036
+ isUploading = false;
1037
+ showMessage('Erreur réseau lors de l\'upload', 'error');
1038
+ callback(false);
1039
+ });
1040
+
1041
+ isUploading = true;
1042
+ xhr.open('POST', '/upload');
1043
+ xhr.send(formData);
1044
+ }
1045
+
1046
+ function loadFiles() {
1047
+ const loading = document.getElementById('loading');
1048
+ const filesGrid = document.getElementById('filesGrid');
1049
+
1050
+ loading.style.display = 'block';
1051
+ filesGrid.innerHTML = '';
1052
+
1053
+ fetch('/api/files')
1054
+ .then(response => response.json())
1055
+ .then(data => {
1056
+ loading.style.display = 'none';
1057
+ displayFiles(data.files);
1058
+ updateStats(data.total_files, data.total_size);
1059
+ })
1060
+ .catch(error => {
1061
+ loading.style.display = 'none';
1062
+ showMessage('Erreur lors du chargement des fichiers', 'error');
1063
+ console.error('Error:', error);
1064
+ });
1065
+ }
1066
+
1067
+ function displayFiles(files) {
1068
+ const filesGrid = document.getElementById('filesGrid');
1069
+
1070
+ if (files.length === 0) {
1071
+ filesGrid.innerHTML = `
1072
+ <div class="empty-state">
1073
+ <div class="empty-icon">📭</div>
1074
+ <h3>Aucun fichier</h3>
1075
+ <p>Uploadez vos premiers fichiers pour commencer</p>
1076
+ </div>
1077
+ `;
1078
+ return;
1079
+ }
1080
+
1081
+ filesGrid.innerHTML = files.map(file => {
1082
+ let previewHtml = '';
1083
+
1084
+ if (file.is_image && file.thumbnail) {
1085
+ previewHtml = `
1086
+ <div class="file-preview" onclick="openPreview('${file.name}', 'image')">
1087
+ <img src="/thumbnail/${file.thumbnail}" alt="${file.name}" loading="lazy">
1088
+ </div>
1089
+ `;
1090
+ } else if (file.is_video) {
1091
+ previewHtml = `
1092
+ <div class="file-preview" onclick="openPreview('${file.name}', 'video')">
1093
+ <video preload="metadata">
1094
+ <source src="/preview/${encodeURIComponent(file.name)}" type="video/mp4">
1095
+ </video>
1096
+ <div class="video-overlay">
1097
+ <i class="fas fa-play"></i>
1098
+ </div>
1099
+ </div>
1100
+ `;
1101
+ } else {
1102
+ previewHtml = `
1103
+ <div class="file-preview">
1104
+ <div class="file-preview-icon">${getFileIcon(file.name)}</div>
1105
+ </div>
1106
+ `;
1107
+ }
1108
+
1109
+ return `
1110
+ <div class="file-card">
1111
+ ${previewHtml}
1112
+ <div class="file-info">
1113
+ <div class="file-details">
1114
+ <h3>${file.name}</h3>
1115
+ <div class="file-meta">
1116
+ ${file.size} • ${file.date}
1117
+ </div>
1118
+ </div>
1119
+ </div>
1120
+ <div class="file-actions">
1121
+ <button class="btn btn-small btn-download" onclick="downloadFile('${file.name}')">
1122
+ <i class="fas fa-download"></i> Télécharger
1123
+ </button>
1124
+ <button class="btn btn-small btn-delete" onclick="deleteFile('${file.name}')">
1125
+ <i class="fas fa-trash"></i> Supprimer
1126
+ </button>
1127
+ </div>
1128
+ </div>
1129
+ `;
1130
+ }).join('');
1131
+ }
1132
+
1133
+ function getFileIcon(filename) {
1134
+ const ext = filename.split('.').pop().toLowerCase();
1135
+ const icons = {
1136
+ 'pdf': '📄',
1137
+ 'doc': '📝', 'docx': '📝',
1138
+ 'xls': '📊', 'xlsx': '📊',
1139
+ 'ppt': '📽️', 'pptx': '📽️',
1140
+ 'txt': '📃',
1141
+ 'jpg': '🖼️', 'jpeg': '🖼️', 'png': '🖼️', 'gif': '🖼️',
1142
+ 'mp3': '🎵', 'wav': '🎵',
1143
+ 'mp4': '🎬', 'avi': '🎬', 'mov': '🎬',
1144
+ 'zip': '📦', 'rar': '📦', '7z': '📦',
1145
+ 'py': '🐍', 'js': '💛', 'html': '🌐', 'css': '🎨'
1146
+ };
1147
+ return icons[ext] || '📄';
1148
+ }
1149
+
1150
+ function downloadFile(filename) {
1151
+ window.open(`/download/${encodeURIComponent(filename)}`, '_blank');
1152
+ }
1153
+
1154
+ function deleteFile(filename) {
1155
+ if (!confirm(`Êtes-vous sûr de vouloir supprimer "${filename}" ?`)) {
1156
+ return;
1157
+ }
1158
+
1159
+ fetch(`/delete/${encodeURIComponent(filename)}`, {
1160
+ method: 'DELETE'
1161
+ })
1162
+ .then(response => response.json())
1163
+ .then(data => {
1164
+ if (data.success) {
1165
+ showMessage(data.message, 'success');
1166
+ loadFiles();
1167
+ } else {
1168
+ showMessage(data.error, 'error');
1169
+ }
1170
+ })
1171
+ .catch(error => {
1172
+ showMessage('Erreur lors de la suppression', 'error');
1173
+ console.error('Error:', error);
1174
+ });
1175
+ }
1176
+
1177
+ function showProgress() {
1178
+ document.getElementById('progressContainer').style.display = 'block';
1179
+ }
1180
+
1181
+ function hideProgress() {
1182
+ document.getElementById('progressContainer').style.display = 'none';
1183
+ document.getElementById('progressFill').style.width = '0%';
1184
+ }
1185
+
1186
+ function updateProgress(percent, text) {
1187
+ document.getElementById('progressFill').style.width = percent + '%';
1188
+ document.getElementById('progressText').textContent = text;
1189
+ }
1190
+
1191
+ function updateStats(totalFiles, totalSize) {
1192
+ document.getElementById('totalFiles').textContent = totalFiles;
1193
+ document.getElementById('totalSize').textContent = totalSize;
1194
+ }
1195
+
1196
+ function showMessage(message, type) {
1197
+ const container = document.getElementById('messageContainer');
1198
+ const messageDiv = document.createElement('div');
1199
+ messageDiv.className = `message ${type}`;
1200
+ messageDiv.textContent = message;
1201
+
1202
+ container.appendChild(messageDiv);
1203
+
1204
+ setTimeout(() => {
1205
+ messageDiv.remove();
1206
+ }, 5000);
1207
+ }
1208
+
1209
+ // Fonctions de prévisualisation
1210
+ function openPreview(filename, type) {
1211
+ const modal = document.getElementById('previewModal');
1212
+ const modalTitle = document.getElementById('modalTitle');
1213
+ const modalBody = document.getElementById('modalBody');
1214
+
1215
+ modalTitle.textContent = filename;
1216
+
1217
+ if (type === 'image') {
1218
+ modalBody.innerHTML = `<img src="/preview/${encodeURIComponent(filename)}" alt="${filename}">`;
1219
+ } else if (type === 'video') {
1220
+ modalBody.innerHTML = `
1221
+ <video controls autoplay>
1222
+ <source src="/preview/${encodeURIComponent(filename)}" type="video/mp4">
1223
+ Votre navigateur ne supporte pas la lecture vidéo.
1224
+ </video>
1225
+ `;
1226
+ }
1227
+
1228
+ modal.style.display = 'block';
1229
+ document.body.style.overflow = 'hidden';
1230
+ }
1231
+
1232
+ function closePreview() {
1233
+ const modal = document.getElementById('previewModal');
1234
+ const modalBody = document.getElementById('modalBody');
1235
+
1236
+ modal.style.display = 'none';
1237
+ document.body.style.overflow = 'auto';
1238
+ modalBody.innerHTML = '';
1239
+ }
1240
+
1241
+ // Fermer la modal en cliquant à l'extérieur
1242
+ document.getElementById('previewModal').addEventListener('click', function(e) {
1243
+ if (e.target === this) {
1244
+ closePreview();
1245
+ }
1246
+ });
1247
+
1248
+ // Fermer la modal avec la touche Escape
1249
+ document.addEventListener('keydown', function(e) {
1250
+ if (e.key === 'Escape') {
1251
+ closePreview();
1252
+ }
1253
+ });
1254
+
1255
+ // Fonctions d'administration
1256
+ function toggleAdminPanel() {
1257
+ const panel = document.getElementById('adminPanel');
1258
+ if (panel.style.display === 'none' || panel.style.display === '') {
1259
+ panel.style.display = 'block';
1260
+ loadUsers();
1261
+ } else {
1262
+ panel.style.display = 'none';
1263
+ }
1264
+ }
1265
+
1266
+ function switchAdminTab(tab) {
1267
+ // Gérer les onglets
1268
+ document.querySelectorAll('.admin-tab').forEach(t => t.classList.remove('active'));
1269
+ document.querySelector(`[onclick="switchAdminTab('${tab}')"]`).classList.add('active');
1270
+
1271
+ // Gérer les sections
1272
+ document.getElementById('add-user-section').style.display = tab === 'add-user' ? 'block' : 'none';
1273
+ document.getElementById('manage-users-section').style.display = tab === 'manage-users' ? 'block' : 'none';
1274
+
1275
+ // Charger les utilisateurs si on va sur l'onglet de gestion
1276
+ if (tab === 'manage-users') {
1277
+ loadUsers();
1278
+ }
1279
+ }
1280
+
1281
+ function loadUsers() {
1282
+ if (!isAdmin) return;
1283
+
1284
+ fetch('/admin/users')
1285
+ .then(response => response.json())
1286
+ .then(data => {
1287
+ const usersList = document.getElementById('usersList');
1288
+ usersList.innerHTML = data.users.map(user => `
1289
+ <div class="user-card">
1290
+ <div class="user-info">
1291
+ <div class="user-avatar">
1292
+ ${user.username.charAt(0).toUpperCase()}
1293
+ </div>
1294
+ <div class="user-details">
1295
+ <h4>${user.username}</h4>
1296
+ <div class="user-role">
1297
+ ${user.role === 'admin' ? '👑 Administrateur' : '👤 Utilisateur'}
1298
+ </div>
1299
+ </div>
1300
+ </div>
1301
+ ${user.username !== 'admin' ?
1302
+ `<button class="btn-delete-user" onclick="deleteUser('${user.username}')">
1303
+ <i class="fas fa-trash"></i> Supprimer
1304
+ </button>` :
1305
+ `<button class="btn-delete-user" disabled>
1306
+ <i class="fas fa-shield-alt"></i> Protégé
1307
+ </button>`
1308
+ }
1309
+ </div>
1310
+ `).join('');
1311
+ })
1312
+ .catch(error => {
1313
+ console.error('Erreur lors du chargement des utilisateurs:', error);
1314
+ showMessage('Erreur lors du chargement des utilisateurs', 'error');
1315
+ });
1316
+ }
1317
+
1318
+ function addUser() {
1319
+ const username = document.getElementById('newUsername').value.trim();
1320
+ const password = document.getElementById('newPassword').value.trim();
1321
+ const role = document.getElementById('newRole').value;
1322
+
1323
+ if (!username || !password) {
1324
+ showMessage('Nom d\'utilisateur et mot de passe requis', 'error');
1325
+ return;
1326
+ }
1327
+
1328
+ fetch('/admin/users', {
1329
+ method: 'POST',
1330
+ headers: {
1331
+ 'Content-Type': 'application/json'
1332
+ },
1333
+ body: JSON.stringify({
1334
+ username: username,
1335
+ password: password,
1336
+ role: role
1337
+ })
1338
+ })
1339
+ .then(response => response.json())
1340
+ .then(data => {
1341
+ if (data.success) {
1342
+ showMessage(data.message, 'success');
1343
+ document.getElementById('newUsername').value = '';
1344
+ document.getElementById('newPassword').value = '';
1345
+ document.getElementById('newRole').value = 'user';
1346
+ loadUsers();
1347
+ } else {
1348
+ showMessage(data.error, 'error');
1349
+ }
1350
+ })
1351
+ .catch(error => {
1352
+ showMessage('Erreur lors de l\'ajout de l\'utilisateur', 'error');
1353
+ console.error('Error:', error);
1354
+ });
1355
+ }
1356
+
1357
+ function deleteUser(username) {
1358
+ if (!confirm(`Êtes-vous sûr de vouloir supprimer l'utilisateur "${username}" et tous ses fichiers ?`)) {
1359
+ return;
1360
+ }
1361
+
1362
+ fetch(`/admin/users/${encodeURIComponent(username)}`, {
1363
+ method: 'DELETE'
1364
+ })
1365
+ .then(response => response.json())
1366
+ .then(data => {
1367
+ if (data.success) {
1368
+ showMessage(data.message, 'success');
1369
+ loadUsers();
1370
+ } else {
1371
+ showMessage(data.error, 'error');
1372
+ }
1373
+ })
1374
+ .catch(error => {
1375
+ showMessage('Erreur lors de la suppression de l\'utilisateur', 'error');
1376
+ console.error('Error:', error);
1377
+ });
1378
+ }
1379
+
1380
+ // Reset file input après upload
1381
+ function resetFileInput() {
1382
+ document.getElementById('fileInput').value = '';
1383
+ }
1384
+ </script>
1385
+ </body>
1386
+ </html>
templates/login.html ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="fr">
4
+ <head>
5
+ <meta charset="utf-8"/>
6
+ <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
7
+ <title>Connexion - Gestionnaire de Fichiers Pro</title>
8
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"/>
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
19
+ height: 100vh;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ }
24
+
25
+ .login-container {
26
+ background: white;
27
+ border-radius: 20px;
28
+ box-shadow: 0 20px 40px rgba(0,0,0,0.2);
29
+ padding: 40px;
30
+ width: 400px;
31
+ max-width: 90vw;
32
+ text-align: center;
33
+ }
34
+
35
+ .login-header {
36
+ margin-bottom: 30px;
37
+ }
38
+
39
+ .login-icon {
40
+ width: 80px;
41
+ height: 80px;
42
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
43
+ border-radius: 50%;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ margin: 0 auto 20px;
48
+ color: white;
49
+ font-size: 32px;
50
+ }
51
+
52
+ .login-title {
53
+ font-size: 24px;
54
+ color: #333;
55
+ margin-bottom: 8px;
56
+ font-weight: 700;
57
+ }
58
+
59
+ .login-subtitle {
60
+ color: #666;
61
+ font-size: 14px;
62
+ }
63
+
64
+ .login-form {
65
+ margin-bottom: 20px;
66
+ }
67
+
68
+ .form-group {
69
+ margin-bottom: 20px;
70
+ text-align: left;
71
+ }
72
+
73
+ .form-label {
74
+ display: block;
75
+ margin-bottom: 8px;
76
+ color: #333;
77
+ font-weight: 500;
78
+ font-size: 14px;
79
+ }
80
+
81
+ .form-input {
82
+ width: 100%;
83
+ padding: 12px 16px;
84
+ border: 2px solid #e1e5e9;
85
+ border-radius: 8px;
86
+ font-size: 16px;
87
+ transition: border-color 0.3s ease;
88
+ outline: none;
89
+ }
90
+
91
+ .form-input:focus {
92
+ border-color: #4facfe;
93
+ box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
94
+ }
95
+
96
+ .login-btn {
97
+ width: 100%;
98
+ padding: 12px;
99
+ background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
100
+ color: white;
101
+ border: none;
102
+ border-radius: 8px;
103
+ font-size: 16px;
104
+ font-weight: 600;
105
+ cursor: pointer;
106
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
107
+ }
108
+
109
+ .login-btn:hover {
110
+ transform: translateY(-2px);
111
+ box-shadow: 0 8px 25px rgba(79, 172, 254, 0.3);
112
+ }
113
+
114
+ .login-btn:active {
115
+ transform: translateY(0);
116
+ }
117
+
118
+ .login-btn:disabled {
119
+ opacity: 0.6;
120
+ cursor: not-allowed;
121
+ transform: none;
122
+ }
123
+
124
+ .error-message {
125
+ background: #fee;
126
+ color: #c33;
127
+ padding: 12px;
128
+ border-radius: 8px;
129
+ margin-bottom: 20px;
130
+ border: 1px solid #fcc;
131
+ display: none;
132
+ }
133
+
134
+ .success-message {
135
+ background: #efe;
136
+ color: #3c3;
137
+ padding: 12px;
138
+ border-radius: 8px;
139
+ margin-bottom: 20px;
140
+ border: 1px solid #cfc;
141
+ display: none;
142
+ }
143
+
144
+ .loading {
145
+ display: none;
146
+ margin-left: 8px;
147
+ }
148
+
149
+ .loading i {
150
+ animation: spin 1s linear infinite;
151
+ }
152
+
153
+ @keyframes spin {
154
+ from { transform: rotate(0deg); }
155
+ to { transform: rotate(360deg); }
156
+ }
157
+
158
+ .login-footer {
159
+ margin-top: 30px;
160
+ padding-top: 20px;
161
+ border-top: 1px solid #e1e5e9;
162
+ color: #666;
163
+ font-size: 12px;
164
+ }
165
+
166
+ .demo-accounts {
167
+ background: #f8f9fa;
168
+ border-radius: 8px;
169
+ padding: 15px;
170
+ margin-top: 20px;
171
+ text-align: left;
172
+ }
173
+
174
+ .demo-title {
175
+ font-weight: 600;
176
+ color: #333;
177
+ margin-bottom: 10px;
178
+ text-align: center;
179
+ }
180
+
181
+ .demo-account {
182
+ display: flex;
183
+ justify-content: space-between;
184
+ padding: 5px 0;
185
+ font-size: 13px;
186
+ color: #555;
187
+ }
188
+
189
+ .demo-account:hover {
190
+ background: #e9ecef;
191
+ border-radius: 4px;
192
+ padding: 5px 8px;
193
+ cursor: pointer;
194
+ }
195
+
196
+ .admin-badge {
197
+ background: #dc3545;
198
+ color: white;
199
+ font-size: 10px;
200
+ padding: 2px 6px;
201
+ border-radius: 10px;
202
+ margin-left: 5px;
203
+ }
204
+
205
+ /* Responsive */
206
+ @media (max-width: 480px) {
207
+ .login-container {
208
+ padding: 30px 20px;
209
+ }
210
+
211
+ .login-icon {
212
+ width: 60px;
213
+ height: 60px;
214
+ font-size: 24px;
215
+ }
216
+
217
+ .login-title {
218
+ font-size: 20px;
219
+ }
220
+ }
221
+
222
+ /* Animation d'entrée */
223
+ .login-container {
224
+ animation: slideIn 0.5s ease-out;
225
+ }
226
+
227
+ @keyframes slideIn {
228
+ from {
229
+ opacity: 0;
230
+ transform: translateY(30px);
231
+ }
232
+ to {
233
+ opacity: 1;
234
+ transform: translateY(0);
235
+ }
236
+ }
237
+ </style>
238
+ </head>
239
+ <body>
240
+ <div class="login-container">
241
+ <div class="login-header">
242
+ <div class="login-icon">
243
+ <i class="fas fa-folder-open"></i>
244
+ </div>
245
+ <h1 class="login-title">Gestionnaire de Fichiers Pro</h1>
246
+ <p class="login-subtitle">Connectez-vous pour accéder à vos fichiers</p>
247
+ </div>
248
+ <div class="error-message" id="error-message">
249
+ Identifiants incorrects. Veuillez réessayer.
250
+ </div>
251
+ <div class="success-message" id="success-message">
252
+ Connexion réussie ! Redirection en cours...
253
+ </div>
254
+ <form class="login-form" id="login-form">
255
+ <div class="form-group">
256
+ <label class="form-label" for="username">
257
+ <i class="fas fa-user"></i> Identifiant
258
+ </label>
259
+ <input autocomplete="username" class="form-input" id="username" placeholder="Entrez votre identifiant" required="" type="text"/>
260
+ </div>
261
+ <div class="form-group">
262
+ <label class="form-label" for="password">
263
+ <i class="fas fa-lock"></i> Mot de passe
264
+ </label>
265
+ <input autocomplete="current-password" class="form-input" id="password" placeholder="Entrez votre mot de passe" required="" type="password"/>
266
+ </div>
267
+ <button class="login-btn" id="login-btn" type="submit">
268
+ <span><i class="fas fa-sign-in-alt"></i> Se connecter</span>
269
+ <span class="loading" id="loading">
270
+ <i class="fas fa-spinner"></i>
271
+ </span>
272
+ </button>
273
+ </form>
274
+ <div class="demo-accounts">
275
+ <div class="demo-title">👥 Comptes de démonstration</div>
276
+ <div class="demo-account" onclick="fillCredentials('admin', 'admin123')">
277
+ <span><strong>admin</strong><span class="admin-badge">ADMIN</span></span>
278
+ <span>admin123</span>
279
+ </div>
280
+ <div class="demo-account" onclick="fillCredentials('user1', 'password1')">
281
+ <span><strong>user1</strong></span>
282
+ <span>password1</span>
283
+ </div>
284
+ <div class="demo-account" onclick="fillCredentials('user2', 'password2')">
285
+ <span><strong>user2</strong></span>
286
+ <span>password2</span>
287
+ </div>
288
+ <div class="demo-account" onclick="fillCredentials('demo', 'demo')">
289
+ <span><strong>demo</strong></span>
290
+ <span>demo</span>
291
+ </div>
292
+ </div>
293
+ <div class="login-footer">
294
+ <p><i class="fas fa-folder-open" style="color: #4facfe; margin-right: 5px;"></i>Gestionnaire de fichiers sécurisé</p>
295
+ </div>
296
+ </div>
297
+ <script>
298
+ document.addEventListener('DOMContentLoaded', function() {
299
+ const form = document.getElementById('login-form');
300
+ const usernameInput = document.getElementById('username');
301
+ const passwordInput = document.getElementById('password');
302
+ const loginBtn = document.getElementById('login-btn');
303
+ const loading = document.getElementById('loading');
304
+ const errorMessage = document.getElementById('error-message');
305
+ const successMessage = document.getElementById('success-message');
306
+
307
+ usernameInput.focus();
308
+
309
+ form.addEventListener('submit', function(e) {
310
+ e.preventDefault();
311
+
312
+ const username = usernameInput.value.trim();
313
+ const password = passwordInput.value.trim();
314
+
315
+ if (!username || !password) {
316
+ showError('Veuillez remplir tous les champs');
317
+ return;
318
+ }
319
+
320
+ loginBtn.disabled = true;
321
+ loading.style.display = 'inline';
322
+ hideMessages();
323
+
324
+ fetch('/login', {
325
+ method: 'POST',
326
+ headers: {
327
+ 'Content-Type': 'application/json'
328
+ },
329
+ body: JSON.stringify({
330
+ username: username,
331
+ password: password
332
+ })
333
+ })
334
+ .then(response => response.json())
335
+ .then(data => {
336
+ loginBtn.disabled = false;
337
+ loading.style.display = 'none';
338
+
339
+ if (data.success) {
340
+ showSuccess('Connexion réussie ! Redirection...');
341
+ setTimeout(() => {
342
+ window.location.href = data.redirect;
343
+ }, 1500);
344
+ } else {
345
+ showError(data.error || 'Identifiants incorrects');
346
+ passwordInput.value = '';
347
+ usernameInput.focus();
348
+ }
349
+ })
350
+ .catch(error => {
351
+ loginBtn.disabled = false;
352
+ loading.style.display = 'none';
353
+ showError('Erreur de connexion. Veuillez réessayer.');
354
+ console.error('Erreur:', error);
355
+ });
356
+ });
357
+
358
+ [usernameInput, passwordInput].forEach(input => {
359
+ input.addEventListener('input', hideMessages);
360
+ });
361
+
362
+ function showError(message) {
363
+ errorMessage.textContent = message;
364
+ errorMessage.style.display = 'block';
365
+ successMessage.style.display = 'none';
366
+ }
367
+
368
+ function showSuccess(message) {
369
+ successMessage.textContent = message;
370
+ successMessage.style.display = 'block';
371
+ errorMessage.style.display = 'none';
372
+ }
373
+
374
+ function hideMessages() {
375
+ errorMessage.style.display = 'none';
376
+ successMessage.style.display = 'none';
377
+ }
378
+ });
379
+
380
+ function fillCredentials(username, password) {
381
+ document.getElementById('username').value = username;
382
+ document.getElementById('password').value = password;
383
+ document.getElementById('username').focus();
384
+ }
385
+ </script>
386
+ </body>
387
+ </html>