fix: image upload proxy, compression, and JSON parse safety

- Add /api/v1/ and /files/ rewrite rules in next.config.ts so frontend
  can call backend without /admin139 prefix
- Fix upload using MultiPartParser instead of req->getUploadedFiles()
- Add client-side image compression (canvas resize to 1920px, quality 0.8)
  for photos >500KB before upload
- Safe JSON parsing: catch HTML error responses instead of throwing
  SyntaxError on non-JSON backend responses
- Fix backslash escape in delete filename validation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
这个提交包含在:
cryptocommuniums-afk
2026-02-16 18:10:47 +08:00
父节点 cfbe9a0363
当前提交 7dd10bef2d
修改 3 个文件,包含 190 行新增4 行删除

查看文件

@@ -18,6 +18,16 @@ const nextConfig: NextConfig = {
source: "/admin139/:path+",
destination: `${backendInternal}/:path*`,
},
{
// Proxy backend API calls made without /admin139 prefix
source: "/api/v1/:path*",
destination: `${backendInternal}/api/v1/:path*`,
},
{
// Proxy backend static files (note images etc.)
source: "/files/:path*",
destination: `${backendInternal}/files/:path*`,
},
];
},
};