npm run format
This commit is contained in:
parent
c4a42066ab
commit
709d34d59b
@ -21,25 +21,25 @@ class DateManager {
|
||||
// When a GM sets the time, update the current date and update the world file
|
||||
public async setTime(time: string): Promise<void> {
|
||||
try {
|
||||
let newDate: Date;
|
||||
let newDate: Date
|
||||
|
||||
// Check if it's just a time (HH:mm or HH:mm:ss format)
|
||||
if (/^\d{1,2}:\d{2}(:\d{2})?$/.test(time)) {
|
||||
const [hours, minutes] = time.split(':').map(Number);
|
||||
newDate = new Date(this.currentDate); // Clone current date
|
||||
newDate.setHours(hours, minutes);
|
||||
const [hours, minutes] = time.split(':').map(Number)
|
||||
newDate = new Date(this.currentDate) // Clone current date
|
||||
newDate.setHours(hours, minutes)
|
||||
} else {
|
||||
// Treat as full datetime string
|
||||
newDate = new Date(time);
|
||||
if (isNaN(newDate.getTime())) return;
|
||||
newDate = new Date(time)
|
||||
if (isNaN(newDate.getTime())) return
|
||||
}
|
||||
|
||||
this.currentDate = newDate;
|
||||
this.emitDate();
|
||||
await this.saveDate();
|
||||
this.currentDate = newDate
|
||||
this.emitDate()
|
||||
await this.saveDate()
|
||||
} catch (error) {
|
||||
appLogger.error(`Failed to set time: ${error instanceof Error ? error.message : String(error)}`);
|
||||
throw error;
|
||||
appLogger.error(`Failed to set time: ${error instanceof Error ? error.message : String(error)}`)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,11 @@ export class Server {
|
||||
*/
|
||||
constructor() {
|
||||
this.app = express()
|
||||
this.app.use(cors({
|
||||
this.app.use(
|
||||
cors({
|
||||
origin: config.CLIENT_URL
|
||||
}))
|
||||
})
|
||||
)
|
||||
this.app.use(express.json())
|
||||
this.app.use(express.urlencoded({ extended: true }))
|
||||
this.http = httpServer(this.app)
|
||||
|
@ -8,7 +8,6 @@ class PasswordResetTokenService {
|
||||
* @param token
|
||||
*/
|
||||
public async delete(token: string): Promise<boolean> {
|
||||
|
||||
try {
|
||||
const tokenData = await passwordResetTokenRepository.getByToken(token)
|
||||
if (!tokenData) {
|
||||
|
@ -23,7 +23,7 @@ export default class TeleportCommandEvent {
|
||||
private async handleTeleportCommand(data: TypePayload, callback: (response: boolean) => void): Promise<void> {
|
||||
try {
|
||||
// Check if character exists
|
||||
const character = await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number) as ExtendedCharacter
|
||||
const character = (await CharacterRepository.getByUserAndId(this.socket.user?.id as number, this.socket.characterId as number)) as ExtendedCharacter
|
||||
if (!character) {
|
||||
gameLogger.error('chat:alert_command error', 'Character not found')
|
||||
callback(false)
|
||||
|
@ -42,10 +42,7 @@ export const resetPasswordSchema = z.object({
|
||||
})
|
||||
|
||||
export const newPasswordSchema = z.object({
|
||||
urlToken: z
|
||||
.string()
|
||||
.min(10, { message: 'Invalid request' })
|
||||
.max(255, { message: 'Invalid request' }),
|
||||
urlToken: z.string().min(10, { message: 'Invalid request' }).max(255, { message: 'Invalid request' }),
|
||||
password: z
|
||||
.string()
|
||||
.min(8, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user