refactor widget.js, return http 200 when server is offline
This commit is contained in:
parent
ad66637ff1
commit
b36ef0234e
2 changed files with 2 additions and 16 deletions
|
@ -18,7 +18,7 @@ export default async function minecraftProxyHandler(req, res) {
|
|||
});
|
||||
} catch (e) {
|
||||
logger.warn(e)
|
||||
res.status(500).send({
|
||||
res.status(200).send({
|
||||
version: undefined,
|
||||
online: false,
|
||||
players: undefined
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
import minecraftProxyHandler from "utils/proxy/handlers/minecraft";
|
||||
import { asJson } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
proxyHandler: minecraftProxyHandler,
|
||||
mappings: {
|
||||
status: {
|
||||
endpoint: "_",
|
||||
map: (data) => {
|
||||
const jsonData = asJson(data);
|
||||
return {
|
||||
players: jsonData.players,
|
||||
version: jsonData.version,
|
||||
online: jsonData.online
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
proxyHandler: minecraftProxyHandler
|
||||
}
|
||||
|
||||
export default widget;
|
||||
|
|
Loading…
Add table
Reference in a new issue