diff --git a/public/script.js b/public/script.js index 8c1391c..1b9e644 100644 --- a/public/script.js +++ b/public/script.js @@ -109,6 +109,15 @@ async function init() { }); }); + ws.on('private message', evt => { + write_message({ + type: 'normal', + from: evt.sender, + msg: evt.data, + is_private: true, + }); + }) + ws.on('command-block-reply', data => { write_message({ type: 'command-block', diff --git a/src/user.ts b/src/user.ts index 5425e9b..c9f8b9e 100644 --- a/src/user.ts +++ b/src/user.ts @@ -40,8 +40,8 @@ function splite_toplevel_concat(filter_string: string) { matched += 1; } else if (c === ')') { matched -= 1; - } - + } + if (c === '+' && matched === 0) { res.push(buf); buf = ''; @@ -56,9 +56,9 @@ function splite_toplevel_concat(filter_string: string) { export function find_user(filter_string_raw: string, users: Map, owner_id: string): string[] { const parse_lower = (filter: string) => { - return find_user(filter, users, owner_id); + return find_user(filter, users, owner_id); }; - + // trim spaces (start and end) const filter_string = filter_string_raw.replace(/(^\s*)|(\s*$)/g, ''); @@ -149,7 +149,12 @@ export function find_user(filter_string_raw: string, users: Map, o let admin_passcode: string; function refreash_admin_passcode() { - admin_passcode = Math.random().toString(); + if (process.env.PASSCODE) { + admin_passcode = process.env.PASSCODE.toString(); + } else { + admin_passcode = Math.random().toString(); + } + console.log('Admin passcode is:', admin_passcode); return admin_passcode; }