mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
code improvements and clientsettings fallback
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
[/Script/FortniteGame.FortGlobals]
|
[/Script/FortniteGame.FortGlobals]
|
||||||
bAllowLogout=true
|
bAllowLogout=true # Enables log out button.
|
||||||
|
|
||||||
[/Script/FortniteGame.FortChatManager]
|
[/Script/FortniteGame.FortChatManager]
|
||||||
bShouldRequestGeneralChatRooms=true
|
bShouldRequestGeneralChatRooms=true # Request for chat rooms (global chat and founders chat).
|
||||||
bShouldJoinGlobalChat=true
|
bShouldJoinGlobalChat=true
|
||||||
bShouldJoinFounderChat=true
|
bShouldJoinFounderChat=true
|
||||||
bIsAthenaGlobalChatEnabled=true
|
bIsAthenaGlobalChatEnabled=true # Battle royale global chat.
|
||||||
|
|
||||||
[/Script/FortniteGame.FortTextHotfixConfig]
|
[/Script/FortniteGame.FortTextHotfixConfig]
|
||||||
+TextReplacements=(Category=Game, Namespace="", bIsMinimalPatch=True, Key="D5ECE3CD484655CBAE1DB6922C1D87C7", NativeString="Getting Started", LocalizedStrings=(("ar","مرحبًا بك في LawinServer!"),("en","Welcome to LawinServer!"),("de","Willkommen bei LawinServer!"),("es","¡Bienvenidos a LawinServer!"),("es-419","¡Bienvenidos a LawinServer!"),("fr","Bienvenue sur LawinServer !"),("it","Benvenuto in LawinServer!"),("ja","LawinServerへようこそ!"),("ko","LawinServer에 오신 것을 환영합니다!"),("pl","Witaj w LawinServerze!"),("pt-BR","Bem-vindo ao LawinServer!"),("ru","Добро пожаловать в LawinServer!"),("tr","LavinServer'a Hoş Geldiniz!")))
|
+TextReplacements=(Category=Game, Namespace="", bIsMinimalPatch=True, Key="D5ECE3CD484655CBAE1DB6922C1D87C7", NativeString="Getting Started", LocalizedStrings=(("ar","مرحبًا بك في LawinServer!"),("en","Welcome to LawinServer!"),("de","Willkommen bei LawinServer!"),("es","¡Bienvenidos a LawinServer!"),("es-419","¡Bienvenidos a LawinServer!"),("fr","Bienvenue sur LawinServer !"),("it","Benvenuto in LawinServer!"),("ja","LawinServerへようこそ!"),("ko","LawinServer에 오신 것을 환영합니다!"),("pl","Witaj w LawinServerze!"),("pt-BR","Bem-vindo ao LawinServer!"),("ru","Добро пожаловать в LawinServer!"),("tr","LavinServer'a Hoş Geldiniz!")))
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
[Config]
|
[Config]
|
||||||
bUseConfigDisplayName=false # If this is set to false, it will use the email to display name method.
|
# If this is set to false, it will use the email to display name method.
|
||||||
displayName=LawinServer # Your fortnite display name.
|
bUseConfigDisplayName=false
|
||||||
|
# Your fortnite display name (will only be used if the property above is set to true).
|
||||||
|
displayName=LawinServer
|
||||||
|
|
||||||
[Profile]
|
[Profile]
|
||||||
bCompletedSeasonalQuests=false # If this is set to true, every BR and StW seasonal quest will be on complete. Works for Battle Royale from Season 3 to Season 20 and for Save the World from Season 2 to Season X.
|
# If this is set to true, every BR and StW seasonal quest will be on complete. Works for Battle Royale from Season 3 to Season 20 and for Save the World from Season 2 to Season X.
|
||||||
|
bCompletedSeasonalQuests=false
|
||||||
|
|
||||||
[GameServer]
|
[GameServer]
|
||||||
# Matchmaker gameserver config, you can use this to connect to gameservers like rift (titanium), fortmp, etc... (they have to be hosting though).
|
# Matchmaker gameserver config, you can use this to connect to gameservers like rift (titanium), fortmp, etc... (they have to be hosting though).
|
||||||
ip=127.0.0.1 # IP the matchmaker will use upon join.
|
|
||||||
port=7777 # PORT the matchmaker will use upon join.
|
# IP the matchmaker will use upon join.
|
||||||
|
ip=127.0.0.1
|
||||||
|
# PORT the matchmaker will use upon join.
|
||||||
|
port=7777
|
||||||
26
index.js
26
index.js
@@ -2,10 +2,12 @@ const Express = require("express");
|
|||||||
const express = Express();
|
const express = Express();
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const cookieParser = require("cookie-parser");
|
||||||
|
|
||||||
express.use(Express.json());
|
express.use(Express.json());
|
||||||
express.use(Express.urlencoded({ extended: true }));
|
express.use(Express.urlencoded({ extended: true }));
|
||||||
express.use(Express.static('public'));
|
express.use(Express.static('public'));
|
||||||
|
express.use(cookieParser());
|
||||||
|
|
||||||
express.use(require("./structure/party.js"));
|
express.use(require("./structure/party.js"));
|
||||||
express.use(require("./structure/discovery.js"))
|
express.use(require("./structure/discovery.js"))
|
||||||
@@ -24,13 +26,26 @@ express.use(require("./structure/cloudstorage.js"));
|
|||||||
express.use(require("./structure/mcp.js"));
|
express.use(require("./structure/mcp.js"));
|
||||||
|
|
||||||
const port = process.env.PORT || 3551;
|
const port = process.env.PORT || 3551;
|
||||||
express.listen(port, console.log("LawinServer started listening on port", port));
|
express.listen(port, () => {
|
||||||
require("./structure/xmpp.js");
|
console.log("LawinServer started listening on port", port);
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer"))) fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer"));
|
require("./structure/xmpp.js");
|
||||||
|
}).on("error", (err) => {
|
||||||
|
if (err.code == "EADDRINUSE") console.log(`\x1b[31mERROR\x1b[0m: Port ${port} is already in use!`);
|
||||||
|
else throw err;
|
||||||
|
|
||||||
// keep this at the end of the code thanks
|
process.exit(0);
|
||||||
express.all("*", async (req, res) => {
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer"))) fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer"));
|
||||||
|
} catch (err) {
|
||||||
|
// fallback
|
||||||
|
if (!fs.existsSync(path.join(__dirname, "ClientSettings"))) fs.mkdirSync(path.join(__dirname, "ClientSettings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if endpoint not found, return this error
|
||||||
|
express.use((req, res, next) => {
|
||||||
var XEpicErrorName = "errors.com.lawinserver.common.not_found";
|
var XEpicErrorName = "errors.com.lawinserver.common.not_found";
|
||||||
var XEpicErrorCode = 1004;
|
var XEpicErrorCode = 1004;
|
||||||
|
|
||||||
@@ -47,5 +62,4 @@ express.all("*", async (req, res) => {
|
|||||||
"originatingService": "any",
|
"originatingService": "any",
|
||||||
"intent": "prod"
|
"intent": "prod"
|
||||||
});
|
});
|
||||||
res.end();
|
|
||||||
});
|
});
|
||||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -9,6 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cookie-parser": "^1.4.6",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
@@ -92,6 +93,18 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cookie-parser": {
|
||||||
|
"version": "1.4.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
|
||||||
|
"integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
|
||||||
|
"dependencies": {
|
||||||
|
"cookie": "0.4.1",
|
||||||
|
"cookie-signature": "1.0.6"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cookie-signature": {
|
"node_modules/cookie-signature": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||||
@@ -661,6 +674,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
|
||||||
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
|
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
|
||||||
},
|
},
|
||||||
|
"cookie-parser": {
|
||||||
|
"version": "1.4.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz",
|
||||||
|
"integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==",
|
||||||
|
"requires": {
|
||||||
|
"cookie": "0.4.1",
|
||||||
|
"cookie-signature": "1.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"cookie-signature": {
|
"cookie-signature": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"description": "A fortnite backend which supports both BR and STW for every single fortnite build.",
|
"description": "A fortnite backend which supports both BR and STW for every single fortnite build.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"cookie-parser": "^1.4.6",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"express": "^4.17.2",
|
"express": "^4.17.2",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
|
|||||||
4035
profiles/athena.json
4035
profiles/athena.json
File diff suppressed because it is too large
Load Diff
@@ -4,11 +4,10 @@ const crypto = require("crypto");
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
const memory = require("./../memory.json");
|
|
||||||
|
|
||||||
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.includes('/fortnite/api/cloudstorage/user/') && req.method == "PUT") {
|
if (req.originalUrl.toLowerCase().startsWith("/fortnite/api/cloudstorage/user/") && req.method == "PUT") {
|
||||||
req.rawBody = "";
|
req.rawBody = "";
|
||||||
req.setEncoding("latin1");
|
req.setEncoding("latin1");
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ express.use((req, res, next) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/system", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/system", async (req, res) => {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
if (memory.build >= 9.40 && memory.build <= 10.40) {
|
if (memory.build >= 9.40 && memory.build <= 10.40) {
|
||||||
return res.status(404).end();
|
return res.status(404).end();
|
||||||
@@ -65,9 +64,11 @@ express.get("/fortnite/api/cloudstorage/system/:file", async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
try {
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
||||||
}
|
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
res.set("Content-Type", "application/octet-stream")
|
res.set("Content-Type", "application/octet-stream")
|
||||||
|
|
||||||
@@ -77,10 +78,13 @@ express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
var currentBuildID = memory.CL;
|
||||||
const file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
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)) {
|
if (fs.existsSync(file)) {
|
||||||
const ParsedFile = fs.readFileSync(file);
|
const ParsedFile = fs.readFileSync(file);
|
||||||
@@ -93,16 +97,21 @@ express.get("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
express.get("/fortnite/api/cloudstorage/user/:accountId", async (req, res) => {
|
express.get("/fortnite/api/cloudstorage/user/:accountId", async (req, res) => {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
try {
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
||||||
}
|
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
res.set("Content-Type", "application/json")
|
res.set("Content-Type", "application/json")
|
||||||
|
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
var currentBuildID = memory.CL;
|
||||||
const file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
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)) {
|
if (fs.existsSync(file)) {
|
||||||
const ParsedFile = fs.readFileSync(file, 'latin1');
|
const ParsedFile = fs.readFileSync(file, 'latin1');
|
||||||
@@ -126,15 +135,26 @@ express.get("/fortnite/api/cloudstorage/user/:accountId", async (req, res) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
express.put("/fortnite/api/cloudstorage/user/*/*", async (req, res) => {
|
express.put("/fortnite/api/cloudstorage/user/*/:file", async (req, res) => {
|
||||||
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
try {
|
||||||
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
if (!fs.existsSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"))) {
|
||||||
|
fs.mkdirSync(path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings"));
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
if (req.params.file.toLowerCase() != "clientsettings.sav") {
|
||||||
|
return res.status(404).json({
|
||||||
|
"error": "file not found"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
var currentBuildID = memory.CL;
|
var currentBuildID = memory.CL;
|
||||||
const file = path.join(process.env.LOCALAPPDATA, "LawinServer", "ClientSettings", `ClientSettings-${currentBuildID}.Sav`);
|
|
||||||
|
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`);
|
||||||
|
|
||||||
fs.writeFileSync(file, req.rawBody, 'latin1');
|
fs.writeFileSync(file, req.rawBody, 'latin1');
|
||||||
res.status(204).end();
|
res.status(204).end();
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const fs = require("fs");
|
|||||||
const friendslist = require("./../responses/friendslist.json");
|
const friendslist = require("./../responses/friendslist.json");
|
||||||
const friendslist2 = require("./../responses/friendslist2.json");
|
const friendslist2 = require("./../responses/friendslist2.json");
|
||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
const memory = require("./../memory.json");
|
|
||||||
|
|
||||||
express.get("/friends/api/v1/*/settings", async (req, res) => {
|
express.get("/friends/api/v1/*/settings", async (req, res) => {
|
||||||
res.json({})
|
res.json({})
|
||||||
@@ -15,7 +14,7 @@ express.get("/friends/api/v1/*/blocklist", async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
express.get("/friends/api/public/friends/:accountId", async (req, res) => {
|
express.get("/friends/api/public/friends/:accountId", async (req, res) => {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
if (!friendslist.find(i => i.accountId == req.params.accountId)) {
|
if (!friendslist.find(i => i.accountId == req.params.accountId)) {
|
||||||
var FriendObject = {
|
var FriendObject = {
|
||||||
|
|||||||
@@ -1,33 +1,37 @@
|
|||||||
const memory = require("./../memory.json");
|
|
||||||
const XMLBuilder = require("xmlbuilder");
|
const XMLBuilder = require("xmlbuilder");
|
||||||
const uuid = require("uuid");
|
const uuid = require("uuid");
|
||||||
|
|
||||||
function GetVersionInfo(req, memory) {
|
function GetVersionInfo(req) {
|
||||||
|
var memory = {
|
||||||
|
season: 0,
|
||||||
|
build: 0.0,
|
||||||
|
CL: "",
|
||||||
|
lobby: ""
|
||||||
|
}
|
||||||
|
|
||||||
if (req.headers["user-agent"])
|
if (req.headers["user-agent"])
|
||||||
{
|
{
|
||||||
var CL = "";
|
var CL = "";
|
||||||
|
|
||||||
if (req.headers["user-agent"]) {
|
try {
|
||||||
try {
|
var BuildID = req.headers["user-agent"].split("-")[3].split(",")[0]
|
||||||
var BuildID = req.headers["user-agent"].split("-")[3].split(",")[0]
|
if (!Number.isNaN(Number(BuildID))) {
|
||||||
|
CL = BuildID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Number.isNaN(Number(BuildID))) {
|
||||||
|
var BuildID = req.headers["user-agent"].split("-")[3].split(" ")[0]
|
||||||
if (!Number.isNaN(Number(BuildID))) {
|
if (!Number.isNaN(Number(BuildID))) {
|
||||||
CL = BuildID;
|
CL = BuildID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number.isNaN(Number(BuildID))) {
|
|
||||||
var BuildID = req.headers["user-agent"].split("-")[3].split(" ")[0]
|
|
||||||
if (!Number.isNaN(Number(BuildID))) {
|
|
||||||
CL = BuildID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
try {
|
|
||||||
var BuildID = req.headers["user-agent"].split("-")[1].split("+")[0]
|
|
||||||
if (!Number.isNaN(Number(BuildID))) {
|
|
||||||
CL = BuildID;
|
|
||||||
}
|
|
||||||
} catch (err) {}
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
try {
|
||||||
|
var BuildID = req.headers["user-agent"].split("-")[1].split("+")[0]
|
||||||
|
if (!Number.isNaN(Number(BuildID))) {
|
||||||
|
CL = BuildID;
|
||||||
|
}
|
||||||
|
} catch (err) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -53,6 +57,8 @@ function GetVersionInfo(req, memory) {
|
|||||||
memory.lobby = "LobbyWinterDecor";
|
memory.lobby = "LobbyWinterDecor";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemShop() {
|
function getItemShop() {
|
||||||
@@ -131,7 +137,7 @@ function getItemShop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTheater(req) {
|
function getTheater(req) {
|
||||||
GetVersionInfo(req, memory);
|
const memory = GetVersionInfo(req);
|
||||||
|
|
||||||
var theater = JSON.stringify(require("./../responses/worldstw.json"));
|
var theater = JSON.stringify(require("./../responses/worldstw.json"));
|
||||||
var Season = "Season" + memory.season;
|
var Season = "Season" + memory.season;
|
||||||
@@ -178,7 +184,7 @@ function getTheater(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getContentPages(req) {
|
function getContentPages(req) {
|
||||||
GetVersionInfo(req, memory);
|
const memory = GetVersionInfo(req);
|
||||||
|
|
||||||
const contentpages = JSON.parse(JSON.stringify(require("./../responses/contentpages.json")));
|
const contentpages = JSON.parse(JSON.stringify(require("./../responses/contentpages.json")));
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const path = require("path");
|
|||||||
const iniparser = require("ini");
|
const iniparser = require("ini");
|
||||||
const config = iniparser.parse(fs.readFileSync(path.join(__dirname, "..", "Config", "config.ini")).toString());
|
const config = iniparser.parse(fs.readFileSync(path.join(__dirname, "..", "Config", "config.ini")).toString());
|
||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
const memory = require("./../memory.json");
|
|
||||||
|
|
||||||
express.get("/fortnite/api/matchmaking/session/findPlayer/*", async (req, res) => {
|
express.get("/fortnite/api/matchmaking/session/findPlayer/*", async (req, res) => {
|
||||||
res.status(200);
|
res.status(200);
|
||||||
@@ -13,9 +12,7 @@ express.get("/fortnite/api/matchmaking/session/findPlayer/*", async (req, res) =
|
|||||||
})
|
})
|
||||||
|
|
||||||
express.get("/fortnite/api/game/v2/matchmakingservice/ticket/player/*", async (req, res) => {
|
express.get("/fortnite/api/game/v2/matchmakingservice/ticket/player/*", async (req, res) => {
|
||||||
memory.currentbuildUniqueId = req.query.bucketId.split(":")[0];
|
res.cookie("currentbuildUniqueId", req.query.bucketId.split(":")[0]);
|
||||||
|
|
||||||
fs.writeFileSync("./memory.json", JSON.stringify(memory, null, 2));
|
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
"serviceUrl": "ws://lawinservermatchmaker.herokuapp.com",
|
"serviceUrl": "ws://lawinservermatchmaker.herokuapp.com",
|
||||||
@@ -72,7 +69,7 @@ express.get("/fortnite/api/matchmaking/session/:session_id", async (req, res) =>
|
|||||||
"usesPresence": false,
|
"usesPresence": false,
|
||||||
"allowJoinViaPresence": true,
|
"allowJoinViaPresence": true,
|
||||||
"allowJoinViaPresenceFriendsOnly": false,
|
"allowJoinViaPresenceFriendsOnly": false,
|
||||||
"buildUniqueId": memory.currentbuildUniqueId, // buildUniqueId is different for every build, this uses the netver of the version you're currently using
|
"buildUniqueId": req.cookies.currentbuildUniqueId || "0", // buildUniqueId is different for every build, this uses the netver of the version you're currently using
|
||||||
"lastUpdated": new Date().toISOString(),
|
"lastUpdated": new Date().toISOString(),
|
||||||
"started": false
|
"started": false
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ const iniparser = require("ini");
|
|||||||
const config = iniparser.parse(fs.readFileSync(path.join(__dirname, "..", "Config", "config.ini")).toString());
|
const config = iniparser.parse(fs.readFileSync(path.join(__dirname, "..", "Config", "config.ini")).toString());
|
||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
const catalog = functions.getItemShop();
|
const catalog = functions.getItemShop();
|
||||||
const memory = require("./../memory.json");
|
|
||||||
|
|
||||||
express.use(function (req, res, next) {
|
express.use((req, res, next) => {
|
||||||
if (!req.query.profileId) {
|
if (!req.query.profileId && req.originalUrl.toLowerCase().startsWith("/fortnite/api/game/v2/profile/")) {
|
||||||
return res.status(404).json({
|
return res.status(404).json({
|
||||||
error: "Profile not defined."
|
error: "Profile not defined."
|
||||||
});
|
});
|
||||||
@@ -17,7 +16,8 @@ express.use(function (req, res, next) {
|
|||||||
|
|
||||||
fs.readdirSync("./profiles").forEach((file) => {
|
fs.readdirSync("./profiles").forEach((file) => {
|
||||||
if (file.endsWith(".json")) {
|
if (file.endsWith(".json")) {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
const profile = require(`./../profiles/${file}`);
|
const profile = require(`./../profiles/${file}`);
|
||||||
if (!profile.rvn) profile.rvn = 0;
|
if (!profile.rvn) profile.rvn = 0;
|
||||||
if (!profile.items) profile.items = {}
|
if (!profile.items) profile.items = {}
|
||||||
@@ -61,6 +61,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/SetAffiliateName", async (r
|
|||||||
if (req.body.affiliateName.toLowerCase() == code.toLowerCase() || req.body.affiliateName == "") {
|
if (req.body.affiliateName.toLowerCase() == code.toLowerCase() || req.body.affiliateName == "") {
|
||||||
profile.stats.attributes.mtx_affiliate_set_time = new Date().toISOString();
|
profile.stats.attributes.mtx_affiliate_set_time = new Date().toISOString();
|
||||||
profile.stats.attributes.mtx_affiliate = req.body.affiliateName;
|
profile.stats.attributes.mtx_affiliate = req.body.affiliateName;
|
||||||
|
|
||||||
StatChanged = true;
|
StatChanged = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -312,7 +313,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/UnlockRewardNode", async (r
|
|||||||
const profile = require(`./../profiles/${req.query.profileId || "athena"}.json`);
|
const profile = require(`./../profiles/${req.query.profileId || "athena"}.json`);
|
||||||
const common_core = require("./../profiles/common_core.json");
|
const common_core = require("./../profiles/common_core.json");
|
||||||
const WinterFestIDS = require("./../responses/winterfestrewards.json");
|
const WinterFestIDS = require("./../responses/winterfestrewards.json");
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
// do not change any of these or you will end up breaking it
|
// do not change any of these or you will end up breaking it
|
||||||
var ApplyProfileChanges = [];
|
var ApplyProfileChanges = [];
|
||||||
@@ -865,7 +866,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/MarkNewQuestNotificationSen
|
|||||||
express.post("/fortnite/api/game/v2/profile/*/client/ClientQuestLogin", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/ClientQuestLogin", async (req, res) => {
|
||||||
const profile = require(`./../profiles/${req.query.profileId || "athena"}.json`);
|
const profile = require(`./../profiles/${req.query.profileId || "athena"}.json`);
|
||||||
var QuestIDS = JSON.parse(JSON.stringify(require("./../responses/quests.json")));
|
var QuestIDS = JSON.parse(JSON.stringify(require("./../responses/quests.json")));
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
// do not change any of these or you will end up breaking it
|
// do not change any of these or you will end up breaking it
|
||||||
var ApplyProfileChanges = [];
|
var ApplyProfileChanges = [];
|
||||||
@@ -1387,7 +1388,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/IncrementNamedCounterStat",
|
|||||||
express.post("/fortnite/api/game/v2/profile/*/client/ClaimLoginReward", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/ClaimLoginReward", async (req, res) => {
|
||||||
const profile = require(`./../profiles/${req.query.profileId || "campaign"}.json`);
|
const profile = require(`./../profiles/${req.query.profileId || "campaign"}.json`);
|
||||||
const DailyRewards = require("./../responses/dailyrewards.json");
|
const DailyRewards = require("./../responses/dailyrewards.json");
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
// do not change any of these or you will end up breaking it
|
// do not change any of these or you will end up breaking it
|
||||||
var ApplyProfileChanges = [];
|
var ApplyProfileChanges = [];
|
||||||
@@ -2461,7 +2462,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/TransmogItem", async (req,
|
|||||||
|
|
||||||
// Craft item STW (Guns, melees and traps only)
|
// Craft item STW (Guns, melees and traps only)
|
||||||
express.post("/fortnite/api/game/v2/profile/*/client/CraftWorldItem", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/CraftWorldItem", async (req, res) => {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
const profile = require(`./../profiles/${req.query.profileId || "theater0"}.json`);
|
const profile = require(`./../profiles/${req.query.profileId || "theater0"}.json`);
|
||||||
var schematic_profile;
|
var schematic_profile;
|
||||||
@@ -3512,7 +3513,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/ClearHeroLoadout", async (r
|
|||||||
|
|
||||||
// Recycle items STW
|
// Recycle items STW
|
||||||
express.post("/fortnite/api/game/v2/profile/*/client/RecycleItemBatch", async (req, res) => {
|
express.post("/fortnite/api/game/v2/profile/*/client/RecycleItemBatch", async (req, res) => {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
const profile = require(`./../profiles/${req.query.profileId || "campaign"}.json`);
|
const profile = require(`./../profiles/${req.query.profileId || "campaign"}.json`);
|
||||||
|
|
||||||
@@ -5381,7 +5382,7 @@ express.post("/fortnite/api/game/v2/profile/*/client/PurchaseCatalogEntry", asyn
|
|||||||
if (value.offerId == req.body.offerId) {
|
if (value.offerId == req.body.offerId) {
|
||||||
var Quantity = 0;
|
var Quantity = 0;
|
||||||
catalog.storefronts[a].catalogEntries[b].itemGrants.forEach(function(value, c) {
|
catalog.storefronts[a].catalogEntries[b].itemGrants.forEach(function(value, c) {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
if (4 >= memory.season && PurchasedLlama == false) {
|
if (4 >= memory.season && PurchasedLlama == false) {
|
||||||
if (MultiUpdate.length == 0) {
|
if (MultiUpdate.length == 0) {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
const Express = require("express");
|
const Express = require("express");
|
||||||
const express = Express.Router();
|
const express = Express.Router();
|
||||||
const functions = require("./functions.js");
|
const functions = require("./functions.js");
|
||||||
const memory = require("./../memory.json");
|
|
||||||
|
|
||||||
express.get("/fortnite/api/calendar/v1/timeline", async (req, res) => {
|
express.get("/fortnite/api/calendar/v1/timeline", async (req, res) => {
|
||||||
functions.GetVersionInfo(req, memory);
|
const memory = functions.GetVersionInfo(req);
|
||||||
|
|
||||||
var activeEvents = [
|
var activeEvents = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ const XMLParser = require("xml-parser");
|
|||||||
const functions = require("./../structure/functions.js");
|
const functions = require("./../structure/functions.js");
|
||||||
|
|
||||||
const port = 80;
|
const port = 80;
|
||||||
const wss = new WebSocket({ port: port }, console.log("XMPP started listening on port", port));
|
|
||||||
|
const wss = new WebSocket({ port: port }, () => console.log("XMPP started listening on port", port));
|
||||||
|
wss.on("error", (err) => {
|
||||||
|
if (err.code == "EADDRINUSE") console.log("XMPP \x1b[31mFAILED\x1b[0m to start hosting on port", port);
|
||||||
|
else throw err;
|
||||||
|
})
|
||||||
|
|
||||||
global.Clients = [];
|
global.Clients = [];
|
||||||
|
|
||||||
@@ -62,8 +67,10 @@ wss.on('connection', async (ws) => {
|
|||||||
|
|
||||||
if (decodedBase64 && accountId && decodedBase64.length == 3) {
|
if (decodedBase64 && accountId && decodedBase64.length == 3) {
|
||||||
Authenticated = true;
|
Authenticated = true;
|
||||||
|
|
||||||
console.log(`An xmpp client with the account id ${accountId} has logged in.`);
|
console.log(`An xmpp client with the account id ${accountId} has logged in.`);
|
||||||
Success(ws);
|
|
||||||
|
ws.send(XMLBuilder.create("success").attribute("xmlns", "urn:ietf:params:xml:ns:xmpp-sasl").toString());
|
||||||
} else {
|
} else {
|
||||||
return Error(ws);
|
return Error(ws);
|
||||||
}
|
}
|
||||||
@@ -207,10 +214,6 @@ function Error(ws) {
|
|||||||
ws.close();
|
ws.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Success(ws) {
|
|
||||||
ws.send(XMLBuilder.create("success").attribute("xmlns", "urn:ietf:params:xml:ns:xmpp-sasl").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
function updatePresenceForAll(ws, body, away, offline) {
|
function updatePresenceForAll(ws, body, away, offline) {
|
||||||
if (global.Clients.find(i => i.client == ws)) {
|
if (global.Clients.find(i => i.client == ws)) {
|
||||||
var SenderData = global.Clients.find(i => i.client == ws);
|
var SenderData = global.Clients.find(i => i.client == ws);
|
||||||
|
|||||||
Reference in New Issue
Block a user