diff --git a/routes/api/v1/file/index.js b/routes/api/v1/file/index.js new file mode 100644 index 0000000..f0d5c99 --- /dev/null +++ b/routes/api/v1/file/index.js @@ -0,0 +1,9 @@ +const express = require("express") +const router = express.Router() +const { DefaultError } = require("../../../../errors/errors") + +router.get(/.*/, async (req, res) => { + throw new DefaultError(410, "Support for old launcher permanently removed.") +}) + +module.exports = router \ No newline at end of file diff --git a/routes/download.js b/routes/api/v2/download.js similarity index 74% rename from routes/download.js rename to routes/api/v2/download.js index dda6cb6..d402830 100644 --- a/routes/download.js +++ b/routes/api/v2/download.js @@ -1,6 +1,6 @@ const express = require("express") const router = express.Router() -const gameFilesService = require("../services/gameDataService") +const gameFilesService = require("../../../services/gameDataService") router.get(/.*/, async (req, res) => { const fileRequest = await gameFilesService.getFile(req.baseUrl.replace("/download/", "")) diff --git a/routes/gamefiles.js b/routes/api/v2/gamefiles.js similarity index 69% rename from routes/gamefiles.js rename to routes/api/v2/gamefiles.js index 48ac79c..4e33182 100644 --- a/routes/gamefiles.js +++ b/routes/api/v2/gamefiles.js @@ -1,6 +1,6 @@ const express = require("express") const router = express.Router() -const gameFilesService = require("../services/gameDataService") +const gameFilesService = require("../../../services/gameDataService") router.get("", async (req, res) => { const gameIndex = await gameFilesService.getGameFiles() diff --git a/routes/api/v2/status.js b/routes/api/v2/status.js new file mode 100644 index 0000000..23bf782 --- /dev/null +++ b/routes/api/v2/status.js @@ -0,0 +1,14 @@ +const express = require("express") +const router = express.Router() +const utils = require("../../../modules/utils") + +router.get("", async (req, res) => { + return res.status(200).json({ + maintenance: { + enabled: utils.isTrueFromDotEnv("MAINTENANCE"), + message: process.env.MANTENANCE_MESSAGE || "Launcher is on maintenance." + } + }) +}) + +module.exports = router \ No newline at end of file