mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 16:43:55 +08:00
Merge pull request #2539 from xinnan-tech/hot-fix
fix:网页测试工具和manager-web关键缓存冲突
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
// 配置管理模块
|
// 配置管理模块
|
||||||
import { log } from '../utils/logger.js';
|
|
||||||
|
|
||||||
// 生成随机MAC地址
|
// 生成随机MAC地址
|
||||||
function generateRandomMac() {
|
function generateRandomMac() {
|
||||||
@@ -23,30 +22,30 @@ export function loadConfig() {
|
|||||||
const otaUrlInput = document.getElementById('otaUrl');
|
const otaUrlInput = document.getElementById('otaUrl');
|
||||||
|
|
||||||
// 从localStorage加载MAC地址,如果没有则生成新的
|
// 从localStorage加载MAC地址,如果没有则生成新的
|
||||||
let savedMac = localStorage.getItem('deviceMac');
|
let savedMac = localStorage.getItem('xz_tester_deviceMac');
|
||||||
if (!savedMac) {
|
if (!savedMac) {
|
||||||
savedMac = generateRandomMac();
|
savedMac = generateRandomMac();
|
||||||
localStorage.setItem('deviceMac', savedMac);
|
localStorage.setItem('xz_tester_deviceMac', savedMac);
|
||||||
}
|
}
|
||||||
deviceMacInput.value = savedMac;
|
deviceMacInput.value = savedMac;
|
||||||
|
|
||||||
// 从localStorage加载其他配置
|
// 从localStorage加载其他配置
|
||||||
const savedDeviceName = localStorage.getItem('deviceName');
|
const savedDeviceName = localStorage.getItem('xz_tester_deviceName');
|
||||||
if (savedDeviceName) {
|
if (savedDeviceName) {
|
||||||
deviceNameInput.value = savedDeviceName;
|
deviceNameInput.value = savedDeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedClientId = localStorage.getItem('clientId');
|
const savedClientId = localStorage.getItem('xz_tester_clientId');
|
||||||
if (savedClientId) {
|
if (savedClientId) {
|
||||||
clientIdInput.value = savedClientId;
|
clientIdInput.value = savedClientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedToken = localStorage.getItem('token');
|
const savedToken = localStorage.getItem('xz_tester_token');
|
||||||
if (savedToken) {
|
if (savedToken) {
|
||||||
tokenInput.value = savedToken;
|
tokenInput.value = savedToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedOtaUrl = localStorage.getItem('otaUrl');
|
const savedOtaUrl = localStorage.getItem('xz_tester_otaUrl');
|
||||||
if (savedOtaUrl) {
|
if (savedOtaUrl) {
|
||||||
otaUrlInput.value = savedOtaUrl;
|
otaUrlInput.value = savedOtaUrl;
|
||||||
}
|
}
|
||||||
@@ -59,10 +58,10 @@ export function saveConfig() {
|
|||||||
const clientIdInput = document.getElementById('clientId');
|
const clientIdInput = document.getElementById('clientId');
|
||||||
const tokenInput = document.getElementById('token');
|
const tokenInput = document.getElementById('token');
|
||||||
|
|
||||||
localStorage.setItem('deviceMac', deviceMacInput.value);
|
localStorage.setItem('xz_tester_deviceMac', deviceMacInput.value);
|
||||||
localStorage.setItem('deviceName', deviceNameInput.value);
|
localStorage.setItem('xz_tester_deviceName', deviceNameInput.value);
|
||||||
localStorage.setItem('clientId', clientIdInput.value);
|
localStorage.setItem('xz_tester_clientId', clientIdInput.value);
|
||||||
localStorage.setItem('token', tokenInput.value);
|
localStorage.setItem('xz_tester_token', tokenInput.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取配置值
|
// 获取配置值
|
||||||
@@ -81,6 +80,6 @@ export function getConfig() {
|
|||||||
export function saveConnectionUrls() {
|
export function saveConnectionUrls() {
|
||||||
const otaUrl = document.getElementById('otaUrl').value.trim();
|
const otaUrl = document.getElementById('otaUrl').value.trim();
|
||||||
const wsUrl = document.getElementById('serverUrl').value.trim();
|
const wsUrl = document.getElementById('serverUrl').value.trim();
|
||||||
localStorage.setItem('otaUrl', otaUrl);
|
localStorage.setItem('xz_tester_otaUrl', otaUrl);
|
||||||
localStorage.setItem('wsUrl', wsUrl);
|
localStorage.setItem('xz_tester_wsUrl', wsUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user