Enhance security, add admin features, and improve UX

Removed unused cryptography directive and switched to BCrypt for hashing IPs and tokens with a configurable salt. Updated file paths for cross-platform compatibility. Added rate limiting to routes and new admin API endpoints for user management. Improved `config.json` handling and added random password generation.

Enhanced `admin.html` with search debounce, infinite scrolling, and updated CSS. Added password change functionality and notifications to `user.html`. Improved error handling in `archives.html` and refactored `index.html` for better readability. Corrected password character count in `signup.html`.
This commit is contained in:
whoswhip
2024-09-07 18:57:18 -04:00
parent f02e68b1d3
commit 071434efc9
9 changed files with 860 additions and 185 deletions
+22 -3
View File
@@ -40,11 +40,11 @@
function searchPastes() {
const searchInput = document.querySelector('.text-input');
if (searchInput.value.length < 3 && searchInput.value.length != 0){
if (searchInput.value.length < 3 && searchInput.value.length != 0) {
return;
}
}
else if (searchInput.value.length == 0) {
fetch(`/api/pastes/search?html=true`,{
fetch(`/api/pastes/search?html=true`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -60,6 +60,16 @@
pastesWrapper.innerHTML = '<h1>no pastes found</h1>';
return;
}
try {
json = JSON.parse(data);
if (json.error != null) {
pastesWrapper.innerHTML = `<h1>${json.error}</h1>`;
return;
}
}
catch {
}
pastesWrapper.innerHTML = data;
});
return;
@@ -80,6 +90,15 @@
pastesWrapper.innerHTML = '<h1>no pastes found</h1>';
return;
}
try {
json = JSON.parse(data);
if (json.error != null) {
pastesWrapper.innerHTML = `<h1>${json.error}</h1>`;
return;
}
}
catch {
}
pastesWrapper.innerHTML = data;
});
}