qumra-engine 2.0.171 → 2.0.174

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.
@@ -13,11 +13,9 @@ function renderHandler(locals) {
13
13
  const market = locals?.render?.globals?.market || locals?.market;
14
14
  const currency = market?.currency;
15
15
  const localesPath = locals?.localesPath;
16
- console.log("🚀 ~ renderHandlerocalesPath", localesPath);
17
16
  let languages = [];
18
17
  if (localesPath && fs_1.default.existsSync(localesPath)) {
19
18
  languages = fs_1.default.readdirSync(localesPath).map(lang => path_1.default.basename(lang, '.json'));
20
- console.log("🚀 ~ renderHandler ~ languages:", languages);
21
19
  }
22
20
  const objectsData = {};
23
21
  if (render?.globals?.customer)
@@ -17,16 +17,11 @@ const renderMiddleware = (req, res, next) => {
17
17
  const pageLayout = env.getGlobal("pageData").layout ?? "layout";
18
18
  if (widgetId && jsonPreview === "true") {
19
19
  const overrideLayout = `{% content " " %}`;
20
- env.renderString(overrideLayout,
21
- // resolveTranslations(
22
- {
20
+ env.renderString(overrideLayout, {
23
21
  context,
24
22
  globals,
25
23
  ...renderData
26
- },
27
- // env.getGlobal("t")
28
- // ),
29
- (err, html) => {
24
+ }, (err, html) => {
30
25
  if (err) {
31
26
  return next(new Error(`❌ Nunjucks render error: ${err.message}`));
32
27
  }
@@ -41,16 +36,11 @@ const renderMiddleware = (req, res, next) => {
41
36
  });
42
37
  return;
43
38
  }
44
- env.render(`layouts/${pageLayout}.njk`,
45
- // resolveTranslations(
46
- {
39
+ env.render(`layouts/${pageLayout}.njk`, {
47
40
  context,
48
41
  globals,
49
42
  ...renderData
50
- },
51
- // env.getGlobal("t")
52
- // ),
53
- (err, html) => {
43
+ }, (err, html) => {
54
44
  if (err) {
55
45
  return next(new Error(`❌ Nunjucks render error: ${err.message}`));
56
46
  }
@@ -2,10 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validatePathForRender = void 0;
4
4
  const validatePathForRender = (filePath) => {
5
- // نشيل أي query string
6
5
  const path = filePath.split("?")[0].toLowerCase();
7
- // whitelist بدون لمس الـ query
8
- const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|product\/[^\/]+$|blog\/[^\/]+$|cart$|search$)/;
6
+ const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|blogs$|blog\/[^\/]+$|article\/[^\/]+$|product\/[^\/]+$|cart$|search$|localize\/(lang|market|currency|search)$|auth\/(login|logout|verify|signup)$|checkout\/order$|order\/(buynow|create)$)/;
9
7
  if (!whitelistRegex.test(path)) {
10
8
  return {
11
9
  allowed: false,
@@ -13,7 +11,6 @@ const validatePathForRender = (filePath) => {
13
11
  reason: "Path not allowed",
14
12
  };
15
13
  }
16
- // ✔ مسموح + query مسموح
17
14
  return {
18
15
  allowed: true,
19
16
  status: 200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.171",
3
+ "version": "2.0.174",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {