qumra-engine 2.0.164 → 2.0.165

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.
@@ -22,8 +22,7 @@ const extensions_middleware_1 = require("./middleware/extensions.middleware");
22
22
  const locals_middleware_1 = require("./middleware/locals.middleware");
23
23
  const setGlobals_middleware_1 = require("./middleware/setGlobals.middleware");
24
24
  const locals_1 = require("./store/locals");
25
- const fs_1 = __importDefault(require("fs"));
26
- const path_2 = __importDefault(require("path"));
25
+ const _404_1 = require("./pages/404");
27
26
  const startEngine = async ({ renderApi, mode, getRender, setRender, port = 3000, themesRepo, themeId = null, currentApp, market }) => {
28
27
  try {
29
28
  const app = (0, express_1.default)();
@@ -87,18 +86,16 @@ const startEngine = async ({ renderApi, mode, getRender, setRender, port = 3000,
87
86
  app.use('/assets', express_1.default.static(staticPath));
88
87
  // app.use("/api", devRouter);
89
88
  }
90
- const notFoundPagePath = path_2.default.join(__dirname, 'pages', '404.html');
91
- const notFoundPage = fs_1.default.readFileSync(notFoundPagePath, 'utf8');
92
89
  app.use((req, res, next) => {
93
90
  const path = res.locals.parsedUrl?.pathname || req.path;
94
91
  const result = (0, isPathAllowedToRender_1.validatePathForRender)(path);
95
92
  if (!result.allowed) {
96
- console.log("🚀 ~ startEngine ~ notFoundPagePath:", notFoundPagePath);
93
+ console.log("🚀 ~ startEngine ~ notFoundPagePath:", _404_1.notFoundPage);
97
94
  // return res.status(result.status).json({
98
95
  // success: false,
99
96
  // message: result.reason,
100
97
  // });
101
- return res.status(result.status).send(notFoundPage);
98
+ return res.status(result.status).send(_404_1.notFoundPage);
102
99
  }
103
100
  next();
104
101
  });
@@ -0,0 +1 @@
1
+ export declare const notFoundPage = "\n<!DOCTYPE html>\n<html lang=\"ar\" dir=\"rtl\">\n<head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>\u0627\u0644\u0635\u0641\u062D\u0629 \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F\u0629</title>\n <style>\n body {\n margin: 0;\n padding: 0;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto;\n background: #f9fafb;\n color: #111827;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n text-align: center;\n }\n\n .container {\n max-width: 420px;\n padding: 20px;\n }\n\n h1 {\n font-size: 82px;\n margin-bottom: 0;\n color: #ef4444;\n font-weight: 800;\n }\n\n .subtitle {\n font-size: 22px;\n margin-bottom: 15px;\n }\n\n p {\n font-size: 16px;\n color: #6b7280;\n margin-bottom: 30px;\n }\n\n a {\n display: inline-block;\n padding: 12px 26px;\n background: #111827;\n color: #fff;\n border-radius: 10px;\n text-decoration: none;\n font-size: 16px;\n transition: 0.2s;\n }\n\n a:hover {\n background: #000;\n transform: translateY(-2px);\n }\n </style>\n</head>\n\n<body>\n <div class=\"container\">\n <h1>404</h1>\n <div class=\"subtitle\">\u0627\u0644\u0635\u0641\u062D\u0629 \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F\u0629</div>\n <p>\u0627\u0644\u0635\u0641\u062D\u0629 \u0627\u0644\u062A\u064A \u062A\u062D\u0627\u0648\u0644 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u064A\u0647\u0627 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u0623\u0648 \u062A\u0645 \u0646\u0642\u0644\u0647\u0627.</p>\n <a href=\"/\">\u0627\u0644\u0631\u062C\u0648\u0639 \u0644\u0644\u0631\u0626\u064A\u0633\u064A\u0629</a>\n </div>\n</body>\n</html>\n";
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notFoundPage = void 0;
4
+ exports.notFoundPage = `
5
+ <!DOCTYPE html>
6
+ <html lang="ar" dir="rtl">
7
+ <head>
8
+ <meta charset="UTF-8" />
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
+ <title>الصفحة غير موجودة</title>
11
+ <style>
12
+ body {
13
+ margin: 0;
14
+ padding: 0;
15
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
16
+ background: #f9fafb;
17
+ color: #111827;
18
+ display: flex;
19
+ justify-content: center;
20
+ align-items: center;
21
+ height: 100vh;
22
+ text-align: center;
23
+ }
24
+
25
+ .container {
26
+ max-width: 420px;
27
+ padding: 20px;
28
+ }
29
+
30
+ h1 {
31
+ font-size: 82px;
32
+ margin-bottom: 0;
33
+ color: #ef4444;
34
+ font-weight: 800;
35
+ }
36
+
37
+ .subtitle {
38
+ font-size: 22px;
39
+ margin-bottom: 15px;
40
+ }
41
+
42
+ p {
43
+ font-size: 16px;
44
+ color: #6b7280;
45
+ margin-bottom: 30px;
46
+ }
47
+
48
+ a {
49
+ display: inline-block;
50
+ padding: 12px 26px;
51
+ background: #111827;
52
+ color: #fff;
53
+ border-radius: 10px;
54
+ text-decoration: none;
55
+ font-size: 16px;
56
+ transition: 0.2s;
57
+ }
58
+
59
+ a:hover {
60
+ background: #000;
61
+ transform: translateY(-2px);
62
+ }
63
+ </style>
64
+ </head>
65
+
66
+ <body>
67
+ <div class="container">
68
+ <h1>404</h1>
69
+ <div class="subtitle">الصفحة غير موجودة</div>
70
+ <p>الصفحة التي تحاول الوصول إليها غير متاحة أو تم نقلها.</p>
71
+ <a href="/">الرجوع للرئيسية</a>
72
+ </div>
73
+ </body>
74
+ </html>
75
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.164",
3
+ "version": "2.0.165",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {