diff --git a/responses/account.json b/responses/account.json deleted file mode 100644 index 93673cc..0000000 --- a/responses/account.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "id": "SubtoLawin_123", - "displayName": "Subscribe to Lawin on YouTube!", - "externalAuths": {} - }, - { - "id": "Followlawin_123", - "displayName": "Follow @lawin_010 on twitter!", - "externalAuths": {} - } -] \ No newline at end of file diff --git a/responses/friendslist.json b/responses/friendslist.json index 58063a1..0637a08 100644 --- a/responses/friendslist.json +++ b/responses/friendslist.json @@ -1,16 +1 @@ -[ - { - "accountId": "SubtoLawin_123", - "status": "ACCEPTED", - "direction": "OUTBOUND", - "created": "2000-05-11T15:53:53.072Z", - "favorite": false - }, - { - "accountId": "Followlawin_123", - "status": "ACCEPTED", - "direction": "OUTBOUND", - "created": "2000-04-08T12:32:42.069Z", - "favorite": false - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/responses/friendslist2.json b/responses/friendslist2.json index e50d307..754dc76 100644 --- a/responses/friendslist2.json +++ b/responses/friendslist2.json @@ -1,24 +1,5 @@ { - "friends": [ - { - "accountId": "SubtoLawin_123", - "groups": [], - "mutual": 0, - "alias": "", - "note": "", - "favorite": false, - "created": "2000-04-08T12:32:42.069Z" - }, - { - "accountId": "Followlawin_123", - "groups": [], - "mutual": 0, - "alias": "", - "note": "", - "favorite": false, - "created": "2000-04-08T12:32:42.069Z" - } - ], + "friends": [], "incoming": [], "outgoing": [], "suggested": [], diff --git a/structure/user.js b/structure/user.js index 2575207..6bdc47d 100644 --- a/structure/user.js +++ b/structure/user.js @@ -4,64 +4,35 @@ const fs = require("fs"); const path = require("path"); const iniparser = require("ini"); const config = iniparser.parse(fs.readFileSync(path.join(__dirname, "..", "Config", "config.ini")).toString()); -const functions = require("./functions.js"); -const accounts = require("./../responses/account.json"); var Memory_CurrentAccountID = config.Config.displayName; express.get("/account/api/public/account", async (req, res) => { var response = []; - if (Memory_CurrentAccountID.includes("@")) Memory_CurrentAccountID = Memory_CurrentAccountID.split("@")[0]; - - if (config.Config.bUseConfigDisplayName == false) { - if (typeof req.query.accountId == "string") { - Memory_CurrentAccountID = req.query.accountId; - if (Memory_CurrentAccountID.includes("@")) Memory_CurrentAccountID = Memory_CurrentAccountID.split("@")[0]; - - if (!accounts.find(i => i.id == req.query.accountId)) { - accounts.push({ - "id": req.query.accountId, - "displayName": Memory_CurrentAccountID, - "externalAuths": {} - }) - } - - if (accounts.find(i => i.id == req.query.accountId).displayName != Memory_CurrentAccountID) { - var index = accounts.findIndex(i => i.id == req.query.accountId); - accounts[index].displayName = Memory_CurrentAccountID; - } - } - } else if (typeof req.query.accountId == "string") { - if (!accounts.find(i => i.id == req.query.accountId)) { - accounts.push({ - "id": req.query.accountId, - "displayName": Memory_CurrentAccountID, - "externalAuths": {} - }) - } - - if (accounts.find(i => i.id == req.query.accountId).displayName != Memory_CurrentAccountID) { - var index = accounts.findIndex(i => i.id == req.query.accountId); - accounts[index].displayName = Memory_CurrentAccountID; - } - } - if (typeof req.query.accountId == "string") { - if (accounts.find(i => i.id == req.query.accountId)) { - response.push(accounts.find(i => i.id == req.query.accountId)) - } + var accountId = req.query.accountId; + if (accountId.includes("@")) accountId = accountId.split("@")[0]; + + response.push({ + "id": accountId, + "displayName": accountId, + "externalAuths": {} + }) } if (Array.isArray(req.query.accountId)) { for (var x in req.query.accountId) { - if (accounts.find(i => i.id == req.query.accountId[x])) { - response.push(accounts.find(i => i.id == req.query.accountId[x])) - } + var accountId = req.query.accountId[x]; + if (accountId.includes("@")) accountId = accountId.split("@")[0]; + + response.push({ + "id": accountId, + "displayName": accountId, + "externalAuths": {} + }) } } - fs.writeFileSync("./responses/account.json", JSON.stringify(accounts, null, 2)); - res.json(response) }) @@ -171,4 +142,4 @@ express.post("/fortnite/api/game/v2/tryPlayOnPlatform/account/*", async (req, re res.send(true); }) -module.exports = express; +module.exports = express; \ No newline at end of file