create backup dir if not exist according to subdirectory

allow admin to use chat even on proxy
This commit is contained in:
HF 2020-06-13 21:02:16 +02:00
parent b70c7e0b3a
commit e3be885cd0
2 changed files with 8 additions and 3 deletions

View File

@ -97,8 +97,13 @@ function getDateFolder() {
const dir = path.resolve(__dirname, BACKUP_DIR);
if (!fs.existsSync(dir)) {
// eslint-disable-next-line max-len
console.error(`Backup directory ${BACKUP_DIR} does not exist! Trying to create it`);
fs.mkdirSync(BACKUP_DIR);
console.info(`Backup directory ${BACKUP_DIR} does not exist! Trying to create it`);
try {
fs.mkdirSync(dir);
} catch {
console.error('Couldn\'t create backup dir');
process.exit(1);
}
}
const date = new Date();
let month = date.getMonth() + 1;

View File

@ -273,7 +273,7 @@ class SocketServer extends WebSocketEvents {
return;
}
// check proxy
if (await cheapDetector(user.ip)) {
if (!user.isAdmin() && await cheapDetector(user.ip)) {
logger.info(
`${ws.name} / ${user.ip} tried to send chat message with proxy`,
);