Made sendResponse/protobuf revision check more resilient
This commit is contained in:
parent
f603423fa7
commit
beef930e3c
@ -82,7 +82,7 @@ export default class CarModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadCarResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadCarResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response
|
// Send the response
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ export default class CarModule extends Module {
|
|||||||
let message = wm.wm.protobuf.CreateCarResponse.encode(msg);
|
let message = wm.wm.protobuf.CreateCarResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response
|
// Send the response
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ export default class CarModule extends Module {
|
|||||||
let message = wm.wm.protobuf.CreateCarResponse.encode(msg);
|
let message = wm.wm.protobuf.CreateCarResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response
|
// Send the response
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ export default class CarModule extends Module {
|
|||||||
let message = wm.wm.protobuf.UpdateCarResponse.encode(msg);
|
let message = wm.wm.protobuf.UpdateCarResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response
|
// Send the response
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -158,7 +158,7 @@ export default class GameModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SaveGameResultResponse.encode(msg);
|
let message = wm.wm.protobuf.SaveGameResultResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ export default class GameModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGameHistoryResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGameHistoryResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ export default class GameModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SaveChargeResponse.encode(msg);
|
let message = wm.wm.protobuf.SaveChargeResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ export default class GameModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SaveScreenshotResponse.encode(msg);
|
let message = wm.wm.protobuf.SaveScreenshotResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -87,7 +87,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadStampTargetResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadStampTargetResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SearchCarsByLevelResponse.encode(msg);
|
let message = wm.wm.protobuf.SearchCarsByLevelResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGhostDriveDataResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGhostDriveDataResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.RegisterGhostTrailResponse.encode(msg);
|
let message = wm.wm.protobuf.RegisterGhostTrailResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.GhostTrail.encode(msg);
|
let message = wm.wm.protobuf.GhostTrail.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadPathsAndTuningsResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadPathsAndTuningsResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.LockCrownResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.LockCrownResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -378,7 +378,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGhostCompetitionInfoResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGhostCompetitionInfoResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -699,7 +699,7 @@ export default class GhostModule extends Module {
|
|||||||
let message = wm.wm.protobuf.GhostCompetitionTarget.encode(msg);
|
let message = wm.wm.protobuf.GhostCompetitionTarget.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -76,7 +76,7 @@ export default class ResourceModule extends Module {
|
|||||||
let message = wm.wm.protobuf.PlaceList.encode({places});
|
let message = wm.wm.protobuf.PlaceList.encode({places});
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get Ranking data for attract screen (TA, Ghost, VS)
|
// Get Ranking data for attract screen (TA, Ghost, VS)
|
||||||
@ -103,7 +103,7 @@ export default class ResourceModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.Ranking.encode({lists});
|
let message = wmsrv.wm.protobuf.Ranking.encode({lists});
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ export default class ResourceModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.CrownList.encode( {crowns} );
|
let message = wmsrv.wm.protobuf.CrownList.encode( {crowns} );
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ export default class ResourceModule extends Module {
|
|||||||
let message = wm.wm.protobuf.FileList.encode(msg);
|
let message = wm.wm.protobuf.FileList.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ export default class ResourceModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.GhostList.encode(msg);
|
let message = wmsrv.wm.protobuf.GhostList.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -49,7 +49,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.RegisterSystemInfoResponse.encode(msg);
|
let message = wm.wm.protobuf.RegisterSystemInfoResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.UpdateUserSessionResponse.encode(msg);
|
let message = wm.wm.protobuf.UpdateUserSessionResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.PingResponse.encode(ping);
|
let message = wm.wm.protobuf.PingResponse.encode(ping);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.RegisterSystemStatsResponse.encode(msg);
|
let message = wm.wm.protobuf.RegisterSystemStatsResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.UpdateEventModeSerialResponse.encode(msg);
|
let message = wm.wm.protobuf.UpdateEventModeSerialResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ export default class StartupModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SubmitClientLogResponse.encode(msg);
|
let message = wm.wm.protobuf.SubmitClientLogResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadTerminalInformationResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadTerminalInformationResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadBookmarksResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.CarSummary.encode(msg);
|
let message = wm.wm.protobuf.CarSummary.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SaveTerminalResultResponse.encode(msg);
|
let message = wm.wm.protobuf.SaveTerminalResultResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadScratchInformationResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadScratchInformationResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.TurnScratchSheetResponse.encode(msg);
|
let message = wm.wm.protobuf.TurnScratchSheetResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -598,7 +598,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.SaveScratchSheetResponse.encode(msg);
|
let message = wm.wm.protobuf.SaveScratchSheetResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -1033,7 +1033,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadGhostCompetitionRankingResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadGhostCompetitionRankingResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -1098,7 +1098,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wm.wm.protobuf.RegisterOpponentGhostResponse.encode(msg);
|
let message = wm.wm.protobuf.RegisterOpponentGhostResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -1144,7 +1144,7 @@ export default class TerminalModule extends Module {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -1163,7 +1163,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.LoadUnreceivedUserItemsResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.LoadUnreceivedUserItemsResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -1181,7 +1181,7 @@ export default class TerminalModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.CheckItemReceivableCarsResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.CheckItemReceivableCarsResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ export default class TimeAttackModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadTimeAttackRecordResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadTimeAttackRecordResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ export default class TimeAttackModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadTimeAttackRecordResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadTimeAttackRecordResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -587,7 +587,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.CreateUserResponse.encode(msg);
|
let message = wm.wm.protobuf.CreateUserResponse.encode(msg);
|
||||||
|
|
||||||
// Send response to client
|
// Send response to client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.LoadDriveInformationResponse.encode(msg);
|
let message = wm.wm.protobuf.LoadDriveInformationResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -710,7 +710,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wm.wm.protobuf.UpdateUserSessionResponse.encode(msg);
|
let message = wm.wm.protobuf.UpdateUserSessionResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.StartTransferResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.StartTransferResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.GrantCarRightResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.GrantCarRightResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -768,7 +768,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.AskAccessCodeResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.AskAccessCodeResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -787,7 +787,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.ParticipateInInviteFriendCampaignResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.ParticipateInInviteFriendCampaignResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -805,7 +805,7 @@ export default class UserModule extends Module {
|
|||||||
let message = wmsrv.wm.protobuf.ConsumeUserItemResponse.encode(msg);
|
let message = wmsrv.wm.protobuf.ConsumeUserItemResponse.encode(msg);
|
||||||
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
common.sendResponse(message, res, req.rawHeaders[5], req.rawHeaders[7]);
|
common.sendResponse(message, res, req.rawHeaders);
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -3,68 +3,110 @@ import { Writer } from "protobufjs";
|
|||||||
import { Config } from "../../config";
|
import { Config } from "../../config";
|
||||||
import Long from "long";
|
import Long from "long";
|
||||||
|
|
||||||
|
// getProtobufRevision: Number
|
||||||
|
// Given the headers from a request, filters
|
||||||
|
// the 'application/x-protobuf' property from the
|
||||||
|
// request and returns the value. If not found,
|
||||||
|
// returns null.
|
||||||
|
function getProtobufRevision(headers: string[]) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Find protobuf revision headers
|
||||||
|
const filtered = headers.filter(
|
||||||
|
x => x.includes('application/x-protobuf')
|
||||||
|
);
|
||||||
|
|
||||||
|
// At least one header is found
|
||||||
|
if (filtered.length > 0) {
|
||||||
|
// These should be all the same, just take the first one
|
||||||
|
const header = filtered.pop();
|
||||||
|
|
||||||
|
// Header is not null
|
||||||
|
if (header) {
|
||||||
|
// Header includes a semicolon
|
||||||
|
if (header.includes('=')) {
|
||||||
|
// Retrieves the protobuf revision from the header,
|
||||||
|
// strips any trailing whitespace and converts to int
|
||||||
|
const value = Number(header.split('=')[1].trimEnd());
|
||||||
|
|
||||||
|
// Return the revision
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else // No semicolon
|
||||||
|
{
|
||||||
|
throw Error(`No revision found in protobuf header!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw Error(`Protobuf header is not defined!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // No headers found
|
||||||
|
{
|
||||||
|
throw Error("Protobuf revision not found!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) // Failed to get protobuf revision
|
||||||
|
{
|
||||||
|
writeLog(`Failed to get protobuf revision! ${String(e)}`);
|
||||||
|
|
||||||
|
// No protobuf revision
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sendResponse(message, res): Void
|
// sendResponse(message, res): Void
|
||||||
// Sends the server response to the client
|
// Sends the server response to the client
|
||||||
export function sendResponse(message: Writer, res: Response, rawHeaders: string, rawHeaders2: string)
|
export function sendResponse(message: Writer, res: Response, headers: string[]) {
|
||||||
{
|
try {
|
||||||
// Get the end of the message
|
|
||||||
let end = message.finish();
|
|
||||||
|
|
||||||
// Built the response data
|
// Get config
|
||||||
let r = res
|
const config = Config.getConfig();
|
||||||
.header('Server', 'v388 wangan')
|
|
||||||
.header('Content-Type', 'application/x-protobuf; revision=8053')
|
|
||||||
.header('Content-Length', end.length.toString())
|
|
||||||
.status(200);
|
|
||||||
|
|
||||||
// Revision Check
|
// Get the end of the message
|
||||||
let revisionCheck = Config.getConfig().gameOptions.revisionCheck || 1;
|
let end = message.finish();
|
||||||
|
|
||||||
// Revision Check is enabled
|
// Built the response data
|
||||||
if(revisionCheck === 1)
|
let r = res
|
||||||
{
|
.header('Server', 'v388 wangan')
|
||||||
// Get the Revision
|
.header('Content-Type', 'application/x-protobuf; revision=8053')
|
||||||
let getProtobufRev;
|
.header('Content-Length', end.length.toString())
|
||||||
if(rawHeaders.includes('application/x-protobuf')) // application/x-protobuf; revision=number_here
|
.status(200);
|
||||||
{
|
|
||||||
getProtobufRev = rawHeaders.split('; ');
|
// If revision check is enabled
|
||||||
}
|
if (config.gameOptions.revisionCheck) {
|
||||||
else
|
|
||||||
{
|
// Get the protobuf revision from the headers
|
||||||
getProtobufRev = rawHeaders2.split('; ');
|
let revision = getProtobufRevision(headers);
|
||||||
|
|
||||||
|
// Revision does not match
|
||||||
|
if (revision !== 8053) {
|
||||||
|
throw Error(`Protobuf revision does not match!`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let protobufRev = getProtobufRev[1].split('='); // array 0 = content type, array 1 = protobuf revision
|
|
||||||
|
|
||||||
// Connect to the server if the Revision is match
|
|
||||||
if(protobufRev[1] === "8053")
|
|
||||||
{
|
|
||||||
// Send the response to the client
|
|
||||||
r.send(Buffer.from(end));
|
|
||||||
}
|
|
||||||
// else{} Prevent connecting to the server
|
|
||||||
}
|
|
||||||
// Just send it
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Send the response to the client
|
// Send the response to the client
|
||||||
r.send(Buffer.from(end));
|
r.send(Buffer.from(end));
|
||||||
}
|
}
|
||||||
|
catch (e) // Failed to send response
|
||||||
|
{
|
||||||
|
writeLog(`Failed to send response: ${String(e)}`);
|
||||||
|
|
||||||
|
// Internal Server Error
|
||||||
|
res.sendStatus(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// getBigIntFromLong(n: Long): BigInt
|
// getBigIntFromLong(n: Long): BigInt
|
||||||
// Given a Long data object, converts
|
// Given a Long data object, converts
|
||||||
// it into a BigInt and returns it.
|
// it into a BigInt and returns it.
|
||||||
export function getBigIntFromLong(n: Long)
|
export function getBigIntFromLong(n: Long) {
|
||||||
{
|
|
||||||
// Create the default value
|
// Create the default value
|
||||||
let bigInt = BigInt(0);
|
let bigInt = BigInt(0);
|
||||||
|
|
||||||
// If 'n' is a long data type
|
// If 'n' is a long data type
|
||||||
if (n instanceof Long)
|
if (n instanceof Long) {
|
||||||
{
|
|
||||||
// Perform the bit-wise operations
|
// Perform the bit-wise operations
|
||||||
bigInt = bigInt | BigInt(n.high);
|
bigInt = bigInt | BigInt(n.high);
|
||||||
bigInt = bigInt << BigInt(32);
|
bigInt = bigInt << BigInt(32);
|
||||||
@ -77,30 +119,26 @@ export function getBigIntFromLong(n: Long)
|
|||||||
|
|
||||||
|
|
||||||
// Undefined Input Sanitization
|
// Undefined Input Sanitization
|
||||||
export function sanitizeInput(value: any)
|
export function sanitizeInput(value: any) {
|
||||||
{
|
|
||||||
return (value == null || value == undefined) ? undefined : value;
|
return (value == null || value == undefined) ? undefined : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Undefined and Zero Input Sanitization
|
// Undefined and Zero Input Sanitization
|
||||||
export function sanitizeInputNotZero(value: any)
|
export function sanitizeInputNotZero(value: any) {
|
||||||
{
|
|
||||||
return (value !== null && value !== undefined && value !== 0) ? value : undefined;
|
return (value !== null && value !== undefined && value !== 0) ? value : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get Time Stamp
|
// Get Time Stamp
|
||||||
export function getTimeStamp(date: Date = new Date())
|
export function getTimeStamp(date: Date = new Date()) {
|
||||||
{
|
|
||||||
// Return a timestamp string for the current / provided time
|
// Return a timestamp string for the current / provided time
|
||||||
return String("[" + date.toLocaleString() + "]");
|
return String("[" + date.toLocaleString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write Log
|
// Write Log
|
||||||
export async function writeLog(message: string)
|
export async function writeLog(message: string) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
// Get the current timestamp
|
// Get the current timestamp
|
||||||
const timestamp: string = getTimeStamp();
|
const timestamp: string = getTimeStamp();
|
||||||
|
Loading…
Reference in New Issue
Block a user