Update file upload limits to 2GB in backend and frontend components; refactor avatar utility functions for improved name handling.

This commit is contained in:
liu
2026-01-31 01:17:51 +08:00
parent 25196410c2
commit f18bf32d33
7 changed files with 80 additions and 66 deletions

View File

@@ -95,13 +95,13 @@ import MessageItem from '@/components/MessageItem.vue';
import FileMessage from '@/components/FileMessage.vue';
import ImageMessage from '@/components/ImageMessage.vue';
import MessageInput from '@/components/MessageInput.vue';
import { getFileDownloadUrl, downloadWithProgress, getMyIp } from '@/api/room';
import { getFileDownloadUrl, downloadWithProgress } from '@/api/room';
import { useWsStore } from '@/stores/wsStore';
import type { RoomMessagePayload } from '@/types/room';
import { isImageMimeType } from '@/types/room';
// 开发时用空字符串走同源,由 Vite 代理到后端,便于其它设备通过本机 IP:5173 访问
const API_BASE = import.meta.env.VITE_API_BASE ?? (import.meta.env.DEV ? '' : 'http://localhost:8080');
// 未设置 VITE_API_BASE 时使用同源:开发时走 Vite 代理Docker/生产时与页面同 host:port避免硬编码 localhost 导致部署后连不上
const API_BASE = import.meta.env.VITE_API_BASE ?? '';
const route = useRoute();
const router = useRouter();
@@ -128,14 +128,10 @@ onMounted(() => {
watch(
() => wsStore.status,
async (status) => {
(status) => {
if (status === 'connected' && roomCode) {
try {
const ip = await getMyIp(API_BASE);
wsStore.joinRoom({ roomCode, nickname: ip?.trim() || '访客' });
} catch {
wsStore.joinRoom({ roomCode, nickname: '访客' });
}
// 使用 store 中已生成的随机中国人名
wsStore.joinRoom({ roomCode, nickname: wsStore.myNickname });
}
},
{ immediate: true },