Skip to content

Commit

Permalink
Fixed proxy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoAbove committed Oct 20, 2023
1 parent 3f35a2a commit c13d518
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions server/patreon.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ router.get(
}

res.redirect("/");
}
},
);

const authenticated = (req, res, next) => {
Expand Down Expand Up @@ -343,7 +343,7 @@ router.get(
loadPatreonClient,
async (req, res) => {
res.send(gatherMeData(req.user, req.patreonUser));
}
},
);

// router.get('/me/db/:collection', authenticated, loadUser, async (req, res) => {
Expand Down Expand Up @@ -438,7 +438,7 @@ router.post(
genSessionCookie(res);

res.status(200).send(null);
}
},
);

router.post(
Expand All @@ -455,7 +455,7 @@ router.post(
res.status(200).send(null);
const user = req.user;
user.sessionToken = randomUUID();
}
},
);

// handle patreon webhook
Expand Down
16 changes: 9 additions & 7 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ const b2 = new B2({

const app = express();

app.set("trust proxy", 2);

app.use(morgan("combined"));
app.use(cookieParser());
app.use(
bodyParser.json({
verify: (req, res, buf) => {
req.rawBody = buf;
},
})
}),
);
app.use(
bodyParser.urlencoded({
extended: true,
})
}),
);

let data = [];
Expand Down Expand Up @@ -122,33 +124,33 @@ for (const route of ["/", "/info", "/search", "/live", "/test", "/compute", "/co
(req, res) => {
res.setHeader("Cache-Control", "no-store");
res.sendFile("build/index.html", { root: "." });
}
},
);
}

app.use(
"/static",
express.static("build/static", {
maxAge: "1y",
})
}),
);
app.use(
"/locales",
express.static("build/locales", {
maxAge: "1d",
})
}),
);
app.use(
"/ocr",
express.static("build/ocr", {
maxAge: "1d",
})
}),
);
app.use(
"/",
express.static("build/", {
maxAge: "1d",
})
}),
);

app.use((err, req, res, next) => {
Expand Down

0 comments on commit c13d518

Please sign in to comment.