mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 23:06:36 +08:00
fix(admin): stop console Intl errors and log websocket drops
Use raw i18n for push template hints so ICU does not parse
{{placeholders}}. Pass total into the user list record count.
Allow log websocket origins behind the Next rewrite, skip the
proxy on Upgrade, and do not open a socket after unmount.
This commit is contained in:
+7
-2
@@ -81,6 +81,11 @@ export function proxy(request: NextRequest) {
|
||||
process.env.WAVELET_SESSION_COOKIE_NAME || 'wavelet_session_id';
|
||||
const sessionCookie = request.cookies.get(sessionCookieName);
|
||||
|
||||
// WebSocket upgrades must pass through to rewrites untouched.
|
||||
if (request.headers.get('upgrade')?.toLowerCase() === 'websocket') {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/* API 请求:速率限制后放行 */
|
||||
if (pathname.startsWith('/api/')) {
|
||||
const rateLimitEnabled = process.env.WAVELET_RATE_LIMIT_ENABLED === 'true';
|
||||
@@ -136,7 +141,7 @@ export function proxy(request: NextRequest) {
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
'/api/:path*',
|
||||
'/((?!_next|favicon.ico|robots.txt|sitemap.xml|.*\\.(?:jpg|jpeg|gif|png|svg|ico|webp)).*)',
|
||||
'/api/((?!v1/admin/logs/ws).*)',
|
||||
'/((?!_next|favicon.ico|robots.txt|sitemap.xml|api/v1/admin/logs/ws|.*\\.(?:jpg|jpeg|gif|png|svg|ico|webp)).*)',
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user