Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop

This commit is contained in:
syuilo 2023-03-12 20:57:04 +09:00
commit 7e9d3d9b2f
6 changed files with 13 additions and 12 deletions

View File

@ -20,7 +20,8 @@ You should also include the user name that made the change.
- enhance(client): DM作成時にメンションも含むように - enhance(client): DM作成時にメンションも含むように
- enhance(client): フォロー申請のボタンのデザインを改善 - enhance(client): フォロー申請のボタンのデザインを改善
- enhance(backend): OpenAPIエンドポイントを復旧 - enhance(backend): OpenAPIエンドポイントを復旧
- 透明なWebP/AVIF映像はJPEGではなくWebPに変換するように - WebP/AVIF/JPEGのweb公開用画像は、サーバーサイドではJPEGではなくWebPに変換するように
- アニメーション画像のサムネイルを生成するように
- アクティブユーザー数チャートの記録上限値を拡張 - アクティブユーザー数チャートの記録上限値を拡張
- Playのソースコード上限文字数を2倍に拡張 - Playのソースコード上限文字数を2倍に拡張
- 付箋ウィジェットの高さを設定可能に - 付箋ウィジェットの高さを設定可能に

View File

@ -295,7 +295,7 @@ export class DriveService {
satisfyWebpublic = !!( satisfyWebpublic = !!(
type !== 'image/svg+xml' && // security reason type !== 'image/svg+xml' && // security reason
type !== 'image/avif' && // not supported by Mastodon type !== 'image/avif' && // not supported by Mastodon and MS Edge
!(metadata.exif ?? metadata.iptc ?? metadata.xmp ?? metadata.tifftagPhotoshop) && !(metadata.exif ?? metadata.iptc ?? metadata.xmp ?? metadata.tifftagPhotoshop) &&
metadata.width && metadata.width <= 2048 && metadata.width && metadata.width <= 2048 &&
metadata.height && metadata.height <= 2048 metadata.height && metadata.height <= 2048
@ -339,7 +339,7 @@ export class DriveService {
if (isAnimated) { if (isAnimated) {
thumbnail = await this.imageProcessingService.convertSharpToWebp(sharp(path, { animated: true }), 374, 317, { alphaQuality: 70 }); thumbnail = await this.imageProcessingService.convertSharpToWebp(sharp(path, { animated: true }), 374, 317, { alphaQuality: 70 });
} else { } else {
thumbnail = await this.imageProcessingService.convertSharpToAvif(img, 498, 422); thumbnail = await this.imageProcessingService.convertSharpToWebp(img, 498, 422);
} }
} catch (err) { } catch (err) {
this.registerLogger.warn('thumbnail not created (an error occured)', err as Error); this.registerLogger.warn('thumbnail not created (an error occured)', err as Error);

View File

@ -76,7 +76,7 @@ export class DriveFileEntityService {
@bindThis @bindThis
private getProxiedUrl(url: string, mode?: 'static' | 'avatar'): string { private getProxiedUrl(url: string, mode?: 'static' | 'avatar'): string {
return appendQuery( return appendQuery(
`${this.config.mediaProxy}/${mode ?? 'image'}.${mode === 'avatar' ? 'webp' : 'avif'}`, `${this.config.mediaProxy}/${mode ?? 'image'}.webp`,
query({ query({
url, url,
...(mode ? { [mode]: '1' } : {}), ...(mode ? { [mode]: '1' } : {}),

View File

@ -130,7 +130,7 @@ export class FileServerService {
if (isMimeImage(file.mime, 'sharp-convertible-image-with-bmp')) { if (isMimeImage(file.mime, 'sharp-convertible-image-with-bmp')) {
reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Cache-Control', 'max-age=31536000, immutable');
const url = new URL(`${this.config.mediaProxy}/static.avif`); const url = new URL(`${this.config.mediaProxy}/static.webp`);
url.searchParams.set('url', file.url); url.searchParams.set('url', file.url);
url.searchParams.set('static', '1'); url.searchParams.set('static', '1');
@ -151,7 +151,7 @@ export class FileServerService {
if (['image/svg+xml'].includes(file.mime)) { if (['image/svg+xml'].includes(file.mime)) {
reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Cache-Control', 'max-age=31536000, immutable');
const url = new URL(`${this.config.mediaProxy}/svg.avif`); const url = new URL(`${this.config.mediaProxy}/svg.webp`);
url.searchParams.set('url', file.url); url.searchParams.set('url', file.url);
file.cleanup(); file.cleanup();
@ -291,9 +291,9 @@ export class FileServerService {
}; };
} }
} else if ('static' in request.query) { } else if ('static' in request.query) {
image = this.imageProcessingService.convertSharpToAvifStream(await sharpBmp(file.path, file.mime), 498, 422); image = this.imageProcessingService.convertSharpToWebpStream(await sharpBmp(file.path, file.mime), 498, 422);
} else if ('preview' in request.query) { } else if ('preview' in request.query) {
image = this.imageProcessingService.convertSharpToAvifStream(await sharpBmp(file.path, file.mime), 200, 200); image = this.imageProcessingService.convertSharpToWebpStream(await sharpBmp(file.path, file.mime), 200, 200);
} else if ('badge' in request.query) { } else if ('badge' in request.query) {
const mask = (await sharpBmp(file.path, file.mime)) const mask = (await sharpBmp(file.path, file.mime))
.resize(96, 96, { .resize(96, 96, {
@ -325,7 +325,7 @@ export class FileServerService {
type: 'image/png', type: 'image/png',
}; };
} else if (file.mime === 'image/svg+xml') { } else if (file.mime === 'image/svg+xml') {
image = this.imageProcessingService.convertToAvifStream(file.path, 2048, 2048); image = this.imageProcessingService.convertToWebpStream(file.path, 2048, 2048);
} else if (!file.mime.startsWith('image/') || !FILE_TYPE_BROWSERSAFE.includes(file.mime)) { } else if (!file.mime.startsWith('image/') || !FILE_TYPE_BROWSERSAFE.includes(file.mime)) {
throw new StatusError('Rejected type', 403, 'Rejected type'); throw new StatusError('Rejected type', 403, 'Rejected type');
} }

View File

@ -33,7 +33,7 @@ export class UrlPreviewService {
private wrap(url?: string | null): string | null { private wrap(url?: string | null): string | null {
return url != null return url != null
? url.match(/^https?:\/\//) ? url.match(/^https?:\/\//)
? `${this.config.mediaProxy}/preview.avif?${query({ ? `${this.config.mediaProxy}/preview.webp?${query({
url, url,
preview: '1', preview: '1',
})}` })}`

View File

@ -11,7 +11,7 @@ export function getProxiedImageUrl(imageUrl: string, type?: 'preview', mustOrigi
} }
return `${mustOrigin ? localProxy : instance.mediaProxy}/${ return `${mustOrigin ? localProxy : instance.mediaProxy}/${
type === 'preview' ? 'preview.avif' type === 'preview' ? 'preview.webp'
: 'image.webp' : 'image.webp'
}?${query({ }?${query({
url: imageUrl, url: imageUrl,
@ -41,7 +41,7 @@ export function getStaticImageUrl(baseUrl: string): string {
return u.href; return u.href;
} }
return `${instance.mediaProxy}/static.avif?${query({ return `${instance.mediaProxy}/static.webp?${query({
url: u.href, url: u.href,
static: '1', static: '1',
})}`; })}`;