收紧分享载荷边界

将 share.open 分享目标归一化提升到共享 HostBridge 契约

让 H5 facade 和 Expo 移动壳按共享分享边界发送与消费载荷

把原生分享 URL 统一映射到公开 H5 主站地址

增加分享载荷测试和三端壳总门禁反查

同步宿主壳协议文档和共享决策记录
This commit is contained in:
2026-06-19 16:08:42 +08:00
parent 98f62474b6
commit 14da1a7e12
10 changed files with 235 additions and 110 deletions
@@ -9,6 +9,7 @@ import {
} from '@testing-library/react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { HOST_BRIDGE_PUBLIC_WEB_ORIGIN } from '../../../packages/shared/src/contracts/hostBridge';
import * as clipboardService from '../../services/clipboard';
import { PublishShareModal } from './PublishShareModal';
import {
@@ -195,13 +196,18 @@ describe('PublishShareModal', () => {
within(dialog).getByRole('button', { name: '已打开' }),
).toBeTruthy();
});
const rawShareUrl = new URL(buildPublishShareUrl(payload));
const publicShareUrl = new URL(
`${rawShareUrl.pathname}${rawShareUrl.search}${rawShareUrl.hash}`,
HOST_BRIDGE_PUBLIC_WEB_ORIGIN,
).toString();
expect(invoke).toHaveBeenCalledWith('host_bridge_request', {
request: expect.objectContaining({
method: 'share.open',
payload: {
title: '暖灯猫街',
message: '邀请你来玩《暖灯猫街》\n作品号:PZ-00000001',
url: buildPublishShareUrl(payload),
url: publicShareUrl,
},
}),
});