mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 00:23:53 +08:00
update:删除认证令牌输入框,从ota接口获取令牌
This commit is contained in:
@@ -18,7 +18,6 @@ export function loadConfig() {
|
|||||||
const deviceMacInput = document.getElementById('deviceMac');
|
const deviceMacInput = document.getElementById('deviceMac');
|
||||||
const deviceNameInput = document.getElementById('deviceName');
|
const deviceNameInput = document.getElementById('deviceName');
|
||||||
const clientIdInput = document.getElementById('clientId');
|
const clientIdInput = document.getElementById('clientId');
|
||||||
const tokenInput = document.getElementById('token');
|
|
||||||
const otaUrlInput = document.getElementById('otaUrl');
|
const otaUrlInput = document.getElementById('otaUrl');
|
||||||
|
|
||||||
// 从localStorage加载MAC地址,如果没有则生成新的
|
// 从localStorage加载MAC地址,如果没有则生成新的
|
||||||
@@ -40,11 +39,6 @@ export function loadConfig() {
|
|||||||
clientIdInput.value = savedClientId;
|
clientIdInput.value = savedClientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedToken = localStorage.getItem('xz_tester_token');
|
|
||||||
if (savedToken) {
|
|
||||||
tokenInput.value = savedToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
const savedOtaUrl = localStorage.getItem('xz_tester_otaUrl');
|
const savedOtaUrl = localStorage.getItem('xz_tester_otaUrl');
|
||||||
if (savedOtaUrl) {
|
if (savedOtaUrl) {
|
||||||
otaUrlInput.value = savedOtaUrl;
|
otaUrlInput.value = savedOtaUrl;
|
||||||
@@ -56,12 +50,10 @@ export function saveConfig() {
|
|||||||
const deviceMacInput = document.getElementById('deviceMac');
|
const deviceMacInput = document.getElementById('deviceMac');
|
||||||
const deviceNameInput = document.getElementById('deviceName');
|
const deviceNameInput = document.getElementById('deviceName');
|
||||||
const clientIdInput = document.getElementById('clientId');
|
const clientIdInput = document.getElementById('clientId');
|
||||||
const tokenInput = document.getElementById('token');
|
|
||||||
|
|
||||||
localStorage.setItem('xz_tester_deviceMac', deviceMacInput.value);
|
localStorage.setItem('xz_tester_deviceMac', deviceMacInput.value);
|
||||||
localStorage.setItem('xz_tester_deviceName', deviceNameInput.value);
|
localStorage.setItem('xz_tester_deviceName', deviceNameInput.value);
|
||||||
localStorage.setItem('xz_tester_clientId', clientIdInput.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
|
deviceId: deviceMac, // 使用MAC地址作为deviceId
|
||||||
deviceName: document.getElementById('deviceName').value.trim(),
|
deviceName: document.getElementById('deviceName').value.trim(),
|
||||||
deviceMac: deviceMac,
|
deviceMac: deviceMac,
|
||||||
clientId: document.getElementById('clientId').value.trim(),
|
clientId: document.getElementById('clientId').value.trim()
|
||||||
token: document.getElementById('token').value.trim()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// UI控制模块
|
// UI控制模块
|
||||||
import { loadConfig, saveConfig } from '../config/manager.js';
|
import { loadConfig, saveConfig } from '../config/manager.js';
|
||||||
|
import { getAudioPlayer } from '../core/audio/player.js';
|
||||||
import { getAudioRecorder } from '../core/audio/recorder.js';
|
import { getAudioRecorder } from '../core/audio/recorder.js';
|
||||||
import { getWebSocketHandler } from '../core/network/websocket.js';
|
import { getWebSocketHandler } from '../core/network/websocket.js';
|
||||||
import { getAudioPlayer } from '../core/audio/player.js';
|
|
||||||
|
|
||||||
// UI控制器类
|
// UI控制器类
|
||||||
export class UIController {
|
export class UIController {
|
||||||
@@ -266,7 +266,6 @@ export class UIController {
|
|||||||
const deviceMacInput = document.getElementById('deviceMac');
|
const deviceMacInput = document.getElementById('deviceMac');
|
||||||
const deviceNameInput = document.getElementById('deviceName');
|
const deviceNameInput = document.getElementById('deviceName');
|
||||||
const clientIdInput = document.getElementById('clientId');
|
const clientIdInput = document.getElementById('clientId');
|
||||||
const tokenInput = document.getElementById('token');
|
|
||||||
|
|
||||||
toggleButton.addEventListener('click', () => {
|
toggleButton.addEventListener('click', () => {
|
||||||
this.isEditing = !this.isEditing;
|
this.isEditing = !this.isEditing;
|
||||||
@@ -274,7 +273,6 @@ export class UIController {
|
|||||||
deviceMacInput.disabled = !this.isEditing;
|
deviceMacInput.disabled = !this.isEditing;
|
||||||
deviceNameInput.disabled = !this.isEditing;
|
deviceNameInput.disabled = !this.isEditing;
|
||||||
clientIdInput.disabled = !this.isEditing;
|
clientIdInput.disabled = !this.isEditing;
|
||||||
tokenInput.disabled = !this.isEditing;
|
|
||||||
|
|
||||||
toggleButton.textContent = this.isEditing ? '确定' : '编辑';
|
toggleButton.textContent = this.isEditing ? '确定' : '编辑';
|
||||||
|
|
||||||
|
|||||||
@@ -52,20 +52,16 @@
|
|||||||
<label for="deviceMac">设备MAC:</label>
|
<label for="deviceMac">设备MAC:</label>
|
||||||
<input type="text" id="deviceMac" placeholder="device-id" disabled>
|
<input type="text" id="deviceMac" placeholder="device-id" disabled>
|
||||||
</div>
|
</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">
|
<div class="config-item">
|
||||||
<label for="clientId">客户端ID:</label>
|
<label for="clientId">客户端ID:</label>
|
||||||
<input type="text" id="clientId" value="web_test_client" placeholder="client-id"
|
<input type="text" id="clientId" value="web_test_client" placeholder="client-id"
|
||||||
disabled>
|
disabled>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="config-row">
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<label for="token">认证令牌:</label>
|
<label for="deviceName">设备名称:</label>
|
||||||
<input type="text" id="token" value="your-token1" placeholder="token" disabled>
|
<input type="text" id="deviceName" value="Web测试设备" placeholder="deviceName" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,7 +113,8 @@
|
|||||||
<div style="margin: -10px 0px 10px 0px;">
|
<div style="margin: -10px 0px 10px 0px;">
|
||||||
<span class="connection-status llm-emoji">
|
<span class="connection-status llm-emoji">
|
||||||
<span id="sessionStatus" class="status offline" style="position: relative; display: inline-block;">
|
<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 style="position: relative; z-index: 1;"><span class="emoji-large">😶</span> 小智离线中</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user