收紧桌面壳宿主版本边界
桌面壳配置检查校验 release 和 dev 入口 hostVersion 桌面壳配置检查要求 runtime 回包使用 Cargo 版本 宿主壳方案和共享决策记录桌面版本边界
This commit is contained in:
@@ -221,6 +221,11 @@ function resolveHostCapabilitiesFromUrl(rawUrl) {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function resolveHostVersionFromUrl(rawUrl) {
|
||||
const url = new URL(rawUrl, 'https://app.genarrative.world/');
|
||||
return url.searchParams.get('hostVersion');
|
||||
}
|
||||
|
||||
function assertSameList(actual, expected, label) {
|
||||
if (
|
||||
actual.length !== expected.length ||
|
||||
@@ -339,6 +344,10 @@ if (extractCargoPackageString(cargoManifest, 'version') !== config.version) {
|
||||
throw new Error('desktop shell Cargo package version must match tauri.conf.json version');
|
||||
}
|
||||
|
||||
if (!main.includes('host_version: env!("CARGO_PKG_VERSION")')) {
|
||||
throw new Error('desktop shell runtime response must use the Cargo package version');
|
||||
}
|
||||
|
||||
if (config.build?.frontendDist !== '../../../dist') {
|
||||
throw new Error('desktop shell must package the root H5 dist');
|
||||
}
|
||||
@@ -435,6 +444,14 @@ for (const part of requiredUrlParts) {
|
||||
}
|
||||
}
|
||||
|
||||
if (resolveHostVersionFromUrl(mainWindow.url) !== config.version) {
|
||||
throw new Error('desktop shell main window hostVersion must match tauri.conf.json version');
|
||||
}
|
||||
|
||||
if (resolveHostVersionFromUrl(config.build?.devUrl ?? '') !== config.version) {
|
||||
throw new Error('desktop shell dev hostVersion must match tauri.conf.json version');
|
||||
}
|
||||
|
||||
assertSameList(
|
||||
resolveHostCapabilitiesFromUrl(mainWindow.url),
|
||||
desktopCapabilities,
|
||||
|
||||
Reference in New Issue
Block a user