XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

chore: raise size limit for text/plain requests

3c99b748
Sainan <sainan@calamity.inc>
提交于

代码差异

2 个文件 +12 -19
Modified src/app.ts +1 -1
@@ -17,7 +17,7 @@ const app = express();
17 17
18 18 app.use(bodyParser.raw());
19 19 app.use(express.json());
20 app.use(bodyParser.text());
20 app.use(bodyParser.text({ limit: "4mb" }));
21 21 app.use(requestLogger);
22 22
23 23 app.use("/api", apiRouter);
Modified static/webui/script.js +11 -18
@@ -1091,24 +1091,17 @@ function doAddAllMods() {
1091 1091 modsAll.length != 0 &&
1092 1092 window.confirm("Are you sure you want to add " + modsAll.length + " mods to your account?")
1093 1093 ) {
1094 // Batch to avoid PayloadTooLargeError
1095 const batches = [];
1096 for (let i = 0; i < modsAll.length; i += 1000) {
1097 batches.push(modsAll.slice(i, i + 1000));
1098 }
1099 batches.forEach(batch => {
1100 $.post({
1101 url: "/api/missionInventoryUpdate.php?" + window.authz,
1102 contentType: "text/plain",
1103 data: JSON.stringify({
1104 RawUpgrades: batch.map(mod => ({
1105 ItemType: mod,
1106 ItemCount: 21 // To fully upgrade certain arcanes
1107 }))
1108 })
1109 }).done(function () {
1110 updateInventory();
1111 });
1094 $.post({
1095 url: "/api/missionInventoryUpdate.php?" + window.authz,
1096 contentType: "text/plain",
1097 data: JSON.stringify({
1098 RawUpgrades: modsAll.map(mod => ({
1099 ItemType: mod,
1100 ItemCount: 21 // To fully upgrade certain arcanes
1101 }))
1102 })
1103 }).done(function () {
1104 updateInventory();
1112 1105 });
1113 1106 }
1114 1107 });