diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..d7df89c9c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..de26c2873 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.autoSave": "afterDelay", + "files.autoSaveDelay": 0, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" +} diff --git a/config.js b/config.js index 172aa7b50..569e35a5b 100644 --- a/config.js +++ b/config.js @@ -4,7 +4,5 @@ const config = { // You can add multiple users by doing username: 'password'. interstellar: "password", }, - routes: true, // Change this to false if you just want to host a bare server. - local: true, // Change this to false to disable local assets. } export default config diff --git a/index.js b/index.js index 305016587..cd0c8b9ba 100644 --- a/index.js +++ b/index.js @@ -33,33 +33,29 @@ app.use(cors()) app.use(express.static(path.join(__dirname, "static"))) app.use("/libcurl/", express.static(libcurlPath)) -if (config.routes !== false) { - const routes = [ - { path: "/as", file: "apps.html" }, - { path: "/gm", file: "games.html" }, - { path: "/st", file: "settings.html" }, - { path: "/ta", file: "tabs.html" }, - { path: "/", file: "index.html" }, - { path: "/tos", file: "tos.html" }, - ] - - routes.forEach((route) => { - app.get(route.path, (req, res) => { - res.sendFile(path.join(__dirname, "static", route.file)) - }) +const routes = [ + { path: "/as", file: "apps.html" }, + { path: "/gm", file: "games.html" }, + { path: "/st", file: "settings.html" }, + { path: "/ta", file: "tabs.html" }, + { path: "/", file: "index.html" }, + { path: "/tos", file: "tos.html" }, +] + +routes.forEach((route) => { + app.get(route.path, (req, res) => { + res.sendFile(path.join(__dirname, "static", route.file)) }) -} +}) -if (config.local !== false) { - app.get("/e/*", (req, res, next) => { - const baseUrls = [ - "https://raw.githubusercontent.com/v-5x/x/fixy", - "https://raw.githubusercontent.com/ypxa/y/main", - "https://raw.githubusercontent.com/ypxa/w/master", - ] - fetchData(req, res, next, baseUrls) - }) -} +app.get("/e/*", (req, res, next) => { + const baseUrls = [ + "https://raw.githubusercontent.com/v-5x/x/fixy", + "https://raw.githubusercontent.com/ypxa/y/main", + "https://raw.githubusercontent.com/ypxa/w/master", + ] + fetchData(req, res, next, baseUrls) +}) const fetchData = async (req, res, next, baseUrls) => { try { @@ -86,10 +82,6 @@ const fetchData = async (req, res, next, baseUrls) => { } } -app.get("*", (req, res) => { - res.status(404).send() -}) - app.use((err, req, res, next) => { console.error(err.stack) res.status(500).send()