feat: add Telegram message verification code copy
This commit is contained in:
@@ -52,6 +52,23 @@ const telegramService = {
|
|||||||
const jwtToken = await jwtUtils.generateToken(c, { emailId: email.emailId })
|
const jwtToken = await jwtUtils.generateToken(c, { emailId: email.emailId })
|
||||||
|
|
||||||
const webAppUrl = customDomain ? `${domainUtils.toOssDomain(customDomain)}/api/telegram/getEmail/${jwtToken}` : 'https://www.cloudflare.com/404'
|
const webAppUrl = customDomain ? `${domainUtils.toOssDomain(customDomain)}/api/telegram/getEmail/${jwtToken}` : 'https://www.cloudflare.com/404'
|
||||||
|
const inlineKeyboard = [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: '查看',
|
||||||
|
web_app: { url: webAppUrl }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (email.code) {
|
||||||
|
inlineKeyboard.push([
|
||||||
|
{
|
||||||
|
text: email.code,
|
||||||
|
copy_text: { text: email.code }
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
await Promise.all(tgChatIds.map(async chatId => {
|
await Promise.all(tgChatIds.map(async chatId => {
|
||||||
try {
|
try {
|
||||||
@@ -65,14 +82,7 @@ const telegramService = {
|
|||||||
parse_mode: 'HTML',
|
parse_mode: 'HTML',
|
||||||
text: emailMsgTemplate(email, tgMsgTo, tgMsgFrom, tgMsgText),
|
text: emailMsgTemplate(email, tgMsgTo, tgMsgFrom, tgMsgText),
|
||||||
reply_markup: {
|
reply_markup: {
|
||||||
inline_keyboard: [
|
inline_keyboard: inlineKeyboard
|
||||||
[
|
|
||||||
{
|
|
||||||
text: '查看',
|
|
||||||
web_app: { url: webAppUrl }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user