From 020cd5cc028711f9a9ba8b660d8fded6bacf3020 Mon Sep 17 00:00:00 2001 From: xtexChooser Date: Sat, 10 Dec 2022 07:55:07 +0800 Subject: [PATCH] fix: typo (#9300) --- packages/backend/src/core/IdService.ts | 6 +++--- packages/backend/src/misc/id/aid.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/core/IdService.ts b/packages/backend/src/core/IdService.ts index 0e8a7b13a..31c0819e5 100644 --- a/packages/backend/src/core/IdService.ts +++ b/packages/backend/src/core/IdService.ts @@ -10,20 +10,20 @@ import { bindThis } from '@/decorators.js'; @Injectable() export class IdService { - private metohd: string; + private method: string; constructor( @Inject(DI.config) private config: Config, ) { - this.metohd = config.id.toLowerCase(); + this.method = config.id.toLowerCase(); } @bindThis public genId(date?: Date): string { if (!date || (date > new Date())) date = new Date(); - switch (this.metohd) { + switch (this.method) { case 'aid': return genAid(date); case 'meid': return genMeid(date); case 'meidg': return genMeidg(date); diff --git a/packages/backend/src/misc/id/aid.ts b/packages/backend/src/misc/id/aid.ts index 87e688826..19c8546f9 100644 --- a/packages/backend/src/misc/id/aid.ts +++ b/packages/backend/src/misc/id/aid.ts @@ -6,14 +6,14 @@ import * as crypto from 'node:crypto'; const TIME2000 = 946684800000; let counter = crypto.randomBytes(2).readUInt16LE(0); -function getTime(time: number) { +function getTime(time: number): string { time = time - TIME2000; if (time < 0) time = 0; return time.toString(36).padStart(8, '0'); } -function getNoise() { +function getNoise(): string { return counter.toString(36).padStart(2, '0').slice(-2); }