import { rebootWithNormolLogin, rebootWithQuickLogin } from '@/common/utils/reboot'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { selfInfo } from '@/core/data'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { delay: { type: 'number' } } } as const satisfies JSONSchema; type Payload = FromSchema; export class Reboot extends BaseAction { actionName = ActionName.Reboot; protected async _handle(payload: Payload): Promise { if (payload.delay) { setTimeout(() => { rebootWithQuickLogin(selfInfo.uin); }, payload.delay); } else { rebootWithQuickLogin(selfInfo.uin); } return null; } } export class RebootNormal extends BaseAction { actionName = ActionName.RebootNormal; protected async _handle(payload: Payload): Promise { if (payload.delay) { setTimeout(() => { rebootWithNormolLogin(); }, payload.delay); } else { rebootWithNormolLogin(); } return null; } }