online users
This commit is contained in:
@ -241,9 +241,7 @@ async function editProfile(body, token, admin) {
|
|||||||
"X-Authentication": process.env.PROCESSING_SERVER_SECRET
|
"X-Authentication": process.env.PROCESSING_SERVER_SECRET
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("created request");
|
|
||||||
let oggFile = await fetch(request);
|
let oggFile = await fetch(request);
|
||||||
console.log("finished request");
|
|
||||||
let filePath = `/data/${userData.id}/${crypto.randomUUID()}.ogg`;
|
let filePath = `/data/${userData.id}/${crypto.randomUUID()}.ogg`;
|
||||||
await Bun.write(process.env.DATA_PATH + filePath, oggFile);
|
await Bun.write(process.env.DATA_PATH + filePath, oggFile);
|
||||||
const updateAccount = accs.query(`UPDATE accounts SET music = $music WHERE username = $user`)
|
const updateAccount = accs.query(`UPDATE accounts SET music = $music WHERE username = $user`)
|
||||||
@ -252,7 +250,6 @@ async function editProfile(body, token, admin) {
|
|||||||
name: body.title,
|
name: body.title,
|
||||||
artist: body.artist
|
artist: body.artist
|
||||||
}), $user: user });
|
}), $user: user });
|
||||||
console.log("database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<!-- initialize externals -->
|
<!-- initialize externals -->
|
||||||
<meta property="og:title" content="Selenite" />
|
<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 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 name="keywords" content="proxy, web proxy, unblock websites, unblock chromebook, free web proxy, proxy list, proxy sites, un block chromebook, online proxy, proxy server, proxysite, proxy youtube, bypass securly, bypass iboss, bypass lightspeed filter, chromebooks, unblock youtube, youtube proxy, unblocked youtube, youtube unblocked, unblock games, selenite, unblocked games, free games">
|
|
||||||
<meta content="/favicon.png" property="og:image" />
|
<meta content="/favicon.png" property="og:image" />
|
||||||
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
||||||
<meta name="googlebot" content="index, follow, snippet" />
|
<meta name="googlebot" content="index, follow, snippet" />
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<!-- initialize externals -->
|
<!-- initialize externals -->
|
||||||
<meta property="og:title" content="Selenite" />
|
<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 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 name="keywords" content="proxy, web proxy, unblock websites, unblock chromebook, free web proxy, proxy list, proxy sites, un block chromebook, online proxy, proxy server, proxysite, proxy youtube, bypass securly, bypass iboss, bypass lightspeed filter, chromebooks, unblock youtube, youtube proxy, unblocked youtube, youtube unblocked, unblock games, selenite, unblocked games, free games">
|
|
||||||
<meta content="/favicon.png" property="og:image" />
|
<meta content="/favicon.png" property="og:image" />
|
||||||
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
||||||
<meta name="googlebot" content="index, follow, snippet" />
|
<meta name="googlebot" content="index, follow, snippet" />
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<!-- initialize externals -->
|
<!-- initialize externals -->
|
||||||
<meta property="og:title" content="Selenite" />
|
<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 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 name="keywords" content="proxy, web proxy, unblock websites, unblock chromebook, free web proxy, proxy list, proxy sites, un block chromebook, online proxy, proxy server, proxysite, proxy youtube, bypass securly, bypass iboss, bypass lightspeed filter, chromebooks, unblock youtube, youtube proxy, unblocked youtube, youtube unblocked, unblock games, selenite, unblocked games, free games">
|
|
||||||
<meta content="/favicon.png" property="og:image" />
|
<meta content="/favicon.png" property="og:image" />
|
||||||
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
<meta content="#c77dff" data-react-helmet="true" name="theme-color" />
|
||||||
<meta name="googlebot" content="index, follow, snippet" />
|
<meta name="googlebot" content="index, follow, snippet" />
|
||||||
|
|||||||
18
index.js
18
index.js
@ -37,27 +37,21 @@ import WebSocket, { WebSocketServer } from "ws";
|
|||||||
const wss = new WebSocketServer({ noServer: true });
|
const wss = new WebSocketServer({ noServer: true });
|
||||||
let openSockets = 0;
|
let openSockets = 0;
|
||||||
wss.on("connection", function connection(ws, req, res) {
|
wss.on("connection", function connection(ws, req, res) {
|
||||||
openSockets++;
|
ws.send(`online=${wss.clients.size}`);
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
ws.send("ping");
|
ws.send(`online=${wss.clients.size}`);
|
||||||
}, 30000);
|
}, 5000);
|
||||||
|
|
||||||
ws.on("error", console.error);
|
ws.on("error", console.error);
|
||||||
|
|
||||||
ws.on("message", async function message(data, isBinary) {
|
ws.on("message", async function message(data, isBinary) {
|
||||||
let message = Buffer.from(data).toString();
|
let message = Buffer.from(data).toString();
|
||||||
if (message.startsWith(process.env.ANNOUNCEMENT_KEY)) {
|
if (message.startsWith("token") && (await verifyCookie(message.substring(6)))) {
|
||||||
wss.clients.forEach(function each(client) {
|
|
||||||
if (client.readyState === WebSocket.OPEN) {
|
|
||||||
client.send(message.replace(process.env.ANNOUNCEMENT_KEY, "announce."));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (message.startsWith("token") && (await verifyCookie(message.substring(6)))) {
|
|
||||||
ws.id = await getUserFromCookie(message.substring(6));
|
ws.id = await getUserFromCookie(message.substring(6));
|
||||||
ws.send(ws.id);
|
ws.send(ws.id);
|
||||||
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("pong")) {
|
} else if (message.startsWith("1")) {
|
||||||
if (ws.id) {
|
if (ws.id) {
|
||||||
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 });
|
||||||
@ -65,7 +59,7 @@ wss.on("connection", function connection(ws, req, res) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on("close", () => {openSockets--;});
|
ws.on("close", () => {});
|
||||||
});
|
});
|
||||||
app.post(
|
app.post(
|
||||||
"/api/event",
|
"/api/event",
|
||||||
|
|||||||
Reference in New Issue
Block a user