收口桌面窗口标题桥接边界
将 Tauri 窗口标题 HostBridge 处理收口到 title 模块 让桌面 dispatch 只委托窗口标题请求 同步桌面壳结构门禁、架构文档和共享记忆
This commit is contained in:
@@ -118,6 +118,14 @@ const desktopHostBridgeShareSource = fs.readFileSync(
|
||||
desktopHostBridgeSharePath,
|
||||
'utf8',
|
||||
);
|
||||
const desktopHostBridgeTitlePath = new URL(
|
||||
'../src-tauri/src/host_bridge/title.rs',
|
||||
import.meta.url,
|
||||
);
|
||||
const desktopHostBridgeTitleSource = fs.readFileSync(
|
||||
desktopHostBridgeTitlePath,
|
||||
'utf8',
|
||||
);
|
||||
const desktopShellUrlPath = new URL(
|
||||
'../src-tauri/src/shell/url.rs',
|
||||
import.meta.url,
|
||||
@@ -237,6 +245,7 @@ const expectedDesktopHostBridgeRustFiles = [
|
||||
'notifications.rs',
|
||||
'protocol.rs',
|
||||
'share.rs',
|
||||
'title.rs',
|
||||
];
|
||||
const expectedDesktopShellRustFiles = [
|
||||
'deep_link.rs',
|
||||
@@ -1323,7 +1332,7 @@ const desktopHostBridgePayloadLimits = {
|
||||
'BADGE_COUNT_MAX',
|
||||
),
|
||||
HOST_BRIDGE_APP_TITLE_MAX_LENGTH: extractRustNumberConst(
|
||||
rustHostSource,
|
||||
desktopHostBridgeTitleSource,
|
||||
'WINDOW_TITLE_MAX_LENGTH',
|
||||
),
|
||||
HOST_BRIDGE_CLIPBOARD_TEXT_MAX_LENGTH: extractRustNumberConst(
|
||||
@@ -1934,6 +1943,7 @@ const expectedRustHostBridgeFiles = [
|
||||
'notifications.rs',
|
||||
'protocol.rs',
|
||||
'share.rs',
|
||||
'title.rs',
|
||||
];
|
||||
const expectedRustShellFiles = [
|
||||
'deep_link.rs',
|
||||
@@ -2211,6 +2221,27 @@ for (const snippet of [
|
||||
if (!desktopHostBridgeBadgeSource.match(/window\s*\.\s*set_badge_count\s*\(\s*count\s*\)/)) {
|
||||
throw new Error('desktop shell badge module must call window.set_badge_count(count)');
|
||||
}
|
||||
if (
|
||||
!desktopHostBridgeDispatchSource.includes(
|
||||
'set_desktop_host_bridge_window_title(&app, &request)',
|
||||
) ||
|
||||
desktopHostBridgeDispatchSource.includes('WINDOW_TITLE_MAX_LENGTH') ||
|
||||
desktopHostBridgeDispatchSource.includes('required_string_payload(&request, "title")') ||
|
||||
desktopHostBridgeDispatchSource.includes('window.set_title')
|
||||
) {
|
||||
throw new Error('desktop shell title HostBridge method must delegate to title module');
|
||||
}
|
||||
for (const snippet of [
|
||||
'WINDOW_TITLE_MAX_LENGTH',
|
||||
'normalize_window_title',
|
||||
'required_string_payload(request, "title")',
|
||||
'window.set_title(&title)',
|
||||
'"title is required"',
|
||||
]) {
|
||||
if (!desktopHostBridgeTitleSource.includes(snippet)) {
|
||||
throw new Error(`desktop shell title module is missing ${snippet}`);
|
||||
}
|
||||
}
|
||||
if (
|
||||
!desktopHostBridgeDispatchSource.includes(
|
||||
'show_desktop_local_notification(&app, &request)',
|
||||
|
||||
Reference in New Issue
Block a user