mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-10-04 20:47:58 +03:00
working sdvx trial mode
This commit is contained in:
+38
-12
@@ -1,22 +1,48 @@
|
||||
import { Context } from '../types.js';
|
||||
import { eacnet } from '../decorators/eacnet.js';
|
||||
import { p2d, sdvx } from '../decorators/eacnet.js';
|
||||
import { v } from '../utils/kxml-value.js';
|
||||
import { singleton } from 'tsyringe';
|
||||
|
||||
@singleton()
|
||||
export class DefaultService {
|
||||
async default(ctx: Context) {
|
||||
const descriptor = {
|
||||
value: () => ({
|
||||
status: v.s32(0),
|
||||
error: v.s32(0),
|
||||
result: {
|
||||
dummy: v.u8(0),
|
||||
}
|
||||
})
|
||||
};
|
||||
if (ctx.service.name === 'p2d') {
|
||||
const descriptor = {
|
||||
value: () => ({
|
||||
status: v.s32(0),
|
||||
error: v.s32(0),
|
||||
result: {},
|
||||
})
|
||||
};
|
||||
|
||||
eacnet(ctx.service.name)(undefined, undefined, descriptor);
|
||||
return descriptor.value();
|
||||
p2d()(undefined, undefined, descriptor);
|
||||
return descriptor.value();
|
||||
} else if (ctx.service.name === 'sdvx') {
|
||||
const result = {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {},
|
||||
};
|
||||
|
||||
// handle ac relay
|
||||
if (ctx.eacnetRequest) {
|
||||
result['xrpc_status_code'] = v.s32(0);
|
||||
result['xrpc_fault_code'] = v.s32(0);
|
||||
result['response'] = {
|
||||
[ctx.eacnetRequest.module]: {
|
||||
$status: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const descriptor = {
|
||||
value: () => result,
|
||||
};
|
||||
|
||||
sdvx()(undefined, undefined, descriptor);
|
||||
return descriptor.value();
|
||||
}
|
||||
|
||||
throw new Error(`unsupported game ${ctx.service.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user