Skip to content

Commit

Permalink
動画はProxyさせないようにfix
Browse files Browse the repository at this point in the history
  • Loading branch information
AyumuNekozuki committed Jan 17, 2024
1 parent 455c3e4 commit 9b0987f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/backend/src/core/entities/DriveFileEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export class DriveFileEntityService {

@bindThis
private getProxiedUrl(url: string, mode?: 'static' | 'avatar'): string {
// みすほわ独自: 動画であればproxyさせない
if(url.endsWith('.mp4') || url.endsWith('.mov') || url.endsWith('.m4v') || url.endsWith('.3gp')){

Check failure on line 80 in packages/backend/src/core/entities/DriveFileEntityService.ts

View workflow job for this annotation

GitHub Actions / lint (backend)

Expected space(s) after "if"

Check failure on line 80 in packages/backend/src/core/entities/DriveFileEntityService.ts

View workflow job for this annotation

GitHub Actions / lint (backend)

Missing space before opening brace
return url;
}

return appendQuery(
`${this.config.mediaProxy}/${mode ?? 'image'}.webp`,
query({
Expand Down
5 changes: 5 additions & 0 deletions packages/frontend/src/scripts/media-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export function getProxiedImageUrl(imageUrl: string, type?: 'preview' | 'emoji'
imageUrl = (new URL(imageUrl)).searchParams.get('url') ?? imageUrl;
}

// みすほわ独自: 動画であればproxyさせない
if(imageUrl.endsWith('.mp4') || imageUrl.endsWith('.mov') || imageUrl.endsWith('.m4v') || imageUrl.endsWith('.3gp')){

Check failure on line 19 in packages/frontend/src/scripts/media-proxy.ts

View workflow job for this annotation

GitHub Actions / lint (frontend)

Expected space(s) after "if"

Check failure on line 19 in packages/frontend/src/scripts/media-proxy.ts

View workflow job for this annotation

GitHub Actions / lint (frontend)

Missing space before opening brace
return imageUrl;
}

return `${mustOrigin ? localProxy : instance.mediaProxy}/${
type === 'preview' ? 'preview.webp'
: 'image.webp'
Expand Down

0 comments on commit 9b0987f

Please sign in to comment.