qumra-engine 2.0.170 → 2.0.172
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)
|
|
@@ -83,8 +81,15 @@ function renderHandler(locals) {
|
|
|
83
81
|
objectsData.settings = settings;
|
|
84
82
|
if (market)
|
|
85
83
|
objectsData.market = market;
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
objectsData.localization = {};
|
|
85
|
+
if (market)
|
|
86
|
+
objectsData.localization.market = market;
|
|
87
|
+
if (lang)
|
|
88
|
+
objectsData.localization.lang = lang;
|
|
89
|
+
if (currency)
|
|
90
|
+
objectsData.localization.currency = currency;
|
|
91
|
+
if (languages)
|
|
92
|
+
objectsData.localization.languages = languages;
|
|
88
93
|
if (lang)
|
|
89
94
|
objectsData.local = lang;
|
|
90
95
|
return objectsData;
|
|
@@ -4,8 +4,7 @@ exports.validatePathForRender = void 0;
|
|
|
4
4
|
const validatePathForRender = (filePath) => {
|
|
5
5
|
// نشيل أي query string
|
|
6
6
|
const path = filePath.split("?")[0].toLowerCase();
|
|
7
|
-
|
|
8
|
-
const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|product\/[^\/]+$|blog\/[^\/]+$|cart$|search$)/;
|
|
7
|
+
const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|product\/[^\/]+$|blog\/[^\/]+$|cart$|search$|localize\/(lang|market|currency|search)$|auth\/(login|logout|verify|signup)$|checkout\/order$|order\/(buynow|create)$)/;
|
|
9
8
|
if (!whitelistRegex.test(path)) {
|
|
10
9
|
return {
|
|
11
10
|
allowed: false,
|
|
@@ -13,7 +12,6 @@ const validatePathForRender = (filePath) => {
|
|
|
13
12
|
reason: "Path not allowed",
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
|
-
// ✔ مسموح + query مسموح
|
|
17
15
|
return {
|
|
18
16
|
allowed: true,
|
|
19
17
|
status: 200,
|