mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
Fix display names for XMPP
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"id": "SubtoLawin_123",
|
|
||||||
"displayName": "Subscribe to Lawin on YouTube!",
|
|
||||||
"externalAuths": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "Followlawin_123",
|
|
||||||
"displayName": "Follow @lawin_010 on twitter!",
|
|
||||||
"externalAuths": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@@ -1,24 +1,5 @@
|
|||||||
{
|
{
|
||||||
"friends": [
|
"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"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"incoming": [],
|
"incoming": [],
|
||||||
"outgoing": [],
|
"outgoing": [],
|
||||||
"suggested": [],
|
"suggested": [],
|
||||||
|
|||||||
@@ -4,64 +4,35 @@ const fs = require("fs");
|
|||||||
const path = require("path");
|
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 accounts = require("./../responses/account.json");
|
|
||||||
var Memory_CurrentAccountID = config.Config.displayName;
|
var Memory_CurrentAccountID = config.Config.displayName;
|
||||||
|
|
||||||
express.get("/account/api/public/account", async (req, res) => {
|
express.get("/account/api/public/account", async (req, res) => {
|
||||||
var response = [];
|
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 (typeof req.query.accountId == "string") {
|
||||||
if (accounts.find(i => i.id == req.query.accountId)) {
|
var accountId = req.query.accountId;
|
||||||
response.push(accounts.find(i => i.id == req.query.accountId))
|
if (accountId.includes("@")) accountId = accountId.split("@")[0];
|
||||||
}
|
|
||||||
|
response.push({
|
||||||
|
"id": accountId,
|
||||||
|
"displayName": accountId,
|
||||||
|
"externalAuths": {}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(req.query.accountId)) {
|
if (Array.isArray(req.query.accountId)) {
|
||||||
for (var x in req.query.accountId) {
|
for (var x in req.query.accountId) {
|
||||||
if (accounts.find(i => i.id == req.query.accountId[x])) {
|
var accountId = req.query.accountId[x];
|
||||||
response.push(accounts.find(i => i.id == 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)
|
res.json(response)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -171,4 +142,4 @@ express.post("/fortnite/api/game/v2/tryPlayOnPlatform/account/*", async (req, re
|
|||||||
res.send(true);
|
res.send(true);
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = express;
|
module.exports = express;
|
||||||
Reference in New Issue
Block a user