chore: proxy image preview in frontend (#11957)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Images and icons in bookmark cards are now loaded through an image proxy for improved reliability and consistency. - Embed blocks for GitHub, Loom, and YouTube now display banner and creator images via an image proxy service for enhanced image loading. - **Refactor** - Simplified backend URL handling and proxy logic for images, resulting in more efficient processing and reduced complexity. - Consolidated image proxy middleware and services into a shared adapter module for streamlined imports and improved maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -209,7 +209,6 @@ export class WorkerController {
|
||||
videos: [],
|
||||
favicons: [],
|
||||
};
|
||||
const baseUrl = new URL(request.url, this.url.baseUrl).toString();
|
||||
|
||||
if (response.body) {
|
||||
const resp = await decodeWithCharset(response, res);
|
||||
@@ -276,7 +275,7 @@ export class WorkerController {
|
||||
|
||||
await rewriter.transform(resp).text();
|
||||
|
||||
res.images = await reduceUrls(baseUrl, res.images);
|
||||
res.images = await reduceUrls(res.images);
|
||||
|
||||
this.logger.debug('Processed response with HTMLRewriter', {
|
||||
origin,
|
||||
@@ -293,7 +292,7 @@ export class WorkerController {
|
||||
appendUrl(faviconUrl.toString(), res.favicons);
|
||||
}
|
||||
|
||||
res.favicons = await reduceUrls(baseUrl, res.favicons);
|
||||
res.favicons = await reduceUrls(res.favicons);
|
||||
}
|
||||
|
||||
const json = JSON.stringify(res);
|
||||
|
||||
Reference in New Issue
Block a user