Update -> refactor and optimize UI , code ,...

This commit is contained in:
2026-04-10 11:35:25 +03:30
parent 3327207f05
commit 0de951fd91
20 changed files with 1085 additions and 282 deletions

View File

@@ -1,28 +1,108 @@
<?php
$action = $_GET['action'] ?? '';
if ($action === 'save') {
if (($_GET['action'] ?? '') === 'save') {
require __DIR__ . '/../app/controllers/SaveController.php';
exit;
}
?>
<link rel="stylesheet" href="/assets/css/style.css">
<script src="/assets/js/main.js"></script>
<script src="/assets/js/app.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SafePaste — Secure Text Sharing</title>
<link rel="stylesheet" href="/assets/css/style.css">
</head>
<body>
<div class="page-wrapper">
<header class="site-header">
<div class="logo">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="4" rx="1"/><path d="M5 4h-1a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1"/><path d="M9 12h6M9 16h4"/></svg>
SafePaste
</div>
<span class="header-badge">End-to-end encrypted</span>
</header>
<main class="main-card">
<div class="card-header">
<h1>New Paste</h1>
<p>Your text is encrypted before storage. Share safely.</p>
</div>
<form method="POST" action="?action=save" id="pasteForm">
<textarea name="text" placeholder="Enter your text..." required></textarea>
<input type="text" class="usepassword" name="password" placeholder="Password (Optional)">
<select name="expire">
<option value="60">1 MIN</option>
<option value="3600">1 Hours</option>
<option value="86400">2 Day</option>
<option value="0">without time</option>
</select>
<button type="submit">Create link</button>
</form>
<form id="pasteForm" novalidate>
<div class="field">
<div class="textarea-wrapper">
<textarea
id="pasteText"
name="text"
placeholder="Paste your text, code, or notes here..."
rows="12"
spellcheck="false"
autocomplete="off"
></textarea>
<div class="char-counter"><span id="charCount">0</span> chars</div>
</div>
</div>
<div id="result"></div>
<div class="options-row">
<div class="field-group">
<label for="pasteExpire">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
Expires
</label>
<select id="pasteExpire" name="expire">
<option value="300">5 minutes</option>
<option value="3600" selected>1 hour</option>
<option value="86400">1 day</option>
<option value="604800">1 week</option>
<option value="0">Never</option>
</select>
</div>
<div class="field-group">
<label for="pastePassword">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
Password
</label>
<input
id="pastePassword"
type="password"
name="password"
placeholder="Optional password"
autocomplete="new-password"
>
</div>
</div>
<button type="submit" class="btn-primary" id="submitBtn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
<span>Create Secure Link</span>
</button>
</form>
<div id="result" class="result-box" hidden>
<div class="result-header">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
Paste created successfully!
</div>
<div class="result-link-row">
<input type="text" id="pasteLink" readonly>
<button type="button" id="copyLinkBtn" class="btn-copy">
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
Copy
</button>
</div>
<a id="viewLink" href="#" class="result-open-link" target="_blank">
Open paste
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
</a>
</div>
</main>
<footer class="site-footer">
AES-256-CBC encrypted &middot; Open source &middot; No tracking
</footer>
</div>
<script src="/assets/js/app.js"></script>
</body>
</html>