fix(route/telegram): fix channel media path overlap (#20085)

This commit is contained in:
Tony 2025-09-17 21:23:48 +08:00 committed by GitHub
parent 9f8e967c8a
commit 2566b86617
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -161,9 +161,9 @@ function streamResponse(c: Context, bodyIter: AsyncGenerator<Buffer>) {
}
export const route: Route = {
path: '/channel/:entityName/:messageId',
path: '/media/:entityName/:messageId',
categories: ['social-media'],
example: '/channel/telegram/1233',
example: '/telegram/media/telegram/1233',
parameters: { entityName: 'entity name', messageId: 'message id' },
features: {
requireConfig: [

View File

@ -10,7 +10,7 @@ import { getGeoLink, getMediaLink } from './tglib/channel';
export const route: Route = {
path: '/stories/:username/:story?',
categories: ['social-media'],
example: '/stories/sandboxuser1',
example: '/telegram/stories/telegram',
parameters: { username: 'entity name', story: 'story' },
features: {
requireConfig: [

View File

@ -142,7 +142,7 @@ export default async function handler(ctx: Context) {
}
// messages that have no text are shown as if they're one post
// because in TG only 1 attachment per message is possible
const src = `${new URL(ctx.req.url).origin}/telegram/channel/${username}/${message.id}`;
const src = `${new URL(ctx.req.url).origin}/telegram/media/${username}/${message.id}`;
attachments.push(getMediaLink(src, media));
}
if (message.replyMarkup instanceof Api.ReplyInlineMarkup) {