From 4003d2dcfda8b4f1da0c01beb44b59cc73e8737b Mon Sep 17 00:00:00 2001 From: Lawin0129 Date: Thu, 2 Dec 2021 19:52:15 +0000 Subject: [PATCH] Add endpoints --- index.js | 82 ++++++++++++++++++++++++++++++++---------- responses/catalog.json | 38 ++++++++++---------- responses/privacy.json | 4 +++ 3 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 responses/privacy.json diff --git a/index.js b/index.js index 497026c..cc994a5 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,8 @@ const config = require("./config.json"); const worldstw = require("./responses/worldstw.json"); const friendslist = require("./responses/friendslist.json"); const friendslist2 = require("./responses/friendslist2.json"); -const Keychain = require("./responses/keychain.json"); +const keychain = require("./responses/keychain.json"); +const privacy = require("./responses/privacy.json"); const catalog = getItemShop(); express.use(function(req, res, next) { // Getting the raw body of a request for client saving @@ -142,12 +143,6 @@ express.get("/fortnite/api/version", async (req, res) => { res.end(); }) -express.post("/fortnite/api/feedback/Bug", async (req, res) => { - res.json({}); - res.status(200); - res.end(); -}) - express.get("/launcher/api/public/distributionpoints/", async (req, res) => { res.json({ "distributions": [ @@ -244,11 +239,68 @@ express.get("/fortnite/api/matchmaking/session/findPlayer/*", async (req, res) = res.end(); }) -express.get("/fortnite/api/statsv2/account/*", async (req, res) => { - res.json([]) +express.get("/fortnite/api/game/v2/privacy/account/:accountId", async (req, res) => { + privacy.accountId = req.params.accountId; + + res.json(privacy); res.status(200); res.end(); -}) +}); + +express.post("/fortnite/api/game/v2/privacy/account/:accountId", async (req, res) => { + privacy.accountId = req.params.accountId; + privacy.optOutOfPublicLeaderboards = req.body.optOutOfPublicLeaderboards; + + fs.writeFileSync("./responses/privacy.json", JSON.stringify(privacy, null, 2)); + + res.json(privacy); + res.status(200); + res.end(); +}); + +express.get("/fortnite/api/statsv2/account/:accountId", async (req, res) => { + res.json({ + "startTime": 0, + "endTime": 0, + "stats": {}, + "accountId": req.params.accountId + }); + res.status(200); + res.end(); +}); + +express.get("/statsproxy/api/statsv2/account/:accountId", async (req, res) => { + res.json({ + "startTime": 0, + "endTime": 0, + "stats": {}, + "accountId": req.params.accountId + }); + res.status(200); + res.end(); +}); + +express.post("/fortnite/api/feedback/*", async (req, res) => { + res.status(200); + res.end(); +}); + +express.post("/fortnite/api/statsv2/query", async (req, res) => { + res.json([]); + res.status(200); + res.end(); +}); + +express.post("/statsproxy/api/statsv2/query", async (req, res) => { + res.json([]); + res.status(200); + res.end(); +}); + +express.post("/fortnite/api/game/v2/events/v2/setSubgroup/*", async (req, res) => { + res.status(204); + res.end(); +}); express.get("/fortnite/api/game/v2/enabled_features", async (req, res) => { res.json([]) @@ -518,12 +570,6 @@ express.get("/account/api/public/account", async (req, res) => { res.end(); }) -express.get("/fortnite/api/game/v2/privacy/account/*", async (req, res) => { - res.json({}) - res.status(200); - res.end(); -}) - express.get("/account/api/public/account/:accountId", async (req, res) => { res.json({ "id": req.params.accountId, @@ -1258,7 +1304,7 @@ express.get("/friends/api/public/blocklist/*", async (req, res) => { res.end(); }) -express.get("/content/api/pages/fortnite-game", async (req, res) => { +express.get("/content/api/pages/*", async (req, res) => { const contentpages = getContentPages(req); res.json(contentpages) @@ -1273,7 +1319,7 @@ express.get("/fortnite/api/game/v2/world/info", async (req, res) => { }) express.get("/fortnite/api/storefront/v2/keychain", async (req, res) => { - res.json(Keychain) + res.json(keychain) res.status(200); res.end(); }) diff --git a/responses/catalog.json b/responses/catalog.json index 7ce82dc..fc4c7a4 100644 --- a/responses/catalog.json +++ b/responses/catalog.json @@ -1,19 +1,19 @@ { - "refreshIntervalHrs":24, - "dailyPurchaseHrs":24, - "expiration":"9999-12-31T00:00:00.000Z", - "storefronts":[ - { - "name": "BRDailyStorefront", - "catalogEntries": [] - }, - { - "name": "BRWeeklyStorefront", - "catalogEntries": [] - }, + "refreshIntervalHrs": 24, + "dailyPurchaseHrs": 24, + "expiration": "9999-12-31T00:00:00.000Z", + "storefronts": [ { - "name":"CardPackStore", - "catalogEntries":[ + "name": "BRDailyStorefront", + "catalogEntries": [] + }, + { + "name": "BRWeeklyStorefront", + "catalogEntries": [] + }, + { + "name": "CardPackStore", + "catalogEntries": [ { "offerId":"B9B0CE758A5049F898773C1A47A69ED4", "devName":"Always.UpgradePack.03", @@ -299,8 +299,8 @@ ] }, { - "name":"CardPackStorePreroll", - "catalogEntries":[ + "name": "CardPackStorePreroll", + "catalogEntries": [ { "offerId":"D2E08EFA731D437B85B7340EB51A5E1D", "devName":"Always.UpgradePack.01", @@ -488,8 +488,8 @@ ] }, { - "name":"CardPackStoreGameplay", - "catalogEntries":[ + "name": "CardPackStoreGameplay", + "catalogEntries": [ { "offerId":"1F6B613D4B7BAD47D8A93CAEED2C4996", "devName":"Mini Llama Manual Tutorial - high SharedDisplayPriority", @@ -580,4 +580,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/responses/privacy.json b/responses/privacy.json new file mode 100644 index 0000000..bcee6a0 --- /dev/null +++ b/responses/privacy.json @@ -0,0 +1,4 @@ +{ + "accountId": "", + "optOutOfPublicLeaderboards": false +} \ No newline at end of file