Renamed file
This commit is contained in:
parent
e73500fb91
commit
6646ba8a25
|
@ -4,27 +4,27 @@ const app = express();
|
|||
const publicDirname = path.join(__dirname, "../public");
|
||||
const DEVELOPMENT_PORT = 8000;
|
||||
|
||||
import whiteListedUsers from "./whitelistedUser.json";
|
||||
import allowedUsers from "./allowedUsers.json";
|
||||
|
||||
import * as dotenv from "dotenv";
|
||||
import { makePullRequest } from "./giteaClient";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const devQuestId = "cdalek"
|
||||
const devQuestId = "cdalek";
|
||||
|
||||
const validateAuthorization = (req, res, next) => {
|
||||
// TODO: Replace with actual quest id from request
|
||||
if (!whiteListedUsers.includes(devQuestId)) {
|
||||
if (!allowedUsers.includes(devQuestId)) {
|
||||
res.status(401);
|
||||
res.sendFile(path.join(publicDirname, "unauthorized.html"));
|
||||
} else {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Validate user's quest id
|
||||
app.use(validateAuthorization);
|
||||
app.use(validateAuthorization);
|
||||
|
||||
app.get("/", async (req, res) => {
|
||||
res.sendFile(path.join(publicDirname, "index.html"));
|
||||
|
@ -36,8 +36,6 @@ app.get("/", async (req, res) => {
|
|||
// Allows serving static files
|
||||
app.use(express.static(publicDirname));
|
||||
|
||||
|
||||
app.listen(DEVELOPMENT_PORT, () => {
|
||||
console.log(`Listening on http://localhost:${DEVELOPMENT_PORT}`);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue