diff --git a/content b/content index 24c5961..94bd7ac 160000 --- a/content +++ b/content @@ -1 +1 @@ -Subproject commit 24c59612706489d6e41bed7c087ccc716f9db2e0 +Subproject commit 94bd7aca98671d668ceee710b9509e7ac058f534 diff --git a/public/css/styles.css b/public/css/styles.css index d57e4fe..75ef772 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -29,6 +29,12 @@ position: relative; z-index: 1; } +.hide { + display: none; +} +.inline { + display: inline +} footer { background-color: #34495e; color: #ecf0f1; @@ -110,6 +116,12 @@ font-size: 0.85em; color: #777; } +footer small { + color: #666; font-size: 10px; opacity: 0.3; +} +footer small a { + color: inherit +} /* Header */ header#site-header { background-color: #2c3e50; @@ -118,13 +130,6 @@ position:relative; z-index: 10; } -/* header#site-header .container { - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 0.5rem; - padding: 1rem 0; -} */ header#site-header .container { max-width: 800px; margin: 0 auto; @@ -282,6 +287,11 @@ background-color: white; min-width: 160px; box-shadow: 0px 8px 16px rgba(0,0,0,0.2); + + flex-direction: column; + white-space: nowrap; + left: 0; + top: 100%; } nav.site-nav .dropdown-content a { display: block; @@ -295,9 +305,6 @@ color: #ecf0f1; background-color: #34495e; /* Match the main nav hover color */ } -nav.site-nav .dropdown:hover .dropdown-content { - display: block; -} header#site-header .menu-toggle { display: none; background: none; @@ -327,6 +334,23 @@ top: 1rem; bottom: 1rem; } +nav.site-nav .dropdown-content .dropdown-content { + top: 0; + left: 100%; /* shift nested submenu to the right */ + margin-left: 0.2rem; /* small gap */ + min-width: 160px; + z-index: 12; +} +nav.site-nav .dropdown-content .dropdown:hover > .dropdown-content { + display: block; +} +nav.site-nav > .dropdown:hover > .dropdown-content { + display: block; +} +/* Only show direct submenu of nested dropdowns */ +nav.site-nav .dropdown-content > .dropdown:hover > .dropdown-content { + display: block; +} /* Reset */ * { margin: 0; @@ -391,7 +415,6 @@ display: block; margin-bottom: 0.3em; } -/* Enhanced TOC Styles */ .toc { background: #f8f9fa; border: 1px solid #e9ecef; @@ -416,7 +439,7 @@ max-height: none; overflow-y: auto; } -/* Custom Scrollbar - Subtle and Non-intrusive */ +/* Scrollbar */ .toc::-webkit-scrollbar { width: 6px; } diff --git a/public/styles.css b/public/styles.css new file mode 100644 index 0000000..a8db40c --- /dev/null +++ b/public/styles.css @@ -0,0 +1,826 @@ +/* Base styles */ +html, body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + background-color: #f8f9fa; + color: #212529; + min-height: 100vh; + line-height: 1.6; +} +/* Container utility */ +.container { + max-width: 800px; + margin: 0 auto; + padding: 1rem 1.5rem; +} +.pattern-dots { + position: relative; + background-image: radial-gradient(circle, rgba(0,0,0,0.07) 1px, transparent 1px); + background-size: 15px 15px; + z-index: 0; +} +.pattern-dots::after { + content: ""; + pointer-events: none; + position: absolute; + inset: 0; + background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 90%); +} +.pattern-dots > * { + position: relative; + z-index: 1; +} +.hide { + display: none; +} +.inline { + display: inline +} +footer { + background-color: #34495e; + color: #ecf0f1; + padding: 2rem 0; + text-align: center; + border-top: none; + box-shadow: 0 -2px 5px rgba(0,0,0,0.1); + font-size: 0.9rem; +} +footer .container { + display: flex; + flex-direction: column; + align-items: center; + gap: 1rem; +} +footer p { + font-size: 0.85rem; + color: #bdc3c7; + line-height: 1.5; + margin: 0; + max-width: 600px; +} +footer p a { + color: #9bd3ff; + text-decoration: none; + transition: color 0.2s ease-in-out; +} +footer p a:hover { + color: #ecf0f1; + text-decoration: underline; +} +footer img { + vertical-align: middle; + margin-left: 0.5rem; + opacity: 0.8; + transition: opacity 0.2s ease-in-out; +} +footer img:hover { + opacity: 1; +} +footer nav { + margin-top: 0; + margin-bottom: 0; + display: flex; + gap: 1.5rem; + justify-content: center; + flex-wrap: wrap; +} +footer nav p { + margin: 0; + +} +footer .social-contact { + display: flex; + gap: 1rem; + flex-wrap: wrap; + justify-content: center; + margin-top: 1rem; +} +footer .social-contact p { + margin: 0; + font-size: 1rem; + font-weight: 600; +} +footer .social-contact p img, +footer .social-contact p svg { + vertical-align: middle; + margin: 0 0.25rem; + width: 24px; + height: 24px; + opacity: 0.9; + transition: opacity 0.2s ease-in-out; +} +footer .social-contact p img:hover, +footer .social-contact p svg:hover { + opacity: 1; +} +.xml-sitemap-link { + font-size: 0.85em; + color: #777; +} +footer small { + color: #666; font-size: 10px; opacity: 0.3; +} +footer small a { + color: inherit +} +/* Header */ +header#site-header { + background-color: #2c3e50; + color: #ecf0f1; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); + position:relative; + z-index: 10; +} +header#site-header .container { + max-width: 800px; + margin: 0 auto; + padding: 1rem 1.5rem; + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 0.5rem; + position: relative; +} +/* Logo section - positioned above nav */ +header#site-header .logo { + display: flex; + align-items: center; + font-size: 1.8rem; + font-weight: bolder; + position: relative; + text-decoration: none; + color: inherit; + gap: 1rem; + margin-left: 10px; + padding-left: 64px; /* Space for the icon */ +} +header#site-header .site-title { + color: inherit; + text-decoration: none; + position: relative; + display: inline-block; +} +header#site-header .site-title, a { + color: inherit; + text-decoration: none; + position: relative; + display: inline-block; +} +header#site-header .site-title a::after { + content: ""; + position: absolute; + left: 0; + bottom: -2px; + width: 100%; + height: 2px; + background-color: #ecf0f1; + transform: scaleX(0); + transform-origin: left; + transition: transform 0.3s ease; +} +header#site-header .site-title a:hover::after { + transform: scaleX(1); +} +.pattern-lambda { + background-image: + repeating-linear-gradient( + 45deg, + transparent, + transparent 50px, + rgba(236, 240, 241, 0.08) 50px, + rgba(236, 240, 241, 0.08) 52px + ); + position: relative; +} +.pattern-lambda::before { + content: '> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >'; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + font-size: 2rem; + color: rgba(236, 240, 241, 0.05); + letter-spacing: 2rem; + line-height: 3rem; + overflow: hidden; + pointer-events: none; +} +/* Main content */ +main.container { + flex: 1; + background-color: #ffffff; + padding: 2rem; + border-radius: 6px; + box-shadow: 0 2px 6px rgba(0,0,0,0.05); +} +main h1 { + font-size: 1.5rem; + font-weight: 600; + margin-bottom: 1rem; + border-bottom: 2px solid #2c3e50; + padding-bottom: 0.3rem; +} +main article p { + font-size: 1rem; + color: #444; +} +main { + padding: 1rem; +} +.layout { + display: flex; + align-items: flex-start; + max-width: 1200px; + margin: 2rem auto; + padding: 0 1.5rem; + gap: 2rem; +} +header#site-header nav.site-nav { + display: flex; + gap: 1rem; + position: relative; + z-index: 10; +} +header#site-header nav.site-nav a, +nav.site-nav .dropdown-content form button { + text-decoration: none; + font-weight: 600; + padding: 0.3rem 0.6rem; + border-radius: 3px; + transition: background-color 0.2s ease-in-out; +} +nav.site-nav .dropdown-content form button { + all: unset; + display: block; + width: 100%; + padding: 0.3rem 0.6rem; + color: #2c3e50; + cursor: pointer; + font: inherit; + font-weight: 600; /* Match the link font weight */ + text-align: left; + user-select: none; + box-sizing: border-box; +} +header#site-header nav.site-nav > a { + color: #ecf0f1; +} +header#site-header nav.site-nav a:hover, +header#site-header nav.site-nav a:focus, +nav.site-nav .dropdown-content form button:hover, +nav.site-nav .dropdown-content form button:focus { + background-color: #34495e; +} +nav.site-nav .dropdown { + position: relative; + display: block; + z-index: 11; +} +nav.site-nav .dropbtn { + display: inline-block; + cursor: pointer; +} +nav.site-nav .dropdown-content { + z-index: 11; + display: none; + position: absolute; + background-color: white; + min-width: 160px; + box-shadow: 0px 8px 16px rgba(0,0,0,0.2); + + flex-direction: column; + white-space: nowrap; + left: 0; + top: 100%; +} +nav.site-nav .dropdown-content a { + display: block; + padding: 0.3rem 0.6rem; + text-decoration: none; + color: #2c3e50; + font-weight: 600; /* Match the button font weight */ +} +nav.site-nav .dropdown-content a:hover, +nav.site-nav .dropdown-content form button:hover { + color: #ecf0f1; + background-color: #34495e; /* Match the main nav hover color */ +} +nav.site-nav .dropdown:hover .dropdown-content { + display: block; +} +header#site-header .menu-toggle { + display: none; + background: none; + border: none; + font-size: 1.5em; + padding: 0.5em; +} +nav.site-nav .dropdown-content form { + margin: 0; +} +/* Navigation row with consistent left alignment */ +.nav-row { + display: flex; + align-items: center; + gap: 1rem; + width: 100%; + padding-left: 64px; /* Same as icon width + gap to align with site title */ +} +/* Logo icon that acts as home link - spans from site title to nav */ +.nav-logo { + text-decoration: none; + color: inherit; + display: flex; + align-items: flex-end; + position: absolute; + left: 1rem; + top: 1rem; + bottom: 1rem; +} +/* Nested dropdowns */ +nav.site-nav .dropdown-content .dropdown { + position: relative; /* make container relative for nested absolute */ +} +nav.site-nav .dropdown-content .dropdown-content { + top: 0; + left: 100%; /* shift nested submenu to the right */ + margin-left: 0.2rem; /* small gap */ + min-width: 160px; + z-index: 12; +} +nav.site-nav .dropdown:hover > .dropdown-content { + display: block; +} +nav.site-nav .dropdown-content .dropdown:hover > .dropdown-content { + display: block; +} +/* Reset */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} +.sidebar { + width: 250px; + background-color: #f8f9fa; + border-right: 1px solid #e0e0e0; + padding: 1em; + font-size: 0.95rem; + font-family: Arial, sans-serif; + box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05); + position: relative; +} +/* Apply to all lists */ +.sidebar nav ul { + list-style: none; + padding-left: 0; +} +.sidebar h4.month-label, +.sidebar a.post-label { + text-transform: capitalize !important; +} +.sidebar .menu-year { + font-weight: 700; + font-size: 1.2rem; + color: #333333; + margin-bottom: 1rem; + border-bottom: 2px solid #2c3e50; + padding-bottom: 0.5rem; + text-transform: uppercase; + letter-spacing: 1px; +} +.sidebar .menu-month { + margin-bottom: 1rem; + font-weight: 600; + color: #555555; +} +.sidebar .menu-month ul.posts-list { + list-style: none; + padding-left: 1rem; + margin-top: 0.3rem; +} +.sidebar .menu-month li.post-label a { + color: #2c3e50; + text-decoration: none; + display: block; + padding: 0.2rem 0; + transition: color 0.2s ease-in-out; +} +.sidebar .menu-month li.post-label a:hover { + color: #1a73e8; + text-decoration: underline; +} +.sidebar .menu-year { + margin-bottom: 1em; +} +.sidebar .month-label { + font-weight: normal; + display: block; + margin-bottom: 0.3em; +} +.toc { + background: #f8f9fa; + border: 1px solid #e9ecef; + border-radius: 8px; + box-sizing: border-box; + margin-bottom: 1em; + padding: 1.5em; + transition: all 0.3s ease; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); +} +.toc.sticky { + position: fixed; + top: 20px; + z-index: 1000; + max-height: calc(100vh - 40px); + overflow-y: auto; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); + border-color: #dee2e6; +} +.toc.sticky.bottom-boundary { + position: fixed; + max-height: none; + overflow-y: auto; +} +/* Scrollbar */ +.toc::-webkit-scrollbar { + width: 6px; +} +.toc::-webkit-scrollbar-track { + background: transparent; + border-radius: 3px; +} +.toc::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.2); + border-radius: 3px; + transition: background 0.3s ease; +} +.toc::-webkit-scrollbar-thumb:hover { + background: rgba(0, 0, 0, 0.4); +} +/* Firefox Scrollbar */ +.toc { + scrollbar-width: thin; + scrollbar-color: rgba(0, 0, 0, 0.2) transparent; +} +/* TOC Content Styles */ +.toc ul { + list-style: none; + padding: 0; + margin: 0; +} +.toc li { + margin: 0.5rem 0; + position: relative; +} +.toc li.h3 { + margin-left: 1rem; + font-size: 0.9rem; +} +.toc a { + display: block; + padding: 0.5rem 0.75rem; + text-decoration: none; + color: #495057; + border-radius: 4px; + transition: all 0.2s ease; + border-left: 3px solid transparent; + word-wrap: break-word; + line-height: 1.4; +} +.toc a:hover { + background-color: #e9ecef; + color: #2c3e50; + border-left-color: #007bff; + transform: translateX(2px); +} +.toc a:focus { + outline: 2px solid #007bff; + outline-offset: 2px; +} +/* Active link highlighting */ +.toc a.active { + background-color: #e3f2fd; + color: #1976d2; + border-left-color: #1976d2; + font-weight: 600; +} +.toc-header { + font-weight: 700; + font-size: 1.1rem; + margin-bottom: 1rem; + color: #2c3e50; + border-bottom: 2px solid #dee2e6; + padding-bottom: 0.5rem; + text-transform: uppercase; + letter-spacing: 0.5px; +} +/* Ensure proper spacing between sidebar sections */ +.sidebar nav > * + .toc { + margin-top: 2rem; + border-top: 1px solid #dee2e6; + padding-top: 1.5rem; +} +/* Animation for smooth transitions */ +.toc { + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); +} +.toc.sticky { + animation: slideInSticky 0.3s ease-out; +} +@keyframes slideInSticky { + from { + opacity: 0; + transform: translateY(-10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} +@media (max-width: 600px) { + main { + padding: 1rem 0.5rem; + } + footer .container { + padding: 1.5rem; + } + footer p { + font-size: 0.8rem; + } + .toc { + padding: 1rem; + margin-bottom: 1.5rem; + } + + .toc-header { + font-size: 1rem; + } + + .toc a { + padding: 0.4rem 0.5rem; + font-size: 0.9rem; + } + + .toc li.h3 { + margin-left: 0.5rem; + } +} +@media (max-width: 900px) { + main { + margin-left: 0; + margin-left: 200px; + } + main.container { + margin: 0; + } + .layout { + flex-direction: column; + } + .toc.sticky { + position: relative; + top: auto; + left: auto; + width: auto !important; + max-height: 300px; + z-index: auto; + } +} +/* Navigation adjustments for small screens */ +@media (max-width: 768px) { + .layout { + flex-direction: column; + } + .sidebar { + width: 100%; + } + header#site-header .container { + flex-direction: column; + align-items: flex-start; + gap: 0.5rem; + } + + header#site-header nav.site-nav { + flex-direction: column; + gap: 0; + position: unset; + top: 3em; + left: 0; + + width: 100%; + height: auto; + float: none; + padding: 0.5rem; + border-bottom: 1px solid #444; + + text-align: left; + } + header#site-header nav.site-nav.hide { + display: none; + } + header#site-header #siteNav.hide a { + display: none; + } + nav.site-nav { + flex-direction: column; + gap: 0; + width: 100%; + } + .nav-row { + flex-direction: column; + align-items: flex-start; + width: 100%; + padding-left: 0; + } + .nav-logo { + position: relative; + left: 0; + margin-bottom: 0.5rem; + } + nav.site-nav ul { + display: block; + justify-content: center; + flex-wrap: wrap; + gap: 1rem; + padding: 0.5rem 0; + margin: 0; + list-style: none; + } + nav.site-nav ul li { + margin: 0.25rem 0; + border: none; + } + nav.site-nav ul li a { + padding: 0.5rem 1rem; + display: block; + border-radius: 0; + } + nav.site-nav a { + text-transform: capitalize; + } + header#site-header .menu-toggle { + display: block; + width: 100%; + text-align: left; + } + header#site-header .dropdown { + position: relative; + } + header#site-header .dropdown-content { + position: static; + } +} +.icon { + width: 64px; + height: 64px; + display: flex; + justify-content: center; + align-items: center; + font-size: 36px; + user-select: none; +} +.deep-dive-enhanced { + background: linear-gradient(135deg, #0A192F 0%, #1a2744 30%, #0f1b36 70%, #0A192F 100%); + border-radius: 8px; + color: #00CED1; + font-weight: 700; + position: relative; + overflow: hidden; + box-shadow: + 0 0 8px rgba(0, 206, 209, 0.4), + 0 0 20px rgba(0, 206, 209, 0.15), + inset 0 1px 0 rgba(255, 255, 255, 0.1), + inset 0 0 20px rgba(0, 206, 209, 0.05); + transition: all 0.3s ease; + border: 1px solid rgba(0, 206, 209, 0.2); +} +.deep-dive-enhanced:hover { + transform: translateY(-1px); + box-shadow: + 0 0 12px rgba(0, 206, 209, 0.6), + 0 0 30px rgba(0, 206, 209, 0.25), + 0 2px 8px rgba(0, 0, 0, 0.3), + inset 0 1px 0 rgba(255, 255, 255, 0.15), + inset 0 0 25px rgba(0, 206, 209, 0.08); + border-color: rgba(0, 206, 209, 0.4); +} +.deep-dive-enhanced::before { + content: ''; + position: absolute; + top: 0; + left: -100%; + width: 100%; + height: 100%; + background: linear-gradient(45deg, transparent, rgba(236, 240, 241, 0.08), transparent); + animation: shimmer 4s; +} +.deep-dive-enhanced::after { + content: ''; + position: absolute; + top: 2px; + left: 2px; + right: 2px; + bottom: 2px; + background: linear-gradient(135deg, rgba(0, 206, 209, 0.03) 0%, transparent 50%, rgba(0, 206, 209, 0.03) 100%); + border-radius: 6px; + pointer-events: none; +} +.icon-text { + position: relative; + z-index: 2; + text-shadow: 0 0 8px rgba(0, 206, 209, 0.5); + animation: pulse 4s ease-in-out infinite; +} +@keyframes shimmer { + 0% { + left: -100%; + } + 100% { + left: 100%; + } +} +@keyframes pulse { + 0%, 100% { + text-shadow: 0 0 8px rgba(0, 206, 209, 0.5); + } + 50% { + text-shadow: 0 0 12px rgba(0, 206, 209, 0.8), 0 0 20px rgba(0, 206, 209, 0.3); + } +} +/* Floating particles effect */ +.particles { + position: absolute; + width: 100%; + height: 100%; + pointer-events: none; + overflow: hidden; + border-radius: 12px; +} +.particle { + position: absolute; + width: 2px; + height: 2px; + background: #00CED1; + border-radius: 50%; + opacity: 0.6; + animation: float 6s linear infinite; +} +.particle:nth-child(1) { + left: 20%; + animation-delay: -1s; + animation-duration: 5s; +} +.particle:nth-child(2) { + left: 50%; + animation-delay: -2s; + animation-duration: 7s; +} +.particle:nth-child(3) { + left: 80%; + animation-delay: -3s; + animation-duration: 6s; +} +@keyframes float { + 0% { + transform: translateY(70px) scale(0); + opacity: 0; + } + 10% { + opacity: 0.6; + } + 90% { + opacity: 0.6; + } + 100% { + transform: translateY(-10px) scale(1); + opacity: 0; + } +} +/* Corner accents */ +.corner-accent { + position: absolute; + width: 6px; + height: 1px; + background: rgba(236, 240, 241, 0.3); + opacity: 0.8; +} +.corner-accent.top-left { + top: 4px; + left: 4px; + transform: rotate(45deg); +} +.corner-accent.bottom-right { + bottom: 4px; + right: 4px; + transform: rotate(45deg); +} +.corner-accent.top-right { + top: 4px; + right: 4px; + transform: rotate(-45deg); +} +.corner-accent.bottom-left { + bottom: 4px; + left: 4px; + transform: rotate(-45deg); +} diff --git a/scripts/combine-css.js b/scripts/combine-css.js index b4d028a..bbabbab 100644 --- a/scripts/combine-css.js +++ b/scripts/combine-css.js @@ -11,7 +11,7 @@ // Define the output path and filename for the combined CSS const outputDir = path.join(__dirname, "..", "public", "css"); const outputFilename = "styles.css"; -const outputPath = path.join(outputDir, "..", outputFilename); +const outputPath = path.join(outputDir, outputFilename); async function combineCssImports() { console.log(`Starting CSS bundling from: ${mainCssEntry}`); diff --git a/src/config/securityConfig.js b/src/config/securityConfig.js new file mode 100644 index 0000000..e9d02c3 --- /dev/null +++ b/src/config/securityConfig.js @@ -0,0 +1,32 @@ +// config/securityConfig.js + +const { baseUrl } = require("../utils/baseUrl"); + +module.exports = { + LOCALHOST_HOSTNAMES: ["127.0.0.1", "localhost"], + HEALTHCHECK_METHOD: "HEAD", + HEALTHCHECK_PATH: "/health", + FORBIDDEN_MESSAGE: "Forbidden", + FORBIDDEN_STATUS_CODE: 403, + HSTS_MAX_AGE: 63072000, + CSP_DIRECTIVES: { + defaultSrc: ["'self'", baseUrl], + scriptSrc: [ + "'self'", + "https://hcaptcha.com", + "https://cdn.jsdelivr.net", + "https://cdnjs.cloudflare.com", + "https://jigsaw.w3.org", + ], + styleSrc: ["'self'", "https:"], + imgSrc: [ + "'self'", + "data:", + "https://licensebuttons.net", + "https://cdn.jsdelivr.net", + ], + frameSrc: ["'self'", "https://newassets.hcaptcha.com"], + objectSrc: ["'none'"], + upgradeInsecureRequests: [], + }, +}; diff --git a/src/constants/securityConstants.js b/src/constants/securityConstants.js deleted file mode 100644 index adbebc4..0000000 --- a/src/constants/securityConstants.js +++ /dev/null @@ -1,37 +0,0 @@ -// config/securityConstants.js - -const { baseUrl } = require("../utils/baseUrl"); - -module.exports = { - LOCALHOST_HOSTNAMES: ["127.0.0.1", "localhost"], - HEALTHCHECK_METHOD: "HEAD", - HEALTHCHECK_PATH: "/health", - FORBIDDEN_MESSAGE: "Forbidden", - FORBIDDEN_STATUS_CODE: 403, - HSTS_MAX_AGE: 63072000, - CSP_DIRECTIVES: { - defaultSrc: ["'self'", baseUrl], - scriptSrc: [ - "'self'", - "https://hcaptcha.com", - "https://cdn.jsdelivr.net", - "https://cdnjs.cloudflare.com", - // "'sha256-dMV9we3strWiwZYu55JT4zbPbIhmVvBssnieDrKQMKw='", - // "'sha256-dMV9we3strWiwZYu55JT4zbPbIhmVvBssnieDrKQMKw='", - ], - styleSrc: [ - "'self'", - "https:", - // "'sha256-huhqpKwGcFswbXjh5F/DueoxnLh3Yh/pg/lNbo+tnLE='", - ], - imgSrc: [ - "'self'", - "data:", - "https://licensebuttons.net", - "https://cdn.jsdelivr.net", - ], - frameSrc: ["'self'", "https://newassets.hcaptcha.com"], - objectSrc: ["'none'"], - upgradeInsecureRequests: [], - }, -}; diff --git a/src/controllers/blogControllers.js b/src/controllers/blogControllers.js index 2a3817a..9fa66b2 100644 --- a/src/controllers/blogControllers.js +++ b/src/controllers/blogControllers.js @@ -96,7 +96,7 @@ publishedPosts.sort((a, b) => new Date(b.date) - new Date(a.date)); const etagInput = publishedPosts.map((p) => p.id).join(","); - const etag = `"${hash(etagInput)}"`; + const etag = `"${crypto.createHash("sha256").update(etagInput).digest("hex")}"`; const lastModified = publishedPosts.length > 0 diff --git a/src/css/nav.css b/src/css/nav.css index 86ebc26..cef1c3d 100644 --- a/src/css/nav.css +++ b/src/css/nav.css @@ -56,6 +56,11 @@ background-color: white; min-width: 160px; box-shadow: 0px 8px 16px rgba(0,0,0,0.2); + + flex-direction: column; + white-space: nowrap; + left: 0; + top: 100%; } nav.site-nav .dropdown-content a { @@ -72,9 +77,6 @@ background-color: #34495e; /* Match the main nav hover color */ } -nav.site-nav .dropdown:hover .dropdown-content { - display: block; -} header#site-header .menu-toggle { display: none; @@ -108,3 +110,26 @@ top: 1rem; bottom: 1rem; } + + + + +nav.site-nav .dropdown-content .dropdown-content { + top: 0; + left: 100%; /* shift nested submenu to the right */ + margin-left: 0.2rem; /* small gap */ + min-width: 160px; + z-index: 12; +} +nav.site-nav .dropdown-content .dropdown:hover > .dropdown-content { + display: block; +} + +nav.site-nav > .dropdown:hover > .dropdown-content { + display: block; +} + +/* Only show direct submenu of nested dropdowns */ +nav.site-nav .dropdown-content > .dropdown:hover > .dropdown-content { + display: block; +} diff --git a/src/middleware/applyProductionSecurity.js b/src/middleware/applyProductionSecurity.js index 4bae06f..eef91e5 100644 --- a/src/middleware/applyProductionSecurity.js +++ b/src/middleware/applyProductionSecurity.js @@ -11,7 +11,7 @@ FORBIDDEN_STATUS_CODE, HSTS_MAX_AGE, CSP_DIRECTIVES, -} = require("../constants/securityConstants"); +} = require("../config/securityConfig"); const disablePoweredBy = (req, res, next) => { req.app.disable("x-powered-by"); diff --git a/src/middleware/cacheUtils.js b/src/middleware/cacheUtils.js index 1f12339..d4c30d9 100644 --- a/src/middleware/cacheUtils.js +++ b/src/middleware/cacheUtils.js @@ -25,4 +25,9 @@ next(); } -module.exports = cacheMiddleware; +module.exports = (req, res, next) => { + req.checkCacheHeaders = (options) => { + return false; + }; + next(); +}; // temporarily disable caching until i refactor the front end from backend diff --git a/src/routes/presentation.js b/src/routes/presentation.js index ed31eae..94df141 100644 --- a/src/routes/presentation.js +++ b/src/routes/presentation.js @@ -4,7 +4,7 @@ const { renderPresentation } = require("../controllers/presentationController"); const resolveReturnUrl = require("../middleware/resolveReturnUrl"); const { securityPolicy } = require("../middleware/applyProductionSecurity"); -const { CSP_DIRECTIVES } = require("../constants/securityConstants"); +const { CSP_DIRECTIVES } = require("../config/securityConfig"); router.get( "/", diff --git a/src/utils/structuredLogger.js b/src/utils/structuredLogger.js index ca3ffa8..5321fdb 100644 --- a/src/utils/structuredLogger.js +++ b/src/utils/structuredLogger.js @@ -23,15 +23,29 @@ }; module.exports = (req, res, next) => { res.on("finish", () => { - const { method, url, headers, query, body, ip, connection } = req; + const { method, url, originalUrl, headers, query, body, connection } = req; + const forwardedIp = String(req.ip); + const directIp = String(connection.remoteAddress); const { statusCode } = res; + if (req.method === "GET" && req.accepts("html")) { + req.log.analytics({ + timestamp: Date.now(), + originalUrl, + referrer: req.get("Referer") || "", + userAgent: req.get("User-Agent") || "", + js_enabled: false, + forwardedIp, + directIp, + }); + } + let logLevel = determineLogLevel(statusCode); if (logLevel) { const meta = { statusCode: String(statusCode), - directIp: String(connection.remoteAddress), - forwardedIp: String(ip), + directIp, + forwardedIp, contentLength: String(res.getHeader("content-length") || "0"), ...flatten(headers, "headers"), ...flatten(query, "query"), diff --git a/src/views/layouts/main.handlebars b/src/views/layouts/main.handlebars index 41cbf67..d049ec5 100644 --- a/src/views/layouts/main.handlebars +++ b/src/views/layouts/main.handlebars @@ -6,7 +6,7 @@
- {{> headers}} + {{> page_headers}}