feat: add image proxy route and integrate it into media handling for improved Twitter content fetching
This commit is contained in:
parent
051dbac5bf
commit
907fc4491d
6 changed files with 87 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue