v2 #1
@ -322,6 +322,7 @@ async function generateAccountPage(name, cookie, admin) {
|
|||||||
modifiedHTML = modifiedHTML.replaceAll("{{ url_gen }}", `https://selenite.cc/u/${userData.username}`);
|
modifiedHTML = modifiedHTML.replaceAll("{{ url_gen }}", `https://selenite.cc/u/${userData.username}`);
|
||||||
modifiedHTML = modifiedHTML.replaceAll("{{ online_time }}", dayjs(userData.last_login).fromNow());
|
modifiedHTML = modifiedHTML.replaceAll("{{ online_time }}", dayjs(userData.last_login).fromNow());
|
||||||
modifiedHTML = modifiedHTML.replaceAll("{{ css_edit }}", (userData.badges ? userData.badges.length : 0) > 0 ? '<img src="/img/edit.svg" id="edit" />' : "");
|
modifiedHTML = modifiedHTML.replaceAll("{{ css_edit }}", (userData.badges ? userData.badges.length : 0) > 0 ? '<img src="/img/edit.svg" id="edit" />' : "");
|
||||||
|
modifiedHTML = modifiedHTML.replaceAll("{{ staff_buttons }}", await isAdmin(cookie) ? "<a href='/admin'>admin panel</a>" : "");
|
||||||
if(songData) {
|
if(songData) {
|
||||||
modifiedHTML = modifiedHTML.replaceAll("{{ song_title }}", sanitizeHtml(songData.name, allowNone));
|
modifiedHTML = modifiedHTML.replaceAll("{{ song_title }}", sanitizeHtml(songData.name, allowNone));
|
||||||
modifiedHTML = modifiedHTML.replaceAll("{{ song_artist }}", sanitizeHtml(songData.artist, allowNone));
|
modifiedHTML = modifiedHTML.replaceAll("{{ song_artist }}", sanitizeHtml(songData.artist, allowNone));
|
||||||
@ -329,6 +330,8 @@ async function generateAccountPage(name, cookie, admin) {
|
|||||||
modifiedHTML = modifiedHTML.replaceAll("{{ is_music }}", "true");
|
modifiedHTML = modifiedHTML.replaceAll("{{ is_music }}", "true");
|
||||||
} else {
|
} else {
|
||||||
modifiedHTML = modifiedHTML.replaceAll("{{ is_music }}", "false");
|
modifiedHTML = modifiedHTML.replaceAll("{{ is_music }}", "false");
|
||||||
|
modifiedHTML = modifiedHTML.replaceAll("{{ song_title }}", "no song selected...");
|
||||||
|
modifiedHTML = modifiedHTML.replaceAll("{{ song_artist }}", "");
|
||||||
}
|
}
|
||||||
let badges_html = "";
|
let badges_html = "";
|
||||||
|
|
||||||
|
|||||||
131
html/admin.html
131
html/admin.html
@ -5,92 +5,67 @@
|
|||||||
https://coolors.co/10002b-240046-3c096c-5a189a-7b2cbf-9d4edd-c77dff-e0aaff -->
|
https://coolors.co/10002b-240046-3c096c-5a189a-7b2cbf-9d4edd-c77dff-e0aaff -->
|
||||||
|
|
||||||
<!-- initialize externals -->
|
<!-- initialize externals -->
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
|
<meta property="og:title" content="Selenite" />
|
||||||
<script src=" https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js "></script>
|
<meta property="description" content="Selenite is the best unblocked games site. With over 400 games and an account system, no other websites come close to Selenite." />
|
||||||
|
<meta content="/favicon.png" property="og:image" />
|
||||||
|
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
||||||
|
<meta name="googlebot" content="index, follow, snippet" />
|
||||||
|
<link rel="canonical" href="https://selenite.cc/" />
|
||||||
|
<meta property="og:description" content="Selenite is the best unblocked games site. With over 400 games and an account system, no other websites come close to Selenite." />
|
||||||
|
<meta property="og:title" content="Selenite">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "Organization",
|
||||||
|
"name": "Selenite",
|
||||||
|
"alternateName": "selenite.cc",
|
||||||
|
"url": "https://selenite.cc",
|
||||||
|
"logo": "https://selenite.cc/favicon.png",
|
||||||
|
"sameAs": [
|
||||||
|
"https://github.com/selenite-cc",
|
||||||
|
"https://youtube.com/@selenitecc",
|
||||||
|
"https://tiktok.com/@selenitecc",
|
||||||
|
"https://selenite.cc",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- initialize my stuff -->
|
<!-- initialize my stuff -->
|
||||||
<script src="/js/all.min.js"></script>
|
<script src="/js/all.js"></script>
|
||||||
<script src="/js/main.js"></script>
|
<script src="/js/main.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/style.css" />
|
<link rel="stylesheet" href="/css/main.css" />
|
||||||
|
<link rel="stylesheet" href="/css/pages.css" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<!-- seo + other things -->
|
<!-- seo + other things -->
|
||||||
<title>Profile</title>
|
<title>Selenite</title>
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</head>
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563" crossorigin="anonymous"></script>
|
||||||
<alerts> </alerts>
|
|
||||||
<body id="noscroll">
|
|
||||||
<header>
|
|
||||||
<a href="/index.html">Home</a>
|
|
||||||
<a href="/bookmarklets.html">Bookmarklets</a>
|
|
||||||
<a href="/projects.html">Games</a>
|
|
||||||
<a href="/apps.html">Apps</a>
|
|
||||||
<a href="/settings.html">Settings</a>
|
|
||||||
<a id="blank" href="#">Open Blank</a>
|
|
||||||
<a href="/u/" class="usericon"><img src="/img/user.svg" /></a>
|
|
||||||
</header>
|
|
||||||
<script>
|
<script>
|
||||||
async function addBadge() {
|
function sendAnnouncement() {
|
||||||
let name = prompt("username");
|
let title = prompt("title");
|
||||||
let badge = prompt("badge name");
|
let message = prompt("message");
|
||||||
|
if(prompt("are you sure (y/N)") == "y") {
|
||||||
let run = await fetch("/api/admin/badge", {
|
let cookies = document.cookie.split("; ");
|
||||||
method: "POST",
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
body: JSON.stringify({
|
if (cookies[i].trim().startsWith("token=")) {
|
||||||
username: name,
|
let socket = new WebSocket("/socket");
|
||||||
badge: badge
|
socket.addEventListener("open", () => {
|
||||||
}),
|
socket.send(`annc;;${cookies[i].trim().split("=")[1]};;${title};;${message}`);
|
||||||
headers: {
|
})
|
||||||
"Content-type": "application/json; charset=UTF-8",
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
alert(JSON.stringify(run));
|
|
||||||
}
|
|
||||||
function announce() {
|
|
||||||
let key = prompt("enter key");
|
|
||||||
let announcement = prompt("enter announcement");
|
|
||||||
socket.send(`${key}.${announcement}`)
|
|
||||||
}
|
|
||||||
async function removeAccount() {
|
|
||||||
let name = prompt("enter username");
|
|
||||||
let run = await fetch("/api/admin/removeAcc", {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
username: name
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-type": "application/json; charset=UTF-8",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function ban() {
|
|
||||||
let name = prompt("enter username");
|
|
||||||
let reason = prompt("enter reason");
|
|
||||||
let run = await fetch("/api/admin/ban", {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
name: name,
|
|
||||||
reason: reason,
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-type": "application/json; charset=UTF-8",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<main>
|
</head>
|
||||||
<button onclick="addBadge()">Add a badge</button>
|
<alerts> </alerts>
|
||||||
<button onclick="announce()">Send announcement</button>
|
<body>
|
||||||
<button onclick="removeAccount()">remove account</button>
|
<h1 class="title">admin page</h1>
|
||||||
<button onclick="ban()">ban account</button>
|
<sections>
|
||||||
</main>
|
<button onclick="sendAnnouncement()">send announcement</button>
|
||||||
<footer class="noscroll">
|
</sections>
|
||||||
<a href="https://gitlab.com/skysthelimit.dev/selenite">Source</a>
|
|
||||||
<a href="https://discord.gg/7jyufnwJNf">Discord</a>
|
|
||||||
<a href="/suggest.html">Suggestions & Bugs</a>
|
|
||||||
<a href="/contact.html">Contact</a>
|
|
||||||
<a href="/support.html">Donate</a>
|
|
||||||
<a href="/about.html">About</a>
|
|
||||||
</footer>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -406,13 +406,13 @@
|
|||||||
<button id="close">X</button>
|
<button id="close">X</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="samerow">
|
<div class="samerow">
|
||||||
<button id="download">Download Backup</button>
|
<button id="download">download cloud backup</button>
|
||||||
<button id="upload">Upload Backup</button>
|
<button id="upload">upload cloud backup</button>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="title">{{ name }}'s profile</h1>
|
<h1 class="title">{{ name }}'s profile</h1>
|
||||||
<h3>click on one of the following areas to edit</h3>
|
<h3>click on an area to edit</h3>
|
||||||
<h3>profile picture, name, song, and about me</h3>
|
|
||||||
<p style="font-size: 16px;">share your profile at {{ url_gen }}</p>
|
<p style="font-size: 16px;">share your profile at {{ url_gen }}</p>
|
||||||
|
{{ staff_buttons }}
|
||||||
<section>
|
<section>
|
||||||
<img src="{{ user_pfp }}" class="pfp edit" id="pfp" />
|
<img src="{{ user_pfp }}" class="pfp edit" id="pfp" />
|
||||||
<div class="profile-element edit" id="name">
|
<div class="profile-element edit" id="name">
|
||||||
|
|||||||
@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- initialize theme vars
|
||||||
|
https://coolors.co/10002b-240046-3c096c-5a189a-7b2cbf-9d4edd-c77dff-e0aaff -->
|
||||||
|
|
||||||
|
<!-- initialize externals -->
|
||||||
|
<meta property="og:title" content="Selenite" />
|
||||||
|
<meta property="description" content="Selenite is the best unblocked games site. With over 400 games and an account system, no other websites come close to Selenite." />
|
||||||
|
<meta content="/favicon.png" property="og:image" />
|
||||||
|
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
||||||
|
<meta name="googlebot" content="index, follow, snippet" />
|
||||||
|
<link rel="canonical" href="https://selenite.cc/" />
|
||||||
|
<meta property="og:description" content="Selenite is the best unblocked games site. With over 400 games and an account system, no other websites come close to Selenite." />
|
||||||
|
<meta property="og:title" content="Selenite">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "Organization",
|
||||||
|
"name": "Selenite",
|
||||||
|
"alternateName": "selenite.cc",
|
||||||
|
"url": "https://selenite.cc",
|
||||||
|
"logo": "https://selenite.cc/favicon.png",
|
||||||
|
"sameAs": [
|
||||||
|
"https://github.com/selenite-cc",
|
||||||
|
"https://youtube.com/@selenitecc",
|
||||||
|
"https://tiktok.com/@selenitecc",
|
||||||
|
"https://selenite.cc",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- initialize my stuff -->
|
||||||
|
<script src="/js/all.js"></script>
|
||||||
|
<script src="/js/main.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/css/main.css" />
|
||||||
|
<link rel="stylesheet" href="/css/pages.css" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<!-- seo + other things -->
|
||||||
|
<title>Selenite</title>
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563" crossorigin="anonymous"></script>
|
||||||
|
</head>
|
||||||
|
<alerts> </alerts>
|
||||||
|
<body>
|
||||||
|
<h1 class="title">stats</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
7
index.js
7
index.js
@ -64,6 +64,13 @@ wss.on("connection", function connection(ws, req, res) {
|
|||||||
const updateAccount = accs.query(`UPDATE accounts SET last_login = $login WHERE username = $user`)
|
const updateAccount = accs.query(`UPDATE accounts SET last_login = $login WHERE username = $user`)
|
||||||
updateAccount.get({ $login: new Date().toUTCString(), $user: ws.id });
|
updateAccount.get({ $login: new Date().toUTCString(), $user: ws.id });
|
||||||
}
|
}
|
||||||
|
} else if (message.startsWith("annc")) {
|
||||||
|
let splitMessage = message.split(";;");
|
||||||
|
if(await isAdmin(splitMessage[1])) {
|
||||||
|
wss.clients.forEach(client => {
|
||||||
|
client.send(`annc;;${splitMessage[2]};;${splitMessage[3]}`);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user