summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/proxy
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2022-04-28 11:14:03 +0900
committerGitHub <noreply@github.com>2022-04-28 11:14:03 +0900
commit12a3c6872f0a31c923bf0cd7c183cb8776d58dda (patch)
tree7269d836ee2390cfb1cbb86b49338265d4234794 /packages/backend/src/server/proxy
parentfix(client): fix lint issues in autocomplete (#8548) (diff)
downloadmisskey-12a3c6872f0a31c923bf0cd7c183cb8776d58dda.tar.gz
misskey-12a3c6872f0a31c923bf0cd7c183cb8776d58dda.tar.bz2
misskey-12a3c6872f0a31c923bf0cd7c183cb8776d58dda.zip
enhance: ドライブに画像ファイルをアップロードするときオリジナル画像を破棄してwebpublicのみ保持するオプション (#8216)
* wip * Update packages/client/src/os.ts Co-authored-by: tamaina <tamaina@hotmail.co.jp> * メニューをComposition API化、switchアイテム追加 クライアントサイド画像圧縮の準備 * メニュー型定義を分離 (TypeScriptの型支援が効かないので) * disabled * make keepOriginal to follow setting value * :v: * fix * fix * :v: * WEBP * aaa * :v: * webp * lazy load browser-image-resizer * rename * rename 2 * Fix * clean up * add comment * clean up * jpeg, pngにもどす * fix * fix name * webpでなくする ただしサムネやプレビューはwebpのまま (テスト) * 動画サムネイルはjpegに * エラーハンドリング * :v: * v2.2.1-misskey-beta.2 * browser-image-resizer#v2.2.1-misskey.1 * :v: * fix alert * update browser-image-resizer to v2.2.1-misskey.2 * lockfile Co-authored-by: mei23 <m@m544.net> Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/server/proxy')
-rw-r--r--packages/backend/src/server/proxy/proxy-media.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/backend/src/server/proxy/proxy-media.ts b/packages/backend/src/server/proxy/proxy-media.ts
index 3cc5b827a6..48887bf12f 100644
--- a/packages/backend/src/server/proxy/proxy-media.ts
+++ b/packages/backend/src/server/proxy/proxy-media.ts
@@ -1,7 +1,7 @@
import * as fs from 'node:fs';
import Koa from 'koa';
import { serverLogger } from '../index.js';
-import { IImage, convertToPng, convertToJpeg } from '@/services/drive/image-processor.js';
+import { IImage, convertToWebp } from '@/services/drive/image-processor.js';
import { createTemp } from '@/misc/create-temp.js';
import { downloadUrl } from '@/misc/download-url.js';
import { detectType } from '@/misc/get-file-info.js';
@@ -27,11 +27,11 @@ export async function proxyMedia(ctx: Koa.Context) {
let image: IImage;
if ('static' in ctx.query && ['image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng', 'image/webp', 'image/svg+xml'].includes(mime)) {
- image = await convertToPng(path, 498, 280);
+ image = await convertToWebp(path, 498, 280);
} else if ('preview' in ctx.query && ['image/jpeg', 'image/png', 'image/gif', 'image/apng', 'image/vnd.mozilla.apng', 'image/svg+xml'].includes(mime)) {
- image = await convertToJpeg(path, 200, 200);
+ image = await convertToWebp(path, 200, 200);
} else if (['image/svg+xml'].includes(mime)) {
- image = await convertToPng(path, 2048, 2048);
+ image = await convertToWebp(path, 2048, 2048, 1);
} else if (!mime.startsWith('image/') || !FILE_TYPE_BROWSERSAFE.includes(mime)) {
throw new StatusError('Rejected type', 403, 'Rejected type');
} else {