Wire Taro social pages to social_svc (Centrifugo + live RTMP), drop multi-channel chat chrome, and add weapp WXSS sanitize/deploy helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
const { MEETUPS } = require('./_seed')
|
||
|
||
function text(t) {
|
||
return [{ type: 'text', text: t }]
|
||
}
|
||
|
||
async function openMeetupLive({ meetupId, nick } = {}) {
|
||
const id = String(meetupId || '').trim()
|
||
if (!id) {
|
||
return {
|
||
isError: true,
|
||
content: text('请提供场次 id,例如 wk-nomad-office。可先调用 listMeetupRooms。'),
|
||
}
|
||
}
|
||
const meetup = MEETUPS.find((m) => m.id === id) || {
|
||
id,
|
||
title: '开视频见面',
|
||
date: '',
|
||
time: '',
|
||
mirotalkRoom: id,
|
||
}
|
||
const name = String(nick || wx.getStorageSync('userName') || '游民').trim() || '游民'
|
||
try {
|
||
wx.setStorageSync('nick', name)
|
||
} catch (e) {
|
||
/* ignore */
|
||
}
|
||
|
||
const pagePath = `/pages/social/meetup-live/index`
|
||
return {
|
||
isError: false,
|
||
content: text(
|
||
`准备进入「${meetup.title}」。微信内用 live-pusher / createLivePusherContext(RTC 预览与推流),不走 web-view。`,
|
||
),
|
||
structuredContent: {
|
||
title: meetup.title,
|
||
meetupId: meetup.id,
|
||
nick: name,
|
||
pagePath: `${pagePath}?id=${encodeURIComponent(meetup.id)}`,
|
||
linkText: '进入语音视频厅',
|
||
},
|
||
handoff: () => ({
|
||
path: pagePath,
|
||
query: `id=${encodeURIComponent(meetup.id)}&nick=${encodeURIComponent(name)}`,
|
||
payload: {
|
||
meetupId: meetup.id,
|
||
title: meetup.title,
|
||
mirotalkRoom: meetup.mirotalkRoom,
|
||
nick: name,
|
||
useLivePusher: true,
|
||
},
|
||
}),
|
||
}
|
||
}
|
||
|
||
module.exports = openMeetupLive
|