qumra-engine 2.0.23 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,16 +8,10 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const nunjucksEnv_1 = require("../nunjucksEnv");
|
|
9
9
|
const globals_1 = require("../store/globals");
|
|
10
10
|
const nunjucksMiddleWare = (req, res, next) => {
|
|
11
|
-
console.log(2222222222);
|
|
12
11
|
const isDev = res.locals.mode === "devlopment";
|
|
13
|
-
console.log("🚀 ~ res:", res.locals.render);
|
|
14
|
-
console.log("🚀 ~ res.locals:", res.locals);
|
|
15
|
-
console.log("🚀 ~ isDev:", isDev);
|
|
16
|
-
console.log("🚀 ~ res.locals.themePath:", res.locals.render.themePath);
|
|
17
12
|
const mainPath = isDev
|
|
18
13
|
? path_1.default.join(process.cwd())
|
|
19
14
|
: path_1.default.join(res.locals.themesRepo, res.locals.render.themePath);
|
|
20
|
-
console.log("🚀 ~ mainPath:", mainPath);
|
|
21
15
|
const paths = {
|
|
22
16
|
pagesPath: path_1.default.join(mainPath, "pages"),
|
|
23
17
|
layoutsPath: path_1.default.join(mainPath, "layouts"),
|
|
@@ -10,9 +10,13 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
10
10
|
// return next();
|
|
11
11
|
// }
|
|
12
12
|
// }
|
|
13
|
+
let themePath = '';
|
|
14
|
+
if (req.session.themeId) {
|
|
15
|
+
themePath = `?themeVersionId=${req.session.themeId}`;
|
|
16
|
+
}
|
|
13
17
|
const api = true
|
|
14
|
-
?
|
|
15
|
-
: "http://192.168.1.5:4019/v1/render";
|
|
18
|
+
? `https://store-gate.qumra-dev.site/render${themePath}`
|
|
19
|
+
: "http://192.168.1.5:4019/v1/render${themePath}";
|
|
16
20
|
fetch(api, {
|
|
17
21
|
method: "POST",
|
|
18
22
|
headers: { "Content-Type": "application/json" },
|
package/dist/middleware.js
CHANGED
|
@@ -26,8 +26,8 @@ const startEngine = async ({ mode, getRender, setRender, port = 3000, themesRepo
|
|
|
26
26
|
resave: false,
|
|
27
27
|
saveUninitialized: false,
|
|
28
28
|
cookie: {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
secure: false,
|
|
30
|
+
maxAge: 1000 * 60 * 5,
|
|
31
31
|
},
|
|
32
32
|
}));
|
|
33
33
|
app.use((req, res, next) => {
|
|
@@ -35,6 +35,7 @@ const startEngine = async ({ mode, getRender, setRender, port = 3000, themesRepo
|
|
|
35
35
|
if (themeId) {
|
|
36
36
|
req.session.themeId = themeId;
|
|
37
37
|
console.log(`✅ Theme ID set in session: ${themeId}`);
|
|
38
|
+
return res.redirect('/');
|
|
38
39
|
}
|
|
39
40
|
next();
|
|
40
41
|
});
|