'commit'
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
|
||||
// ==== 插入WebSocket认证代码 ====
|
||||
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const wsUrl = `${wsProtocol}//${window.location.host}/ws/audio-evaluation?token=${getAuthToken()}`;
|
||||
const wsUrl = `${wsProtocol}//${window.location.host}/ws/audio-evaluation`;
|
||||
const ws = new WebSocket(wsUrl);
|
||||
|
||||
// WebSocket事件处理
|
||||
@@ -166,7 +166,6 @@
|
||||
statusDiv.className = 'status error';
|
||||
};
|
||||
// ==== 插入结束 ====
|
||||
|
||||
// 使用更明确的提示并添加详细的错误处理
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
.catch(err => {
|
||||
@@ -329,11 +328,6 @@
|
||||
|
||||
resultContent.innerHTML = html;
|
||||
}
|
||||
// 在<script>标签内添加getAuthToken实现
|
||||
function getAuthToken() {
|
||||
// 实际项目中应从Cookie、localStorage或后端API获取
|
||||
return 'your_auth_token_here'; // 临时占位,需替换为真实认证逻辑
|
||||
}
|
||||
|
||||
// 页面卸载时关闭连接
|
||||
window.addEventListener('beforeunload', () => {
|
||||
|
Reference in New Issue
Block a user