Skip to content

Commit

Permalink
V5.2.1 - Prettier Config + Removed Config Options
Browse files Browse the repository at this point in the history
  • Loading branch information
xbubbo committed May 3, 2024
1 parent 5872368 commit aaced60
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 0,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
2 changes: 0 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
50 changes: 21 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit aaced60

Please sign in to comment.