qumra-engine 2.0.113 → 2.0.115
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.
|
@@ -386,6 +386,29 @@ exports.default = new (class SeoExtension {
|
|
|
386
386
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
387
387
|
});
|
|
388
388
|
</script>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<script>
|
|
392
|
+
window.addEventListener("message", (event) => {
|
|
393
|
+
// يفضل تتحقق من الـ origin لو عايز أمان أكتر
|
|
394
|
+
// if (event.origin !== "https://dashboard.qumra.cloud") return;
|
|
395
|
+
|
|
396
|
+
const data = event.data;
|
|
397
|
+
|
|
398
|
+
if (data?.type === "reRender") {
|
|
399
|
+
console.log("📩 تم استقبال رسالة إعادة الرندر:", data);
|
|
400
|
+
// هنا تقدر تنفذ أي كود لإعادة الرندر أو تحديث الصفحة
|
|
401
|
+
// مثلا:
|
|
402
|
+
// location.reload();
|
|
403
|
+
} else {
|
|
404
|
+
console.log("📩 رسالة وصلت:", data);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
</script>
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
389
412
|
`;
|
|
390
413
|
}
|
|
391
414
|
return new nunjucks_1.runtime.SafeString(scripts);
|
|
@@ -26,6 +26,9 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
26
26
|
if (req.query?.themeVersion) {
|
|
27
27
|
params.set("themeVersion", String(req.query.themeVersion));
|
|
28
28
|
}
|
|
29
|
+
if (req.query?.widget) {
|
|
30
|
+
params.set("widgetId", String(req.query.widget));
|
|
31
|
+
}
|
|
29
32
|
if (req.query?.previewCategory) {
|
|
30
33
|
params.set("previewCategory", String(req.query.previewCategory));
|
|
31
34
|
}
|
|
@@ -38,6 +41,9 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
38
41
|
if (res.locals.preview && res.locals.themeWidget) {
|
|
39
42
|
api = `${res.locals.renderApi}/render/preview-widget${themePath}`;
|
|
40
43
|
}
|
|
44
|
+
else if (req.query?.widget && req.query?.jsonPreview) {
|
|
45
|
+
api = `${res.locals.renderApi}/render/rerender-widget${themePath}`;
|
|
46
|
+
}
|
|
41
47
|
else {
|
|
42
48
|
api = true
|
|
43
49
|
? `${res.locals.renderApi}/render${themePath}`
|
|
@@ -53,7 +59,7 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
53
59
|
Authorization,
|
|
54
60
|
qdid: qdid,
|
|
55
61
|
"client-ip": res.locals.clientIp || "",
|
|
56
|
-
|
|
62
|
+
market: res.locals.market || "",
|
|
57
63
|
},
|
|
58
64
|
})
|
|
59
65
|
.then((engineResponse) => {
|
package/dist/middleware.js
CHANGED
|
@@ -21,15 +21,16 @@ const express_session_1 = __importDefault(require("express-session"));
|
|
|
21
21
|
const printServerLog_1 = require("./utils/printServerLog");
|
|
22
22
|
const cookie_parser_1 = __importDefault(require("cookie-parser"));
|
|
23
23
|
const routers_1 = __importDefault(require("./routers"));
|
|
24
|
-
const cors_1 = __importDefault(require("cors"));
|
|
25
24
|
const startEngine = async ({ renderApi, mode, getRender, setRender, port = 3000, themesRepo, themeId = null, currentApp, market, }) => {
|
|
26
25
|
try {
|
|
27
26
|
const app = (0, express_1.default)();
|
|
28
27
|
app.use((0, cookie_parser_1.default)());
|
|
29
28
|
app.use((0, morgan_1.default)("dev"));
|
|
30
|
-
app.use(
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
// app.use(
|
|
30
|
+
// cors({
|
|
31
|
+
// origin: "*",
|
|
32
|
+
// })
|
|
33
|
+
// );
|
|
33
34
|
app.set("view engine", "nunjucks");
|
|
34
35
|
// لازم ترد على preflight OPTIONS request
|
|
35
36
|
// app.options("*", cors());
|