-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
690 lines (596 loc) · 26.4 KB
/
Copy pathindex.html
File metadata and controls
690 lines (596 loc) · 26.4 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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DEAD MAN'S TRIGGER</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Courier New', monospace;
background: linear-gradient(135deg, #0a0a0a 0%, #1a0000 100%);
color: #ff0000;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
text-align: center;
max-width: 800px;
width: 100%;
}
h1 {
font-size: 3em;
margin-bottom: 20px;
text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000;
animation: pulse 2s infinite;
letter-spacing: 5px;
text-align: center;
width: 100%;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.warning {
font-size: 1.2em;
margin-bottom: 30px;
color: #ff6666;
letter-spacing: 2px;
}
.countdown {
font-size: clamp(2em, 8vw, 6em);
font-weight: bold;
margin: 40px 0;
text-shadow: 0 0 30px #ff0000, 0 0 60px #ff0000, 0 0 90px #ff0000;
padding: 20px;
background: rgba(255, 0, 0, 0.1);
border: 3px solid #ff0000;
border-radius: 10px;
box-shadow: 0 0 50px rgba(255, 0, 0, 0.5);
word-break: break-word;
overflow-wrap: break-word;
}
.countdown.critical {
animation: flashRed 0.5s infinite;
}
@keyframes flashRed {
0%, 100% {
background: rgba(255, 0, 0, 0.1);
border-color: #ff0000;
}
50% {
background: rgba(255, 0, 0, 0.4);
border-color: #ff6666;
}
}
.controls {
margin: 30px 0;
}
.btn {
font-family: 'Courier New', monospace;
font-size: 1.3em;
padding: 15px 40px;
margin: 10px;
background: #ff0000;
color: #000;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 2px;
transition: all 0.3s;
box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}
.btn:hover {
background: #ff3333;
box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
transform: scale(1.05);
}
.btn.secondary {
background: #660000;
color: #ff0000;
}
.btn.secondary:hover {
background: #880000;
}
.config {
margin: 30px 0;
padding: 30px;
background: rgba(0, 0, 0, 0.5);
border: 2px solid #660000;
border-radius: 10px;
}
.config-item {
margin: 20px 0;
text-align: left;
}
label {
display: block;
margin-bottom: 10px;
font-size: 1.1em;
color: #ff6666;
text-transform: uppercase;
letter-spacing: 1px;
}
input, textarea {
width: 100%;
padding: 12px;
background: #0a0a0a;
border: 2px solid #ff0000;
color: #ff0000;
font-family: 'Courier New', monospace;
font-size: 1em;
border-radius: 5px;
}
input:focus, textarea:focus {
outline: none;
box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}
textarea {
min-height: 100px;
resize: vertical;
}
.status {
margin: 20px 0;
padding: 15px;
background: rgba(255, 0, 0, 0.1);
border-left: 4px solid #ff0000;
text-align: left;
font-size: 0.9em;
color: #ff6666;
}
.expired {
font-size: 4em;
color: #ff0000;
animation: flashRed 0.3s infinite;
}
/* Success state - calm blue */
body.success {
background: linear-gradient(135deg, #0a1a2e 0%, #16213e 100%);
animation: none;
}
body.success h1 {
color: #4a9eff;
text-shadow: 0 0 20px #4a9eff;
animation: none;
}
body.success .warning {
color: #87ceeb;
}
body.success .countdown {
background: rgba(74, 158, 255, 0.1);
border-color: #4a9eff;
color: #87ceeb;
text-shadow: none;
box-shadow: 0 0 30px rgba(74, 158, 255, 0.3);
animation: none;
}
.success-message {
background: rgba(74, 158, 255, 0.15);
border: 2px solid #4a9eff;
border-radius: 10px;
padding: 30px;
margin: 30px 0;
color: #b3d9ff;
font-size: 1.1em;
line-height: 1.8;
}
.success-message h2 {
color: #4a9eff;
margin-bottom: 20px;
font-size: 1.8em;
}
/* Mobile responsive styles */
@media (max-width: 768px) {
h1 {
font-size: 1.5em;
letter-spacing: 1px;
}
.warning {
font-size: 1em;
letter-spacing: 1px;
}
.countdown {
font-size: clamp(1.5em, 8vw, 4em);
padding: 15px;
margin: 20px 0;
}
.btn {
font-size: 1.1em;
padding: 12px 30px;
margin: 8px;
}
.config {
padding: 20px;
}
label {
font-size: 0.95em;
}
}
</style>
</head>
<body>
<div class="container">
<h1>⚠ DEAD MAN'S TRIGGER ⚠</h1>
<div class="warning" id="warningText">CONFIGURE TRIGGER TO BEGIN</div>
<div id="countdown" class="countdown">
<div id="notArmedMessage">
NOT ARMED
</div>
</div>
<div id="activeControls" style="display: none;">
<div style="margin: 20px 0; color: #ff6666; font-size: 1.1em;">
⚠ Click CHECK-IN to prove you're alive and reset the timer.<br>
<strong>SERVER WILL AUTO-SEND EMAILS WHEN TRIGGERED!</strong>
</div>
<div class="controls">
<button class="btn" onclick="resetTimer()" style="font-size: 2em; padding: 20px 60px;">CHECK-IN / RESET</button>
<button class="btn secondary" onclick="disarmTrigger()">DISARM & EDIT</button>
</div>
</div>
<div id="setupControls" class="controls">
<button class="btn" onclick="toggleConfig()">SETUP TRIGGER</button>
</div>
<div id="config" class="config" style="display: none;">
<div class="config-item">
<label>⏱ Timer Duration (hours)</label>
<input type="number" id="duration" value="24" min="0.01" max="168" step="0.01">
<div style="font-size: 0.85em; color: #ff9999; margin-top: 5px;">
How often you need to check in (e.g., 24 = check in every day)
</div>
</div>
<div class="config-item">
<label>📧 Email Recipients (REQUIRED)</label>
<input type="text" id="emailRecipients" placeholder="person1@example.com, person2@example.com" required>
<div style="font-size: 0.85em; color: #ff9999; margin-top: 5px;">
Server automatically sends emails when triggered - no manual "Send" needed!
</div>
</div>
<div class="config-item">
<label>📄 Secret Message (will be emailed automatically)</label>
<textarea id="secretMessage" placeholder="Enter confidential information, passwords, instructions, etc..."></textarea>
</div>
<div class="config-item">
<label>📎 Upload File to Include in Email</label>
<input type="file" id="fileUpload" onchange="handleFileUpload(event)">
<div id="fileInfo" style="margin-top: 10px; color: #ff6666;"></div>
</div>
<div class="config-item">
<label>🔗 Additional URLs to open (one per line)</label>
<textarea id="triggerUrls" placeholder="https://example.com/document1 https://example.com/document2"></textarea>
</div>
<div class="status">
<strong>STATUS:</strong> <span id="status">Not Armed</span><br>
<strong>LAST RESET:</strong> <span id="lastReset">Never</span><br>
<strong>EXPIRES:</strong> <span id="expiryTime">Not Set</span><br>
<strong>FILES:</strong> <span id="fileStatus">None</span>
</div>
<button class="btn" onclick="saveConfig()" style="font-size: 1.5em; padding: 20px 50px;">ARM TRIGGER</button>
</div>
</div>
<script>
const API_URL = '/api';
let countdownInterval;
let expiryTimestamp;
let uploadedFile = null;
let isArmed = false;
// Handle file upload
function handleFileUpload(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function(e) {
uploadedFile = {
name: file.name,
type: file.type,
data: e.target.result
};
document.getElementById('fileInfo').textContent = `✓ ${file.name} (${(file.size / 1024).toFixed(2)} KB) loaded`;
};
reader.readAsDataURL(file);
}
// Update UI based on armed state
function updateUI() {
const countdown = document.getElementById('countdown');
if (isArmed) {
document.getElementById('setupControls').style.display = 'none';
document.getElementById('activeControls').style.display = 'block';
document.getElementById('config').style.display = 'none';
document.getElementById('warningText').textContent = 'SYSTEM ARMED • AWAITING CHECK-IN';
// Make sure countdown is visible when armed
if (countdown) {
countdown.style.display = 'block';
}
} else {
document.getElementById('setupControls').style.display = 'block';
document.getElementById('activeControls').style.display = 'none';
document.getElementById('warningText').textContent = 'CONFIGURE TRIGGER TO BEGIN';
// Make sure countdown is visible when not armed
if (countdown) {
countdown.style.display = 'block';
}
// Don't overwrite the NOT ARMED HTML message - let the default HTML show
}
}
// Disarm trigger
async function disarmTrigger() {
if (confirm('Are you sure you want to DISARM the trigger?\n\nThis will stop the countdown and allow you to edit settings.')) {
try {
const response = await fetch(`${API_URL}/disarm`, { method: 'POST' });
const data = await response.json();
if (data.success) {
isArmed = false;
if (countdownInterval) {
clearInterval(countdownInterval);
}
updateUI();
toggleConfig();
} else {
alert('Failed to disarm: ' + (data.error || 'Unknown error'));
}
} catch (error) {
document.getElementById('status').innerText = '⚠ SERVER ERROR - Cannot disarm';
}
}
}
// Load configuration from server
async function loadConfig() {
try {
const response = await fetch(`${API_URL}/status`);
const data = await response.json();
if (data.armed) {
expiryTimestamp = data.expiry_timestamp;
isArmed = true;
document.getElementById('duration').value = data.duration_hours;
document.getElementById('emailRecipients').value = data.email_recipients || '';
document.getElementById('secretMessage').value = data.secret_message || '';
document.getElementById('triggerUrls').value = data.trigger_urls || '';
if (data.uploaded_file_name && data.uploaded_file_data) {
uploadedFile = {
name: data.uploaded_file_name,
data: data.uploaded_file_data
};
document.getElementById('fileInfo').textContent = `✓ ${data.uploaded_file_name} ready`;
}
updateStatus(data);
updateUI();
startCountdown();
} else {
updateUI();
}
} catch (error) {
console.error('Failed to load config:', error);
document.getElementById('status').innerText = '⚠ CONNECTION ERROR - Retrying...';
// Retry after 5 seconds
setTimeout(loadConfig, 5000);
}
}
// Save configuration to server
async function saveConfig() {
const duration = parseFloat(document.getElementById('duration').value);
const emailRecipients = document.getElementById('emailRecipients').value.trim();
const secretMessage = document.getElementById('secretMessage').value.trim();
const triggerUrls = document.getElementById('triggerUrls').value.trim();
// Validation
if (!emailRecipients) {
alert('⚠ Email recipients are REQUIRED!\n\nThe dead man\'s switch needs someone to send emails to.\n\nPlease add at least one email address.');
return;
}
if (!secretMessage && !uploadedFile && !triggerUrls) {
alert('⚠ Please add content to send:\n\n• Secret message\n• File upload\n• URLs to open\n\nYou have email recipients, but nothing to send them!');
return;
}
const payload = {
duration_hours: duration,
email_recipients: emailRecipients || null,
secret_message: secretMessage || null,
uploaded_file_name: uploadedFile ? uploadedFile.name : null,
uploaded_file_data: uploadedFile ? uploadedFile.data : null,
trigger_urls: triggerUrls || null
};
try {
const response = await fetch(`${API_URL}/configure`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
const data = await response.json();
if (data.success) {
expiryTimestamp = data.expiry_timestamp;
isArmed = true;
let actions = [];
if (emailRecipients) actions.push('• AUTO-SEND emails to: ' + emailRecipients);
if (secretMessage) actions.push('• Include secret message in email');
if (uploadedFile) actions.push('• Attach file: ' + uploadedFile.name);
if (triggerUrls) actions.push('• AUTO-OPEN ' + triggerUrls.split('\n').filter(u => u.trim()).length + ' URL(s)');
const confirmed = confirm('🚨 TRIGGER ARMED 🚨\n\nTimer: ' + duration + ' hours\n\nIf you don\'t check in, the SERVER will:\n' + actions.join('\n') + '\n\n✓ EMAILS SENT AUTOMATICALLY!\n✓ No browser needed!\n✓ Works even if computer is off!\n\nKeep clicking CHECK-IN to extend time!\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nClick OK to CONFIRM and start countdown\nClick CANCEL to EDIT DETAILS');
if (confirmed) {
// User confirmed - proceed with arming
updateUI();
startCountdown();
// Reload to sync with server
await loadConfig();
} else {
// User wants to edit - disarm and stay on config page
await fetch(`${API_URL}/disarm`, { method: 'POST' });
isArmed = false;
// Config page stays open for editing
}
} else {
alert('Failed to arm trigger: ' + (data.error || 'Unknown error'));
}
} catch (error) {
document.getElementById('status').innerText = '⚠ SETUP ERROR - Check email configuration';
}
}
// Reset timer (Check-in)
async function resetTimer() {
if (!isArmed) {
alert('Trigger is not armed!');
return;
}
try {
const response = await fetch(`${API_URL}/checkin`, { method: 'POST' });
const data = await response.json();
if (data.success) {
expiryTimestamp = data.new_expiry_timestamp;
startCountdown();
alert('✓ CHECK-IN SUCCESSFUL\n\nYou\'re alive! Timer reset.\n\nNext check-in required before:\n' + data.next_checkin);
} else {
alert('Failed to check in: ' + (data.error || 'Unknown error'));
}
} catch (error) {
document.getElementById('status').innerText = '⚠ CHECK-IN ERROR';
}
}
// Toggle configuration panel
function toggleConfig() {
const config = document.getElementById('config');
const notArmedMsg = document.getElementById('notArmedMessage');
const setupControls = document.getElementById('setupControls');
const countdown = document.getElementById('countdown');
if (config.style.display === 'none') {
config.style.display = 'block';
// Hide countdown box, NOT ARMED message, and SETUP TRIGGER button when showing config
if (countdown) {
countdown.style.display = 'none';
}
if (notArmedMsg) {
notArmedMsg.style.display = 'none';
}
if (setupControls) {
setupControls.style.display = 'none';
}
} else {
config.style.display = 'none';
// Show countdown box, NOT ARMED message, and SETUP TRIGGER button when hiding config
if (countdown) {
countdown.style.display = 'block';
}
if (notArmedMsg) {
notArmedMsg.style.display = 'block';
}
if (setupControls) {
setupControls.style.display = 'block';
}
}
}
// Update status display
function updateStatus(data) {
if (data) {
const lastReset = new Date(data.last_reset).toLocaleString();
const expiry = new Date(data.expiry_timestamp).toLocaleString();
document.getElementById('status').textContent = 'ARMED (SERVER-SIDE ✓)';
document.getElementById('lastReset').textContent = lastReset;
document.getElementById('expiryTime').textContent = expiry;
document.getElementById('fileStatus').textContent = data.uploaded_file_name || 'None';
}
}
// Start countdown
function startCountdown() {
if (countdownInterval) {
clearInterval(countdownInterval);
}
// Clear the NOT ARMED message
const notArmedMsg = document.getElementById('notArmedMessage');
if (notArmedMsg) {
notArmedMsg.remove();
}
countdownInterval = setInterval(async () => {
const now = Date.now();
const remaining = expiryTimestamp - now;
if (remaining <= 0) {
clearInterval(countdownInterval);
countdownInterval = null;
// Fetch trigger details for success page
const response = await fetch(`${API_URL}/status`);
const data = await response.json();
// Calculate stats for privacy-focused display
const recipientCount = data.email_recipients ? data.email_recipients.split(',').length : 0;
const messageLength = data.secret_message ? data.secret_message.length : 0;
const hasFile = data.uploaded_file_name ? true : false;
const fileInfo = hasFile ? getFileInfo(data.uploaded_file_name, data.uploaded_file_data) : null;
const sentTime = new Date().toLocaleString();
console.log('Trigger expired - showing success page', { recipientCount, messageLength, hasFile });
// Switch to calm blue success state
document.body.classList.add('success');
// Force clear and replace countdown content
const countdownEl = document.getElementById('countdown');
countdownEl.innerHTML = `
<div class="success-message" style="font-size: 1rem;">
<h2 style="font-size: 1.8em;">🚨 TRIGGER ACTIVATED</h2>
<p style="margin-bottom: 30px; font-size: 1em;">You didn't check in on time. Your Dead Man's Trigger has been activated and your message was delivered.</p>
<div style="background: rgba(74, 158, 255, 0.1); padding: 20px; border-radius: 8px; margin: 20px 0; text-align: left; font-size: 0.95em;">
<h3 style="color: #4a9eff; margin-top: 0; font-size: 1.2em;">📧 WHAT WAS SENT:</h3>
<p style="font-size: 1em;"><strong>Recipients:</strong> ${recipientCount} email address${recipientCount !== 1 ? 'es' : ''}</p>
<p style="font-size: 1em;"><strong>Message:</strong> ${messageLength > 0 ? messageLength + ' characters' : 'None'}</p>
<p style="font-size: 1em;"><strong>File:</strong> ${hasFile ? fileInfo : 'None'}</p>
<p style="font-size: 1em;"><strong>Sent:</strong> ${sentTime}</p>
</div>
<p style="margin: 30px 0 20px 0; font-size: 1em;"><strong>Your trigger is now DISARMED.</strong></p>
<button onclick="resetTrigger()" style="
background: linear-gradient(135deg, #4a9eff, #357abd);
color: white;
border: none;
padding: 15px 40px;
font-size: 1em;
font-weight: bold;
border-radius: 8px;
cursor: pointer;
margin-top: 10px;
box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
transition: transform 0.2s, box-shadow 0.2s;
" onmouseover="this.style.transform='scale(1.05)'; this.style.boxShadow='0 6px 20px rgba(74, 158, 255, 0.5)';" onmouseout="this.style.transform='scale(1)'; this.style.boxShadow='0 4px 15px rgba(74, 158, 255, 0.3)';">
🔄 Set Up New Trigger
</button>
</div>
`;
document.getElementById('warningText').textContent = '✓ Trigger Completed';
// Mark as not armed and update UI
isArmed = false;
updateUI();
return;
}
const hours = Math.floor(remaining / (1000 * 60 * 60));
const minutes = Math.floor((remaining % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((remaining % (1000 * 60)) / 1000);
const display = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
document.getElementById('countdown').textContent = display;
// Flash when under 1 hour
if (remaining < 60 * 60 * 1000) {
document.getElementById('countdown').classList.add('critical');
} else {
document.getElementById('countdown').classList.remove('critical');
}
}, 100);
}
// Helper: Get file info for display (type and size)
function getFileInfo(fileName, fileData) {
const extension = fileName.split('.').pop().toUpperCase();
const sizeInBytes = fileData ? Math.round(fileData.length * 0.75) : 0; // Estimate from base64
const sizeInMB = (sizeInBytes / (1024 * 1024)).toFixed(2);
return `${extension} document (${sizeInMB} MB)`;
}
// Reset trigger and reload page
async function resetTrigger() {
// Clear the page state
document.body.classList.remove('success');
// Reload the page to start fresh
window.location.reload();
}
// Initialize on load
window.onload = () => {
loadConfig();
};
</script>
</body>
</html>