xypriss 1.1.3 → 1.2.0
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/README.md +13 -13
- package/dist/cjs/mods/security/src/index.js +35 -12
- package/dist/cjs/mods/security/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +56 -0
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/plugins/modules/PluginEngine.js +378 -0
- package/dist/cjs/src/plugins/modules/PluginEngine.js.map +1 -0
- package/dist/cjs/src/plugins/modules/PluginRegistry.js +339 -0
- package/dist/cjs/src/plugins/modules/PluginRegistry.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js +591 -0
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js +413 -0
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js +843 -0
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js +1975 -0
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js +894 -0
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js +799 -0
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/index.js +304 -0
- package/dist/cjs/src/plugins/modules/index.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/builtin/CompressionPlugin.js +410 -0
- package/dist/cjs/src/plugins/modules/network/builtin/CompressionPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/builtin/ConnectionPlugin.js +797 -0
- package/dist/cjs/src/plugins/modules/network/builtin/ConnectionPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js +409 -0
- package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/builtin/RateLimitPlugin.js +606 -0
- package/dist/cjs/src/plugins/modules/network/builtin/RateLimitPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js +225 -0
- package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/core/NetworkPluginFactory.js +40 -0
- package/dist/cjs/src/plugins/modules/network/core/NetworkPluginFactory.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/index.js +120 -0
- package/dist/cjs/src/plugins/modules/network/index.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/types/NetworkTypes.js +24 -0
- package/dist/cjs/src/plugins/modules/network/types/NetworkTypes.js.map +1 -0
- package/dist/cjs/src/plugins/modules/network/utils/NetworkPluginUtils.js +63 -0
- package/dist/cjs/src/plugins/modules/network/utils/NetworkPluginUtils.js.map +1 -0
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js +48 -0
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js.map +1 -0
- package/dist/cjs/src/server/FastServer.js +133 -5
- package/dist/cjs/src/server/FastServer.js.map +1 -1
- package/dist/cjs/src/server/components/fastapi/PluginManager.js +5 -5
- package/dist/cjs/src/server/components/fastapi/PluginManager.js.map +1 -1
- package/dist/cjs/src/server/components/fastapi/RequestProcessor.js +1 -1
- package/dist/cjs/src/server/conf/networkConnectionConf.js +25 -0
- package/dist/cjs/src/server/conf/networkConnectionConf.js.map +1 -0
- package/dist/cjs/src/server/conf/proxyConfig.js +23 -0
- package/dist/cjs/src/server/conf/proxyConfig.js.map +1 -0
- package/dist/cjs/src/server/conf/rateLimitConfig.js +35 -0
- package/dist/cjs/src/server/conf/rateLimitConfig.js.map +1 -0
- package/dist/cjs/src/server/const/default.js +6 -0
- package/dist/cjs/src/server/const/default.js.map +1 -1
- package/dist/cjs/src/server/handlers/NotFoundHandler.js +217 -0
- package/dist/cjs/src/server/handlers/NotFoundHandler.js.map +1 -0
- package/dist/cjs/src/server/handlers/templates/notFoundTemp.js +163 -0
- package/dist/cjs/src/server/handlers/templates/notFoundTemp.js.map +1 -0
- package/dist/esm/mods/security/src/components/cache/UFSIMC.js +5 -5
- package/dist/esm/mods/security/src/components/cache/UFSIMC.js.map +1 -1
- package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js +3 -3
- package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js.map +1 -1
- package/dist/esm/mods/security/src/index.js +14 -10
- package/dist/esm/mods/security/src/index.js.map +1 -1
- package/dist/esm/src/index.js +18 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/plugins/modules/PluginEngine.js +376 -0
- package/dist/esm/src/plugins/modules/PluginEngine.js.map +1 -0
- package/dist/esm/src/plugins/modules/PluginRegistry.js +337 -0
- package/dist/esm/src/plugins/modules/PluginRegistry.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js +589 -0
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js +411 -0
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js +841 -0
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/CachePlugin.js +1973 -0
- package/dist/esm/src/plugins/modules/core/CachePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js +872 -0
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js +797 -0
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/index.js +275 -0
- package/dist/esm/src/plugins/modules/index.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/builtin/CompressionPlugin.js +389 -0
- package/dist/esm/src/plugins/modules/network/builtin/CompressionPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/builtin/ConnectionPlugin.js +776 -0
- package/dist/esm/src/plugins/modules/network/builtin/ConnectionPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js +407 -0
- package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/builtin/RateLimitPlugin.js +585 -0
- package/dist/esm/src/plugins/modules/network/builtin/RateLimitPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js +223 -0
- package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/core/NetworkPluginFactory.js +38 -0
- package/dist/esm/src/plugins/modules/network/core/NetworkPluginFactory.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/index.js +109 -0
- package/dist/esm/src/plugins/modules/network/index.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/types/NetworkTypes.js +24 -0
- package/dist/esm/src/plugins/modules/network/types/NetworkTypes.js.map +1 -0
- package/dist/esm/src/plugins/modules/network/utils/NetworkPluginUtils.js +61 -0
- package/dist/esm/src/plugins/modules/network/utils/NetworkPluginUtils.js.map +1 -0
- package/dist/esm/src/plugins/modules/types/PluginTypes.js +48 -0
- package/dist/esm/src/plugins/modules/types/PluginTypes.js.map +1 -0
- package/dist/esm/src/server/FastServer.js +133 -5
- package/dist/esm/src/server/FastServer.js.map +1 -1
- package/dist/esm/src/server/components/fastapi/PluginManager.js +5 -5
- package/dist/esm/src/server/components/fastapi/PluginManager.js.map +1 -1
- package/dist/esm/src/server/components/fastapi/RequestProcessor.js +1 -1
- package/dist/esm/src/server/conf/networkConnectionConf.js +23 -0
- package/dist/esm/src/server/conf/networkConnectionConf.js.map +1 -0
- package/dist/esm/src/server/conf/proxyConfig.js +21 -0
- package/dist/esm/src/server/conf/proxyConfig.js.map +1 -0
- package/dist/esm/src/server/conf/rateLimitConfig.js +33 -0
- package/dist/esm/src/server/conf/rateLimitConfig.js.map +1 -0
- package/dist/esm/src/server/const/default.js +6 -0
- package/dist/esm/src/server/const/default.js.map +1 -1
- package/dist/esm/src/server/handlers/NotFoundHandler.js +194 -0
- package/dist/esm/src/server/handlers/NotFoundHandler.js.map +1 -0
- package/dist/esm/src/server/handlers/templates/notFoundTemp.js +161 -0
- package/dist/esm/src/server/handlers/templates/notFoundTemp.js.map +1 -0
- package/dist/index.d.ts +5104 -14
- package/package.json +8 -7
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { notFoundTempHtml } from './templates/notFoundTemp.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* XyPriss Custom 404 Not Found Handler
|
|
7
|
+
*
|
|
8
|
+
* Customizable 404 error pages with XyPriss branding
|
|
9
|
+
* and user configuration options.
|
|
10
|
+
*/
|
|
11
|
+
class NotFoundHandler {
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
/**
|
|
14
|
+
* Express middleware handler for 404 errors
|
|
15
|
+
*/
|
|
16
|
+
this.handler = (req, res) => {
|
|
17
|
+
if (!this.config.enabled) {
|
|
18
|
+
// Fall back to Express default
|
|
19
|
+
res.status(404).send(`Cannot ${req.method} ${req.path}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
res.status(404);
|
|
23
|
+
res.set("Content-Type", "text/html");
|
|
24
|
+
res.send(this.generateNotFoundHTML(req));
|
|
25
|
+
};
|
|
26
|
+
this.config = {
|
|
27
|
+
enabled: true,
|
|
28
|
+
title: "Page Not Found - XyPriss",
|
|
29
|
+
message: "The page you're looking for doesn't exist.",
|
|
30
|
+
showSuggestions: true,
|
|
31
|
+
showBackButton: true,
|
|
32
|
+
theme: "auto",
|
|
33
|
+
redirectTo: "/",
|
|
34
|
+
...config,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generate beautiful 404 HTML page using template
|
|
39
|
+
*/
|
|
40
|
+
generateNotFoundHTML(req) {
|
|
41
|
+
// Prepare template data
|
|
42
|
+
const templateData = this.prepareTemplateData(req);
|
|
43
|
+
// Try to load external template file first
|
|
44
|
+
try {
|
|
45
|
+
const templatePath = path.join(__dirname, "templates", "notFound.html");
|
|
46
|
+
if (fs.existsSync(templatePath)) {
|
|
47
|
+
let template = fs.readFileSync(templatePath, "utf8");
|
|
48
|
+
// Replace template variables
|
|
49
|
+
Object.entries(templateData).forEach(([key, value]) => {
|
|
50
|
+
const placeholder = `\${${key}}`;
|
|
51
|
+
template = template.replace(new RegExp(placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), value);
|
|
52
|
+
});
|
|
53
|
+
return template;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
// Fall back to inline template if file loading fails
|
|
58
|
+
console.warn("Failed to load 404 template file, using fallback:", error);
|
|
59
|
+
}
|
|
60
|
+
// Use fallback template function
|
|
61
|
+
return notFoundTempHtml(templateData);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Prepare template data for rendering
|
|
65
|
+
*/
|
|
66
|
+
prepareTemplateData(req) {
|
|
67
|
+
const requestedPath = req.path;
|
|
68
|
+
// Determine theme based on user preference or system
|
|
69
|
+
const themeClass = this.config.theme === "auto"
|
|
70
|
+
? "theme-auto"
|
|
71
|
+
: `theme-${this.config.theme}`;
|
|
72
|
+
// Generate suggestions based on the requested path
|
|
73
|
+
const suggestions = this.config.showSuggestions
|
|
74
|
+
? this.generateSuggestions(requestedPath)
|
|
75
|
+
: [];
|
|
76
|
+
// Auto-redirect script
|
|
77
|
+
const redirectScript = this.config.redirectAfter
|
|
78
|
+
? `
|
|
79
|
+
<script>
|
|
80
|
+
let countdown = ${Math.floor(this.config.redirectAfter / 1000)};
|
|
81
|
+
const countdownEl = document.getElementById('countdown');
|
|
82
|
+
const redirectTimer = setInterval(() => {
|
|
83
|
+
countdownEl.textContent = countdown;
|
|
84
|
+
countdown--;
|
|
85
|
+
if (countdown < 0) {
|
|
86
|
+
clearInterval(redirectTimer);
|
|
87
|
+
window.location.href = '${this.config.redirectTo}';
|
|
88
|
+
}
|
|
89
|
+
}, 1000);
|
|
90
|
+
</script>
|
|
91
|
+
`
|
|
92
|
+
: "";
|
|
93
|
+
// Prepare template sections
|
|
94
|
+
const logoSection = this.config.logoUrl
|
|
95
|
+
? `<img src="${this.config.logoUrl}" alt="Logo" class="logo">`
|
|
96
|
+
: '<div class="logo">XP</div>';
|
|
97
|
+
const suggestionsSection = suggestions.length > 0
|
|
98
|
+
? `
|
|
99
|
+
<div class="suggestions">
|
|
100
|
+
<h3>💡 Suggestions:</h3>
|
|
101
|
+
<ul>
|
|
102
|
+
${suggestions
|
|
103
|
+
.map((suggestion) => `<li>${suggestion}</li>`)
|
|
104
|
+
.join("")}
|
|
105
|
+
</ul>
|
|
106
|
+
</div>
|
|
107
|
+
`
|
|
108
|
+
: "";
|
|
109
|
+
const redirectSection = this.config.redirectAfter
|
|
110
|
+
? `
|
|
111
|
+
<div class="redirect-notice">
|
|
112
|
+
🔄 Redirecting to home page in <span id="countdown">${Math.floor(this.config.redirectAfter / 1000)}</span> seconds...
|
|
113
|
+
</div>
|
|
114
|
+
`
|
|
115
|
+
: "";
|
|
116
|
+
const backButtonSection = this.config.showBackButton
|
|
117
|
+
? `
|
|
118
|
+
<button onclick="history.back()" class="btn btn-secondary">
|
|
119
|
+
← Go Back
|
|
120
|
+
</button>
|
|
121
|
+
`
|
|
122
|
+
: "";
|
|
123
|
+
const customContentSection = this.config.customContent || "";
|
|
124
|
+
const contactSection = this.config.contact
|
|
125
|
+
? `
|
|
126
|
+
<div class="contact-info">
|
|
127
|
+
<h4>Need Help?</h4>
|
|
128
|
+
${this.config.contact.email
|
|
129
|
+
? `<p>📧 <a href="mailto:${this.config.contact.email}">${this.config.contact.email}</a></p>`
|
|
130
|
+
: ""}
|
|
131
|
+
${this.config.contact.website
|
|
132
|
+
? `<p>🌐 <a href="${this.config.contact.website}" target="_blank">${this.config.contact.website}</a></p>`
|
|
133
|
+
: ""}
|
|
134
|
+
${this.config.contact.support
|
|
135
|
+
? `<p>💬 <a href="${this.config.contact.support}" target="_blank">Support</a></p>`
|
|
136
|
+
: ""}
|
|
137
|
+
</div>
|
|
138
|
+
`
|
|
139
|
+
: "";
|
|
140
|
+
return {
|
|
141
|
+
title: this.config.title || "Page Not Found - XyPriss",
|
|
142
|
+
message: this.config.message ||
|
|
143
|
+
"The page you're looking for doesn't exist.",
|
|
144
|
+
requestedPath,
|
|
145
|
+
themeClass,
|
|
146
|
+
customCSS: this.config.customCSS || "",
|
|
147
|
+
logoSection,
|
|
148
|
+
suggestionsSection,
|
|
149
|
+
redirectSection,
|
|
150
|
+
redirectTo: this.config.redirectTo || "/",
|
|
151
|
+
backButtonSection,
|
|
152
|
+
customContentSection,
|
|
153
|
+
contactSection,
|
|
154
|
+
redirectScript,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Generate helpful suggestions based on the requested path
|
|
159
|
+
*/
|
|
160
|
+
generateSuggestions(requestedPath) {
|
|
161
|
+
const suggestions = [];
|
|
162
|
+
// Common suggestions
|
|
163
|
+
suggestions.push("🔍 Check the URL for typos");
|
|
164
|
+
suggestions.push('🏠 <a href="/">Visit our homepage</a>');
|
|
165
|
+
// Path-based suggestions
|
|
166
|
+
if (requestedPath.includes("/api/")) {
|
|
167
|
+
suggestions.push('📚 <a href="/api/docs">Check API documentation</a>');
|
|
168
|
+
}
|
|
169
|
+
if (requestedPath.includes("/admin")) {
|
|
170
|
+
suggestions.push('🔐 <a href="/login">Login to access admin area</a>');
|
|
171
|
+
}
|
|
172
|
+
if (requestedPath.includes("/user") ||
|
|
173
|
+
requestedPath.includes("/profile")) {
|
|
174
|
+
suggestions.push('👤 <a href="/login">Login to access your profile</a>');
|
|
175
|
+
}
|
|
176
|
+
suggestions.push("📞 Contact support if you believe this is an error");
|
|
177
|
+
return suggestions;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Update configuration
|
|
181
|
+
*/
|
|
182
|
+
updateConfig(newConfig) {
|
|
183
|
+
this.config = { ...this.config, ...newConfig };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Create NotFoundHandler from ServerOptions
|
|
188
|
+
*/
|
|
189
|
+
function createNotFoundHandler(options) {
|
|
190
|
+
return new NotFoundHandler(options.notFound);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export { NotFoundHandler, createNotFoundHandler };
|
|
194
|
+
//# sourceMappingURL=NotFoundHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFoundHandler.js","sources":["../../../../../src/server/handlers/NotFoundHandler.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;;;AAKG;MA8BU,eAAe,CAAA;AAGxB,IAAA,WAAA,CAAY,SAAyB,EAAE,EAAA;AAiNvC;;AAEG;AACI,QAAA,IAAA,CAAA,OAAO,GAAG,CAAC,GAAY,EAAE,GAAa,KAAU;AACnD,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;;AAEtB,gBAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA,OAAA,EAAU,GAAG,CAAC,MAAM,CAAI,CAAA,EAAA,GAAG,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC;gBACzD,OAAO;aACV;AAED,YAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAChB,YAAA,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAC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AACjD;;;;"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback 404 HTML template function
|
|
3
|
+
* Used when the external HTML template file is not available
|
|
4
|
+
*/
|
|
5
|
+
const notFoundTempHtml = (data) => {
|
|
6
|
+
return `<!DOCTYPE html>
|
|
7
|
+
<html lang="en" class="${data.themeClass}">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
|
+
<title>${data.title}</title>
|
|
12
|
+
<style>
|
|
13
|
+
:root {
|
|
14
|
+
--primary-color: #667eea;
|
|
15
|
+
--secondary-color: #764ba2;
|
|
16
|
+
--accent-color: #f093fb;
|
|
17
|
+
--text-primary: #2d3748;
|
|
18
|
+
--text-secondary: #4a5568;
|
|
19
|
+
--bg-primary: #ffffff;
|
|
20
|
+
--bg-secondary: #f7fafc;
|
|
21
|
+
--border-color: #e2e8f0;
|
|
22
|
+
--shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
23
|
+
}
|
|
24
|
+
.theme-dark {
|
|
25
|
+
--text-primary: #f7fafc;
|
|
26
|
+
--text-secondary: #e2e8f0;
|
|
27
|
+
--bg-primary: #1a202c;
|
|
28
|
+
--bg-secondary: #2d3748;
|
|
29
|
+
--border-color: #4a5568;
|
|
30
|
+
--shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
|
31
|
+
}
|
|
32
|
+
@media (prefers-color-scheme: dark) {
|
|
33
|
+
.theme-auto {
|
|
34
|
+
--text-primary: #f7fafc;
|
|
35
|
+
--text-secondary: #e2e8f0;
|
|
36
|
+
--bg-primary: #1a202c;
|
|
37
|
+
--bg-secondary: #2d3748;
|
|
38
|
+
--border-color: #4a5568;
|
|
39
|
+
--shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
43
|
+
body {
|
|
44
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
45
|
+
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
|
46
|
+
min-height: 100vh; display: flex; align-items: center; justify-content: center;
|
|
47
|
+
padding: 20px; color: var(--text-primary);
|
|
48
|
+
}
|
|
49
|
+
.container {
|
|
50
|
+
background: var(--bg-primary); border-radius: 20px; padding: 40px;
|
|
51
|
+
max-width: 600px; width: 100%; box-shadow: var(--shadow);
|
|
52
|
+
text-align: center; position: relative; overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
.container::before {
|
|
55
|
+
content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
|
|
56
|
+
background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
|
|
57
|
+
}
|
|
58
|
+
.logo {
|
|
59
|
+
width: 80px; height: 80px; margin: 0 auto 20px;
|
|
60
|
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
|
61
|
+
border-radius: 50%; display: flex; align-items: center; justify-content: center;
|
|
62
|
+
font-size: 32px; font-weight: bold; color: white; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
63
|
+
}
|
|
64
|
+
.error-code {
|
|
65
|
+
font-size: 120px; font-weight: 900;
|
|
66
|
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
|
67
|
+
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
|
|
68
|
+
background-clip: text; line-height: 1; margin-bottom: 20px;
|
|
69
|
+
}
|
|
70
|
+
h1 { font-size: 28px; margin-bottom: 15px; color: var(--text-primary); }
|
|
71
|
+
.message { font-size: 18px; color: var(--text-secondary); margin-bottom: 30px; line-height: 1.6; }
|
|
72
|
+
.requested-path {
|
|
73
|
+
background: var(--bg-secondary); padding: 15px; border-radius: 10px; margin: 20px 0;
|
|
74
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-size: 14px;
|
|
75
|
+
color: var(--text-secondary); border: 1px solid var(--border-color);
|
|
76
|
+
}
|
|
77
|
+
.suggestions { text-align: left; margin: 30px 0; }
|
|
78
|
+
.suggestions h3 { color: var(--text-primary); margin-bottom: 15px; font-size: 18px; }
|
|
79
|
+
.suggestions ul { list-style: none; }
|
|
80
|
+
.suggestions li { padding: 8px 0; color: var(--text-secondary); }
|
|
81
|
+
.suggestions a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
|
|
82
|
+
.suggestions a:hover { text-decoration: underline; }
|
|
83
|
+
.actions { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin: 30px 0; }
|
|
84
|
+
.btn {
|
|
85
|
+
padding: 12px 24px; border: none; border-radius: 10px; font-size: 16px; font-weight: 600;
|
|
86
|
+
cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
|
|
87
|
+
gap: 8px; transition: all 0.3s ease;
|
|
88
|
+
}
|
|
89
|
+
.btn-primary {
|
|
90
|
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
|
91
|
+
color: white;
|
|
92
|
+
}
|
|
93
|
+
.btn-secondary {
|
|
94
|
+
background: var(--bg-secondary); color: var(--text-primary);
|
|
95
|
+
border: 1px solid var(--border-color);
|
|
96
|
+
}
|
|
97
|
+
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); }
|
|
98
|
+
.redirect-notice {
|
|
99
|
+
background: var(--bg-secondary); padding: 15px; border-radius: 10px;
|
|
100
|
+
margin: 20px 0; border: 1px solid var(--border-color);
|
|
101
|
+
}
|
|
102
|
+
.contact-info {
|
|
103
|
+
margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color);
|
|
104
|
+
font-size: 14px; color: var(--text-secondary);
|
|
105
|
+
}
|
|
106
|
+
.contact-info a { color: var(--primary-color); text-decoration: none; }
|
|
107
|
+
.branding {
|
|
108
|
+
margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-color);
|
|
109
|
+
font-size: 12px; color: var(--text-secondary); opacity: 0.8;
|
|
110
|
+
}
|
|
111
|
+
.branding a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
|
|
112
|
+
@media (max-width: 480px) {
|
|
113
|
+
.container { padding: 30px 20px; }
|
|
114
|
+
.error-code { font-size: 80px; }
|
|
115
|
+
h1 { font-size: 24px; }
|
|
116
|
+
.actions { flex-direction: column; }
|
|
117
|
+
}
|
|
118
|
+
${data.customCSS}
|
|
119
|
+
</style>
|
|
120
|
+
</head>
|
|
121
|
+
<body>
|
|
122
|
+
<div class="container">
|
|
123
|
+
${data.logoSection}
|
|
124
|
+
<div class="error-code">404</div>
|
|
125
|
+
<h1>Oops! Page Not Found</h1>
|
|
126
|
+
<p class="message">${data.message}</p>
|
|
127
|
+
<div class="requested-path">
|
|
128
|
+
<strong>Requested:</strong> ${data.requestedPath}
|
|
129
|
+
</div>
|
|
130
|
+
${data.suggestionsSection}
|
|
131
|
+
${data.redirectSection}
|
|
132
|
+
<div class="actions">
|
|
133
|
+
<a href="${data.redirectTo}" class="btn btn-primary">🏠 Go Home</a>
|
|
134
|
+
${data.backButtonSection}
|
|
135
|
+
</div>
|
|
136
|
+
${data.customContentSection}
|
|
137
|
+
${data.contactSection}
|
|
138
|
+
<div class="branding">
|
|
139
|
+
Powered by <a href="https://nehonix.space" target="_blank">Nehonix</a> •
|
|
140
|
+
Built with <a href="https://github.com/Nehonix-Team/XyPriss" target="_blank">XyPriss</a>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
${data.redirectScript}
|
|
144
|
+
<script>
|
|
145
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
146
|
+
const container = document.querySelector('.container');
|
|
147
|
+
container.style.opacity = '0';
|
|
148
|
+
container.style.transform = 'translateY(20px)';
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
container.style.transition = 'all 0.6s ease';
|
|
151
|
+
container.style.opacity = '1';
|
|
152
|
+
container.style.transform = 'translateY(0)';
|
|
153
|
+
}, 100);
|
|
154
|
+
});
|
|
155
|
+
</script>
|
|
156
|
+
</body>
|
|
157
|
+
</html>`;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { notFoundTempHtml };
|
|
161
|
+
//# sourceMappingURL=notFoundTemp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notFoundTemp.js","sources":["../../../../../../src/server/handlers/templates/notFoundTemp.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AAkBU,MAAA,gBAAgB,GAAG,CAAC,IAA0B,KAAY;IACnE,OAAO,CAAA;AACc,uBAAA,EAAA,IAAI,CAAC,UAAU,CAAA;;;;AAI3B,WAAA,EAAA,IAAI,CAAC,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Gb,QAAA,EAAA,IAAI,CAAC,SAAS,CAAA;;;;;AAKd,QAAA,EAAA,IAAI,CAAC,WAAW,CAAA;;;AAGG,2BAAA,EAAA,IAAI,CAAC,OAAO,CAAA;;AAEC,wCAAA,EAAA,IAAI,CAAC,aAAa,CAAA;;AAElD,QAAA,EAAA,IAAI,CAAC,kBAAkB,CAAA;AACvB,QAAA,EAAA,IAAI,CAAC,eAAe,CAAA;;AAEP,qBAAA,EAAA,IAAI,CAAC,UAAU,CAAA;AACxB,YAAA,EAAA,IAAI,CAAC,iBAAiB,CAAA;;AAE1B,QAAA,EAAA,IAAI,CAAC,oBAAoB,CAAA;AACzB,QAAA,EAAA,IAAI,CAAC,cAAc,CAAA;;;;;;AAMvB,IAAA,EAAA,IAAI,CAAC,cAAc,CAAA;;;;;;;;;;;;;;QAcjB,CAAC;AACT;;;;"}
|