diff --git a/src/routes/mod/index.ts b/src/routes/mod/index.ts deleted file mode 100644 index c376057..0000000 --- a/src/routes/mod/index.ts +++ /dev/null @@ -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); - } - }); -} diff --git a/view/_partial/header.ejs b/view/_partial/header.ejs index 18a4e91..8f871c8 100644 --- a/view/_partial/header.ejs +++ b/view/_partial/header.ejs @@ -36,9 +36,6 @@ - <% if (typeof modals !== 'undefined') { %> - - <% } %> diff --git a/view/_scripts/mod/overview.ejs b/view/_scripts/mod/overview.ejs deleted file mode 100644 index 479b0fe..0000000 --- a/view/_scripts/mod/overview.ejs +++ /dev/null @@ -1,282 +0,0 @@ - \ No newline at end of file diff --git a/view/mod/active.ejs b/view/mod/active.ejs deleted file mode 100644 index c970fc4..0000000 --- a/view/mod/active.ejs +++ /dev/null @@ -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'); %> -
- <% for (const acc of recent) { %> -
- - <%= acc.id %> - <%= toDisplayName(acc.username) %>
-
- - <% if (acc.registration_ip) { %> - Registration: <%= acc.registration_ip %>
- <% } %> - <% if (acc.ip) { %> - Last Session: <%= acc.ip %>
- UID: <%= acc.uid %> - <% } %> - - - <%= acc.registration_date.toISOString().replace("T"," ").substring(0, 19); %> - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/chat.ejs b/view/mod/chat.ejs deleted file mode 100644 index 25daf50..0000000 --- a/view/mod/chat.ejs +++ /dev/null @@ -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'); %> -
- <% for (const log of logs) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= toDisplayName(log.username); %>: <%= log.message %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/conversation.ejs b/view/mod/conversation.ejs deleted file mode 100644 index 1c65474..0000000 --- a/view/mod/conversation.ejs +++ /dev/null @@ -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'); %> -
- <% for (const pm of pms) { %> -
- <%= toDisplayName(pm.account_id === fromAcc.id ? fromAcc.username : toAcc.username) %> - -> - <%= toDisplayName(pm.to_account_id === toAcc.id ? toAcc.username : fromAcc.username) %> - - - <%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= pm.message %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/events.ejs b/view/mod/events.ejs deleted file mode 100644 index 789bc86..0000000 --- a/view/mod/events.ejs +++ /dev/null @@ -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'); %> -
- <% for (const log of logs) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= log.event %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/ip.ejs b/view/mod/ip.ejs deleted file mode 100644 index 37cebea..0000000 --- a/view/mod/ip.ejs +++ /dev/null @@ -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'); %> -
- <% for (const session of sessions) { %> -
- - <%= session.ip %> - - -
- - <%= toDisplayName(session.username); %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/item.ejs b/view/mod/item.ejs deleted file mode 100644 index 5cad77a..0000000 --- a/view/mod/item.ejs +++ /dev/null @@ -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'); %> -
- <% for (const log of logs) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= toDisplayName(log.username); %>: <%= log.event %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/notfound.ejs b/view/mod/notfound.ejs deleted file mode 100644 index 9b47e63..0000000 --- a/view/mod/notfound.ejs +++ /dev/null @@ -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'); %> diff --git a/view/mod/overview.ejs b/view/mod/overview.ejs deleted file mode 100644 index acdcd3a..0000000 --- a/view/mod/overview.ejs +++ /dev/null @@ -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') { %> - Account name blocked by a moderator.

-<% } %> - -<%- include('../_components/modal-ban-player'); %> -<%- include('../_components/modal-mute-player'); %> -<%- include('../_components/modal-change-username'); %> - -<% if (account.banned_until) { %> -Banned until: <%= account.banned_until.toISOString().replace("T"," ").substring(0, 19); %>
-<% } %> - -<% if (account.muted_until) { %> -Muted until: <%= account.muted_until.toISOString().replace("T"," ").substring(0, 19); %> -<% } %> - -<% if (account.logged_in !== 0) { %> -Logged into World <%= account.logged_in - 9 %> -<% } %> - -
- <%- 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
Name' }); %> - <%- include('../_components/stones-button.ejs', { id: 'kick-btn', text: 'Kick' }); %> -
- -

Notes

- -
-
- -

- -
- - <% if (account.notes_updated) { %> - Last updated: <%= account.notes_updated.toISOString().replace("T"," ").substring(0, 19); %> - <% }%> -
- -
-

Sessions

- -
- <% for (const session of sessions) { %> -
- World: <%= session.world - 9 %>, IP: <%= session.ip.substring(0, 32); %>, UID: <%= session.uid %> - - - <%= session.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - -
-
- <% } %> -
- -
-

Public Chat Messages

-View Full Log -

- -
- <% for (const chat of chats) { %> -
- - <%= toDisplayCoord(chat.coord) %>, - World: <%= chat.world - 9 %> - - - - <%= chat.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= chat.message %> - - - More context - -
-
- <% } %> -
- -
-

Private Chat Messages

-View Full Log -

- -
- <% for (const pm of pms) { %> -
- To: <%= toDisplayName(pm.username) %> - - - <%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= pm.message %> - - - More context - -
-
- <% } %> -
- -
-

Events

-View Full Log -

- -
- <% for (const log of logs) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= log.event %> -
-
- <% } %> -
- -
-

Wealth Events

-View Full Log -

- -
- <% for (const log of wealth) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= log.event %> - - - More context - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> - - -<%- include('../_scripts/mod/overview.ejs'); %> diff --git a/view/mod/private.ejs b/view/mod/private.ejs deleted file mode 100644 index 58c9ff1..0000000 --- a/view/mod/private.ejs +++ /dev/null @@ -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'); %> -
- <% for (const pm of chats) { %> -
- To: <%= toDisplayName(pm.username) %> - - - <%= pm.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= pm.message %> - - - More context - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> -<%- include('../_scripts/mod/overview.ejs'); %> diff --git a/view/mod/public.ejs b/view/mod/public.ejs deleted file mode 100644 index de04e36..0000000 --- a/view/mod/public.ejs +++ /dev/null @@ -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'); %> -
- <% for (const chat of chats) { %> -
- - <%= toDisplayCoord(chat.coord) %>, - World: <%= chat.world - 9 %> - - - - <%= chat.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= chat.message %> - - - More context - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> -<%- include('../_scripts/mod/overview.ejs'); %> diff --git a/view/mod/recent.ejs b/view/mod/recent.ejs deleted file mode 100644 index fe9f71e..0000000 --- a/view/mod/recent.ejs +++ /dev/null @@ -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'); %> -
- <% for (const acc of recent) { %> -
- - <%= acc.id %> - <%= toDisplayName(acc.username) %>
-
- - <% if (acc.registration_ip) { %> - Registration: <%= acc.registration_ip %>
- <% } %> - <% if (acc.ip) { %> - Last Session: <%= acc.ip %>
- UID: <%= acc.uid %> - <% } %> - - - <%= acc.registration_date.toISOString().replace("T"," ").substring(0, 19); %> - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/reports.ejs b/view/mod/reports.ejs deleted file mode 100644 index a7d8719..0000000 --- a/view/mod/reports.ejs +++ /dev/null @@ -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'); %> -

Reports

- -
- <% for (const report of reports) { %> -
- - <%= toDisplayCoord(report.coord) %>, - World: <%= report.world - 9 %> - - - - <%= report.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= toDisplayName(report.username) %> reported <%= toDisplayName(report.offender) %>: <%= reasons[report.reason] %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/uid.ejs b/view/mod/uid.ejs deleted file mode 100644 index cd583eb..0000000 --- a/view/mod/uid.ejs +++ /dev/null @@ -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'); %> -
- <% for (const session of sessions) { %> -
- - <%= session.uid %> - - -
- - <%= toDisplayName(session.username); %> -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %> diff --git a/view/mod/wealth.ejs b/view/mod/wealth.ejs deleted file mode 100644 index 1ee471e..0000000 --- a/view/mod/wealth.ejs +++ /dev/null @@ -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'); %> -
- <% for (const log of logs) { %> -
- - <%= toDisplayCoord(log.coord) %>, - World: <%= log.world - 9 %> - - - - <%= log.timestamp.toISOString().replace("T"," ").substring(0, 19); %> - - -
- - <%= log.event %> - - - More context - -
-
- <% } %> -
-<%- include('../_components/content-body-end.ejs'); %> - -<%- include('../_components/content-end.ejs'); %> -<%- include('../_partial/footer.ejs'); %>