补齐桌面壳媒体权限说明
为 Tauri macOS 包加入摄像头和麦克风用途说明 将 macOS Info.plist 路径和文案纳入桌面壳配置门禁 同步宿主壳方案文档和项目共享决策记录
This commit is contained in:
@@ -13,6 +13,8 @@ const capabilityPath = new URL(
|
||||
import.meta.url,
|
||||
);
|
||||
const capability = JSON.parse(fs.readFileSync(capabilityPath, 'utf8'));
|
||||
const macInfoPlistPath = new URL('../src-tauri/Info.plist', import.meta.url);
|
||||
const macInfoPlist = fs.readFileSync(macInfoPlistPath, 'utf8');
|
||||
const buildScriptPath = new URL('../src-tauri/build.rs', import.meta.url);
|
||||
const buildScript = fs.readFileSync(buildScriptPath, 'utf8');
|
||||
const cargoManifestPath = new URL('../src-tauri/Cargo.toml', import.meta.url);
|
||||
@@ -79,6 +81,7 @@ const desktopShellNetworkSource = fs.readFileSync(
|
||||
const productionSourceRoots = [
|
||||
new URL('../package.json', import.meta.url),
|
||||
new URL('../src-tauri/Cargo.toml', import.meta.url),
|
||||
new URL('../src-tauri/Info.plist', import.meta.url),
|
||||
new URL('../src-tauri/build.rs', import.meta.url),
|
||||
new URL('../src-tauri/capabilities/main.json', import.meta.url),
|
||||
new URL('../src-tauri/src/', import.meta.url),
|
||||
@@ -1419,6 +1422,28 @@ if (config.bundle?.active !== true || config.bundle?.targets !== 'all') {
|
||||
throw new Error('desktop shell bundle targets must remain enabled for all platforms');
|
||||
}
|
||||
|
||||
if (config.bundle?.macOS?.infoPlist !== 'Info.plist') {
|
||||
throw new Error('desktop shell macOS bundle must merge the checked Info.plist');
|
||||
}
|
||||
|
||||
for (const [key, value] of [
|
||||
[
|
||||
'NSCameraUsageDescription',
|
||||
'允许 Genarrative 使用摄像头运行需要实时动作输入的同源 H5 体验。',
|
||||
],
|
||||
[
|
||||
'NSMicrophoneUsageDescription',
|
||||
'允许 Genarrative 使用麦克风运行需要实时声音输入的同源 H5 玩法。',
|
||||
],
|
||||
]) {
|
||||
if (!macInfoPlist.includes(`<key>${key}</key>`)) {
|
||||
throw new Error(`desktop shell macOS Info.plist missing ${key}`);
|
||||
}
|
||||
if (!macInfoPlist.includes(`<string>${value}</string>`)) {
|
||||
throw new Error(`desktop shell macOS Info.plist ${key} text drifted`);
|
||||
}
|
||||
}
|
||||
|
||||
const csp = String(config.app?.security?.csp ?? '');
|
||||
const devCsp = String(config.app?.security?.devCsp ?? '');
|
||||
for (const blockedCspToken of ["'unsafe-eval'", 'tauri:', 'file:']) {
|
||||
|
||||
Reference in New Issue
Block a user