mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
net.AllowEncryption ONLY ON 24 AND ABOVE
This commit is contained in:
@@ -10,10 +10,6 @@ bUseSSL=false
|
|||||||
ServerAddr="ws://127.0.0.1"
|
ServerAddr="ws://127.0.0.1"
|
||||||
ServerPort=80
|
ServerPort=80
|
||||||
|
|
||||||
# Fixes kicks on higher versions
|
|
||||||
[ConsoleVariables]
|
|
||||||
net.AllowEncryption=0
|
|
||||||
|
|
||||||
# Forces fortnite to use the v1 party system to support lawinserver xmpp
|
# Forces fortnite to use the v1 party system to support lawinserver xmpp
|
||||||
[OnlineSubsystemMcp]
|
[OnlineSubsystemMcp]
|
||||||
bUsePartySystemV2=false
|
bUsePartySystemV2=false
|
||||||
|
|||||||
@@ -6,158 +6,225 @@ const path = require("path");
|
|||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
|
|
||||||
express.use((req, res, next) => {
|
express.use((req, res, next) => {
|
||||||
// Get raw body in encoding latin1 for ClientSettings
|
// Get raw body in encoding latin1 for ClientSettings
|
||||||
if (req.originalUrl.toLowerCase().startsWith("/fortnite/api/cloudstorage/user/") && req.method == "PUT") {
|
if (
|
||||||
req.rawBody = "";
|
req.originalUrl
|
||||||
req.setEncoding("latin1");
|
.toLowerCase()
|
||||||
|
.startsWith("/fortnite/api/cloudstorage/user/") &&
|
||||||
|
req.method == "PUT"
|
||||||
|
) {
|
||||||
|
req.rawBody = "";
|
||||||
|
req.setEncoding("latin1");
|
||||||
|
|
||||||
req.on("data", (chunk) => req.rawBody += chunk);
|
req.on("data", (chunk) => (req.rawBody += chunk));
|
||||||
req.on("end", () => next());
|
req.on("end", () => next());
|
||||||
}
|
} else return next();
|
||||||
else return next();
|
});
|
||||||
})
|
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/system", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/system", async (req, res) => {
|
||||||
const memory = functions.GetVersionInfo(req);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
if (memory.build >= 9.40 && memory.build <= 10.40) {
|
if (memory.build >= 9.4 && memory.build <= 10.4) {
|
||||||
return res.status(404).end();
|
return res.status(404).end();
|
||||||
|
}
|
||||||
|
|
||||||
|
const dir = path.join(__dirname, "..", "CloudStorage");
|
||||||
|
var CloudFiles = [];
|
||||||
|
|
||||||
|
fs.readdirSync(dir).forEach((name) => {
|
||||||
|
if (name.toLowerCase().endsWith(".ini")) {
|
||||||
|
const ParsedFile = fs.readFileSync(path.join(dir, name), "utf-8");
|
||||||
|
const ParsedStats = fs.statSync(path.join(dir, name));
|
||||||
|
|
||||||
|
CloudFiles.push({
|
||||||
|
uniqueFilename: name,
|
||||||
|
filename: name,
|
||||||
|
hash: crypto.createHash("sha1").update(ParsedFile).digest("hex"),
|
||||||
|
hash256: crypto.createHash("sha256").update(ParsedFile).digest("hex"),
|
||||||
|
length: ParsedFile.length,
|
||||||
|
contentType: "application/octet-stream",
|
||||||
|
uploaded: ParsedStats.mtime,
|
||||||
|
storageType: "S3",
|
||||||
|
storageIds: {},
|
||||||
|
doNotCache: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const dir = path.join(__dirname, "..", "CloudStorage")
|
res.json(CloudFiles);
|
||||||
var CloudFiles = [];
|
});
|
||||||
|
|
||||||
fs.readdirSync(dir).forEach(name => {
|
|
||||||
if (name.toLowerCase().endsWith(".ini")) {
|
|
||||||
const ParsedFile = fs.readFileSync(path.join(dir, name), 'utf-8');
|
|
||||||
const ParsedStats = fs.statSync(path.join(dir, name));
|
|
||||||
|
|
||||||
CloudFiles.push({
|
|
||||||
"uniqueFilename": name,
|
|
||||||
"filename": name,
|
|
||||||
"hash": crypto.createHash('sha1').update(ParsedFile).digest('hex'),
|
|
||||||
"hash256": crypto.createHash('sha256').update(ParsedFile).digest('hex'),
|
|
||||||
"length": ParsedFile.length,
|
|
||||||
"contentType": "application/octet-stream",
|
|
||||||
"uploaded": ParsedStats.mtime,
|
|
||||||
"storageType": "S3",
|
|
||||||
"storageIds": {},
|
|
||||||
"doNotCache": true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
res.json(CloudFiles)
|
|
||||||
})
|
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/system/:file", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/system/:file", async (req, res) => {
|
||||||
const file = path.join(__dirname, "..", "CloudStorage", req.params.file);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
if (fs.existsSync(file)) {
|
const file = path.join(__dirname, "..", "CloudStorage", req.params.file);
|
||||||
const ParsedFile = fs.readFileSync(file);
|
|
||||||
|
|
||||||
return res.status(200).send(ParsedFile).end();
|
if (fs.existsSync(file)) {
|
||||||
} else {
|
let ParsedFile = fs.readFileSync(file);
|
||||||
res.status(200);
|
|
||||||
res.end();
|
// Fixes kicks ingame on higher versions
|
||||||
|
if (req.params.file === "DefaultEngine.ini" && memory.season >= 24) {
|
||||||
|
ParsedFile += "\n[ConsoleVariables]\nnet.AllowEncryption=0\n";
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
return res.status(200).send(ParsedFile).end();
|
||||||
|
} else {
|
||||||
|
res.status(200);
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
if (
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
!fs.existsSync(
|
||||||
}
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
} catch (err) {}
|
)
|
||||||
|
) {
|
||||||
res.set("Content-Type", "application/octet-stream")
|
fs.mkdirSync(
|
||||||
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
if (req.params.file.toLowerCase() != "clientsettings.sav") {
|
);
|
||||||
return res.status(404).json({
|
|
||||||
"error": "file not found"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
const memory = functions.GetVersionInfo(req);
|
res.set("Content-Type", "application/octet-stream");
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
if (req.params.file.toLowerCase() != "clientsettings.sav") {
|
||||||
|
return res.status(404).json({
|
||||||
|
error: "file not found",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let file;
|
const memory = functions.GetVersionInfo(req);
|
||||||
if (process.env.LOCALAPPDATA) file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
else file = path.join(__dirname, "..", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
|
||||||
if (fs.existsSync(file)) {
|
var currentBuildID = memory.CL;
|
||||||
const ParsedFile = fs.readFileSync(file);
|
|
||||||
|
|
||||||
return res.status(200).send(ParsedFile).end();
|
let file;
|
||||||
} else {
|
if (process.env.LOCALAPPDATA)
|
||||||
res.status(200);
|
file = path.join(
|
||||||
res.end();
|
process.env.LOCALAPPDATA,
|
||||||
}
|
"LawinServer",
|
||||||
})
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
else
|
||||||
|
file = path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fs.existsSync(file)) {
|
||||||
|
const ParsedFile = fs.readFileSync(file);
|
||||||
|
|
||||||
|
return res.status(200).send(ParsedFile).end();
|
||||||
|
} else {
|
||||||
|
res.status(200);
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/user/:accountId", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/user/:accountId", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
if (
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
!fs.existsSync(
|
||||||
}
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
} catch (err) {}
|
)
|
||||||
|
) {
|
||||||
res.set("Content-Type", "application/json")
|
fs.mkdirSync(
|
||||||
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
const memory = functions.GetVersionInfo(req);
|
);
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
|
||||||
|
|
||||||
let file;
|
|
||||||
if (process.env.LOCALAPPDATA) file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
else file = path.join(__dirname, "..", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
|
||||||
if (fs.existsSync(file)) {
|
|
||||||
const ParsedFile = fs.readFileSync(file, 'latin1');
|
|
||||||
const ParsedStats = fs.statSync(file);
|
|
||||||
|
|
||||||
return res.json([{
|
|
||||||
"uniqueFilename": "ClientSettings.Sav",
|
|
||||||
"filename": "ClientSettings.Sav",
|
|
||||||
"hash": crypto.createHash('sha1').update(ParsedFile).digest('hex'),
|
|
||||||
"hash256": crypto.createHash('sha256').update(ParsedFile).digest('hex'),
|
|
||||||
"length": Buffer.byteLength(ParsedFile),
|
|
||||||
"contentType": "application/octet-stream",
|
|
||||||
"uploaded": ParsedStats.mtime,
|
|
||||||
"storageType": "S3",
|
|
||||||
"storageIds": {},
|
|
||||||
"accountId": req.params.accountId,
|
|
||||||
"doNotCache": true
|
|
||||||
}]);
|
|
||||||
} else {
|
|
||||||
return res.json([]);
|
|
||||||
}
|
}
|
||||||
})
|
} catch (err) {}
|
||||||
|
|
||||||
|
res.set("Content-Type", "application/json");
|
||||||
|
|
||||||
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
|
var currentBuildID = memory.CL;
|
||||||
|
|
||||||
|
let file;
|
||||||
|
if (process.env.LOCALAPPDATA)
|
||||||
|
file = path.join(
|
||||||
|
process.env.LOCALAPPDATA,
|
||||||
|
"LawinServer",
|
||||||
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
else
|
||||||
|
file = path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (fs.existsSync(file)) {
|
||||||
|
const ParsedFile = fs.readFileSync(file, "latin1");
|
||||||
|
const ParsedStats = fs.statSync(file);
|
||||||
|
|
||||||
|
return res.json([
|
||||||
|
{
|
||||||
|
uniqueFilename: "ClientSettings.Sav",
|
||||||
|
filename: "ClientSettings.Sav",
|
||||||
|
hash: crypto.createHash("sha1").update(ParsedFile).digest("hex"),
|
||||||
|
hash256: crypto.createHash("sha256").update(ParsedFile).digest("hex"),
|
||||||
|
length: Buffer.byteLength(ParsedFile),
|
||||||
|
contentType: "application/octet-stream",
|
||||||
|
uploaded: ParsedStats.mtime,
|
||||||
|
storageType: "S3",
|
||||||
|
storageIds: {},
|
||||||
|
accountId: req.params.accountId,
|
||||||
|
doNotCache: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return res.json([]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
express.put("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
express.put("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
if (
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
!fs.existsSync(
|
||||||
}
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
} catch (err) {}
|
)
|
||||||
|
) {
|
||||||
if (req.params.file.toLowerCase() != "clientsettings.sav") {
|
fs.mkdirSync(
|
||||||
return res.status(404).json({
|
path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings")
|
||||||
"error": "file not found"
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
const memory = functions.GetVersionInfo(req);
|
if (req.params.file.toLowerCase() != "clientsettings.sav") {
|
||||||
|
return res.status(404).json({
|
||||||
|
error: "file not found",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
let file;
|
var currentBuildID = memory.CL;
|
||||||
if (process.env.LOCALAPPDATA) file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
else file = path.join(__dirname, "..", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
|
||||||
fs.writeFileSync(file, req.rawBody, 'latin1');
|
let file;
|
||||||
res.status(204).end();
|
if (process.env.LOCALAPPDATA)
|
||||||
})
|
file = path.join(
|
||||||
|
process.env.LOCALAPPDATA,
|
||||||
|
"LawinServer",
|
||||||
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
else
|
||||||
|
file = path.join(
|
||||||
|
__dirname,
|
||||||
|
"..",
|
||||||
|
"ClientSettings",
|
||||||
|
`ClientSettings-${currentBuildID}.Sav`
|
||||||
|
);
|
||||||
|
|
||||||
|
fs.writeFileSync(file, req.rawBody, "latin1");
|
||||||
|
res.status(204).end();
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = express;
|
module.exports = express;
|
||||||
Reference in New Issue
Block a user