Create what?

Renamed create function to createReporter function
This commit is contained in:
2026-03-25 23:26:08 +01:00
parent e0812a2946
commit 052d7332fb
6 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ import {
findPonies, removeCharactersAboveLimit, createCharacter, removeCharacter, assignCharacter, removeAllCharacters
} from './api/ponies';
import { accountStatus, accountAround, getServer, getLoginServer, RemovedDocument, accountHidden } from './internal';
import { create } from './reporter';
import { createReporter } from './reporter';
import { system } from './logger';
import { AdminService } from './services/adminService';
import { getOriginStats, clearOrigins, removeAllOrigins, removeOrigins, addOrigin, clearOriginsForAccounts } from './api/origins';
@@ -185,7 +185,7 @@ export class AdminServerActions implements IAdminServerActions, SocketServer {
}
@Method({ promise: true })
async report(accountId: string) {
create(this.server, accountId).info(`Reported by ${this.account.name}`);
createReporter(this.server, accountId).info(`Reported by ${this.account.name}`);
}
@Method({ promise: true })
async notifyUpdate(server: string) {
+2 -2
View File
@@ -19,7 +19,7 @@ import { World } from './world';
import { centerCameraOn, createCamera } from '../common/camera';
import { findEntitiesInBounds } from './serverMap';
import { CounterService } from './services/counter';
import { create } from './reporter';
import { createReporter } from './reporter';
import { updateAccountState } from './accountUtils';
import { isMod } from '../common/accountUtils';
import { getOriginFromHTTP } from './originUtils';
@@ -61,7 +61,7 @@ export function createClientAndPony(
) {
const { account, character } = client.tokenData as TokenData;
const origin = client.originalRequest && getOriginFromHTTP(client.originalRequest);
const reporter = create(server, account._id, character._id, origin);
const reporter = createReporter(server, account._id, character._id, origin);
const state = getAndFixCharacterState(server, character, world, states);
client.characterState = state;
+2 -2
View File
@@ -43,7 +43,7 @@ const createLogEvent =
const ignoreWarnings = ['Suspicious message', 'Spam'];
/* istanbul ignore next */
export function create(server: ServerConfig, account?: ID, pony?: ID, originInfo?: IOriginInfo): Reporter {
export function createReporter(server: ServerConfig, account?: ID, pony?: ID, originInfo?: IOriginInfo): Reporter {
const logEvent = createLogEvent(server);
const accountId = `${account}`;
@@ -99,5 +99,5 @@ export function createFromRequest(server: ServerConfig, req: Request, pony?: any
const user = req && req.user as IAccount | undefined;
const account = user?._id?.toString();
const origin = req ? getOrigin(req) : undefined;
return create(server, account, pony, origin);
return createReporter(server, account, pony, origin);
}
+3 -3
View File
@@ -8,7 +8,7 @@ import { BannedMuted, Settings, ServerConfig, AccountFlags, ServerLiveSettings }
import { Account, IAccount, Origin, IOrigin } from '../db';
import { limit, auth as authRequest, wrap } from '../requestUtils';
import { CreateAccountOptions, findOrCreateAccount, SuspiciousCheckers, getAccountAlertMessage } from '../accountUtils';
import { create, createFromRequest } from '../reporter';
import { createReporter, createFromRequest } from '../reporter';
import { logger, logServer, system } from '../logger';
import { providers, getProfile } from '../oauth';
import { accountChanged, RemovedDocument } from '../internal';
@@ -120,7 +120,7 @@ async function checkBanField(
server: ServerConfig, account: IAccount, field: keyof BannedMuted, message: string, origin: IOrigin
) {
if (isActive(origin[field]) && !isActive(account[field])) {
create(server, account._id, undefined, origin).warn(message);
createReporter(server, account._id, undefined, origin).warn(message);
account[field] = origin[field];
await account.save();
}
@@ -385,7 +385,7 @@ function createOptions(
creationLocked: acl && acl > (new Date()).toISOString(),
canCreateAccounts: !!settings.canCreateAccounts,
reportPotentialDuplicates: !!settings.reportPotentialDuplicates,
warn: (accountId, message, desc) => create(server, accountId, undefined, origin).warn(message, desc),
warn: (accountId, message, desc) => createReporter(server, accountId, undefined, origin).warn(message, desc),
...checkers,
};
}
+3 -3
View File
@@ -1,7 +1,7 @@
import { readFileSync } from 'fs';
import * as ctrl from './controllers';
import { World, goToMap } from './world';
import { create } from './reporter';
import { createReporter } from './reporter';
import { logger } from './logger';
import { SERVER_FPS } from '../common/constants';
import { ServerConfig } from '../common/adminInterfaces';
@@ -77,7 +77,7 @@ export function start(world: World, server: ServerConfig) {
world.initialize(last);
if (!DEVELOPMENT) {
create(server).info(`Server started`);
createReporter(server).info(`Server started`);
}
setInterval(() => {
@@ -96,7 +96,7 @@ export function start(world: World, server: ServerConfig) {
}
} catch (e) {
if (isErrorAlike(e)) {
create(server).danger(e.message);
createReporter(server).danger(e.message);
}
logger.error(e);
}
+3 -3
View File
@@ -5,7 +5,7 @@ import { IClient } from '../serverInterfaces';
import { logger } from '../logger';
import { isUserError, reportUserError2 } from '../userError';
import { includes } from '../../common/utils';
import { create } from '../reporter';
import { createReporter } from '../reporter';
import { ServerConfig } from '../../common/adminInterfaces';
import { getOriginFromHTTP } from '../originUtils';
import { ServerActions } from '../serverActions';
@@ -62,9 +62,9 @@ function reportError(rollbar: Rollbar | undefined, e: Error, client: IClient | u
client.reporter.error(e);
} else if (client && client.originalRequest) {
const origin = client.originalRequest && getOriginFromHTTP(client.originalRequest);
create(config, undefined, undefined, origin).error(e);
createReporter(config, undefined, undefined, origin).error(e);
} else {
create(config).error(e);
createReporter(config).error(e);
}
if (!rollbarIgnore.test(e.message)) {