mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
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:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user