From 833e730edc17c981d6c0285ad7c4cef6e5009f70 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Sun, 18 Oct 2020 12:42:59 +0200 Subject: [PATCH] Minor changes --- src/app.mjs | 7 ++++--- tests/metrics.mjs | 2 +- utils/build.mjs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app.mjs b/src/app.mjs index a8040551..baf8b825 100644 --- a/src/app.mjs +++ b/src/app.mjs @@ -47,9 +47,10 @@ }) //Base routes - app.get("/", (req, res) => res.sendFile(path.resolve("src/html", "index.html"))) - app.get("/index.html", (req, res) => res.sendFile(path.resolve("src/html", "index.html"))) - app.get("/placeholder.svg", (req, res) => res.sendFile(path.resolve("src/html", "placeholder.svg"))) + const statics = path.resolve("src/html") + app.get("/", (req, res) => res.sendFile(`${statics}/index.html`)) + 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)) //Metrics diff --git a/tests/metrics.mjs b/tests/metrics.mjs index dedc0dbf..ce703699 100644 --- a/tests/metrics.mjs +++ b/tests/metrics.mjs @@ -15,7 +15,7 @@ process.on("unhandledRejection", error => { throw error }) //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 rest = new OctokitRest.Octokit({auth:token}) diff --git a/utils/build.mjs b/utils/build.mjs index 5e50c7d3..263d0ff2 100644 --- a/utils/build.mjs +++ b/utils/build.mjs @@ -19,7 +19,7 @@ //Perform static includes for (const match of [...code.match(/(?<=`)<#include (.+?)>(?=`)/g)]) { 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}`) }