update:删除认证令牌输入框,从ota接口获取令牌

This commit is contained in:
hrz
2026-01-02 22:41:37 +08:00
parent c8a26d9c5e
commit de0d82f1e8
3 changed files with 8 additions and 22 deletions
+1 -10
View File
@@ -18,7 +18,6 @@ export function loadConfig() {
const deviceMacInput = document.getElementById('deviceMac');
const deviceNameInput = document.getElementById('deviceName');
const clientIdInput = document.getElementById('clientId');
const tokenInput = document.getElementById('token');
const otaUrlInput = document.getElementById('otaUrl');
// 从localStorage加载MAC地址,如果没有则生成新的
@@ -40,11 +39,6 @@ export function loadConfig() {
clientIdInput.value = savedClientId;
}
const savedToken = localStorage.getItem('xz_tester_token');
if (savedToken) {
tokenInput.value = savedToken;
}
const savedOtaUrl = localStorage.getItem('xz_tester_otaUrl');
if (savedOtaUrl) {
otaUrlInput.value = savedOtaUrl;
@@ -56,12 +50,10 @@ export function saveConfig() {
const deviceMacInput = document.getElementById('deviceMac');
const deviceNameInput = document.getElementById('deviceName');
const clientIdInput = document.getElementById('clientId');
const tokenInput = document.getElementById('token');
localStorage.setItem('xz_tester_deviceMac', deviceMacInput.value);
localStorage.setItem('xz_tester_deviceName', deviceNameInput.value);
localStorage.setItem('xz_tester_clientId', clientIdInput.value);
localStorage.setItem('xz_tester_token', tokenInput.value);
}
// 获取配置值
@@ -71,8 +63,7 @@ export function getConfig() {
deviceId: deviceMac, // 使用MAC地址作为deviceId
deviceName: document.getElementById('deviceName').value.trim(),
deviceMac: deviceMac,
clientId: document.getElementById('clientId').value.trim(),
token: document.getElementById('token').value.trim()
clientId: document.getElementById('clientId').value.trim()
};
}
+1 -3
View File
@@ -1,8 +1,8 @@
// UI控制模块
import { loadConfig, saveConfig } from '../config/manager.js';
import { getAudioPlayer } from '../core/audio/player.js';
import { getAudioRecorder } from '../core/audio/recorder.js';
import { getWebSocketHandler } from '../core/network/websocket.js';
import { getAudioPlayer } from '../core/audio/player.js';
// UI控制器类
export class UIController {
@@ -266,7 +266,6 @@ export class UIController {
const deviceMacInput = document.getElementById('deviceMac');
const deviceNameInput = document.getElementById('deviceName');
const clientIdInput = document.getElementById('clientId');
const tokenInput = document.getElementById('token');
toggleButton.addEventListener('click', () => {
this.isEditing = !this.isEditing;
@@ -274,7 +273,6 @@ export class UIController {
deviceMacInput.disabled = !this.isEditing;
deviceNameInput.disabled = !this.isEditing;
clientIdInput.disabled = !this.isEditing;
tokenInput.disabled = !this.isEditing;
toggleButton.textContent = this.isEditing ? '确定' : '编辑';
+6 -9
View File
@@ -52,20 +52,16 @@
<label for="deviceMac">设备MAC:</label>
<input type="text" id="deviceMac" placeholder="device-id" disabled>
</div>
<div class="config-item">
<label for="deviceName">设备名称:</label>
<input type="text" id="deviceName" value="Web测试设备" placeholder="deviceName" disabled>
</div>
</div>
<div class="config-row">
<div class="config-item">
<label for="clientId">客户端ID:</label>
<input type="text" id="clientId" value="web_test_client" placeholder="client-id"
disabled>
</div>
</div>
<div class="config-row">
<div class="config-item">
<label for="token">认证令牌:</label>
<input type="text" id="token" value="your-token1" placeholder="token" disabled>
<label for="deviceName">设备名称:</label>
<input type="text" id="deviceName" value="Web测试设备" placeholder="deviceName" disabled>
</div>
</div>
</div>
@@ -117,7 +113,8 @@
<div style="margin: -10px 0px 10px 0px;">
<span class="connection-status llm-emoji">
<span id="sessionStatus" class="status offline" style="position: relative; display: inline-block;">
<span id="sessionStatusBg" style="position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, rgba(76, 175, 80, 0.2), rgba(33, 150, 243, 0.2)); transition: width 0.15s ease-out, background 0.3s ease; z-index: 0; border-radius: 20px;"></span>
<span id="sessionStatusBg"
style="position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, rgba(76, 175, 80, 0.2), rgba(33, 150, 243, 0.2)); transition: width 0.15s ease-out, background 0.3s ease; z-index: 0; border-radius: 20px;"></span>
<span style="position: relative; z-index: 1;"><span class="emoji-large">😶</span> 小智离线中</span>
</span>
</span>