-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.html
More file actions
559 lines (507 loc) · 17.8 KB
/
upload.html
File metadata and controls
559 lines (507 loc) · 17.8 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
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Swaga - Загрузка</title>
<meta property="og:title" content="анапа 2007">
<meta property="og:description" content="фотки на моём макентоши из анапы скоро перекину тебе через факс">
<meta property="og:image" content="memes/anap2007.png">
<meta property="og:url" content="https://forexample-u.github.io/swaga">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Swaga">
<link rel="icon" href="images/swaga.png" type="image/png" />
<link rel="stylesheet" href="assets/menu.css" />
<style>
body {
background-color: #0f0f0f;
margin: 0;
color: #fff;
}
.container {
width: 470px;
max-width: 100%;
margin: 0 auto;
background-color: #242424;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 30px 60px;
margin-top: 16px;
}
.upload-area {
background-color: #3a3a3a;
border: 2px dashed #fff;
border-radius: 10px;
padding: 50px;
text-align: center;
position: relative;
cursor: pointer;
transition: border-color 0.3s;
}
.upload-area:hover,
.upload-area.dragover {
border-color: #4285f4;
}
.upload-area input[type="file"] {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
}
.upload-area .placeholder {
font-size: 16px;
color: #bfbfbf;
pointer-events: none;
}
.upload-area.valid .placeholder {
display: none;
}
.file-info {
margin-top: 20px;
}
.file-info video {
max-width: 200px;
}
.file-info img {
max-width: 200px;
max-height: 200px;
border-radius: 5px;
}
.form-group {
margin-top: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
select,
textarea {
border: 1px solid #353535;
width: 100%;
padding: 10px 10px;
border-radius: 8px;
font-size: 16px;
box-sizing: border-box;
color: #bfbfbf;
background-color: #353535;
}
textarea {
resize: vertical;
height: 100px;
}
button {
background-color: #1877f2;
color: white;
border: none;
padding: 12px 25px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
transition: background-color 0.3s;
}
button:hover {
background-color: #f72187;
}
button:disabled {
background-color: #676767;
cursor: not-allowed;
}
.progress {
display: none;
margin-top: 20px;
}
.progress-bar {
width: 100%;
height: 20px;
background-color: #eee;
border-radius: 10px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background-color: #4285f4;
width: 0%;
transition: width 0.1s;
}
.result {
display: none;
margin-top: 20px;
padding: 5px 10px;
border: 3px solid #4caf50;
border-radius: 25px;
}
.result a {
color: #4285f4;
text-decoration: none;
}
.result a:hover {
text-decoration: underline;
}
#title {
font-weight: bold;
font-size: 16px;
font-family: inherit;
margin: 0;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
#title::placeholder,
#tag::placeholder,
#description::placeholder {
font-weight: normal;
font-size: 16px;
color: #bfbfbf;
}
@media (max-width: 767px) {
.container {
width: auto;
padding: 16px 25px;
}
.upload-area{
padding: 30px 3px;
}
}
</style>
</head>
<body>
<nav class="sidebar" role="navigation" aria-label="Основное меню сайта">
<div class="logo" onclick="location.href='./index.html'" tabindex="0">Swaga</div>
<a href="./index.html?tag=" tabindex="0">
<span class="nav-icon">🏠</span>
<span>Главная</span>
</a>
<a href="./index.html?tag=deepweb" tabindex="0">
<span class="nav-icon">💀</span>
<span>Нижний интернет</span>
</a>
<a href="./index.html?tag=ai" tabindex="0">
<span class="nav-icon">🤖</span>
<span>Нейро-контент</span>
</a>
<a href="./index.html?tag=haha" tabindex="0">
<span class="nav-icon">😈</span>
<span>Хохотач</span>
</a>
</nav>
<main class="content-area">
<header class="header" role="banner">
<div class="header-left">
<div class="menu-toggle" onclick="this.nextElementSibling.classList.toggle('active')">
<span></span>
<span></span>
<span></span>
</div>
<div class="settings-menu">
<a href="./profile.html" class="menu-item">
<span class="menu-item-icon">👤</span>
<span>Профиль</span>
</a>
<a href="https://t.me/+_IvRIMc5cO9kZWQ6" target="_blank" class="menu-item">
<span class="menu-item-icon">🌵</span>
<span>Телеграмм</span>
</a>
<a href="./faq.html" class="menu-item">
<span class="menu-item-icon">📣</span>
<span>FAQ</span>
</a>
<a href="./graphics.html" class="menu-item">
<span class="menu-item-icon">📉</span>
<span>Смотреть на случайный график</span>
</a>
<a href="./allasearch.html" class="menu-item">
<span class="menu-item-icon">📡</span>
<span>Смотреть в скольки метрах от вас Алла Пугачёва</span>
</a>
<a href="#" class="menu-item">
<span class="menu-item-icon">🧩</span>
<span>Пройти качпу</span>
</a>
<a href="http://peer.infinityfreeapp.com/peer/indexx.php" target="_blank" class="menu-item">
<span class="menu-item-icon">📒</span>
<span>Золотая тетрадка смерти для избранных</span>
</a>
<a href="./terms.html" class="menu-item">
<span class="menu-item-icon">📓</span>
<span>Пользовательское соглашение</span>
</a>
<a href="./devblog/index.html" class="menu-item">
<span class="menu-item-icon">📦</span>
<span>Кодерский блог</span>
</a>
<a href="./games/kakasha/index.html" class="menu-item">
<span class="menu-item-icon">👾</span>
<span>Новая игра</span>
</a>
<a href="#" class="menu-item">
<span class="menu-item-icon">🚪</span>
<span>Дверь</span>
</a>
</div>
<a href="./index.html" class="logo-phone">Swaga</a>
</div>
<div class="header-right">
<a href="./upload.html" class="upload-btn">➕ Создать</a>
<a href="./register.html" class="login-btn">Войти</a>
</div>
</header>
<div class="container">
<h1>Загрузка</h1>
<p>Выберите файл (до 100 МБ, video, image, audio)</p>
<div class="upload-area" id="uploadArea">
<input type="file" id="fileInput" accept="video/*,image/*,.mpv,.avi,.mov,.webm,audio/*">
<div class="placeholder">Кликните здесь или перетащите файл</div>
<div class="file-info" id="fileInfo" style="display: none;"></div>
</div>
<div class="form-group">
<label for="title">Название:</label>
<input type="text" id="title" placeholder="Введите название">
</div>
<div class="form-group">
<label for="description">Описание:</label>
<textarea id="description" placeholder="Введите описание"></textarea>
</div>
<div class="form-group">
<label for="tag">Как зовут данного человека?</label>
<input type="text" id="tag" placeholder="Имя человека" list="tagSuggestions">
<datalist id="tagSuggestions">
<option value="Я">
<option value="Пророк Санбой">
<option value="Мэддисон">
<option value="Виджилинк">
<option value="Маргинал">
<option value="Влад Савельев">
<option value="Папич">
<option value="Ваномас">
<option value="Толян">
<option value="Дон Симон">
<option value="Олег Монгол">
<option value="Игорь Гофман">
<option value="Фирамир">
<option value="Слава КПСС">
<option value="Оксимирон">
<option value="Старый ютуб">
<option value="Неизвестно">
<option value="Озон">
<option value="Другое">
<option value="Пучков">
<option value="Меллстрой">
<option value="Депутат">
<option value="Гена Горин">
<option value="Глад Валакос">
<option value="Руслан Гительман">
<option value="Андрей Гобзавр">
<option value="Иван Золо">
<option value="Нейро-контент">
<option value="Аи">
<option value="Не знаю">
<option value="Никак">
<option value="Не скажу">
<option value="Ничего">
<option value="Забыл">
<option value="Абсурд">
</datalist>
</div>
<button id="uploadBtn" disabled>Загрузить</button>
<div class="progress" id="progress">
<div class="progress-bar">
<div class="progress-fill" id="progressFill"></div>
</div>
<p>Загрузка... <span id="progressPercent">0%</span></p>
</div>
<div class="result" id="result">
<h3>Видео загружено!</h3>
<p><a id="contenturl" href="./index.html">Ссылка на видео</a></p>
</div>
</div>
</main>
<script src="./assets/translater.js"></script>
<script>
const fileInput = document.getElementById('fileInput');
const uploadArea = document.getElementById('uploadArea');
const fileInfo = document.getElementById('fileInfo');
const title = document.getElementById('title');
const tag = document.getElementById('tag');
const description = document.getElementById('description');
const uploadBtn = document.getElementById('uploadBtn');
const progress = document.getElementById('progress');
const progressFill = document.getElementById('progressFill');
const progressPercent = document.getElementById('progressPercent');
const result = document.getElementById('result');
uploadArea.addEventListener('dragover', (e) => {
e.preventDefault();
uploadArea.classList.add('dragover');
});
uploadArea.addEventListener('dragleave', () => {
uploadArea.classList.remove('dragover');
});
uploadArea.addEventListener('drop', (e) => {
e.preventDefault();
uploadArea.classList.remove('dragover');
const files = e.dataTransfer.files;
if (files.length) {
fileInput.files = files;
handleFileSelect();
}
});
fileInput.addEventListener('change', handleFileSelect);
tag.addEventListener('input', function() {
if (tag.value.length > 0) {
tag.setAttribute('list', 'tagSuggestions');
} else {
tag.removeAttribute('list');
}
});
tag.addEventListener('focus', function() {
if (tag.value === '') {
tag.removeAttribute('list');
}
});
function handleFileSelect() {
const file = fileInput.files[0];
if (file) {
if (file.size > 100 * 1024 * 1024) {
alert('Файл слишком большой! Максимум 100 МБ.');
return;
}
if (file.type.startsWith('image/')) {
const img = document.createElement('img');
img.src = URL.createObjectURL(file);
fileInfo.innerHTML = '';
fileInfo.appendChild(img);
} else if (file.type.startsWith('video/')) {
const video = document.createElement('video');
video.src = URL.createObjectURL(file);
video.controls = true;
video.style.borderRadius = "5px";
fileInfo.appendChild(video);
} else if (file.type.startsWith('audio/')) {
const audio = document.createElement('audio');
audio.src = URL.createObjectURL(file);
audio.controls = true;
audio.style.borderRadius = "5px";
fileInfo.appendChild(audio);
} else {
fileInfo.innerHTML = `<p>${file.name} (${(file.size / 1024 / 1024).toFixed(2)} МБ)</p>`;
}
uploadArea.classList.add('valid');
fileInfo.style.display = 'block';
uploadBtn.disabled = !title.value || !description.value;
} else {
uploadArea.classList.remove('valid');
fileInfo.style.display = 'none';
uploadBtn.disabled = true;
}
}
title.addEventListener('input', validate);
description.addEventListener('input', validate);
tag.addEventListener('input', validate);
function convertRusToEngName(rusWord) {
let formatRusWord = rusWord.trim().replace(/\s+/g, ' ').replace(' ', '_').toLowerCase();
let engValue = rusToEng(formatRusWord)
.replace("vjlinkhero", "vjlink")
.replace("vidjilinkhero", "vjlink")
.replace("vidjilink", "vjlink")
.replace("uebermarginal", "marginal")
.replace("ubermarginal", "marginal")
.replace("artas", "papic")
.replace("arthas", "papic")
.replace("meddison", "mEddison")
.replace("ilMY_mEddison", "mEddison")
.replace("mEllstroy", "mellstroy")
.replace("eeoneguy", "ivangay")
.replace("neyro-kontent", "ai");
engValue = engValue.split(',')[0];
if (engValue == "nikto" || engValue == "drugoe" || engValue == "Y") { engValue = ""; }
if (engValue == "nikak" || engValue == "ne_skaju" || engValue == "zabIl") { engValue = ""; }
if (engValue == "neizvestno" || engValue == "ne_znaq" || engValue == "hz" || engValue == "nicego") { engValue = "random"; }
if (engValue == "oksi") { engValue = "oksimiron"; }
if (engValue == "prorok_sanboy") { engValue = "sanboy"; }
if (engValue == "don_simon") { engValue = "simon"; }
if (engValue == "oleg_mongol") { engValue = "mongol"; }
if (engValue == "igorM_gofman") { engValue = "gofman"; }
if (engValue == "gena_gorin") { engValue = "gorin"; }
if (engValue == "glad_valakos") { engValue = "valakos"; }
if (engValue == "ruslan_gitelMman") { engValue = "gitelMman"; }
if (engValue == "andrey_gobzavr") { engValue = "gobzavr"; }
return engValue;
}
function validate() {
uploadBtn.disabled = !fileInput.files[0] || !title.value || !description.value || !tag.value;
}
uploadBtn.addEventListener('click', async () => {
if (!fileInput.files[0] || !title.value || !description.value || !tag.value) return;
try {
progress.style.display = 'block';
uploadBtn.disabled = true;
let percent = 0;
const newinterval = setInterval(() => {
percent += Math.random() * 10;
if (percent >= 99) {
percent = 99;
clearInterval(newinterval);
}
progressFill.style.width = percent + '%';
progressPercent.textContent = Math.round(percent) + '%';
}, 200);
const file = fileInput.files[0];
const ext = file.name.split('.').pop();
const formData = new FormData();
formData.append('file', file);
const server = "https://forexampleu.pythonanywhere.com";
const responseFileUrl = await fetch(server + "/upload", {
method: 'POST',
body: formData
});
const interval = setInterval(() => {
percent += Math.random() * 4;
if (percent >= 100) {
percent = 100;
clearInterval(interval);
progress.style.display = 'none';
result.style.display = 'block';
}
progressFill.style.width = percent + '%';
progressPercent.textContent = Math.round(percent) + '%';
}, 200);
let tagValue = "";
const tags = tag.value.split(' ');
if (tags.length >= 2) { tagValue = tags[1]; }
if (tags.length == 1) { tagValue = tags[0]; }
const fileUrl = await responseFileUrl.text();
const postdata = {
id: Math.floor(Math.random() * 2000000000) + 1,
username: localStorage.getItem("login") || "anon",
userpublickey: "",
usersign: "",
title: title.value || "",
description: description.value || "",
views: 1,
emotions: "😁0",
preview: "",
fileurl: fileUrl,
filetype: ext,
comments: [],
category: "deepweb",
tags: convertRusToEngName(tagValue)
};
const responseCreate = await fetch(server + "/create", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(postdata)
});
document.getElementById('contenturl').href = "./index.html";
const blockId = await responseCreate.text();
} catch {
alert("Ошибка");
}
});
</script>
</body>
</html>