diff options
author | marzavec <admin@marzavec.com> | 2019-11-07 08:35:23 +0100 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2019-11-07 08:35:23 +0100 |
commit | f28e65ab8035682372edbe1c11d9ca2581e0a2e6 (patch) | |
tree | a75c9b682ca245baa3f01df5ea704ba95205cef3 /server/src/commands/internal | |
parent | Merge pull request #79 from 0x17de/feature-emote-trip (diff) | |
download | hackchat-f28e65ab8035682372edbe1c11d9ca2581e0a2e6.tar.gz hackchat-f28e65ab8035682372edbe1c11d9ca2581e0a2e6.zip |
Syntax update and formatting tweaks
Diffstat (limited to 'server/src/commands/internal')
-rw-r--r-- | server/src/commands/internal/disconnect.js | 17 | ||||
-rw-r--r-- | server/src/commands/internal/legacylayer.js | 19 | ||||
-rw-r--r-- | server/src/commands/internal/socketreply.js | 15 |
3 files changed, 27 insertions, 24 deletions
diff --git a/server/src/commands/internal/disconnect.js b/server/src/commands/internal/disconnect.js index 520f8cb..07a125e 100644 --- a/server/src/commands/internal/disconnect.js +++ b/server/src/commands/internal/disconnect.js @@ -4,28 +4,29 @@ */ // module main -exports.run = async (core, server, socket, data) => { +export async function run(core, server, socket, data) { if (data.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.remoteAddress, 20); + return server.police.frisk(socket.address, 20); } // send leave notice to client peers if (socket.channel) { server.broadcast({ cmd: 'onlineRemove', - nick: socket.nick + nick: socket.nick, }, { channel: socket.channel }); } // commit close just in case socket.terminate(); -}; -// module meta -exports.requiredData = ['cmdKey']; -exports.info = { + return true; +} + +export const requiredData = ['cmdKey']; +export const info = { name: 'disconnect', usage: 'Internal Use Only', - description: 'Internally used to relay `onlineRemove` event to clients' + description: 'Internally used to relay `onlineRemove` event to clients', }; diff --git a/server/src/commands/internal/legacylayer.js b/server/src/commands/internal/legacylayer.js index 50f5fd7..c0daa13 100644 --- a/server/src/commands/internal/legacylayer.js +++ b/server/src/commands/internal/legacylayer.js @@ -3,18 +3,19 @@ */ // module main -exports.run = async (core, server, socket, data) => { - return; -}; +export async function run(core, server, socket, data) { + /** + * @todo + */ +} // module hook functions -exports.initHooks = (server) => { +export function initHooks(server) { // module is only a placeholder - //server.registerHook('out', '', this.); -}; + // server.registerHook('out', '', this.); +} -// module meta -exports.info = { +export const info = { name: 'legacylayer', - description: 'This module adjusts outgoing data, making it compatible with legacy clients' + description: 'This module adjusts outgoing data, making it compatible with legacy clients', }; diff --git a/server/src/commands/internal/socketreply.js b/server/src/commands/internal/socketreply.js index 5dadaf6..1ba8df2 100644 --- a/server/src/commands/internal/socketreply.js +++ b/server/src/commands/internal/socketreply.js @@ -3,20 +3,21 @@ */ // module main -exports.run = async (core, server, socket, data) => { +export async function run(core, server, socket, data) { if (data.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.remoteAddress, 20); + return server.police.frisk(socket.address, 20); } // send warning to target socket server.reply({ cmd: 'warn', text: data.text }, socket); -}; -// module meta -exports.requiredData = ['cmdKey', 'text']; -exports.info = { + return true; +} + +export const requiredData = ['cmdKey', 'text']; +export const info = { name: 'socketreply', usage: 'Internal Use Only', - description: 'Internally used to relay warnings to clients' + description: 'Internally used to relay warnings to clients', }; |