Minor changes

This commit is contained in:
lowlighter
2020-10-18 12:42:59 +02:00
parent 18f3c2ee74
commit 833e730edc
3 changed files with 6 additions and 5 deletions

View File

@@ -47,9 +47,10 @@
}) })
//Base routes //Base routes
app.get("/", (req, res) => res.sendFile(path.resolve("src/html", "index.html"))) const statics = path.resolve("src/html")
app.get("/index.html", (req, res) => res.sendFile(path.resolve("src/html", "index.html"))) app.get("/", (req, res) => res.sendFile(`${statics}/index.html`))
app.get("/placeholder.svg", (req, res) => res.sendFile(path.resolve("src/html", "placeholder.svg"))) app.get("/index.html", (req, res) => res.sendFile(`${statics}/index.html`))
app.get("/placeholder.svg", (req, res) => res.sendFile(`${statics}/placeholder.svg`))
app.get("/favicon.ico", (req, res) => res.sendStatus(204)) app.get("/favicon.ico", (req, res) => res.sendStatus(204))
//Metrics //Metrics

View File

@@ -15,7 +15,7 @@
process.on("unhandledRejection", error => { throw error }) process.on("unhandledRejection", error => { throw error })
//Load GitHub handlers //Load GitHub handlers
const token = process.argv.slice(2)[0] ?? "73a71c11ec07d9b114f5e2af26a3cdde1c6fe65a" const token = process.argv.slice(2)[0]
const graphql = octokit.graphql.defaults({headers:{authorization: `token ${token}`}}) const graphql = octokit.graphql.defaults({headers:{authorization: `token ${token}`}})
const rest = new OctokitRest.Octokit({auth:token}) const rest = new OctokitRest.Octokit({auth:token})

View File

@@ -19,7 +19,7 @@
//Perform static includes //Perform static includes
for (const match of [...code.match(/(?<=`)<#include (.+?)>(?=`)/g)]) { for (const match of [...code.match(/(?<=`)<#include (.+?)>(?=`)/g)]) {
const file = match.match(/<#include (.+?)>/)[1] const file = match.match(/<#include (.+?)>/)[1]
code = code.replace(`<#include ${file}>`, `${await fs.promises.readFile(path.join(__dirname, "..", "src", file))}`.replace(/([$`])/g, "\\$1")) code = code.replace(`<#include ${file}>`, `${await fs.promises.readFile(path.join(__dirname, "..", "src", file))}`.replace(/([$`\\])/g, "\\$1"))
console.log(`Included ${file}`) console.log(`Included ${file}`)
} }