Remove unused routes

This commit is contained in:
Jordan Eldredge 2020-11-19 03:04:31 -05:00
parent 450faba98b
commit d64ec9db10
2 changed files with 0 additions and 79 deletions

View file

@ -27,17 +27,6 @@ test("/skins/", async () => {
});
});
// Deprecated
test("/skins/missing", async () => {
const { body } = await request(app)
.post("/skins/missing")
.send({ hashes: ["a_fake_md5", "a_missing_md5"] });
expect(body).toEqual({
found: ["a_fake_md5"],
missing: ["a_missing_md5"],
});
});
test("/skins/a_fake_md5/report", async () => {
const { body } = await request(app).post("/skins/a_fake_md5/report");
expect(handler).toHaveBeenCalledWith({

View file

@ -47,25 +47,6 @@ router.get(
})
);
router.post(
"/skins/missing",
asyncHandler(async (req, res) => {
const missing: string[] = [];
const found: string[] = [];
for (const md5 of req.body.hashes as string[]) {
if (!(await SkinModel.exists(req.ctx, md5))) {
missing.push(md5);
} else {
found.push(md5);
}
}
req.log(
`${found.length} skins are found and ${missing.length} are missing.`
);
res.json({ missing, found });
})
);
router.post(
"/skins/get_upload_urls",
asyncHandler(async (req, res) => {
@ -138,46 +119,6 @@ async function reportSkinUpload(result: AddResult, dest: TextChannel) {
}
}
router.post(
"/skins/",
asyncHandler(async (req, res) => {
const client = new Discord.Client();
await client.login(Config.discordToken);
const dest = client.channels.get(
Config.SKIN_UPLOADS_CHANNEL_ID
) as TextChannel;
// https://github.com/richardgirges/express-fileupload#usage
// @ts-ignore
const files = req.files as {
[key: string]: { name: string; data: Buffer };
};
if (files == null) {
dest.send("Someone hit the upload endpoint with no files attached.");
res.status(500).send({ error: "No file supplied" });
return;
}
const upload = files.skin;
if (upload == null) {
dest.send("Someone hit the upload endpoint with no files attached.");
res.status(500).send({ error: "No file supplied" });
return;
}
let result: AddResult;
try {
result = await addSkinFromBuffer(upload.data, upload.name, "Web API");
} catch (e) {
req.logError(String(e));
dest.send(`Encountered an error uploading a skin: ${e.message}`);
res.status(500).send({ error: `Error adding skin: ${e.message}` });
return;
}
await reportSkinUpload(result, dest);
res.json({ ...result, filename: upload.name });
})
);
let processing = false;
async function processesUserUploads() {
@ -238,15 +179,6 @@ router.post(
})
);
router.post(
"/skins/:md5/index",
asyncHandler(async (req, res) => {
const { md5 } = req.params;
const skin = await Skins.updateSearchIndex(md5);
res.json(skin);
})
);
router.get(
"/stylegan.json",
asyncHandler(async (req, res) => {