mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
Enhanced Program.cs with response caching, compression, CORS policy, and private paste handling. Refactored user ban logic and added expiration date handling. Improved admin.html with localization and overflow handling. Introduced PrivatePaste and Punishment classes. Enhanced Paste and User classes for private pastes and punishments. Updated initialization logic for punishedUsers table. Ensured salts are written back to config.json if generated. Enhanced user.html with ban/unban functionality and animations. Improved archives.html, dash.html, and index.html with new UI elements and styles. Added asynchronous content loading and notifications to paste.html. Introduced Encryption.cs for AES encryption and decryption. Created banned.html for displaying error messages. Added privatepaste.html with dynamic content, password protection, and user interactions.
331 lines
9.5 KiB
HTML
331 lines
9.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap" rel="stylesheet">
|
|
<title>create paste</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="nav-div">
|
|
<a href="/">home</a>
|
|
<a href="/pastes">recent pastes</a>
|
|
<a href="/archive">archive</a>
|
|
{html}
|
|
</div>
|
|
<div class="container-wrapper">
|
|
<div class="dash-container">
|
|
<div class="wrapper">
|
|
<div class="idek-wrapper">
|
|
<div class="account-info">
|
|
<span id="username">Username: {username}</span>
|
|
<span id="uuid">UUID: {uuid}</span>
|
|
<span id="uid">UID: {uid}</span>
|
|
<span id="creationdate">{creationdate}</span>
|
|
<span id="lastlogindate">{lastlogindate}</span>
|
|
<span id="type">Account Type: {type}</span>
|
|
<span id="pastescount">Total Pastes: {totalpastes}</span>
|
|
<span id="pasteSize">Total Pastes Size: {totalsize}</span>
|
|
</div>
|
|
<div class="pastes-wrapper">
|
|
<h3>Your Pastes</h3>
|
|
<div class="list-container">
|
|
{pastes}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="idek-wrapper">
|
|
<div class="accounts-wrapper">
|
|
<h3>Accounts</h3>
|
|
<input type="text" placeholder="search" class="text-input" oninput="waitSearch()">
|
|
<div class="list-container" onscroll="getUsers()">
|
|
{accounts}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
<script>
|
|
let searchTimeout;
|
|
function localizeDateTime(unixTimestamp) {
|
|
const date = new Date(unixTimestamp * 1000);
|
|
return date.toLocaleString();
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
const creationdateElement = document.getElementById('creationdate');
|
|
const lastlogindateElement = document.getElementById('lastlogindate');
|
|
|
|
const creationdateText = creationdateElement.innerText.trim();
|
|
const lastlogindateText = lastlogindateElement.innerText.trim();
|
|
|
|
creationdateElement.innerText = "Creation Date: " + localizeDateTime(parseInt(creationdateText));
|
|
lastlogindateElement.innerText = "Last Login Date: " + localizeDateTime(parseInt(lastlogindateText));
|
|
});
|
|
function waitSearch() {
|
|
clearTimeout(searchTimeout);
|
|
searchTimeout = setTimeout(search, 200);
|
|
}
|
|
function search() {
|
|
const input = document.querySelector('.text-input').value;
|
|
const accountWrapper = document.querySelector('.accounts-wrapper');
|
|
const accounts = accountWrapper.querySelectorAll('.list-a');
|
|
if (input.length == 0){
|
|
fetch(`/api/accounts/admin/get?html=true`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
offset: 0,
|
|
})
|
|
})
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
const listContainer = accountWrapper.querySelector('.list-container');
|
|
listContainer.innerHTML = data;
|
|
})
|
|
return;
|
|
}
|
|
fetch(`/api/accounts/admin/search?html=true`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
search: input
|
|
})
|
|
})
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
const listContainer = accountWrapper.querySelector('.list-container');
|
|
listContainer.innerHTML = data;
|
|
})
|
|
}
|
|
function getUsers() {
|
|
const accountWrapper = document.querySelector('.accounts-wrapper');
|
|
const listContainer = accountWrapper.querySelector('.list-container');
|
|
const accounts = accountWrapper.querySelectorAll('.list-a');
|
|
const lastAccount = accounts[accounts.length - 1];
|
|
const lastAccountUsername = lastAccount.querySelector('.list-item').innerText;
|
|
const lastAccountUUID = lastAccount.querySelector('.list-item').getAttribute('data-uuid');
|
|
var isScrolledDown = listContainer.scrollTop + listContainer.clientHeight >= listContainer.scrollHeight;
|
|
if (!isScrolledDown) {
|
|
return;
|
|
}
|
|
fetch(`/api/accounts/admin/get?html=true`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
offset: accounts.length,
|
|
})
|
|
})
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
if (data === '') {
|
|
return;
|
|
}
|
|
console.log(listContainer.innerHTML);
|
|
console.log(data);
|
|
|
|
listContainer.innerHTML += data;
|
|
|
|
}
|
|
)
|
|
|
|
|
|
}
|
|
function isScrolledDown(element){
|
|
var scrollPosition = element.scrollTop + element.clientHeight;
|
|
var scrollHeight = element.scrollHeight;
|
|
return scrollPosition >= scrollHeight;
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
.list-container {
|
|
max-height: 100%;
|
|
overflow-y: scroll;
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
align-items: center;
|
|
}
|
|
|
|
body {
|
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
|
font-weight: bold;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background-color: #0d0d0d;
|
|
}
|
|
|
|
.container-wrapper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 100%;
|
|
height: 98.7vh;
|
|
}
|
|
|
|
.dash-container {
|
|
display: flex;
|
|
padding: 20px;
|
|
background-color: #181818;
|
|
color: white;
|
|
border-radius: 5px;
|
|
width: 80%;
|
|
max-height: 80vh;
|
|
min-height: 20%;
|
|
height: fit-content;
|
|
border: #222222 2px solid;
|
|
}
|
|
|
|
.idek-wrapper {
|
|
display: flex;
|
|
flex-direction: row;
|
|
width: 100%;
|
|
}
|
|
|
|
.account-info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background-color: #222222;
|
|
width: 48%;
|
|
padding: 20px;
|
|
margin-right: 5px;
|
|
border-radius: 5px;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.pastes-wrapper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 48%;
|
|
margin-left: 5px;
|
|
border-radius: 5px;
|
|
padding: 20px;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
background-color: #222222;
|
|
max-height: 30vh;
|
|
}
|
|
|
|
.accounts-wrapper {
|
|
margin-top: 10px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 100%;
|
|
border-radius: 5px;
|
|
padding: 20px;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
background-color: #222222;
|
|
max-height: 40vh;
|
|
}
|
|
|
|
.wrapper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
}
|
|
|
|
.list-a {
|
|
transition: 300ms;
|
|
text-decoration: none;
|
|
color: white;
|
|
width: 90%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
background-color: #2a2a2a;
|
|
margin-top: 5px;
|
|
margin-bottom: 5px;
|
|
border: #3a3a3a00 2px solid;
|
|
}
|
|
|
|
.list-a:hover {
|
|
transition: background-color 300ms;
|
|
background-color: #333333;
|
|
border: #3a3a3a 2px solid;
|
|
}
|
|
|
|
.list-item {
|
|
list-style: none;
|
|
max-width: 100%;
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.text-input {
|
|
transition: border 300ms;
|
|
width: 90.2%;
|
|
height: 1.2rem;
|
|
padding: 10px;
|
|
margin: 10px;
|
|
border-radius: 5px;
|
|
border: #2a2a2a 2px solid;
|
|
background-color: #2a2a2a;
|
|
color: white;
|
|
font-family: "Noto Sans Mono", "Consolas", "SF Mono", monospace;
|
|
}
|
|
|
|
.text-input:focus {
|
|
transition: border 300ms;
|
|
outline: none;
|
|
border: #333333 2px solid;
|
|
}
|
|
|
|
.nav-div {
|
|
top: 0;
|
|
margin-top: 10px;
|
|
position: absolute;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: fit-content;
|
|
background-color: #181818;
|
|
padding-left: 10px;
|
|
padding-right: 10px;
|
|
color: white;
|
|
border-radius: 5px;
|
|
height: fit-content;
|
|
overflow-y: auto;
|
|
border: #222222 2px solid;
|
|
}
|
|
|
|
.nav-div a {
|
|
text-decoration: none;
|
|
color: white;
|
|
padding: 10px;
|
|
margin: 10px;
|
|
border-radius: 5px;
|
|
background-color: #222222;
|
|
transition: 300ms;
|
|
border: #2a2a2a00 2px solid;
|
|
}
|
|
|
|
.nav-div a:hover {
|
|
transition: 300ms;
|
|
background-color: #333333;
|
|
border: #3a3a3a 2px solid;
|
|
}
|
|
</style>
|
|
|
|
</html> |