qumra-engine 2.0.164 → 2.0.166
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.
- package/dist/middleware.js +3 -6
- package/dist/pages/404.d.ts +1 -0
- package/dist/pages/404.js +75 -0
- package/package.json +1 -1
package/dist/middleware.js
CHANGED
|
@@ -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
|
|
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:",
|
|
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 <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 background-color: #001d20;\n font-family: \"Arial\", sans-serif;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n color: #ffffff;\n text-align: center;\n }\n\n .container {\n max-width: 450px;\n padding: 20px;\n }\n\n h1 {\n font-size: 80px;\n margin: 0;\n font-weight: bold;\n color: #4ed5c5;\n }\n\n h2 {\n font-size: 28px;\n margin-top: 10px;\n font-weight: 600;\n color: #ffffff;\n }\n\n p {\n color: #ccf1ee;\n font-size: 16px;\n margin: 15px 0 30px;\n line-height: 1.7;\n }\n\n a {\n display: inline-block;\n padding: 12px 30px;\n background-color: #4ed5c5;\n color: #001d20;\n font-weight: bold;\n text-decoration: none;\n border-radius: 8px;\n transition: 0.2s ease;\n }\n\n a:hover {\n background-color: #3bbcad;\n }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <h1>404</h1>\n <h2>\u0627\u0644\u0635\u0641\u062D\u0629 \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F\u0629</h2>\n <p>\u064A\u0628\u062F\u0648 \u0623\u0646\u0643 \u062A\u062D\u0627\u0648\u0644 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0635\u0641\u062D\u0629 \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 \u0623\u0648 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u062D\u0627\u0644\u064A\u064B\u0627.</p>\n <a href=\"/\">\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0635\u0641\u062D\u0629 \u0627\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
|
+
<title>الصفحة غير موجودة</title>
|
|
10
|
+
<style>
|
|
11
|
+
body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
background-color: #001d20;
|
|
15
|
+
font-family: "Arial", sans-serif;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
height: 100vh;
|
|
20
|
+
color: #ffffff;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.container {
|
|
25
|
+
max-width: 450px;
|
|
26
|
+
padding: 20px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
h1 {
|
|
30
|
+
font-size: 80px;
|
|
31
|
+
margin: 0;
|
|
32
|
+
font-weight: bold;
|
|
33
|
+
color: #4ed5c5;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
h2 {
|
|
37
|
+
font-size: 28px;
|
|
38
|
+
margin-top: 10px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
color: #ffffff;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
p {
|
|
44
|
+
color: #ccf1ee;
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
margin: 15px 0 30px;
|
|
47
|
+
line-height: 1.7;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
a {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
padding: 12px 30px;
|
|
53
|
+
background-color: #4ed5c5;
|
|
54
|
+
color: #001d20;
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
text-decoration: none;
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
transition: 0.2s ease;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
a:hover {
|
|
62
|
+
background-color: #3bbcad;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<div class="container">
|
|
68
|
+
<h1>404</h1>
|
|
69
|
+
<h2>الصفحة غير موجودة</h2>
|
|
70
|
+
<p>يبدو أنك تحاول الوصول إلى صفحة غير صحيحة أو غير متاحة حاليًا.</p>
|
|
71
|
+
<a href="/">العودة إلى الصفحة الرئيسية</a>
|
|
72
|
+
</div>
|
|
73
|
+
</body>
|
|
74
|
+
</html>
|
|
75
|
+
`;
|