Compare commits

..

No commits in common. "1ddcf1eaf2e1c311d028e56bcc7840c82254bfd5" and "96d40456d58a02a6fda2deaad8f86c44b990044a" have entirely different histories.

4 changed files with 1 additions and 45 deletions

View File

@ -1,4 +1,2 @@
WEB_PORT=3000 WEB_PORT=3000
IS_PROD=FALSE IS_PROD=FALSE
INSTANCE_NAME="Azures04"
INSTANCE_LOGO="https://chibieditor.fr/assets/img/avatars/azures.png"

View File

@ -1,10 +0,0 @@
const express = require("express")
const metaService = require("../services/metaService")
const router = express.Router({ mergeParams: true })
router.get(/.*/, async (req, res, next) => {
const file = metaService.serveStaticFile(req.originalUrl)
return res.status(200).sendFile(file)
})
module.exports = router

View File

@ -1,9 +0,0 @@
const express = require("express")
const router = express.Router()
const metaService = require("../services/metaService")
router.get("/", (req, res) => {
return res.status(200).json(metaService.getServerMetadata())
})
module.exports = router

View File

@ -1,23 +0,0 @@
const fs = require("node:fs")
const path = require("node:path")
const { DefaultError } = require("../errors/errors")
function getServerMetadata() {
return {
name: process.env["INSTANCE_NAME"],
logo: process.env["INSTANCE_LOGO"]
}
}
function serveStaticFile(filePath) {
const finalFilePath = path.join(process.cwd(), "data", "static", filePath)
if (fs.existsSync(finalFilePath)) {
return finalFilePath
}
throw new DefaultError(404, "File not found", "File moved/deleted or don't exists", "NotFoundException")
}
module.exports = {
serveStaticFile,
getServerMetadata
}