chore: make lint happy
This commit is contained in:
@@ -23,28 +23,27 @@ app.get('/uploaded_files/:hash', (req, res) => {
|
|||||||
const hash = req.params.hash as string
|
const hash = req.params.hash as string
|
||||||
res.setHeader('Content-Type', 'text/plain')
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
if (hash == null) {
|
if (hash == null) {
|
||||||
res.send("404 Not Found", 404)
|
res.status(404).send("404 Not Found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const file = FileManager.findByHash(hash)
|
const file = FileManager.findByHash(hash)
|
||||||
|
|
||||||
if (file.getChatId() != null) {
|
if (file == null) {
|
||||||
const userToken = TokenManager.decode(req.cookies.token)
|
res.status(404).send("404 Not Found")
|
||||||
console.log(userToken, req.cookies.device_id)
|
|
||||||
if (!TokenManager.checkToken(userToken, req.cookies.device_id)) {
|
|
||||||
res.send("401 UnAuthorized", 401)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!UserChatLinker.checkUserIsLinkedToChat(userToken.author, file.getChatId())) {
|
|
||||||
res.send("403 Forbidden", 403)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file == null) {
|
if (file.getChatId() != null) {
|
||||||
res.send("404 Not Found", 404)
|
const userToken = TokenManager.decode(req.cookies.token)
|
||||||
|
if (!TokenManager.checkToken(userToken, req.cookies.device_id)) {
|
||||||
|
res.status(401).send("401 UnAuthorized")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!UserChatLinker.checkUserIsLinkedToChat(userToken.author, file.getChatId() as string)) {
|
||||||
|
res.status(403).send("403 Forbidden")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res.setHeader('Content-Type', file!.getMime())
|
res.setHeader('Content-Type', file!.getMime())
|
||||||
res.sendFile(path.resolve(file!.getFilePath()))
|
res.sendFile(path.resolve(file!.getFilePath()))
|
||||||
|
|||||||
Reference in New Issue
Block a user