mirror of
https://github.com/2004Scape/Website.git
synced 2026-11-22 21:50:40 -05:00
chore: Reorganizing mod pages
This commit is contained in:
1 parent
791954d838
commit
80eb13ed89
17 files changed
-1557
No files matched your search
@@ -1,725 +0,0 @@
|
||||
import fs from 'fs';
|
||||
|
||||
import { FastifyInstance } from 'fastify';
|
||||
|
||||
import { db, toDbDate } from '#/db/query.js';
|
||||
import { toDisplayName, toSafeName } from '#/jstring/JString.js';
|
||||
import LoggerEventType from '#/util/LoggerEventType.js';
|
||||
import { isUsernameExplicit, isUsernameValid } from '#/util/Username.js';
|
||||
|
||||
function toDisplayCoord(coord: number) {
|
||||
const level = (coord >> 28) & 0x3;
|
||||
const x = (coord >> 14) & 0x3fff;
|
||||
const z = coord & 0x3fff;
|
||||
|
||||
const mx = (x / 64) | 0;
|
||||
const mz = (z / 64) | 0;
|
||||
const lx = x % 64;
|
||||
const lz = z % 64;
|
||||
return `${level}_${mx}_${mz}_${lx}_${lz}`;
|
||||
}
|
||||
|
||||
function toAbsolute(coord: number) {
|
||||
const level = (coord >> 28) & 0x3;
|
||||
const x = (coord >> 14) & 0x3fff;
|
||||
const z = coord & 0x3fff;
|
||||
|
||||
return { level, x, z };
|
||||
}
|
||||
|
||||
function toCoord(level: number, x: number, z: number) {
|
||||
return (level << 28) | (x << 14) | z;
|
||||
}
|
||||
|
||||
function embedCoord(coord: number) {
|
||||
const { level, x, z } = toAbsolute(coord);
|
||||
return `https://mejrs.github.io/historical?era=rs2_2004_06_01&p=${level}&x=${x}&y=${z}&z=4&layer=grid`;
|
||||
}
|
||||
|
||||
const reasons = [
|
||||
'Offensive language',
|
||||
'Item scamming',
|
||||
'Password scamming',
|
||||
'Bug abuse',
|
||||
'Staff impersonation',
|
||||
'Account sharing/trading',
|
||||
'Macroing',
|
||||
'Multiple logging in',
|
||||
'Encouraging others to break rules',
|
||||
'Misuse of customer support',
|
||||
'Advertising / website',
|
||||
'Real world item trading'
|
||||
];
|
||||
|
||||
export default async function (app: FastifyInstance) {
|
||||
app.get('/overview/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/overview/${username}`, 302);
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account').where('username', '=', username).selectAll().executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.view('mod/notfound', {
|
||||
username
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/overview', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
account,
|
||||
sessions: await db.selectFrom('session').where('account_id', '=', account.id)
|
||||
.orderBy('timestamp desc').selectAll().execute(),
|
||||
chats: await db.selectFrom('public_chat').where('account_id', '=', account.id)
|
||||
.orderBy('timestamp desc').limit(100).selectAll().execute(),
|
||||
pms: await db.selectFrom('private_chat').where('account_id', '=', account.id)
|
||||
.leftJoin('account', 'private_chat.to_account_id', 'account.id')
|
||||
.orderBy('timestamp desc').limit(100).selectAll().execute(),
|
||||
logs: await db.selectFrom('account_session').where('account_id', '=', account.id).where('event_type', '!=', LoggerEventType.WEALTH)
|
||||
.orderBy('timestamp desc').limit(100).selectAll().execute(),
|
||||
wealth: await db.selectFrom('account_session').where('account_id', '=', account.id).where('event_type', '=', LoggerEventType.WEALTH)
|
||||
.orderBy('timestamp desc').limit(100).selectAll().execute(),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/note/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/overview/${username}`, 302);
|
||||
}
|
||||
|
||||
const { notes } = req.body;
|
||||
|
||||
await db.updateTable('account').set({
|
||||
notes,
|
||||
notes_updated: toDbDate(new Date())
|
||||
}).where('username', '=', username).execute();
|
||||
|
||||
return res.redirect(`/mod/overview/${username}`, 302);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
})
|
||||
|
||||
app.get('/reports', async (req: any, res: any) => {
|
||||
try {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect('/account/login?redirectUrl=/mod/reports', 302);
|
||||
}
|
||||
|
||||
return res.view('mod/reports', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
reports: await db.selectFrom('report').selectAll('report')
|
||||
.innerJoin('account', 'report.account_id', 'account.id').select('account.username')
|
||||
.orderBy('timestamp desc').execute(),
|
||||
reasons
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/uid/:uid', async (req: any, res: any) => {
|
||||
try {
|
||||
const { uid } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/uid/${uid}`, 302);
|
||||
}
|
||||
|
||||
const sessions = await db.selectFrom('session').select('uid')
|
||||
.where('uid', '=', uid)
|
||||
.groupBy('account_id')
|
||||
.leftJoin('account', 'session.account_id', 'account.id').select('account.username')
|
||||
.execute();
|
||||
|
||||
return res.view('mod/uid', {
|
||||
toDisplayName,
|
||||
sessions
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/ip/:ip', async (req: any, res: any) => {
|
||||
try {
|
||||
const { ip } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/ip/${ip}`, 302);
|
||||
}
|
||||
|
||||
const sessions = await db.selectFrom('session').select('ip')
|
||||
.where('ip', '=', ip)
|
||||
.groupBy('account_id')
|
||||
.leftJoin('account', 'session.account_id', 'account.id').select('account.username')
|
||||
.execute();
|
||||
|
||||
return res.view('mod/ip', {
|
||||
toDisplayName,
|
||||
sessions
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/ban/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const { banned_until } = req.body;
|
||||
|
||||
if (!banned_until) {
|
||||
return res.status(400).send({ error: `Missing 'banned_until' in body` });
|
||||
}
|
||||
|
||||
const account = db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `Account with ID '${id}' does not exist` });
|
||||
}
|
||||
|
||||
const bannedDate = new Date(banned_until);
|
||||
const isInvalidDate = isNaN(bannedDate.getTime()) || bannedDate.getTime() - (new Date()).getTime() < 0;
|
||||
|
||||
await db.updateTable('account')
|
||||
.set({ banned_until: isInvalidDate ? null : toDbDate(banned_until), logged_in: 0 })
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.post('/unban/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const account = db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `Account with ID '${id}' does not exist` });
|
||||
}
|
||||
|
||||
await db.updateTable('account')
|
||||
.set({ banned_until: null, logged_in: 0 })
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.post('/mute/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send();
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const { muted_until } = req.body;
|
||||
|
||||
if (!muted_until) {
|
||||
return res.status(400).send({ error: `Missing 'muted_until' in body` });
|
||||
}
|
||||
|
||||
const account = db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `Account with ID '${id}' does not exist` });
|
||||
}
|
||||
|
||||
const mutedDate = new Date(muted_until);
|
||||
const isInvalidDate = isNaN(mutedDate.getTime()) || mutedDate.getTime() - (new Date()).getTime() < 0;
|
||||
|
||||
await db.updateTable('account')
|
||||
.set({ muted_until: isInvalidDate ? null : toDbDate(muted_until) })
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.post('/unmute/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send();
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const account = db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `Account with ID '${id}' does not exist` });
|
||||
}
|
||||
|
||||
await db.updateTable('account')
|
||||
.set({ muted_until: null, logged_in: 0 })
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.post('/kick/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send();
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const account = db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `Account with ID '${id}' does not exist` });
|
||||
}
|
||||
|
||||
await db.updateTable('account')
|
||||
.set({ logged_in: 0 })
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.post('/change-name/:id', async (req: any, res: any) => {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.status(401).send({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const { id } = req.params;
|
||||
const { new_username, unban } = req.body;
|
||||
|
||||
if (!new_username) {
|
||||
return res.status(400).send({ error: `Missing 'new_username' in body` });
|
||||
}
|
||||
|
||||
const nameCheck = isUsernameValid(new_username);
|
||||
if (!nameCheck.success) {
|
||||
return res.status(400).send({ error: nameCheck.message });
|
||||
}
|
||||
|
||||
const profanityCheck = isUsernameExplicit(new_username);
|
||||
if (!profanityCheck.success) {
|
||||
return res.status(400).send({ error: nameCheck.message });
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account')
|
||||
.where('id', '=', id)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.status(400).send({ error: `User with '${id}' does not exist.` });
|
||||
}
|
||||
|
||||
const safeNewName = toSafeName(new_username);
|
||||
const existingAccount = await db.selectFrom('account')
|
||||
.where('username', '=', safeNewName)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (existingAccount) {
|
||||
return res.status(400).send({ error: `User with ${new_username} already exists - please select a new name.` });
|
||||
}
|
||||
|
||||
let updatePlayerModel: any = { username: safeNewName };
|
||||
if (unban === true) {
|
||||
updatePlayerModel.banned_until = null;
|
||||
updatePlayerModel.logged_in = 0;
|
||||
}
|
||||
|
||||
await db.updateTable('account')
|
||||
.set(updatePlayerModel)
|
||||
.where('id', '=', id)
|
||||
.execute();
|
||||
|
||||
await db.insertInto('account')
|
||||
.values({
|
||||
username: account.username,
|
||||
password: 'blocked'
|
||||
})
|
||||
.execute();
|
||||
|
||||
// todo: profiles
|
||||
if (fs.existsSync(`data/players/beta/${account.username}.sav`)) {
|
||||
fs.renameSync(`data/players/beta/${account.username}.sav`, `data/players/beta/${safeNewName}.sav`);
|
||||
}
|
||||
|
||||
return res.status(200).send({ success: true });
|
||||
});
|
||||
|
||||
app.get('/wealth/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/wealth/${username}`, 302);
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account')
|
||||
.where('username', '=', username)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.view('mod/notfound', {
|
||||
username
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/wealth', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
account,
|
||||
logs: await db.selectFrom('account_session').select(['timestamp', 'coord', 'event', 'world'])
|
||||
.where('profile', '=', 'beta')
|
||||
.where('account_id', '=', account.id)
|
||||
.where('event_type', '=', LoggerEventType.WEALTH)
|
||||
.orderBy('timestamp desc').execute()
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/events/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/events/${username}`, 302);
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account')
|
||||
.where('username', '=', username)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.view('mod/notfound', {
|
||||
username
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/events', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
account,
|
||||
logs: await db.selectFrom('account_session').select(['timestamp', 'coord', 'event', 'world'])
|
||||
.where('profile', '=', 'beta')
|
||||
.where('account_id', '=', account.id)
|
||||
.where('event_type', '!=', LoggerEventType.WEALTH)
|
||||
.orderBy('timestamp desc').execute()
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/chat', async (req: any, res: any) => {
|
||||
try {
|
||||
const { coord, world, timestamp } = req.query;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/chat?coord=${coord}&world=${world}×tamp=${timestamp}`, 302);
|
||||
}
|
||||
|
||||
if (typeof coord === 'undefined' || typeof world === 'undefined' || typeof timestamp === 'undefined') {
|
||||
return res.redirect('/', 302);
|
||||
}
|
||||
|
||||
const center = toAbsolute(coord);
|
||||
const topLeft = { level: center.level, x: center.x - 15, z: center.z - 15 };
|
||||
const bottomRight = { level: center.level, x: center.x + 15, z: center.z + 15 };
|
||||
|
||||
const allCoords: number[] = [];
|
||||
for (let x = topLeft.x; x <= bottomRight.x; x++) {
|
||||
for (let z = topLeft.z; z <= bottomRight.z; z++) {
|
||||
allCoords.push(toCoord(center.level, x, z));
|
||||
}
|
||||
}
|
||||
|
||||
const sixMinutesBefore = toDbDate(parseInt(timestamp) - (1000 * 60 * 6));
|
||||
const sixMinutesAfter = toDbDate(parseInt(timestamp) + (1000 * 60 * 6));
|
||||
|
||||
const logs = await db.selectFrom('public_chat').select(['timestamp', 'coord', 'message', 'world'])
|
||||
.innerJoin('account', 'public_chat.account_id', 'account.id').select('account.username')
|
||||
.where('profile', '=', 'beta')
|
||||
.where('world', '=', world)
|
||||
.where((eb: any) => eb.or(
|
||||
allCoords.map(c =>
|
||||
eb('coord', '=', c)
|
||||
)
|
||||
))
|
||||
.where('timestamp', '<', sixMinutesAfter)
|
||||
.where('timestamp', '>', sixMinutesBefore)
|
||||
.orderBy('timestamp desc').execute();
|
||||
|
||||
return res.view('mod/chat', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
logs
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/item', async (req: any, res: any) => {
|
||||
try {
|
||||
const { coord, world, timestamp } = req.query;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/item?coord=${coord}&world=${world}×tamp=${timestamp}`, 302);
|
||||
}
|
||||
|
||||
if (typeof coord === 'undefined' || typeof world === 'undefined' || typeof timestamp === 'undefined') {
|
||||
return res.redirect('/', 302);
|
||||
}
|
||||
|
||||
const center = toAbsolute(coord);
|
||||
const topLeft = { level: center.level, x: center.x - 10, z: center.z - 10 };
|
||||
const bottomRight = { level: center.level, x: center.x + 10, z: center.z + 10 };
|
||||
|
||||
const allCoords: number[] = [];
|
||||
for (let x = topLeft.x; x <= bottomRight.x; x++) {
|
||||
for (let z = topLeft.z; z <= bottomRight.z; z++) {
|
||||
allCoords.push(toCoord(center.level, x, z));
|
||||
}
|
||||
}
|
||||
|
||||
const sixMinutesBefore = toDbDate(parseInt(timestamp) - (1000 * 60 * 6));
|
||||
const sixMinutesAfter = toDbDate(parseInt(timestamp) + (1000 * 60 * 6));
|
||||
|
||||
const logs = await db.selectFrom('account_session').select(['timestamp', 'coord', 'event', 'world'])
|
||||
.innerJoin('account', 'account_session.account_id', 'account.id').select('account.username')
|
||||
.where('profile', '=', 'beta')
|
||||
.where('world', '=', world)
|
||||
.where('event_type', '=', LoggerEventType.WEALTH)
|
||||
.where((eb: any) => eb.or(
|
||||
allCoords.map(c =>
|
||||
eb('coord', '=', c)
|
||||
)
|
||||
))
|
||||
.where('timestamp', '<', sixMinutesAfter)
|
||||
.where('timestamp', '>', sixMinutesBefore)
|
||||
.orderBy('timestamp desc').execute();
|
||||
|
||||
return res.view('mod/item', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
logs
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/public/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/public/${username}`, 302);
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account')
|
||||
.where('username', '=', username)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.view('mod/notfound', {
|
||||
username
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/public', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
account,
|
||||
chats: await db.selectFrom('public_chat').where('account_id', '=', account.id)
|
||||
.orderBy('timestamp desc').selectAll().execute(),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/private/:username', async (req: any, res: any) => {
|
||||
try {
|
||||
const { username } = req.params;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/private/${username}`, 302);
|
||||
}
|
||||
|
||||
const account = await db.selectFrom('account')
|
||||
.where('username', '=', username)
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!account) {
|
||||
return res.view('mod/notfound', {
|
||||
username
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/private', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
account,
|
||||
chats: await db.selectFrom('private_chat').where('account_id', '=', account.id)
|
||||
.leftJoin('account', 'private_chat.to_account_id', 'account.id')
|
||||
.orderBy('timestamp desc').selectAll().execute(),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/conversation', async (req: any, res: any) => {
|
||||
try {
|
||||
const { from, to } = req.query;
|
||||
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect(`/account/login?redirectUrl=/mod/conversation?from=${from}&to=${to}`, 302);
|
||||
}
|
||||
|
||||
const fromAcc = await db.selectFrom('account')
|
||||
.where('username', '=', toSafeName(from))
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!fromAcc) {
|
||||
return res.view('mod/notfound', {
|
||||
username: from
|
||||
});
|
||||
}
|
||||
|
||||
const toAcc = await db.selectFrom('account')
|
||||
.where('username', '=', toSafeName(to))
|
||||
.selectAll()
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!toAcc) {
|
||||
return res.view('mod/notfound', {
|
||||
username: to
|
||||
});
|
||||
}
|
||||
|
||||
return res.view('mod/conversation', {
|
||||
toDisplayName,
|
||||
toDisplayCoord,
|
||||
embedCoord,
|
||||
fromAcc,
|
||||
toAcc,
|
||||
pms: await db.selectFrom('private_chat')
|
||||
.where((eb) => eb.or([
|
||||
eb('account_id', '=', fromAcc.id),
|
||||
eb('account_id', '=', toAcc.id)
|
||||
]))
|
||||
.where((eb) => eb.or([
|
||||
eb('to_account_id', '=', fromAcc.id),
|
||||
eb('to_account_id', '=', toAcc.id)
|
||||
]))
|
||||
.orderBy('timestamp desc').selectAll().execute(),
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/recent', async (req: any, res: any) => {
|
||||
try {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect('/account/login?redirectUrl=/mod/recent', 302);
|
||||
}
|
||||
|
||||
const recent = await db.selectFrom('account').select(['username', 'registration_ip', 'registration_date'])
|
||||
.leftJoin('session', 'account.id', 'session.account_id').select(['ip', 'uid'])
|
||||
.groupBy('id')
|
||||
.orderBy('registration_date', 'desc')
|
||||
.orderBy('timestamp', 'desc')
|
||||
.execute();
|
||||
|
||||
return res.view('mod/recent', {
|
||||
toDisplayName,
|
||||
recent
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/active', async (req: any, res: any) => {
|
||||
try {
|
||||
if (!req.session.account || req.session.account.staffmodlevel < 1) {
|
||||
return res.redirect('/account/login?redirectUrl=/mod/active', 302);
|
||||
}
|
||||
|
||||
const recent = await db.selectFrom('account').select(['username', 'registration_ip', 'registration_date'])
|
||||
.where('logged_in', '!=', 0)
|
||||
.leftJoin('session', 'account.id', 'session.account_id').select(['ip', 'uid'])
|
||||
.groupBy('id')
|
||||
.orderBy('timestamp', 'desc')
|
||||
.execute();
|
||||
|
||||
return res.view('mod/active', {
|
||||
toDisplayName,
|
||||
recent
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.redirect('/', 302);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -36,9 +36,6 @@
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/css/site.css">
|
||||
<% if (typeof modals !== 'undefined') { %>
|
||||
<link rel="stylesheet" type="text/css" href="/css/modals.css">
|
||||
<% } %>
|
||||
</head>
|
||||
</html>
|
||||
<body bgcolor=black text="white" link=#90c040 alink=#90c040 vlink=#90c040 topmargin=0 leftmargin=0>
|
||||
|
||||
@@ -1,282 +0,0 @@
|
||||
<script>
|
||||
const banButton = document.getElementById('ban-btn'),
|
||||
muteButton = document.getElementById('mute-btn'),
|
||||
changeUsernameButton = document.getElementById('name-change-btn'),
|
||||
kickButton = document.getElementById('kick-btn');
|
||||
|
||||
const banModal = document.getElementById('modal-ban-player'),
|
||||
banModalUsername = document.getElementById('modal-ban-player-username'),
|
||||
banModalTimePeriodSelect = document.getElementById('modal-ban-player-time-select'),
|
||||
banModalCustomTimePeriod = document.getElementById('modal-ban-player-time-custom'),
|
||||
banModalBanButton = document.getElementById('modal-ban-player-btn'),
|
||||
banModalMercyButton = document.getElementById('modal-cancel-ban-btn');
|
||||
|
||||
const changeUsernameModal = document.getElementById('modal-change-username'),
|
||||
changeUsernameConfirmButton = document.getElementById('modal-confirm-change-username-btn'),
|
||||
changeUsernameUnbanConfirmButton = document.getElementById('modal-confirm-change-unban-username-btn'),
|
||||
changeUsernameCancelButton = document.getElementById('modal-cancel-change-username-btn'),
|
||||
changeUsernameTitle = document.getElementById('modal-change-username-span'),
|
||||
changeUsernameInput = document.getElementById('modal-change-username-input');
|
||||
|
||||
const muteModal = document.getElementById('modal-mute-player'),
|
||||
muteModalUsername = document.getElementById('modal-mute-player-username'),
|
||||
muteModalTimePeriodSelect = document.getElementById('modal-mute-player-time-select'),
|
||||
muteModalCustomTimePeriod = document.getElementById('modal-mute-player-time-custom'),
|
||||
muteModalMuteButton = document.getElementById('modal-mute-player-btn'),
|
||||
muteModalMercyButton = document.getElementById('modal-cancel-mute-btn');
|
||||
|
||||
function addDaysToCurrentDate(days) {
|
||||
const currentDate = new Date();
|
||||
|
||||
// Get the current timestamp, and add days converted to milliseconds because .setDate()/.getDate()
|
||||
// give wildly inaccurate results for some reason
|
||||
const futureTime = currentDate.getTime() + (days * 24 * 60 * 60 * 1000);
|
||||
return new Date(futureTime);
|
||||
}
|
||||
|
||||
function resetModalInputs() {
|
||||
banModalTimePeriodSelect.value = 1;
|
||||
banModalCustomTimePeriod.value = "";
|
||||
muteModalTimePeriodSelect.value = 1;
|
||||
muteModalCustomTimePeriod.value = "";
|
||||
changeUsernameInput.value = "";
|
||||
}
|
||||
|
||||
async function submitBanUserRequest() {
|
||||
if (banModalTimePeriodSelect.value === -1) {
|
||||
if (banModalCustomTimePeriod.value == "" || banModalCustomTimePeriod.value == null) {
|
||||
alert('Please enter a new period of time:');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let numberOfDays = banModalTimePeriodSelect.value == -1 ? banModalCustomTimePeriod.value : banModalTimePeriodSelect.value;
|
||||
let banDate = addDaysToCurrentDate(numberOfDays);
|
||||
|
||||
if (confirm(`Are you SURE you want to ban ${account.username} for ${numberOfDays} day(s)?`)) {
|
||||
fetch(`/mod/ban/${account.id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
banned_until: banDate.toISOString()
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
banModal.close();
|
||||
alert(`Banned ${account.username} for ${numberOfDays} day(s).`);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(json.error);
|
||||
}
|
||||
}).catch(err => {
|
||||
alert(`An unknown error occurred. Please report this issue.\n\n${err}`);
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function submitUnbanUserRequest() {
|
||||
if (confirm(`Are you sure you want to unban '${account.username}'?`)) {
|
||||
fetch(`/mod/unban/${account.id}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
alert(`Successfully unbanned '${account.username}'`);
|
||||
location.reload();
|
||||
} else {
|
||||
alert(json.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function submitMuteUserRequest() {
|
||||
if (muteModalTimePeriodSelect.value === -1) {
|
||||
if (muteModalCustomTimePeriod.value == "" || muteModalCustomTimePeriod.value == null) {
|
||||
alert('Please enter a new period of time:');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let numberOfDays = muteModalTimePeriodSelect.value == -1 ? muteModalCustomTimePeriod.value : muteModalTimePeriodSelect.value;
|
||||
let muteDate = addDaysToCurrentDate(numberOfDays);
|
||||
|
||||
if (confirm(`Are you SURE you want to mute '${account.username}' for ${numberOfDays} day(s)?`)) {
|
||||
fetch(`/mod/mute/${account.id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
muted_until: muteDate.toISOString()
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
muteModal.close();
|
||||
alert(`Muted ${account.username} for ${numberOfDays} day(s).`);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(json.error);
|
||||
}
|
||||
}).catch(err => {
|
||||
alert(`An unknown error occurred. Please report this issue.\n\n${err}`);
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function submitUnmuteUserRequest() {
|
||||
if (confirm(`Are you sure you want to unmute '${account.username}'?`)) {
|
||||
fetch(`/mod/unmute/${account.id}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
alert(`Successfully unmuted '${account.username}'`);
|
||||
location.reload();
|
||||
} else {
|
||||
alert(json.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function submitChangeUsernameRequest(unban = false) {
|
||||
const newUsername = changeUsernameInput.value;
|
||||
if (newUsername === "") {
|
||||
alert('Please enter new username before submitting!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm(`Are you sure you want to ${unban ? 'unban and ' : ''}rename ${account.username} to '${newUsername}?'`)) {
|
||||
let body = {
|
||||
new_username: newUsername
|
||||
};
|
||||
|
||||
if (unban) {
|
||||
body.unban = true;
|
||||
}
|
||||
|
||||
fetch(`/mod/change-name/${account.id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.error) {
|
||||
alert(json.error);
|
||||
} else {
|
||||
changeUsernameModal.close();
|
||||
alert(`Successfully ${unban ? 'unbanned and ' : ''}changed ${account.username}'s username to '${newUsername}'.`);
|
||||
location.href = `/mod/overview/${newUsername}`
|
||||
}
|
||||
}).catch(err => {
|
||||
alert(`An unknown error occurred. Please report this issue.\n\n${err}`);
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function submitKickUserRequest() {
|
||||
if (confirm(`Are you sure you want to kick '${account.username}'?`)) {
|
||||
fetch(`/mod/kick/${account.id}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json.success) {
|
||||
alert(`Successfully kicked '${account.username}'`);
|
||||
location.reload();
|
||||
} else {
|
||||
alert(json.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
banButton.addEventListener('click', (event) => {
|
||||
if (account.banned_until) {
|
||||
submitUnbanUserRequest();
|
||||
} else {
|
||||
resetModalInputs();
|
||||
banModal.showModal();
|
||||
}
|
||||
});
|
||||
banModalMercyButton.addEventListener('click', (event) => {
|
||||
banModal.close();
|
||||
});
|
||||
banModalBanButton.addEventListener('click', submitBanUserRequest);
|
||||
banModalTimePeriodSelect.addEventListener('change', (event) => {
|
||||
const newValue = event.target.value;
|
||||
if (newValue == -1) {
|
||||
banModalCustomTimePeriod.classList.remove('hidden');
|
||||
} else {
|
||||
banModalCustomTimePeriod.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
muteButton.addEventListener('click', (event) => {
|
||||
if (account.muted_until) {
|
||||
submitUnmuteUserRequest();
|
||||
} else {
|
||||
resetModalInputs();
|
||||
muteModal.showModal();
|
||||
}
|
||||
});
|
||||
muteModalMuteButton.addEventListener('click', (event) => {
|
||||
submitMuteUserRequest();
|
||||
});
|
||||
muteModalMercyButton.addEventListener('click', (event) => {
|
||||
muteModal.close();
|
||||
});
|
||||
muteModalTimePeriodSelect.addEventListener('change', (event) => {
|
||||
const newValue = event.target.value;
|
||||
if (newValue == -1) {
|
||||
muteModalCustomTimePeriod.classList.remove('hidden');
|
||||
} else {
|
||||
muteModalCustomTimePeriod.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
changeUsernameButton.addEventListener('click', (event) => {
|
||||
resetModalInputs();
|
||||
changeUsernameModal.showModal();
|
||||
});
|
||||
changeUsernameConfirmButton.addEventListener('click', (event) => {
|
||||
submitChangeUsernameRequest();
|
||||
});
|
||||
changeUsernameUnbanConfirmButton.addEventListener('click', (event) => {
|
||||
submitChangeUsernameRequest(true);
|
||||
});
|
||||
changeUsernameCancelButton.addEventListener('click', (event) => {
|
||||
changeUsernameModal.close();
|
||||
});
|
||||
|
||||
kickButton.addEventListener('click', (event) => {
|
||||
submitKickUserRequest();
|
||||
});
|
||||
|
||||
banModalUsername.textContent = account.username;
|
||||
muteModalUsername.textContent = account.username;
|
||||
changeUsernameTitle.textContent = account.username;
|
||||
|
||||
if (account.banned_until) {
|
||||
document.getElementById('banned-until-display').textContent = (new Date(account.banned_until)).toLocaleString();
|
||||
}
|
||||
if (account.muted_until) {
|
||||
document.getElementById('muted-until-display').textContent = (new Date(account.muted_until)).toLocaleString();
|
||||
}
|
||||
resetModalInputs();
|
||||
</script>
|
||||
@@ -1,33 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Active Abuse Monitor' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: "Active Abuse Monitor" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const acc of recent) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<%= acc.id %>
|
||||
<a href="/mod/overview/<%= acc.username %>"><%= toDisplayName(acc.username) %></a><br>
|
||||
</strong>
|
||||
|
||||
<% if (acc.registration_ip) { %>
|
||||
Registration: <a href="/mod/ip/<%= acc.registration_ip %>"><%= acc.registration_ip %></a><br>
|
||||
<% } %>
|
||||
<% if (acc.ip) { %>
|
||||
Last Session: <a href="/mod/ip/<%= acc.ip %>"><%= acc.ip %></a><br>
|
||||
UID: <a href="/mod/uid/<%= acc.uid %>"><%= acc.uid %></a>
|
||||
<% } %>
|
||||
|
||||
<span style="float: right">
|
||||
<%= acc.registration_date.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,29 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Public Chat Log' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: 'Public Chat Log' }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of logs) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="/mod/overview/<%= log.username %>"><%= toDisplayName(log.username); %></a>: <%= log.message %>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Private Conversation' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: 'Private Conversation', links: [ { text: 'Overview', href: '/mod/overview/' + fromAcc.username } ] }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const pm of pms) { %>
|
||||
<div style="text-align: left">
|
||||
<strong><a href="/mod/overview/<%= pm.account_id === fromAcc.id ? fromAcc.username : toAcc.username %>"><%= toDisplayName(pm.account_id === fromAcc.id ? fromAcc.username : toAcc.username) %></a></strong>
|
||||
->
|
||||
<strong><a href="/mod/overview/<%= pm.to_account_id === toAcc.id ? toAcc.username : fromAcc.username %>"><%= toDisplayName(pm.to_account_id === toAcc.id ? toAcc.username : fromAcc.username) %></a></strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= pm.message %>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,29 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Event Log' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: account.username + "'s Event Log", links: [ { text: 'Overview', href: '/mod/overview/' + account.username } ] }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of logs) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= log.event %>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,24 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Lookup by IP' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: "Lookup by IP" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const session of sessions) { %>
|
||||
<div style="text-align: left">
|
||||
<span style="float: right">
|
||||
<%= session.ip %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="/mod/overview/<%= session.username %>"><%= toDisplayName(session.username); %></a>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,29 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Item Log' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: 'Item Log' }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of logs) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="/mod/overview/<%= log.username %>"><%= toDisplayName(log.username); %></a>: <%= log.event %>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,7 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'User Not Found' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: username + " Not Found" }); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,182 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: toDisplayName(account.username) + "'s Mod Overview", modals: true }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: toDisplayName(account.username) + "'s Mod Overview" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
|
||||
<% if (account.password === 'blocked') { %>
|
||||
<strong>Account name blocked by a moderator.</strong><br><br>
|
||||
<% } %>
|
||||
|
||||
<%- include('../_components/modal-ban-player'); %>
|
||||
<%- include('../_components/modal-mute-player'); %>
|
||||
<%- include('../_components/modal-change-username'); %>
|
||||
|
||||
<% if (account.banned_until) { %>
|
||||
Banned until: <strong id="banned-until-display"><%= account.banned_until.toISOString().replace("T"," ").substring(0, 19); %></strong><br>
|
||||
<% } %>
|
||||
|
||||
<% if (account.muted_until) { %>
|
||||
Muted until: <strong id="muted-until-display"><%= account.muted_until.toISOString().replace("T"," ").substring(0, 19); %></strong>
|
||||
<% } %>
|
||||
|
||||
<% if (account.logged_in !== 0) { %>
|
||||
Logged into World <%= account.logged_in - 9 %>
|
||||
<% } %>
|
||||
|
||||
<div style="display: flex; justify-content: space-around;">
|
||||
<%- include('../_components/stones-button.ejs', { id: 'ban-btn', text: account.banned_until ? 'Unban' : 'Ban', shiny: true, account }) %>
|
||||
<%- include('../_components/stones-button.ejs', { id: 'mute-btn', text: account.muted_until ? 'Unmute' : 'Mute', shiny: true }) %>
|
||||
<%- include('../_components/stones-button.ejs', { id: 'name-change-btn', text: 'Change<br>Name' }); %>
|
||||
<%- include('../_components/stones-button.ejs', { id: 'kick-btn', text: 'Kick' }); %>
|
||||
</div>
|
||||
|
||||
<h3>Notes</h3>
|
||||
|
||||
<div style="height: 250px; overflow-y: scroll">
|
||||
<form method="post" action="/mod/note/<%= account.username %>">
|
||||
<textarea name="notes" style="width: 100%; height: 70%; background-color: #000; color: #fff; border: 0"><%- account.notes %></textarea>
|
||||
<br><br>
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
<% if (account.notes_updated) { %>
|
||||
Last updated: <%= account.notes_updated.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
<% }%>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h3>Sessions</h3>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const session of sessions) { %>
|
||||
<div style="text-align: left">
|
||||
World: <strong><%= session.world - 9 %></strong>, IP: <strong><a href="/mod/ip/<%= session.ip %>"><%= session.ip.substring(0, 32); %></a></strong>, UID: <strong><a href="/mod/uid/<%= session.uid %>"><%= session.uid %></a></strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= session.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h3>Public Chat Messages</h3>
|
||||
<a href="/mod/public/<%= account.username %>">View Full Log</a>
|
||||
<br><br>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const chat of chats) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(chat.coord) %>"><%= toDisplayCoord(chat.coord) %></a>,
|
||||
World: <%= chat.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= chat.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= chat.message %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/chat?coord=<%= chat.coord %>&world=<%= chat.world %>×tamp=<%= chat.timestamp.getTime() %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h3>Private Chat Messages</h3>
|
||||
<a href="/mod/private/<%= account.username %>">View Full Log</a>
|
||||
<br><br>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const pm of pms) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>To: <a href="/mod/overview/<%= pm.username %>"><%= toDisplayName(pm.username) %></a></strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= pm.message %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/conversation?from=<%= account.username %>&to=<%= pm.username %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h3>Events</h3>
|
||||
<a href="/mod/events/<%= account.username %>">View Full Log</a>
|
||||
<br><br>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of logs) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= log.event %>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h3>Wealth Events</h3>
|
||||
<a href="/mod/wealth/<%= account.username %>">View Full Log</a>
|
||||
<br><br>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of wealth) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= log.event %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/item?coord=<%= log.coord %>&world=<%= log.world %>×tamp=<%= log.timestamp.getTime() %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
|
||||
<script>
|
||||
<% const { password, notes, ...sanitizedAccount } = account %>
|
||||
const account = JSON.parse(`<%- JSON.stringify(sanitizedAccount) %>`);
|
||||
</script>
|
||||
<%- include('../_scripts/mod/overview.ejs'); %>
|
||||
@@ -1,31 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Private Chat Messages', modals: true }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: account.username + "'s Private Chat Messages", links: [ { text: 'Overview', href: '/mod/overview/' + account.username } ] }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const pm of chats) { %>
|
||||
<div style="text-align: left">
|
||||
To: <strong><a href="/mod/overview/<%= pm.username %>"><%= toDisplayName(pm.username) %></a></strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= pm.message %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/conversation?from=<%= account.username %>&to=<%= pm.username %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
<%- include('../_scripts/mod/overview.ejs'); %>
|
||||
@@ -1,34 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Public Chat Messages', modals: true }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: account.username + "'s Public Chat Messages", links: [ { text: 'Overview', href: '/mod/overview/' + account.username } ] }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const chat of chats) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(chat.coord) %>"><%= toDisplayCoord(chat.coord) %></a>,
|
||||
World: <%= chat.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= chat.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= chat.message %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/chat?coord=<%= chat.coord %>&world=<%= chat.world %>×tamp=<%= chat.timestamp.getTime() %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
<%- include('../_scripts/mod/overview.ejs'); %>
|
||||
@@ -1,33 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Abuse Monitor' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: "Abuse Monitor" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const acc of recent) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<%= acc.id %>
|
||||
<a href="/mod/overview/<%= acc.username %>"><%= toDisplayName(acc.username) %></a><br>
|
||||
</strong>
|
||||
|
||||
<% if (acc.registration_ip) { %>
|
||||
Registration: <a href="/mod/ip/<%= acc.registration_ip %>"><%= acc.registration_ip %></a><br>
|
||||
<% } %>
|
||||
<% if (acc.ip) { %>
|
||||
Last Session: <a href="/mod/ip/<%= acc.ip %>"><%= acc.ip %></a><br>
|
||||
UID: <a href="/mod/uid/<%= acc.uid %>"><%= acc.uid %></a>
|
||||
<% } %>
|
||||
|
||||
<span style="float: right">
|
||||
<%= acc.registration_date.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,31 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Report Log' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: "Report log" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<h3>Reports</h3>
|
||||
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const report of reports) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(report.coord) %>"><%= toDisplayCoord(report.coord) %></a>,
|
||||
World: <%= report.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= report.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="/mod/overview/<%= report.username %>"><%= toDisplayName(report.username) %></a> reported <a href="/mod/overview/<%= report.offender %>"><%= toDisplayName(report.offender) %></a>: <em><%= reasons[report.reason] %></em>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,24 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Lookup by UUID' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: "Lookup by UUID" }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const session of sessions) { %>
|
||||
<div style="text-align: left">
|
||||
<span style="float: right">
|
||||
<%= session.uid %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="/mod/overview/<%= session.username %>"><%= toDisplayName(session.username); %></a>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
@@ -1,33 +0,0 @@
|
||||
<%- include('../_partial/header.ejs', { title: 'Wealth Log' }); %>
|
||||
<%- include('../_components/frame-top.ejs'); %>
|
||||
<%- include('../_components/content-start.ejs'); %>
|
||||
<%- include('../_components/title-box.ejs', { title: account.username + "'s Wealth Log", links: [ { text: 'Overview', href: '/mod/overview/' + account.username } ] }); %>
|
||||
|
||||
<%- include('../_components/content-body-start.ejs'); %>
|
||||
<div style="height: 500px; overflow-y: scroll">
|
||||
<% for (const log of logs) { %>
|
||||
<div style="text-align: left">
|
||||
<strong>
|
||||
<a target="_blank" href="<%= embedCoord(log.coord) %>"><%= toDisplayCoord(log.coord) %></a>,
|
||||
World: <%= log.world - 9 %>
|
||||
</strong>
|
||||
|
||||
<span style="float: right">
|
||||
<%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %>
|
||||
</span>
|
||||
|
||||
<br>
|
||||
|
||||
<%= log.event %>
|
||||
|
||||
<span style="float: right">
|
||||
<a href="/mod/item?coord=<%= log.coord %>&world=<%= log.world %>×tamp=<%= log.timestamp.getTime() %>">More context</a>
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include('../_components/content-body-end.ejs'); %>
|
||||
|
||||
<%- include('../_components/content-end.ejs'); %>
|
||||
<%- include('../_partial/footer.ejs'); %>
|
||||
Reference in new issue
Block a user