This commit is contained in:
Baobhan Sith
2025-04-25 17:28:28 +08:00
parent c02556dc0b
commit 56e61683f8
4 changed files with 10 additions and 2 deletions
@@ -347,7 +347,7 @@ const scrollToHighlighted = async () => {
class="mt-4 px-4 py-2 bg-primary text-white border-none rounded-lg text-sm font-semibold cursor-pointer shadow-md transition-colors duration-200 ease-in-out hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary"
@click="handleMenuAction('add')"
>
{{ t('connections.addFirstConnection') }} <!-- Need translation -->
{{ t('connections.addFirstConnection') }}
</button>
</div>
+1
View File
@@ -108,6 +108,7 @@
"connections": {
"addConnection": "Add New Connection",
"noConnections": "No connections yet. Click 'Add New Connection' to create one!",
"addFirstConnection": "Add your first connection",
"table": {
"name": "Name",
"host": "Host",
+1
View File
@@ -108,6 +108,7 @@
"connections": {
"addConnection": "添加新连接",
"noConnections": "还没有任何连接。点击'添加新连接'来创建一个吧!",
"addFirstConnection": "添加第一个连接",
"table": {
"name": "名称",
"host": "主机",
@@ -189,7 +189,13 @@ export const useSessionStore = defineStore('session', () => {
console.log(`[SessionStore] 已创建新会话实例: ${newSessionId} for connection ${dbConnId}`);
// 4. 启动 WebSocket 连接
const wsUrl = `ws://${window.location.hostname}:3001`; // TODO: 从配置获取 URL
// 根据当前页面协议动态生成 WebSocket URL,并移除硬编码的端口
// 假设 WebSocket 服务与 Web 服务在同一主机和端口上提供(通过反向代理)
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
// 移除端口 :3001,依赖反向代理或同源策略
// 如果 WebSocket 有特定路径 (例如 /ws),需要在这里添加
const wsUrl = `${protocol}//${window.location.hostname}/`;
console.log(`[SessionStore] Generated WebSocket URL: ${wsUrl}`); // 添加日志记录生成的 URL
wsManager.connect(wsUrl);
console.log(`[SessionStore] 已为会话 ${newSessionId} 启动 WebSocket 连接。`);
};