Round 19: Fix auth 500/session persistence, script tag warning, module factory error, rate limiting
- Fix auth session persistence: set cookie on both cookies() and NextResponse - Fix isSecureRequest: check x-forwarded-proto for HTTPS proxy support - Fix excessive GET /api/auth polling: add useRef guard to prevent duplicate checks - Increase rate limits: auth POST 30/min, auth GET 120/min - Fix script tag warning: use ref-based textContent instead of dangerouslySetInnerHTML in chart.tsx - Fix sanitizeHtml: improve regex patterns for script tag removal - Fix module factory error: disable SW registration in dev, skip /_next/ caching in sw.js - Bump SW cache version v2→v3 to force cache invalidation - Better error handling in auth route with specific error messages
This commit is contained in:
1 parent
760fa70e82
commit
74404708e5
9 files changed
+192
-47
No files matched your search
@@ -179,6 +179,9 @@ export function useServiceWorker() {
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined') return;
|
||||
if (!('serviceWorker' in navigator)) return;
|
||||
// Skip service worker registration during development to avoid stale
|
||||
// Turbopack chunk caching ("module factory is not available" errors)
|
||||
if (process.env.NODE_ENV === 'development') return;
|
||||
|
||||
async function registerSW() {
|
||||
try {
|
||||
|
||||
@@ -78,12 +78,9 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<style
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: Object.entries(THEMES)
|
||||
.map(
|
||||
([theme, prefix]) => `
|
||||
const cssText = Object.entries(THEMES)
|
||||
.map(
|
||||
([theme, prefix]) => `
|
||||
${prefix} [data-chart=${id}] {
|
||||
${colorConfig
|
||||
.map(([key, itemConfig]) => {
|
||||
@@ -95,11 +92,12 @@ ${colorConfig
|
||||
.join("\n")}
|
||||
}
|
||||
`
|
||||
)
|
||||
.join("\n"),
|
||||
}}
|
||||
/>
|
||||
)
|
||||
)
|
||||
.join("\n")
|
||||
|
||||
// Use ref to set textContent instead of dangerouslySetInnerHTML to avoid
|
||||
// React 19 "Encountered a script tag" warning for style elements
|
||||
return <style ref={(el) => { if (el) el.textContent = cssText }} />
|
||||
}
|
||||
|
||||
const ChartTooltip = RechartsPrimitive.Tooltip
|
||||
|
||||
Reference in new issue
Block a user