@seip/bluebird-js 0.1.1 → 0.1.4
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/.vscode/extensions.json +7 -0
- package/.vscode/settings.json +10 -0
- package/AGENTS.md +124 -64
- package/README.md +236 -103
- package/app/routes/web.js +47 -55
- package/app/views/about.jsx +98 -0
- package/app/views/components/Header.jsx +42 -0
- package/app/views/components/LiveCounter.jsx +67 -0
- package/app/views/dashboard.jsx +300 -0
- package/app/views/index.jsx +123 -0
- package/app/views/layouts/main/view.jsx +201 -0
- package/app/views/legal/terms.html +29 -19
- package/app/views/login.jsx +141 -0
- package/core/actions.d.ts +4 -0
- package/core/actions.js +329 -0
- package/core/app.js +129 -22
- package/core/auth.js +1 -1
- package/core/cli/doctor.js +3 -4
- package/core/cli/init.js +153 -6
- package/core/cli/migrate.js +418 -145
- package/core/cli/view.js +76 -11
- package/core/config.js +35 -5
- package/core/csrf.js +1 -1
- package/core/database.js +52 -17
- package/core/debug.js +1 -1
- package/core/html.d.ts +54 -42
- package/core/html.js +473 -217
- package/core/index.d.ts +187 -85
- package/core/jsx.d.ts +38 -0
- package/core/jsx.js +1180 -0
- package/core/model.js +282 -61
- package/core/queue.js +7 -4
- package/core/render-cache.js +212 -212
- package/core/render.d.ts +20 -2
- package/core/render.js +320 -43
- package/core/upload.js +7 -1
- package/core/validate.js +1 -1
- package/core/view-loader.js +341 -19
- package/core/vite.js +1 -1
- package/package.json +9 -3
- package/public/js/bluebird-client.js +2313 -1049
- package/public/js/tailwind.js +8 -0
- package/app/views/about.js +0 -63
- package/app/views/dashboard.js +0 -147
- package/app/views/index.js +0 -80
- package/app/views/layouts/main/view.js +0 -81
- package/app/views/login.js +0 -80
- package/public/css/bluebird.min.css +0 -2
- package/public/js/bluebird.min.js +0 -1073
package/app/views/about.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
-
|
|
3
|
-
export const layout = "main";
|
|
4
|
-
|
|
5
|
-
export const head = () => ({
|
|
6
|
-
title: "About Us — Blue Bird Framework",
|
|
7
|
-
description: "Learn about the architecture and design philosophy of Blue Bird.",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* About page view module.
|
|
12
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
-
*/
|
|
14
|
-
export default function AboutView() {
|
|
15
|
-
return html`
|
|
16
|
-
<section class="hero">
|
|
17
|
-
<h1 class="mt-3 text-gradient font-bold">About Blue Bird</h1>
|
|
18
|
-
<p class="lead">Built for performance, simplicity, and raw speed.</p>
|
|
19
|
-
</section>
|
|
20
|
-
|
|
21
|
-
<article class="mt-6">
|
|
22
|
-
<header>
|
|
23
|
-
<h2 class="text-gradient-blue font-semibold">Our Philosophy</h2>
|
|
24
|
-
</header>
|
|
25
|
-
<p>
|
|
26
|
-
Blue Bird was born out of a desire for a clean, performance-first approach to web development. We
|
|
27
|
-
believe in harnessing the raw power of Express.js and modern Node.js ESM, stripping away unnecessary bloat, and
|
|
28
|
-
providing developers with a robust foundation that just works.
|
|
29
|
-
</p>
|
|
30
|
-
<p>
|
|
31
|
-
By combining server-rendered pure JavaScript HTML modules with vanilla client scripts and native browser View Transitions,
|
|
32
|
-
Blue Bird eliminates heavy compilation pipelines and excessive memory usage.
|
|
33
|
-
</p>
|
|
34
|
-
</article>
|
|
35
|
-
|
|
36
|
-
<div class="px-4 py-4 mb-4">
|
|
37
|
-
<h2 class="text-gradient-blue font-semibold">Why Blue Bird?</h2>
|
|
38
|
-
|
|
39
|
-
<div class="grid cols-2 gap-4">
|
|
40
|
-
<div>
|
|
41
|
-
<details open>
|
|
42
|
-
<summary>Production Ready</summary>
|
|
43
|
-
<p>Seamless transition from development to production with PM2 clustering, systemd, and high performance multi-level caching.</p>
|
|
44
|
-
</details>
|
|
45
|
-
<details open>
|
|
46
|
-
<summary>Military Grade Security</summary>
|
|
47
|
-
<p>Built-in AES-256-GCM JWT encryption, secure HttpOnly cookie sessions, security headers, and rate limiting.</p>
|
|
48
|
-
</details>
|
|
49
|
-
</div>
|
|
50
|
-
<div>
|
|
51
|
-
<details open>
|
|
52
|
-
<summary>Multi-Tier Caching</summary>
|
|
53
|
-
<p>In-memory LRU, Redis clustering, and persistent file caching for maximum requests per second with minimum CPU usage.</p>
|
|
54
|
-
</details>
|
|
55
|
-
<details open>
|
|
56
|
-
<summary>Pure Modern JavaScript</summary>
|
|
57
|
-
<p>No heavy build steps or complex toolchains. Modern ESM templates and inline vanilla scripts executed cleanly in the browser.</p>
|
|
58
|
-
</details>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
`;
|
|
63
|
-
}
|
package/app/views/dashboard.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { html, script } from "@seip/bluebird-js/core/html.js";
|
|
2
|
-
|
|
3
|
-
export const layout = "main";
|
|
4
|
-
|
|
5
|
-
export const head = (data) => ({
|
|
6
|
-
title: `Dashboard — ${data.user?.name || "Member"}`,
|
|
7
|
-
description: "Protected member dashboard for Blue Bird framework.",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Dashboard page view module.
|
|
12
|
-
* @param {Object} props
|
|
13
|
-
* @param {Object} props.user
|
|
14
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
15
|
-
*/
|
|
16
|
-
export default function DashboardView({ user = {} }) {
|
|
17
|
-
const initialCount = 7;
|
|
18
|
-
|
|
19
|
-
return html`
|
|
20
|
-
<section class="hero">
|
|
21
|
-
<h1 class="mt-3 text-gradient font-bold">Protected Dashboard</h1>
|
|
22
|
-
<p class="lead">You are securely authenticated via <strong>Auth.protect()</strong> middleware.</p>
|
|
23
|
-
</section>
|
|
24
|
-
|
|
25
|
-
<div class="mt-6">
|
|
26
|
-
<div class="alert alert-success mb-6">
|
|
27
|
-
<div>
|
|
28
|
-
<strong class="alert-title">Active Protected Session</strong>
|
|
29
|
-
<p class="alert-description">
|
|
30
|
-
This route was rendered on-demand with fresh session data via <code>Render.send(res, "dashboard", ...)</code>, bypassing view caching completely.
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<article class="card">
|
|
36
|
-
<header class="card-header">
|
|
37
|
-
<div class="flex items-center justify-between">
|
|
38
|
-
<div>
|
|
39
|
-
<h3 class="card-title">User Profile</h3>
|
|
40
|
-
<p class="card-description">Decoded JWT payload stored in <code>req.user</code>.</p>
|
|
41
|
-
</div>
|
|
42
|
-
<span class="badge badge-success badge-glow">Active Session</span>
|
|
43
|
-
</div>
|
|
44
|
-
</header>
|
|
45
|
-
|
|
46
|
-
<div class="grid cols-2 gap-4 mt-4">
|
|
47
|
-
<div class="card bg-secondary">
|
|
48
|
-
<small class="text-muted uppercase font-bold tracking-wider">User Name</small>
|
|
49
|
-
<h4 class="font-bold text-lg mt-1">${user.name || "Anonymous"}</h4>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="card bg-secondary">
|
|
52
|
-
<small class="text-muted uppercase font-bold tracking-wider">Email Address</small>
|
|
53
|
-
<h4 class="font-bold text-lg mt-1">${user.email || "user@example.com"}</h4>
|
|
54
|
-
</div>
|
|
55
|
-
<div class="card bg-secondary">
|
|
56
|
-
<small class="text-muted uppercase font-bold tracking-wider">Account Role</small>
|
|
57
|
-
<p class="mt-1"><span class="badge badge-primary">${user.role || "user"}</span></p>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="card bg-secondary">
|
|
60
|
-
<small class="text-muted uppercase font-bold tracking-wider">Session Identifier</small>
|
|
61
|
-
<p class="mt-1 font-mono text-xs"><code>${user._sessionId || "sess_active"}</code></p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<footer class="card-footer mt-6">
|
|
66
|
-
<a href="/logout" data-no-prefetch="true" role="button" class="destructive">Sign Out →</a>
|
|
67
|
-
<div class="flex items-center gap-2">
|
|
68
|
-
<a href="/about" role="button" class="outline">Test Transition to /about</a>
|
|
69
|
-
<a href="/" role="button" class="outline">Test Transition to /</a>
|
|
70
|
-
</div>
|
|
71
|
-
</footer>
|
|
72
|
-
</article>
|
|
73
|
-
|
|
74
|
-
<article class="card mt-6">
|
|
75
|
-
<header class="card-header">
|
|
76
|
-
<div class="flex items-center justify-between">
|
|
77
|
-
<div>
|
|
78
|
-
<h3 class="card-title">Vanilla Interactive Controls</h3>
|
|
79
|
-
<p class="card-description">Simple native inline script with zero framework overhead.</p>
|
|
80
|
-
</div>
|
|
81
|
-
<span class="badge badge-primary pulse-badge">Live Interactive</span>
|
|
82
|
-
</div>
|
|
83
|
-
</header>
|
|
84
|
-
|
|
85
|
-
<div class="mt-4">
|
|
86
|
-
<p class="text-sm">Click the buttons below to interact without page reloads:</p>
|
|
87
|
-
|
|
88
|
-
<div class="flex items-center gap-4 mt-3">
|
|
89
|
-
<button id="btnDec" type="button" class="btn-sm outline">− Decrement</button>
|
|
90
|
-
<span id="counterVal" class="font-mono text-2xl font-bold px-3 py-1 bg-secondary rounded">${initialCount}</span>
|
|
91
|
-
<button id="btnInc" type="button" class="btn-sm outline">+ Increment</button>
|
|
92
|
-
<button id="btnReset" type="button" class="btn-sm destructive">Reset</button>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div class="mt-6">
|
|
96
|
-
<label for="filterQuery" class="text-sm font-semibold">Live Input Demo:</label>
|
|
97
|
-
<input type="text" id="filterQuery" placeholder="Type here to test live vanilla event handling..." class="mt-2" />
|
|
98
|
-
<p id="summaryText" class="text-sm text-muted mt-2">Type in the field above to test live event listening.</p>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</article>
|
|
102
|
-
|
|
103
|
-
<script>
|
|
104
|
-
let count = ${initialCount};
|
|
105
|
-
const valEl = document.getElementById("counterVal");
|
|
106
|
-
const incBtn = document.getElementById("btnInc");
|
|
107
|
-
const decBtn = document.getElementById("btnDec");
|
|
108
|
-
const resetBtn = document.getElementById("btnReset");
|
|
109
|
-
const queryInput = document.getElementById("filterQuery");
|
|
110
|
-
const summaryEl = document.getElementById("summaryText");
|
|
111
|
-
|
|
112
|
-
const update = () => { if (valEl) valEl.textContent = String(count); };
|
|
113
|
-
incBtn?.addEventListener("click", () => { count++; update(); });
|
|
114
|
-
decBtn?.addEventListener("click", () => { if (count > 0) count--; update(); });
|
|
115
|
-
resetBtn?.addEventListener("click", () => { count = 0; update(); });
|
|
116
|
-
|
|
117
|
-
queryInput?.addEventListener("input", (e) => {
|
|
118
|
-
if (summaryEl) {
|
|
119
|
-
summaryEl.textContent = e.target.value
|
|
120
|
-
? "Active input: " + e.target.value
|
|
121
|
-
: "Type in the field above to test live event listening.";
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<article class="mt-6">
|
|
127
|
-
<header>
|
|
128
|
-
<h4 class="font-bold">Transition & Middleware Diagnostics</h4>
|
|
129
|
-
</header>
|
|
130
|
-
<div class="grid cols-3 gap-4 mt-4">
|
|
131
|
-
<div class="card">
|
|
132
|
-
<h5 class="font-bold mb-1">Stateful Navigation</h5>
|
|
133
|
-
<p class="text-sm">Click links between Home, About, and Dashboard. Notice how the View Transitions API animates without page refreshes while preserving session cookies.</p>
|
|
134
|
-
</div>
|
|
135
|
-
<div class="card">
|
|
136
|
-
<h5 class="font-bold mb-1">Zero Cache On Dashboard</h5>
|
|
137
|
-
<p class="text-sm">Response header <code>X-Bluebird-Cache: MISS</code> is returned, verifying that user-sensitive data is never statically cached.</p>
|
|
138
|
-
</div>
|
|
139
|
-
<div class="card">
|
|
140
|
-
<h5 class="font-bold mb-1">Automatic Revocation</h5>
|
|
141
|
-
<p class="text-sm">Clicking "Sign Out" revokes the session in memory/Redis and clears the HttpOnly cookie, blocking subsequent dashboard visits.</p>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</article>
|
|
145
|
-
</div>
|
|
146
|
-
`;
|
|
147
|
-
}
|
package/app/views/index.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
-
|
|
3
|
-
export const layout = "main";
|
|
4
|
-
|
|
5
|
-
export const head = () => ({
|
|
6
|
-
title: "Blue Bird Framework — High Performance Web Framework",
|
|
7
|
-
description: "Fast, structured, and opinionated Express.js framework for visual elegance and performance.",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Home page view module.
|
|
12
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
-
*/
|
|
14
|
-
export default function IndexView() {
|
|
15
|
-
return html`
|
|
16
|
-
<section class="hero">
|
|
17
|
-
<h1 class="mt-3 text-gradient font-bold">Hello, Developer!</h1>
|
|
18
|
-
<p class="lead">
|
|
19
|
-
Blue Bird is a fast, structured, and opinionated Express.js framework for developers who want
|
|
20
|
-
visual elegance and performance with raw HTML and modern JavaScript.
|
|
21
|
-
</p>
|
|
22
|
-
<div class="hero-actions">
|
|
23
|
-
<a href="/about" role="button">About Us →</a>
|
|
24
|
-
<a href="https://github.com/seip25/bluebird-js" target="_blank" role="button" class="outline">GitHub</a>
|
|
25
|
-
</div>
|
|
26
|
-
</section>
|
|
27
|
-
|
|
28
|
-
<div class="mt-8">
|
|
29
|
-
<div class="grid cols-3 gap-4">
|
|
30
|
-
<article class="hover-glow">
|
|
31
|
-
<header>
|
|
32
|
-
<span class="badge badge-primary mb-2">Rendering</span>
|
|
33
|
-
<h3 class="text-gradient-blue">Zero-Build JS Views</h3>
|
|
34
|
-
</header>
|
|
35
|
-
<p>Direct tagged template literal rendering (html\`...\`) with automatic XSS escaping, nested layouts, and multi-tier caching.</p>
|
|
36
|
-
</article>
|
|
37
|
-
|
|
38
|
-
<article class="hover-glow">
|
|
39
|
-
<header>
|
|
40
|
-
<span class="badge badge-primary mb-2">Performance</span>
|
|
41
|
-
<h3 class="text-gradient-blue">Multi-Tier Caching</h3>
|
|
42
|
-
</header>
|
|
43
|
-
<p>Configurable TTL caching. Rendered pages and fragments are stored in L1 RAM LRU, L2 Redis, or L3 persistent file cache.</p>
|
|
44
|
-
</article>
|
|
45
|
-
|
|
46
|
-
<article class="hover-glow">
|
|
47
|
-
<header>
|
|
48
|
-
<span class="badge badge-primary mb-2">Security</span>
|
|
49
|
-
<h3 class="text-gradient-blue">JWT & Route Security</h3>
|
|
50
|
-
</header>
|
|
51
|
-
<p>Secure cookie management, GCM-encrypted JWT tokens, custom security headers, and route rate limiting built-in.</p>
|
|
52
|
-
</article>
|
|
53
|
-
|
|
54
|
-
<article class="hover-glow">
|
|
55
|
-
<header>
|
|
56
|
-
<span class="badge badge-primary mb-2">Database</span>
|
|
57
|
-
<h3 class="text-gradient-blue">Unified DB Layer</h3>
|
|
58
|
-
</header>
|
|
59
|
-
<p>Built-in support for SQLite (native node:sqlite with WAL), MySQL, and PostgreSQL with connection pooling and caching.</p>
|
|
60
|
-
</article>
|
|
61
|
-
|
|
62
|
-
<article class="hover-glow">
|
|
63
|
-
<header>
|
|
64
|
-
<span class="badge badge-primary mb-2">DevOps</span>
|
|
65
|
-
<h3 class="text-gradient-blue">Production Ready</h3>
|
|
66
|
-
</header>
|
|
67
|
-
<p>Production cluster orchestration with PM2, native health checks, and smooth View Transitions SPA navigation.</p>
|
|
68
|
-
</article>
|
|
69
|
-
|
|
70
|
-
<article class="hover-glow">
|
|
71
|
-
<header>
|
|
72
|
-
<span class="badge badge-primary mb-2">Design</span>
|
|
73
|
-
<h3 class="text-gradient-blue">Pure Semantic CSS</h3>
|
|
74
|
-
</header>
|
|
75
|
-
<p>Clean semantic markup styled by <a href="https://seip25.github.io/Blue-bird-css/" target="_blank">Blue Bird CSS</a> with zero node compile steps.</p>
|
|
76
|
-
</article>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
`;
|
|
80
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Shared application layout for Bluebird.js.
|
|
5
|
-
* Provides the global HTML shell, header navigation, aside menu, and footer.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} context
|
|
8
|
-
* @param {import('@seip/bluebird-js/core/html.js').SafeHtml} context.body - Main content rendered by the view.
|
|
9
|
-
* @param {Object} context.head - Head metadata (title, description, canonical, etc.).
|
|
10
|
-
* @param {Object} context.ctx - Request context ({ req, res, user, locals }).
|
|
11
|
-
* @param {Object} context.data - View data props.
|
|
12
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
-
*/
|
|
14
|
-
export default function MainLayout({ body, head = {}, ctx = {} }) {
|
|
15
|
-
const currentPath = ctx.req?.path || "/";
|
|
16
|
-
const user = ctx.user || ctx.req?.user;
|
|
17
|
-
|
|
18
|
-
const isActive = (path) =>
|
|
19
|
-
currentPath === path ? "active badge badge-glow px-3 py-3" : "";
|
|
20
|
-
|
|
21
|
-
return html`<!DOCTYPE html>
|
|
22
|
-
<html lang="en" data-theme="dark">
|
|
23
|
-
<head>
|
|
24
|
-
<meta charset="UTF-8" />
|
|
25
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
26
|
-
<title>${head.title || "Blue Bird Framework"}</title>
|
|
27
|
-
<link rel="canonical" href="${head.canonical || "https://seip25.github.io/Blue-bird/"}" />
|
|
28
|
-
<meta name="description" content="${head.description || "Blue Bird is a fast, structured, and opinionated Express.js framework for developers who want visual elegance and performance with raw HTML and CSS."}" />
|
|
29
|
-
<meta name="keywords" content="${head.keywords || "Blue Bird, Express.js, Node.js, Semantic CSS, Performance, Nginx, Redis"}" />
|
|
30
|
-
<meta name="author" content="Seip25" />
|
|
31
|
-
<link rel="icon" href="/images/favicon.ico" />
|
|
32
|
-
<link rel="stylesheet" href="/css/bluebird.min.css" />
|
|
33
|
-
<script src="/js/bluebird-client.js" defer></script>
|
|
34
|
-
</head>
|
|
35
|
-
<body data-layout="main">
|
|
36
|
-
<header>
|
|
37
|
-
<nav>
|
|
38
|
-
<a href="/" class="flex items-center gap-2">
|
|
39
|
-
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-blue">
|
|
40
|
-
<path d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
|
|
41
|
-
</svg>
|
|
42
|
-
<strong class="text-xl text-gradient">Blue Bird</strong>
|
|
43
|
-
</a>
|
|
44
|
-
</nav>
|
|
45
|
-
</header>
|
|
46
|
-
|
|
47
|
-
<main data-bb-outlet="true">
|
|
48
|
-
<aside>
|
|
49
|
-
<h4>Menu</h4>
|
|
50
|
-
<a href="/" class="${isActive("/")}">Home</a>
|
|
51
|
-
<a href="/about" class="${isActive("/about")}">About</a>
|
|
52
|
-
<a href="/login" class="${isActive("/login")}">Login</a>
|
|
53
|
-
<a href="/dashboard" class="${isActive("/dashboard")}">Dashboard</a>
|
|
54
|
-
<a href="https://seip25.github.io/Blue-bird" target="_blank">Blue bird</a>
|
|
55
|
-
<a href="https://seip25.github.io/Blue-bird-css/" target="_blank">Blue Bird CSS</a>
|
|
56
|
-
${user
|
|
57
|
-
? html`<a href="/logout" data-no-prefetch="true" role="button" class="btn-sm destructive mt-4">Sign Out</a>`
|
|
58
|
-
: html`<a href="https://github.com/seip25/bluebird-js" target="_blank" role="button" class="btn-sm outline">GitHub</a>`}
|
|
59
|
-
</aside>
|
|
60
|
-
|
|
61
|
-
<div class="page-content">
|
|
62
|
-
${body}
|
|
63
|
-
</div>
|
|
64
|
-
</main>
|
|
65
|
-
|
|
66
|
-
<footer>
|
|
67
|
-
<div class="footer-content">
|
|
68
|
-
<p>Powered by <strong class="text-gradient">Blue Bird Framework</strong>
|
|
69
|
-
</p>
|
|
70
|
-
<div class="lang-switcher">
|
|
71
|
-
<a href="/" class="lang-link">Home</a>
|
|
72
|
-
<a href="/about" class="lang-link">About</a>
|
|
73
|
-
<a href="/login" class="lang-link">Login</a>
|
|
74
|
-
<a href="/dashboard" class="lang-link">Dashboard</a>
|
|
75
|
-
<a href="https://github.com/seip25/bluebird-js" target="_blank" class="github-star mt-2">★ GitHub</a>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</footer>
|
|
79
|
-
</body>
|
|
80
|
-
</html>`;
|
|
81
|
-
}
|
package/app/views/login.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { html, script } from "@seip/bluebird-js/core/html.js";
|
|
2
|
-
|
|
3
|
-
export const layout = "main";
|
|
4
|
-
|
|
5
|
-
export const head = () => ({
|
|
6
|
-
title: "Sign In — Blue Bird Framework",
|
|
7
|
-
description: "Test native JWT authentication, encrypted cookies, and protected routes.",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Login page view module.
|
|
12
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
-
*/
|
|
14
|
-
export default function LoginView() {
|
|
15
|
-
return html`
|
|
16
|
-
<section class="hero">
|
|
17
|
-
<h1 class="mt-3 text-gradient font-bold">Authentication Demo</h1>
|
|
18
|
-
<p class="lead">Test native AES-256-GCM JWT auth cookies, Auth.protect middleware, and seamless View Transitions.</p>
|
|
19
|
-
</section>
|
|
20
|
-
|
|
21
|
-
<div class="mt-6">
|
|
22
|
-
<div class="alert alert-info mb-6">
|
|
23
|
-
<div>
|
|
24
|
-
<strong class="alert-title">Interactive Auth Testing</strong>
|
|
25
|
-
<p class="alert-description">
|
|
26
|
-
Submit credentials below to generate an encrypted JWT session cookie with <code>Auth.login(res, user)</code>.
|
|
27
|
-
Try visiting <strong>/dashboard</strong> directly before and after logging in to verify the <code>Auth.protect({ redirect: "/login" })</code> middleware!
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<article class="card">
|
|
33
|
-
<header class="card-header">
|
|
34
|
-
<h3 class="card-title">Sign In</h3>
|
|
35
|
-
<p class="card-description">Enter your test credentials below to start a secure session.</p>
|
|
36
|
-
</header>
|
|
37
|
-
|
|
38
|
-
<form action="/login" method="POST" id="loginForm">
|
|
39
|
-
<label for="email">Email Address</label>
|
|
40
|
-
<input type="email" id="email" name="email" value="alex@example.com" placeholder="alex@example.com" required />
|
|
41
|
-
|
|
42
|
-
<label for="password">Password</label>
|
|
43
|
-
<input type="password" id="password" name="password" value="password123" placeholder="••••••••" required />
|
|
44
|
-
|
|
45
|
-
<div class="flex items-center justify-between gap-4 mt-6">
|
|
46
|
-
<button type="submit" id="submitBtn" class="glow-blue">Sign In →</button>
|
|
47
|
-
<a href="/dashboard" role="button" class="outline">Try /dashboard (Protected)</a>
|
|
48
|
-
</div>
|
|
49
|
-
</form>
|
|
50
|
-
</article>
|
|
51
|
-
|
|
52
|
-
<article class="mt-6">
|
|
53
|
-
<header>
|
|
54
|
-
<h4 class="font-bold">What is being tested here?</h4>
|
|
55
|
-
</header>
|
|
56
|
-
<div class="grid cols-2 gap-4 mt-4">
|
|
57
|
-
<div class="card">
|
|
58
|
-
<h5 class="font-bold mb-2">1. Auth.protect Middleware</h5>
|
|
59
|
-
<p class="text-sm">When an unauthenticated client requests <code>/dashboard</code>, the server issues a 302 redirect to <code>/login</code>. The client router automatically follows the transition smoothly.</p>
|
|
60
|
-
</div>
|
|
61
|
-
<div class="card">
|
|
62
|
-
<h5 class="font-bold mb-2">2. Encrypted JWT Cookies</h5>
|
|
63
|
-
<p class="text-sm">Session cookies are encrypted with AES-256-GCM and marked HttpOnly and SameSite=Lax to protect against token exfiltration.</p>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</article>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<script>
|
|
70
|
-
const form = document.getElementById("loginForm");
|
|
71
|
-
const btn = document.getElementById("submitBtn");
|
|
72
|
-
form?.addEventListener("submit", () => {
|
|
73
|
-
if (btn) {
|
|
74
|
-
btn.textContent = "Signing In...";
|
|
75
|
-
btn.setAttribute("disabled", "true");
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
</script>
|
|
79
|
-
`;
|
|
80
|
-
}
|