Added debug mode
This commit is contained in:
parent
2affa579f7
commit
ae143745ab
|
@ -9,8 +9,8 @@ let tmdb = require("./tmdb.js");
|
||||||
|
|
||||||
// #region Express setup
|
// #region Express setup
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 3001;
|
const port = process.env.SERVER_PORT || 3000;
|
||||||
app.listen(port, () => {
|
app.listen(parseInt(port), () => {
|
||||||
console.log(`Listening on port ${port}`)
|
console.log(`Listening on port ${port}`)
|
||||||
})
|
})
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
@ -456,6 +456,8 @@ api.post("/tournament/create", async (req, res) => {
|
||||||
|
|
||||||
function isSessionLoggedIn(session) {
|
function isSessionLoggedIn(session) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (process.env.DEBUG_ALLOW_ALL === "true") { resolve(true); return; }
|
||||||
|
|
||||||
if (session.user == undefined || session.user.googleId == undefined) {
|
if (session.user == undefined || session.user.googleId == undefined) {
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
|
@ -470,6 +472,8 @@ function isSessionLoggedIn(session) {
|
||||||
|
|
||||||
function isSessionManager(session) {
|
function isSessionManager(session) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (process.env.DEBUG_ALLOW_ALL === "true") { resolve(true); return; }
|
||||||
|
|
||||||
if (session.user == undefined || session.user.googleId == undefined) {
|
if (session.user == undefined || session.user.googleId == undefined) {
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
|
@ -482,7 +486,7 @@ function isSessionManager(session) {
|
||||||
|
|
||||||
api.get("/logout", (req, res) => {
|
api.get("/logout", (req, res) => {
|
||||||
req.session.destroy();
|
req.session.destroy();
|
||||||
res.redirect("/");
|
res.redirect(process.env.AUTH_SUCCESS_REDIRECT);
|
||||||
});
|
});
|
||||||
|
|
||||||
api.get("/users/getSavedUser", (req, res) => {
|
api.get("/users/getSavedUser", (req, res) => {
|
||||||
|
|
Loading…
Reference in New Issue