clean: format
This commit is contained in:
@@ -135,7 +135,7 @@ fn decrypt_js(encrypted_content: String) -> String {
|
|||||||
try {
|
try {
|
||||||
let keyBase64 = hash.replace(/-/g, '+').replace(/_/g, '/');
|
let keyBase64 = hash.replace(/-/g, '+').replace(/_/g, '/');
|
||||||
while (keyBase64.length % 4) keyBase64 += '=';
|
while (keyBase64.length % 4) keyBase64 += '=';
|
||||||
|
|
||||||
const encryptedBytes = Uint8Array.from(atob(encryptedContent), c => c.charCodeAt(0));
|
const encryptedBytes = Uint8Array.from(atob(encryptedContent), c => c.charCodeAt(0));
|
||||||
const keyBytes = Uint8Array.from(atob(keyBase64), c => c.charCodeAt(0));
|
const keyBytes = Uint8Array.from(atob(keyBase64), c => c.charCodeAt(0));
|
||||||
const iv = encryptedBytes.slice(0, 12);
|
const iv = encryptedBytes.slice(0, 12);
|
||||||
@@ -218,19 +218,19 @@ function showShareUrl(url) {
|
|||||||
|
|
||||||
document.getElementById('paste-form')?.addEventListener('submit', async (e) => {
|
document.getElementById('paste-form')?.addEventListener('submit', async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const submitButton = e.target.querySelector('button[type=\"submit\"]');
|
const submitButton = e.target.querySelector('button[type=\"submit\"]');
|
||||||
const contentInput = document.getElementById('content');
|
const contentInput = document.getElementById('content');
|
||||||
const encryptedInput = document.getElementById('encrypted-content');
|
const encryptedInput = document.getElementById('encrypted-content');
|
||||||
const csrfInput = document.getElementById('csrf-token');
|
const csrfInput = document.getElementById('csrf-token');
|
||||||
|
|
||||||
if (!contentInput || !encryptedInput || !csrfInput) {
|
if (!contentInput || !encryptedInput || !csrfInput) {
|
||||||
console.error('Required form elements not found');
|
console.error('Required form elements not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submitButton) submitButton.disabled = true;
|
if (submitButton) submitButton.disabled = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = contentInput.value;
|
const content = contentInput.value;
|
||||||
const { encrypted, key } = await encryptContent(content);
|
const { encrypted, key } = await encryptContent(content);
|
||||||
|
|||||||
Reference in New Issue
Block a user