small
This commit is contained in:
@@ -38,7 +38,6 @@ class Server {
|
||||
|
||||
/* Site */
|
||||
router.post('/free', this.newUserSubmission)
|
||||
router.get('/db/images/*', this.getUserImage)
|
||||
router.get('/api/orgdata/*', this.getOrgData)
|
||||
router.get('/api/mydata/*', this.getPersonalData)
|
||||
router.get('/*', this.get)
|
||||
@@ -135,25 +134,6 @@ class Server {
|
||||
}
|
||||
}
|
||||
|
||||
getUserImage = async (req, res) => {
|
||||
function getFileByNumber(dir, number) {
|
||||
const files = fs.readdirSync(dir);
|
||||
const match = files.find(file => {
|
||||
const base = path.parse(file).name; // filename without extension
|
||||
return base === String(number);
|
||||
});
|
||||
return match ? path.join(dir, match) : null;
|
||||
}
|
||||
|
||||
let filePath = path.join(this.DBPath, "images", path.basename(req.url))
|
||||
|
||||
if(filePath) {
|
||||
res.sendFile(filePath)
|
||||
} else {
|
||||
return res.status(404).json({error: "Can't find image"})
|
||||
}
|
||||
}
|
||||
|
||||
get = async (req, res) => {
|
||||
|
||||
let url = req.url
|
||||
|
||||
Reference in New Issue
Block a user