mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-09-22 22:28:11 +03:00
network: OK
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import pug from 'pug';
|
||||
import { to_bin } from "@kamyu/kbinxml";
|
||||
|
||||
export function kxml(templatePath: string): MethodDecorator {
|
||||
export function kxml(templatePath: string, encoding: 'UTF-8' | 'SHIFT_JIS' = 'UTF-8'): MethodDecorator {
|
||||
const template = pug.compileFile('templates/' + templatePath + '.pug');
|
||||
|
||||
return function (_target, _propertyKey, descriptor) {
|
||||
const orig = descriptor.value as Function;
|
||||
descriptor.value = async function (...args: any[]) {
|
||||
const obj = await orig.apply(this, args);
|
||||
const xml = '<?xml version="1.0" encoding="SHIFT_JIS"?>' + template(obj);
|
||||
const xml = `<?xml version="1.0" encoding="${encoding}"?>` + template(obj);
|
||||
console.log(xml);
|
||||
const kxml = to_bin(xml);
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ export default class implements ILaochanService {
|
||||
},
|
||||
portfw: {
|
||||
globalIp: '127.0.0.1',
|
||||
globalport: 5700,
|
||||
privateport: 5700,
|
||||
globalPort: 5700,
|
||||
privatePort: 5700,
|
||||
},
|
||||
public: {
|
||||
flag: 0,
|
||||
|
||||
Reference in New Issue
Block a user