357 lines
12 KiB
HTML
357 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>PDF Unlock — Undo Designs</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--navy: #0C1A3A;
|
|
--navy-2: #12244C;
|
|
--navy-3: #1a2f5e;
|
|
--navy-4: #0a1428;
|
|
--cyan: #00D4FF;
|
|
--cyan-dim: rgba(0,212,255,.12);
|
|
--cyan-glow: rgba(0,212,255,.06);
|
|
--blue: #1B8EF8;
|
|
--green: #10D98A;
|
|
--green-dim: rgba(16,217,138,.12);
|
|
--red: #F04438;
|
|
--red-dim: rgba(240,68,56,.12);
|
|
--amber: #F79009;
|
|
--w1: rgba(255,255,255,.95);
|
|
--w2: rgba(255,255,255,.65);
|
|
--w3: rgba(255,255,255,.35);
|
|
--w4: rgba(255,255,255,.10);
|
|
--w5: rgba(255,255,255,.05);
|
|
--border: rgba(255,255,255,.07);
|
|
--border-c: rgba(0,212,255,.18);
|
|
--mono: 'JetBrains Mono', monospace;
|
|
--disp: 'Space Grotesk', sans-serif;
|
|
--body: 'Inter', sans-serif;
|
|
--radius: 10px;
|
|
}
|
|
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
font-family: var(--body);
|
|
background: var(--navy-4);
|
|
color: var(--w1);
|
|
min-height: 100vh;
|
|
-webkit-font-smoothing: antialiased;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
body::before {
|
|
content: '';
|
|
position: fixed; inset: 0; pointer-events: none; z-index: 0;
|
|
background-image: radial-gradient(circle, rgba(0,212,255,.07) 1px, transparent 1px);
|
|
background-size: 28px 28px;
|
|
}
|
|
|
|
header {
|
|
position: sticky; top: 0; z-index: 100;
|
|
background: rgba(12,26,58,.85);
|
|
backdrop-filter: blur(12px);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 0 32px;
|
|
height: 60px;
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
}
|
|
.logo {
|
|
display: flex; align-items: center; gap: 10px;
|
|
font-family: var(--disp); font-size: 15px; font-weight: 600;
|
|
color: var(--w1); text-decoration: none;
|
|
}
|
|
.logo-icon {
|
|
width: 30px; height: 30px;
|
|
background: linear-gradient(135deg, var(--navy-3), var(--navy-2));
|
|
border: 1px solid var(--border-c);
|
|
border-radius: 7px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.logo-icon svg { width: 16px; height: 16px; }
|
|
.logo span { color: var(--cyan); }
|
|
|
|
.privacy-badge {
|
|
display: flex; align-items: center; gap: 6px;
|
|
font-family: var(--mono); font-size: 10.5px; color: var(--green);
|
|
background: var(--green-dim); border: 1px solid rgba(16,217,138,.25);
|
|
padding: 5px 12px; border-radius: 20px;
|
|
}
|
|
.privacy-badge svg { width: 12px; height: 12px; }
|
|
|
|
main {
|
|
position: relative; z-index: 1;
|
|
flex: 1;
|
|
max-width: 640px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
padding: 48px 24px 80px;
|
|
}
|
|
|
|
.page-title { margin-bottom: 40px; }
|
|
.eyebrow {
|
|
font-family: var(--mono); font-size: 10px;
|
|
letter-spacing: .16em; text-transform: uppercase;
|
|
color: var(--cyan); margin-bottom: 10px;
|
|
}
|
|
.page-title h1 {
|
|
font-family: var(--disp); font-size: 28px; font-weight: 700;
|
|
color: var(--w1); line-height: 1.2; margin-bottom: 8px;
|
|
}
|
|
.page-title p { font-size: 14px; color: var(--w2); line-height: 1.6; }
|
|
|
|
.card {
|
|
background: var(--navy-2);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 24px;
|
|
margin-bottom: 16px;
|
|
}
|
|
.card-label {
|
|
font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
|
|
text-transform: uppercase; color: var(--w3); margin-bottom: 14px;
|
|
}
|
|
|
|
.file-zone {
|
|
border: 1.5px dashed var(--border);
|
|
border-radius: 8px;
|
|
padding: 28px 20px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all .2s;
|
|
position: relative;
|
|
}
|
|
.file-zone:hover, .file-zone.drag-over { border-color: var(--cyan); background: var(--cyan-glow); }
|
|
.file-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
|
|
.file-zone-icon {
|
|
width: 36px; height: 36px; margin: 0 auto 10px;
|
|
background: var(--w5); border-radius: 8px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.file-zone-icon svg { width: 18px; height: 18px; color: var(--w3); }
|
|
.file-zone-label { font-size: 13px; color: var(--w2); }
|
|
.file-zone-label strong { color: var(--cyan); }
|
|
.file-zone-sub { font-size: 11px; color: var(--w3); margin-top: 4px; }
|
|
.file-chosen { font-family: var(--mono); font-size: 11.5px; color: var(--green); margin-top: 10px; }
|
|
|
|
.field { margin-top: 16px; }
|
|
.field label { display: block; font-size: 11px; color: var(--w3); margin-bottom: 6px; }
|
|
.field-hint { font-size: 11px; color: var(--w3); margin-top: 6px; line-height: 1.5; }
|
|
.field input[type="password"], .field input[type="text"] {
|
|
width: 100%; background: var(--navy-4); border: 1px solid var(--border); border-radius: 6px;
|
|
padding: 9px 12px; font-family: var(--body); font-size: 13px; color: var(--w1);
|
|
outline: none; transition: border-color .2s;
|
|
}
|
|
.field input:focus { border-color: var(--cyan); }
|
|
|
|
.btn {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
padding: 11px 22px; border-radius: 8px; border: none;
|
|
font-family: var(--disp); font-size: 13px; font-weight: 600;
|
|
cursor: pointer; transition: all .2s; text-decoration: none;
|
|
width: 100%; margin-top: 16px;
|
|
}
|
|
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: var(--navy); }
|
|
.btn-primary:hover { filter: brightness(1.08); }
|
|
.btn-primary:disabled { opacity: .4; cursor: not-allowed; filter: none; }
|
|
|
|
.spinner {
|
|
display: none;
|
|
align-items: center; gap: 8px;
|
|
font-family: var(--mono); font-size: 11px; color: var(--w3);
|
|
margin-top: 12px;
|
|
}
|
|
.spinner.visible { display: flex; }
|
|
.spinner-dot {
|
|
width: 6px; height: 6px; border-radius: 50%; background: var(--cyan);
|
|
animation: pulse 1s infinite ease-in-out;
|
|
}
|
|
@keyframes pulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
|
|
|
|
.error-note {
|
|
display: none;
|
|
font-size: 12px; color: var(--red); background: var(--red-dim);
|
|
border: 1px solid rgba(240,68,56,.2); border-radius: 8px;
|
|
padding: 12px 14px; margin-top: 12px;
|
|
}
|
|
.error-note.visible { display: block; }
|
|
|
|
.result-card { display: none; }
|
|
.result-card.visible { display: block; }
|
|
.result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
|
|
.result-icon {
|
|
width: 32px; height: 32px; border-radius: 8px;
|
|
background: var(--green-dim); display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.result-icon svg { width: 16px; height: 16px; }
|
|
.result-title { font-family: var(--disp); font-size: 15px; font-weight: 600; color: var(--w1); }
|
|
.result-sub { font-size: 12px; color: var(--w3); margin-top: 2px; }
|
|
|
|
.notice-note {
|
|
font-size: 12px; color: var(--w2); background: var(--w5);
|
|
border: 1px solid var(--border); border-radius: 8px;
|
|
padding: 12px 14px; margin-top: 14px; line-height: 1.5;
|
|
}
|
|
|
|
footer { position: relative; z-index: 1; text-align: center; padding: 20px; font-size: 11px; color: var(--w3); border-top: 1px solid var(--border); }
|
|
footer a { color: var(--cyan); text-decoration: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<a class="logo" href="/">
|
|
<div class="logo-icon">
|
|
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M2 4h12M2 8h8M2 12h5" stroke="#00D4FF" stroke-width="1.5" stroke-linecap="round"/>
|
|
</svg>
|
|
</div>
|
|
PDF <span>Unlock</span>
|
|
</a>
|
|
<div class="privacy-badge">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
|
|
</svg>
|
|
Deleted from the server right after processing
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="page-title">
|
|
<div class="eyebrow">PDF Utilities</div>
|
|
<h1>PDF Unlock</h1>
|
|
<p>Removes PDF password security so you're free to use your PDFs as you want. Strips owner-set restrictions (no printing, no copying, no editing) automatically, and removes the open password too if you supply it below.</p>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-label">PDF File</div>
|
|
<div class="file-zone" id="fileZone">
|
|
<input type="file" id="fileInput" accept=".pdf,application/pdf">
|
|
<div class="file-zone-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
<polyline points="14,2 14,8 20,8"/>
|
|
</svg>
|
|
</div>
|
|
<div class="file-zone-label" id="dropLabel"><strong>Drop a PDF here</strong> or browse</div>
|
|
<div class="file-zone-sub">.pdf files only</div>
|
|
</div>
|
|
<div class="file-chosen" id="fileChosen" style="display:none"></div>
|
|
|
|
<div class="field">
|
|
<label for="pwInput">Open password (only if this PDF requires one to view)</label>
|
|
<input type="password" id="pwInput" placeholder="Leave blank if the PDF isn't password-protected to open">
|
|
<div class="field-hint">Owner-set restrictions (printing, copying, editing) are removed automatically, no password needed. An open password can only be removed if you know it.</div>
|
|
</div>
|
|
|
|
<button class="btn btn-primary" id="unlockBtn" disabled>Unlock PDF</button>
|
|
<div class="spinner" id="spinner">
|
|
<div class="spinner-dot"></div>
|
|
Processing…
|
|
</div>
|
|
<div class="error-note" id="errorNote"></div>
|
|
</div>
|
|
|
|
<div class="card result-card" id="resultCard">
|
|
<div class="result-header">
|
|
<div class="result-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="#10D98A" stroke-width="2.5">
|
|
<polyline points="20,6 9,17 4,12"/>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<div class="result-title" id="resultTitle">PDF unlocked</div>
|
|
<div class="result-sub" id="resultSub"></div>
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-primary" id="downloadBtn">Download Unlocked PDF</button>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>
|
|
Built by <a href="https://undodesigns.com" target="_blank">Undo Designs</a> · PDF Unlock v1
|
|
</footer>
|
|
|
|
<script>
|
|
const $ = id => document.getElementById(id);
|
|
|
|
let chosenFile = null;
|
|
|
|
function setFile(file) {
|
|
if (!file) return;
|
|
if (!/\.pdf$/i.test(file.name)) {
|
|
$('errorNote').textContent = 'Please choose a .pdf file.';
|
|
$('errorNote').classList.add('visible');
|
|
return;
|
|
}
|
|
chosenFile = file;
|
|
$('errorNote').classList.remove('visible');
|
|
$('fileChosen').textContent = file.name;
|
|
$('fileChosen').style.display = 'block';
|
|
$('unlockBtn').disabled = false;
|
|
$('resultCard').classList.remove('visible');
|
|
}
|
|
|
|
const zone = $('fileZone');
|
|
$('fileInput').addEventListener('change', () => setFile($('fileInput').files[0]));
|
|
zone.addEventListener('dragover', e => { e.preventDefault(); zone.classList.add('drag-over'); });
|
|
zone.addEventListener('dragleave', () => zone.classList.remove('drag-over'));
|
|
zone.addEventListener('drop', e => {
|
|
e.preventDefault(); zone.classList.remove('drag-over');
|
|
setFile(e.dataTransfer.files[0]);
|
|
});
|
|
|
|
let lastFilename = '';
|
|
let lastDownloadName = '';
|
|
|
|
$('unlockBtn').addEventListener('click', async () => {
|
|
if (!chosenFile) return;
|
|
|
|
$('unlockBtn').disabled = true;
|
|
$('spinner').classList.add('visible');
|
|
$('errorNote').classList.remove('visible');
|
|
$('resultCard').classList.remove('visible');
|
|
|
|
const fd = new FormData();
|
|
fd.append('pdf_file', chosenFile);
|
|
const pw = $('pwInput').value;
|
|
if (pw) fd.append('password', pw);
|
|
|
|
try {
|
|
const r = await fetch('/pdf-unlock/api/unlock', { method: 'POST', body: fd });
|
|
const d = await r.json();
|
|
|
|
if (d.status === 'ok') {
|
|
lastFilename = d.filename;
|
|
lastDownloadName = d.download_name;
|
|
$('resultSub').textContent = d.was_protected
|
|
? 'Password protection removed successfully.'
|
|
: 'This PDF wasn\'t protected — here\'s a clean copy.';
|
|
$('resultCard').classList.add('visible');
|
|
} else {
|
|
$('errorNote').textContent = d.error || 'Unexpected error';
|
|
$('errorNote').classList.add('visible');
|
|
}
|
|
} catch (e) {
|
|
$('errorNote').textContent = 'Network error: ' + e.message;
|
|
$('errorNote').classList.add('visible');
|
|
}
|
|
|
|
$('spinner').classList.remove('visible');
|
|
$('unlockBtn').disabled = false;
|
|
});
|
|
|
|
$('downloadBtn').addEventListener('click', () => {
|
|
if (!lastFilename) return;
|
|
window.location.href = '/pdf-unlock/api/download/' + encodeURIComponent(lastFilename)
|
|
+ '?as=' + encodeURIComponent(lastDownloadName);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|