mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2025-02-26 22:49:18 +01:00
Add ping method yes I am committing this change from a hotel room
This commit is contained in:
parent
4a2f9de102
commit
4cf03efa0b
@ -31,7 +31,7 @@ for (let i of dirs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.all('*', (req, res) => {
|
app.all('*', (req, res) => {
|
||||||
console.log(`CATCH-ALL: ${req.method} ${req.originalUrl}`);
|
res.status(200).end();
|
||||||
})
|
})
|
||||||
|
|
||||||
https.createServer({
|
https.createServer({
|
||||||
|
@ -48,5 +48,22 @@ export default class StartupModule extends Module {
|
|||||||
.status(200);
|
.status(200);
|
||||||
r.send(Buffer.from(end));
|
r.send(Buffer.from(end));
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.post('/method/ping', (req, res) => {
|
||||||
|
console.log('ping');
|
||||||
|
let body = wm.wm.protobuf.PingRequest.decode(req.body);
|
||||||
|
let ping = {
|
||||||
|
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
|
||||||
|
pong: body.ping || 1
|
||||||
|
};
|
||||||
|
let resp = wm.wm.protobuf.PingResponse.encode(ping);
|
||||||
|
let end = resp.finish();
|
||||||
|
let r = res
|
||||||
|
.header('Server', 'v388 wangan')
|
||||||
|
.header('Content-Type', 'application/x-protobuf; revision=8053')
|
||||||
|
.header('Content-Length', end.length.toString())
|
||||||
|
.status(200);
|
||||||
|
r.send(Buffer.from(end));
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user