Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit 3bcdb61

Browse files
Updated view.html
1 parent 0192828 commit 3bcdb61

1 file changed

Lines changed: 38 additions & 3 deletions

File tree

frontend/view.html

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
align-items: center;
1919
justify-content: center;
2020
height: 100vh;
21+
padding: 20px;
2122
}
2223

2324
.container {
24-
width: 90%;
25-
max-width: 600px;
25+
width: 100%;
26+
max-width: 700px;
2627
background: white;
2728
padding: 30px;
2829
box-shadow: 0 10px 25px rgba(0,0,0,0.08);
@@ -50,6 +51,23 @@
5051
padding: 15px;
5152
border-radius: 8px;
5253
min-height: 100px;
54+
text-align: left;
55+
margin-bottom: 20px;
56+
}
57+
58+
button {
59+
background: #4b2e83;
60+
color: white;
61+
padding: 10px 16px;
62+
font-size: 14px;
63+
border: none;
64+
border-radius: 6px;
65+
cursor: pointer;
66+
transition: background 0.2s;
67+
}
68+
69+
button:hover {
70+
background: #3d256c;
5371
}
5472
</style>
5573
</head>
@@ -58,9 +76,12 @@
5876
<div class="icon">📄</div>
5977
<h2>Secure Paste</h2>
6078
<div id="output">Loading...</div>
79+
<button onclick="copyToClipboard()">📋 Copy to Clipboard</button>
6180
</div>
6281

6382
<script>
83+
let decryptedContent = "";
84+
6485
async function viewPaste() {
6586
const params = new URLSearchParams(window.location.search);
6687
const id = params.get('id');
@@ -80,7 +101,8 @@ <h2>Secure Paste</h2>
80101
const decrypted = CryptoJS.AES.decrypt(data, fullKey).toString(CryptoJS.enc.Utf8);
81102

82103
if (decrypted) {
83-
document.getElementById("output").innerText = decrypted;
104+
decryptedContent = decrypted;
105+
document.getElementById("output").innerText = decryptedContent;
84106
} else {
85107
document.getElementById("output").innerHTML = "<b>❌ Invalid password or corrupted data.</b>";
86108
}
@@ -89,6 +111,19 @@ <h2>Secure Paste</h2>
89111
}
90112
}
91113

114+
function copyToClipboard() {
115+
if (!decryptedContent) {
116+
alert("Nothing to copy.");
117+
return;
118+
}
119+
120+
navigator.clipboard.writeText(decryptedContent).then(() => {
121+
alert("✅ Copied to clipboard!");
122+
}).catch(() => {
123+
alert("❌ Failed to copy.");
124+
});
125+
}
126+
92127
viewPaste();
93128
</script>
94129
</body>

0 commit comments

Comments
 (0)