FEAT: Adicionada rota protegida que serve apenas o index.html

This commit is contained in:
Gabriel Amancio 2025-10-21 16:23:23 -03:00
parent 6a15058a88
commit 1db2350b96
2 changed files with 7 additions and 1 deletions

6
app.js
View File

@ -598,6 +598,12 @@ app.get("/", (req, res) => {
// servir /public APENAS quando autenticado
app.use("/public", requireAuth, express.static(path.join(__dirname, "public")));
const path = require("path");
// rota protegida que serve o index.html
app.get("/app", requireAuth, (req, res) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
});
/////////////////////////////////////////////////////

View File

@ -29,7 +29,7 @@ router.get("/auth/callback", async (req, res) => {
return res.status(500).send("Erro ao salvar sessão.");
}
console.log("[auth callback] sessão salva, redirecionando");
return res.redirect("/public/index.html");
return res.redirect("/app");
});
} catch (error) {
console.error("[auth callback] Erro ao obter tokens:", error.response?.data || error.message || error);