Correct pings in moderation chat message

change void listener
This commit is contained in:
HF 2022-06-25 15:13:29 +02:00
parent 0e07d74afa
commit e09f2bc55f
3 changed files with 5 additions and 9 deletions

View File

@ -130,7 +130,7 @@ class Void {
// it does skip some pixel, but thats ok // it does skip some pixel, but thats ok
this.curRadius += 1; this.curRadius += 1;
if (this.curRadius > TARGET_RADIUS) { if (this.curRadius > TARGET_RADIUS) {
this.ended = true; this.cancel();
return; return;
} }
this.curAngleDelta = 2 * Math.PI / (2 * this.curRadius * Math.PI); this.curAngleDelta = 2 * Math.PI / (2 * this.curRadius * Math.PI);
@ -161,13 +161,12 @@ class Void {
} }
cancel() { cancel() {
socketEvents.removeListener('pixelUpdate', this.broadcastPixelBuffer);
this.ended = true; this.ended = true;
socketEvents.removeListener('pixelUpdate', this.broadcastPixelBuffer);
} }
checkStatus() { checkStatus() {
if (this.ended) { if (this.ended) {
socketEvents.removeListener('pixelUpdate', this.broadcastPixelBuffer);
return 100; return 100;
} }
return Math.floor(this.curRadius * 100 / TARGET_RADIUS); return Math.floor(this.curRadius * 100 / TARGET_RADIUS);

View File

@ -207,7 +207,7 @@ export async function executeCleanerAction(
return [403, error]; return [403, error];
} }
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const report = `set Canvas Cleaner to ${action} from #${canvasid},${x},${y} to #${canvasid},${u},${v}`; const report = `set Canvas Cleaner to ${action} from #${canvas.ident},${x},${y} to #${canvas.ident},${u},${v}`;
if (logger) logger(report); if (logger) logger(report);
return [200, report]; return [200, report];
} }

View File

@ -2,12 +2,9 @@
* basic mod api * basic mod api
* is used by ../components/Modtools * is used by ../components/Modtools
* *
* @flow
*
*/ */
import express from 'express'; import express from 'express';
import type { Request, Response } from 'express';
import multer from 'multer'; import multer from 'multer';
import CanvasCleaner from '../../core/CanvasCleaner'; import CanvasCleaner from '../../core/CanvasCleaner';
@ -76,7 +73,7 @@ router.use(async (req, res, next) => {
router.post('/', upload.single('image'), async (req, res, next) => { router.post('/', upload.single('image'), async (req, res, next) => {
const aLogger = (text) => { const aLogger = (text) => {
const timeString = new Date().toLocaleTimeString(); const timeString = new Date().toLocaleTimeString();
const logText = `@${req.user.regUser.name}[${req.user.id}] ${text}`; const logText = `@[${req.user.regUser.name}](${req.user.id}) ${text}`;
modtoolsLogger.info( modtoolsLogger.info(
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
`${timeString} | MODTOOLS> ${logText}`, `${timeString} | MODTOOLS> ${logText}`,
@ -227,7 +224,7 @@ router.post('/', async (req, res, next) => {
}); });
router.use(async (req: Request, res: Response) => { router.use(async (req, res) => {
res.status(400).send('Invalid request'); res.status(400).send('Invalid request');
}); });