mirror of
https://github.com/ApfelTeeSaft/LawinServerV2.git
synced 2026-08-26 19:23:39 +00:00
1.0-3.0 account search support
This commit is contained in:
+22
-1
@@ -55,12 +55,33 @@ app.get("/account/api/public/account/displayName/:displayName", async (req, res)
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/persona/api/public/account/lookup", async (req, res) => {
|
||||
if (typeof req.query.q != "string") return res.status(400).json(error.createError(
|
||||
"errors.com.epicgames.bad_request",
|
||||
"Required String parameter 'q' is invalid or not present",
|
||||
undefined, 1001, undefined)
|
||||
);
|
||||
|
||||
let user = await User.findOne({ username_lower: req.query.q.toLowerCase(), banned: false }).lean();
|
||||
if (!user) return res.status(404).json(error.createError(
|
||||
"errors.com.epicgames.account.account_not_found",
|
||||
`Sorry, we couldn't find an account for ${req.query.q}`,
|
||||
[req.query.q], 18007, undefined)
|
||||
);
|
||||
|
||||
res.json({
|
||||
id: user.accountId,
|
||||
displayName: user.username,
|
||||
externalAuths: {}
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/api/v1/search/:accountId", async (req, res) => {
|
||||
let response = [];
|
||||
|
||||
if (typeof req.query.prefix != "string") return res.status(400).json(error.createError(
|
||||
"errors.com.epicgames.bad_request",
|
||||
"Required String parameter 'prefix' is not present",
|
||||
"Required String parameter 'prefix' is invalid or not present",
|
||||
undefined, 1001, undefined)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user