Werk hoofdapplicatie bij

Legt de bestaande wijzigingen in de hoofdworktree vast voordat de laatste worktree wordt gemerged.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-07 20:45:36 +02:00
parent 26a820b41a
commit c07d503d83
41 changed files with 1837 additions and 313 deletions
+5 -6
View File
@@ -1,15 +1,14 @@
const Database = require("better-sqlite3");
const path = require("path");
const databaseFile = path.join(
__dirname,
"..",
process.env.DATABASE || "database.sqlite"
);
const configuredDatabase = process.env.DATABASE || "database.sqlite";
const databaseFile = path.isAbsolute(configuredDatabase)
? configuredDatabase
: path.join(__dirname, "..", configuredDatabase);
const db = new Database(databaseFile);
db.pragma("journal_mode = WAL");
db.pragma("foreign_keys = ON");
module.exports = db;
module.exports = db;
+24 -2
View File
@@ -57,9 +57,24 @@ module.exports = () => {
app.use(session);
app.use(userMiddleware);
app.use(flash());
app.use(flash());
app.use(userMiddleware);
app.use((req, res, next) => {
res.locals.user = req.user || null;
res.locals.success = req.flash("success");
res.locals.error = req.flash("error");
res.locals.info = req.flash("info");
res.locals.warning = req.flash("warning");
res.locals.title = res.locals.title || "PantryHub";
next();
});
app.use(
@@ -69,6 +84,13 @@ app.use(flash());
);
// API Routes
app.use(
"/api",
require("../routes/api")
);
// Web Routes
app.use(
"/",
require("../routes/auth")
+6 -3
View File
@@ -14,14 +14,17 @@ module.exports = session({
}
}),
secret: process.env.SESSION_SECRET,
secret: process.env.SESSION_SECRET || "change-this-development-secret",
resave: false,
saveUninitialized: false,
cookie: {
maxAge: 1000 * 60 * 60 * 24 * 30
maxAge: 1000 * 60 * 60 * 24 * 30,
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production"
}
});
});