同步移动端工程、设备控制改进与发布资料
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
} from "../current-display-playback.js";
|
||||
|
||||
const statusEls = {
|
||||
mobile: document.getElementById("topbar-mobile"),
|
||||
orientation: document.getElementById("status-orientation"),
|
||||
brightness: document.getElementById("status-brightness"),
|
||||
currentContent: document.getElementById("topbar-current-content"),
|
||||
@@ -760,9 +761,22 @@ export async function refreshDeviceStorage() {
|
||||
}
|
||||
}
|
||||
|
||||
let lastMobileSession = null;
|
||||
|
||||
export async function refreshStatus({ source = "manual" } = {}) {
|
||||
try {
|
||||
const data = await apiJson("/api/status");
|
||||
const mobile = data.mobile;
|
||||
if (statusEls.mobile) {
|
||||
statusEls.mobile.textContent = mobile?.connected
|
||||
? `手机:${mobile.client_name || "已连接"}`
|
||||
: (mobile?.available === false ? "手机蓝牙暂不可用" : "手机未连接");
|
||||
const session = `${data.service?.instance_id || ""}:${mobile?.generation || 0}`;
|
||||
if (mobile?.connected && lastMobileSession !== null && session !== lastMobileSession) {
|
||||
announce(`${mobile.client_name || "手机"}已连接`);
|
||||
}
|
||||
lastMobileSession = session;
|
||||
}
|
||||
syncCurrentDisplayDialogStatus(data);
|
||||
statusEls.orientation.textContent = `${data.state.orientation}°`;
|
||||
showDeviceBrightness(data.state);
|
||||
|
||||
Reference in New Issue
Block a user