✨ 优化上传体验:上传前检查文件大小限制
问题:原来文件上传完成后才提示超过大小限制,浪费用户时间 修复: - 后端:添加 /api/config 公开接口返回上传大小限制 - 前端:页面加载时获取配置 - 前端:uploadFile 函数开始时检查文件大小,超限立即提示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -972,6 +972,17 @@ app.get('/api/health', (req, res) => {
|
||||
res.json({ success: true, message: 'Server is running' });
|
||||
});
|
||||
|
||||
// 获取公开的系统配置(不需要登录)
|
||||
app.get('/api/config', (req, res) => {
|
||||
const maxUploadSize = parseInt(SettingsDB.get('max_upload_size') || '10737418240');
|
||||
res.json({
|
||||
success: true,
|
||||
config: {
|
||||
max_upload_size: maxUploadSize
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 生成验证码API
|
||||
app.get('/api/captcha', captchaRateLimitMiddleware, (req, res) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user