fix: isolate WeChat runtime delivery path
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
export async function bootstrapPortalIntegrationServices({
|
||||
pool,
|
||||
h5Root,
|
||||
codeRoot = h5Root,
|
||||
env = process.env,
|
||||
usersRoot,
|
||||
wechatMpConfig,
|
||||
@@ -76,7 +77,9 @@ export async function bootstrapPortalIntegrationServices({
|
||||
);
|
||||
}
|
||||
|
||||
const wechatMp = await loadWechatMpModuleFn(h5Root);
|
||||
const wechatMpRoot = codeRoot || h5Root;
|
||||
logger.log?.(`[WeChat MP] Loading runtime module from code root: ${wechatMpRoot}`);
|
||||
const wechatMp = await loadWechatMpModuleFn(wechatMpRoot);
|
||||
const pageDataDeliveryReviewer =
|
||||
wechatMpConfig?.pageDataAiderReviewEnabled === true
|
||||
? createPageDataDeliveryCodeReviewServiceFn({
|
||||
@@ -122,6 +125,7 @@ export async function bootstrapPortalIntegrationServices({
|
||||
tkmindProxy.startSessionForUser(userId, {
|
||||
workingDir,
|
||||
sessionPolicy,
|
||||
origin: 'wechat',
|
||||
}),
|
||||
sessionApiFetch: async (
|
||||
sessionId,
|
||||
|
||||
@@ -97,6 +97,7 @@ function createSetup(overrides = {}) {
|
||||
const options = {
|
||||
pool,
|
||||
h5Root: '/app',
|
||||
codeRoot: '/runtime',
|
||||
env: {
|
||||
H5_SCHEDULE_ENABLED: '1',
|
||||
H5_REMINDER_WORKER_ENABLED: '1',
|
||||
@@ -236,6 +237,10 @@ test('preserves WeChat service configuration and proxy callbacks', async () => {
|
||||
);
|
||||
const { wechatOptions } = setup.getCaptured();
|
||||
|
||||
assert.deepEqual(
|
||||
setup.calls.find(([kind]) => kind === 'load-wechat'),
|
||||
['load-wechat', '/runtime'],
|
||||
);
|
||||
assert.equal(
|
||||
wechatOptions.pageDataFinishGuard,
|
||||
setup.options.mindSpacePublicFinish,
|
||||
@@ -268,6 +273,18 @@ test('preserves WeChat service configuration and proxy callbacks', async () => {
|
||||
}),
|
||||
{ sessionId: 'session-1' },
|
||||
);
|
||||
assert.deepEqual(
|
||||
setup.calls.find(([kind]) => kind === 'start-session'),
|
||||
[
|
||||
'start-session',
|
||||
'user-1',
|
||||
{
|
||||
workingDir: '/workspace',
|
||||
sessionPolicy: { sandboxed: true },
|
||||
origin: 'wechat',
|
||||
},
|
||||
],
|
||||
);
|
||||
assert.deepEqual(
|
||||
await wechatOptions.sessionApiFetch(
|
||||
'session-1',
|
||||
|
||||
Reference in New Issue
Block a user