fix(wechat): sync MindSpace pages after MP generation and redirect on 401
Memind CI / Test, build, and release guards (push) Failing after 3m31s
Memind CI / Test, build, and release guards (push) Failing after 3m31s
WeChat page delivery now triggers syncUserGeneratedPages so write_file HTML gets page records; public share widget redirects unauthenticated owners to WeChat OAuth instead of only showing an error. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -51,6 +51,7 @@ export async function bootstrapPortalIntegrationServices({
|
||||
apiSecret,
|
||||
mindSpacePages,
|
||||
mindSpacePageLiveEdit,
|
||||
syncUserGeneratedPages = null,
|
||||
logger = console,
|
||||
healthChannelStore = null,
|
||||
healthObservationStore = null,
|
||||
@@ -212,6 +213,35 @@ export async function bootstrapPortalIntegrationServices({
|
||||
sessionId,
|
||||
artifacts = [],
|
||||
}) => {
|
||||
const relativePaths = [
|
||||
...new Set(
|
||||
artifacts
|
||||
.map((artifact) =>
|
||||
String(
|
||||
artifact?.relativePath ??
|
||||
artifact?.relative_path ??
|
||||
'',
|
||||
).trim(),
|
||||
)
|
||||
.filter(Boolean),
|
||||
),
|
||||
];
|
||||
if (
|
||||
typeof syncUserGeneratedPages === 'function' &&
|
||||
userId
|
||||
) {
|
||||
void syncUserGeneratedPages(userId, {
|
||||
sessionId,
|
||||
sinceMs: Date.now() - 10 * 60 * 1000,
|
||||
onlyRelativePaths:
|
||||
relativePaths.length > 0 ? relativePaths : null,
|
||||
}).catch((error) => {
|
||||
logger.warn?.(
|
||||
'[WeChat MP] page sync after generation failed:',
|
||||
error instanceof Error ? error.message : error,
|
||||
);
|
||||
});
|
||||
}
|
||||
for (const artifact of artifacts) {
|
||||
const pageOwner =
|
||||
(await userAuth
|
||||
|
||||
Reference in New Issue
Block a user