feat: add image proxy route and integrate it into media handling for improved Twitter content fetching

This commit is contained in:
암냥 2026-05-23 22:31:02 +09:00
commit 907fc4491d
No known key found for this signature in database
6 changed files with 87 additions and 12 deletions

View file

@ -610,11 +610,18 @@ export default new Elysia({ prefix: "/post" })
const tweetData = await fetchTweetData(body.url);
let savedCount = 0;
let failedCount = 0;
const savedIds: string[] = [];
if (!tweetData.tweet) {
const apiCode = tweetData.code ?? "unknown";
console.warn(`[Upload failed] fxtwitter returned no tweet, code=${apiCode} url=${body.url}`);
return status(404, uploadError(`트윗을 찾을 수 없거나 비공개 계정입니다. (code: ${apiCode})`));
}
if (tweetData.tweet) {
const media = tweetData.tweet.media.all || tweetData.tweet.media.photos || [];
const media = tweetData.tweet.media?.all || tweetData.tweet.media?.photos || [];
if (media.length > 0) {
const hasExplicitSelection = body.selected.length > 0;
const savedIds: string[] = [];
for (const [index, mediaItem] of media.entries()) {
const isSelected = hasExplicitSelection
? body.selected[index] === true