1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-23 14:46:44 +09:00

Merge remote-branch 'misskey/develop'

This commit is contained in:
NoriDev 2023-07-07 17:34:23 +09:00
commit 5a92456a83
22 changed files with 2812 additions and 2166 deletions

View File

@ -6,7 +6,7 @@
"features": { "features": {
"ghcr.io/devcontainers-contrib/features/pnpm:2": {}, "ghcr.io/devcontainers-contrib/features/pnpm:2": {},
"ghcr.io/devcontainers/features/node:1": { "ghcr.io/devcontainers/features/node:1": {
"version": "18.16.0" "version": "20.4.0"
} }
}, },
"forwardPorts": [3000], "forwardPorts": [3000],

View File

@ -54,7 +54,7 @@ Please include errors from the developer console and/or server log files if you
* Installation Method or Hosting Service: <!-- Example: docker compose, k8s/docker, systemd, "CherryPick install shell script", development environment --> * Installation Method or Hosting Service: <!-- Example: docker compose, k8s/docker, systemd, "CherryPick install shell script", development environment -->
* CherryPick: 13.x.x-cp-4.x.x * CherryPick: 13.x.x-cp-4.x.x
* Node: 18.x.x * Node: 20.x.x
* PostgreSQL: 15.x.x * PostgreSQL: 15.x.x
* Redis: 7.x.x * Redis: 7.x.x
* OS and Architecture: <!-- Example: Ubuntu 22.04.2 LTS aarch64 --> * OS and Architecture: <!-- Example: Ubuntu 22.04.2 LTS aarch64 -->

View File

@ -37,7 +37,7 @@ jobs:
with: with:
version: 8 version: 8
run_install: false run_install: false
- name: Use Node.js 18.x - name: Use Node.js 20.x
uses: actions/setup-node@v3.6.0 uses: actions/setup-node@v3.6.0
with: with:
node-version-file: '.node-version' node-version-file: '.node-version'

View File

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x] node-version: [20.x]
services: services:
postgres: postgres:

View File

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x] node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:

View File

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x] node-version: [20.x]
steps: steps:
- uses: actions/checkout@v3.3.0 - uses: actions/checkout@v3.3.0
@ -51,7 +51,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [18.x] node-version: [20.x]
browser: [chrome] browser: [chrome]
services: services:

View File

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x] node-version: [20.x]
steps: steps:
- uses: actions/checkout@v3.3.0 - uses: actions/checkout@v3.3.0

3
.gitignore vendored
View File

@ -65,4 +65,5 @@ temp
*.blend4 *.blend4
*.blend5 *.blend5
.pnpm-store/ # VSCode addon
.favorites.json

View File

@ -1 +1 @@
18.16.0 20.4.0

View File

@ -14,6 +14,9 @@
## 13.x.x (unreleased) ## 13.x.x (unreleased)
### NOTE
- Node.js 20.4.0以上が必要になりました
### General ### General
- identicon生成を無効にしてパフォーマンスを向上させることができるようになりました - identicon生成を無効にしてパフォーマンスを向上させることができるようになりました
- サーバーのマシン情報の公開を無効にしてパフォーマンスを向上させることができるようになりました - サーバーのマシン情報の公開を無効にしてパフォーマンスを向上させることができるようになりました
@ -24,6 +27,7 @@
- deck UIのカラムのメニューからアンテナとリストの編集画面を開けるように - deck UIのカラムのメニューからアンテナとリストの編集画面を開けるように
- ドライブファイルのメニューで画像をクロップできるように - ドライブファイルのメニューで画像をクロップできるように
- 画像を動画と同様に簡単に隠せるように - 画像を動画と同様に簡単に隠せるように
- オリジナル画像を保持せずにアップロードする場合webpでアップロードされるように(Safari以外)
### Server ### Server
- JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました - JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました

View File

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.4 # syntax = docker/dockerfile:1.4
ARG NODE_VERSION=18.16.0-bullseye ARG NODE_VERSION=20.4.0-bullseye
# build assets & compile TypeScript # build assets & compile TypeScript

View File

@ -51,16 +51,16 @@
"gulp-replace": "1.1.4", "gulp-replace": "1.1.4",
"gulp-terser": "2.1.0", "gulp-terser": "2.1.0",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"typescript": "5.1.3" "typescript": "5.1.6"
}, },
"devDependencies": { "devDependencies": {
"@types/gulp": "4.0.10", "@types/gulp": "4.0.10",
"@types/gulp-rename": "2.0.1", "@types/gulp-rename": "2.0.1",
"@typescript-eslint/eslint-plugin": "5.60.0", "@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.60.0", "@typescript-eslint/parser": "5.61.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "12.15.0", "cypress": "12.17.0",
"eslint": "8.43.0", "eslint": "8.44.0",
"start-server-and-test": "2.0.0" "start-server-and-test": "2.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@ -51,12 +51,12 @@
"utf-8-validate": "^6.0.3" "utf-8-validate": "^6.0.3"
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "3.321.1", "@aws-sdk/client-s3": "3.367.0",
"@aws-sdk/lib-storage": "3.321.1", "@aws-sdk/lib-storage": "3.367.0",
"@aws-sdk/node-http-handler": "3.321.1", "@aws-sdk/node-http-handler": "3.360.0",
"@bull-board/api": "5.5.3", "@bull-board/api": "5.6.0",
"@bull-board/fastify": "5.5.3", "@bull-board/fastify": "5.6.0",
"@bull-board/ui": "5.5.3", "@bull-board/ui": "5.6.0",
"@discordapp/twemoji": "14.1.2", "@discordapp/twemoji": "14.1.2",
"@fastify/accepts": "4.2.0", "@fastify/accepts": "4.2.0",
"@fastify/cookie": "8.3.0", "@fastify/cookie": "8.3.0",
@ -64,16 +64,16 @@
"@fastify/http-proxy": "9.2.1", "@fastify/http-proxy": "9.2.1",
"@fastify/multipart": "7.7.0", "@fastify/multipart": "7.7.0",
"@fastify/static": "6.10.2", "@fastify/static": "6.10.2",
"@fastify/view": "7.4.1", "@fastify/view": "8.0.0",
"@google-cloud/logging": "^10.5.0", "@google-cloud/logging": "^10.5.0",
"@google-cloud/translate": "^7.2.1", "@google-cloud/translate": "^7.2.1",
"@nestjs/common": "10.0.3", "@nestjs/common": "10.0.5",
"@nestjs/core": "10.0.3", "@nestjs/core": "10.0.5",
"@nestjs/testing": "10.0.3", "@nestjs/testing": "10.0.5",
"@peertube/http-signature": "1.7.0", "@peertube/http-signature": "1.7.0",
"@sinonjs/fake-timers": "10.3.0", "@sinonjs/fake-timers": "10.3.0",
"@swc/cli": "0.1.62", "@swc/cli": "0.1.62",
"@swc/core": "1.3.66", "@swc/core": "1.3.68",
"@vitalets/google-translate-api": "9.2.0", "@vitalets/google-translate-api": "9.2.0",
"accepts": "1.3.8", "accepts": "1.3.8",
"ajv": "8.12.0", "ajv": "8.12.0",
@ -81,7 +81,7 @@
"autwh": "0.1.0", "autwh": "0.1.0",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"blurhash": "2.0.5", "blurhash": "2.0.5",
"bullmq": "4.1.0", "bullmq": "4.2.0",
"cacheable-lookup": "7.0.0", "cacheable-lookup": "7.0.0",
"cbor": "9.0.0", "cbor": "9.0.0",
"chalk": "5.2.0", "chalk": "5.2.0",
@ -95,18 +95,18 @@
"date-fns": "2.30.0", "date-fns": "2.30.0",
"deep-email-validator": "0.1.21", "deep-email-validator": "0.1.21",
"escape-regexp": "0.0.1", "escape-regexp": "0.0.1",
"fastify": "4.18.0", "fastify": "4.19.2",
"feed": "4.2.2", "feed": "4.2.2",
"file-type": "18.5.0", "file-type": "18.5.0",
"fluent-ffmpeg": "2.1.2", "fluent-ffmpeg": "2.1.2",
"form-data": "4.0.0", "form-data": "4.0.0",
"got": "13.0.0", "got": "13.0.0",
"happy-dom": "9.20.3", "happy-dom": "10.0.3",
"hpagent": "1.2.0", "hpagent": "1.2.0",
"ioredis": "5.3.2", "ioredis": "5.3.2",
"ip-cidr": "3.1.0", "ip-cidr": "3.1.0",
"ipaddr.js": "2.1.0", "ipaddr.js": "2.1.0",
"is-svg": "4.3.2", "is-svg": "5.0.0",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"jsdom": "22.1.0", "jsdom": "22.1.0",
"json5": "2.2.3", "json5": "2.2.3",
@ -121,9 +121,9 @@
"nsfwjs": "2.4.2", "nsfwjs": "2.4.2",
"oauth": "0.10.0", "oauth": "0.10.0",
"os-utils": "0.0.14", "os-utils": "0.0.14",
"otpauth": "9.1.2", "otpauth": "9.1.3",
"parse5": "7.1.2", "parse5": "7.1.2",
"pg": "8.11.0", "pg": "8.11.1",
"probe-image-size": "7.2.3", "probe-image-size": "7.2.3",
"promise-limit": "2.7.0", "promise-limit": "2.7.0",
"pug": "3.0.2", "pug": "3.0.2",
@ -148,14 +148,14 @@
"stringz": "2.1.0", "stringz": "2.1.0",
"strip-ansi": "^7.1.0", "strip-ansi": "^7.1.0",
"summaly": "github:misskey-dev/summaly", "summaly": "github:misskey-dev/summaly",
"systeminformation": "5.18.4", "systeminformation": "5.18.6",
"tinycolor2": "1.6.0", "tinycolor2": "1.6.0",
"tmp": "0.2.1", "tmp": "0.2.1",
"tsc-alias": "1.8.6", "tsc-alias": "1.8.7",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"twemoji-parser": "14.0.0", "twemoji-parser": "14.0.0",
"typeorm": "0.3.17", "typeorm": "0.3.17",
"typescript": "5.1.3", "typescript": "5.1.6",
"ulid": "2.3.0", "ulid": "2.3.0",
"unzipper": "0.10.14", "unzipper": "0.10.14",
"uuid": "9.0.0", "uuid": "9.0.0",
@ -165,7 +165,7 @@
"xev": "3.0.2" "xev": "3.0.2"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "29.5.0", "@jest/globals": "29.6.1",
"@swc/jest": "0.2.26", "@swc/jest": "0.2.26",
"@types/accepts": "1.3.5", "@types/accepts": "1.3.5",
"@types/archiver": "5.3.2", "@types/archiver": "5.3.2",
@ -182,14 +182,14 @@
"@types/jsrsasign": "10.5.8", "@types/jsrsasign": "10.5.8",
"@types/mime-types": "2.1.1", "@types/mime-types": "2.1.1",
"@types/ms": "^0.7.31", "@types/ms": "^0.7.31",
"@types/node": "20.3.1", "@types/node": "20.4.0",
"@types/node-fetch": "3.0.3", "@types/node-fetch": "3.0.3",
"@types/nodemailer": "6.4.8", "@types/nodemailer": "6.4.8",
"@types/oauth": "0.9.1", "@types/oauth": "0.9.1",
"@types/pg": "8.10.2", "@types/pg": "8.10.2",
"@types/pug": "2.0.6", "@types/pug": "2.0.6",
"@types/punycode": "2.1.0", "@types/punycode": "2.1.0",
"@types/qrcode": "1.5.0", "@types/qrcode": "1.5.1",
"@types/random-seed": "0.3.3", "@types/random-seed": "0.3.3",
"@types/ratelimiter": "3.4.4", "@types/ratelimiter": "3.4.4",
"@types/redis": "4.0.11", "@types/redis": "4.0.11",
@ -206,14 +206,14 @@
"@types/web-push": "3.3.2", "@types/web-push": "3.3.2",
"@types/websocket": "1.0.5", "@types/websocket": "1.0.5",
"@types/ws": "8.5.5", "@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "5.60.0", "@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.60.0", "@typescript-eslint/parser": "5.61.0",
"aws-sdk-client-mock": "2.1.1", "aws-sdk-client-mock": "3.0.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"eslint": "8.43.0", "eslint": "8.44.0",
"eslint-plugin-import": "2.27.5", "eslint-plugin-import": "2.27.5",
"execa": "6.1.0", "execa": "7.1.1",
"jest": "29.5.0", "jest": "29.6.1",
"jest-mock": "29.5.0" "jest-mock": "29.6.1"
} }
} }

View File

@ -304,11 +304,11 @@ export class FileInfoService {
@bindThis @bindThis
public fixMime(mime: string | fileType.MimeType): string { public fixMime(mime: string | fileType.MimeType): string {
// see https://github.com/misskey-dev/misskey/pull/10686 // see https://github.com/misskey-dev/misskey/pull/10686
if (mime === "audio/x-flac") { if (mime === 'audio/x-flac') {
return "audio/flac"; return 'audio/flac';
} }
if (mime === "audio/vnd.wave") { if (mime === 'audio/vnd.wave') {
return "audio/wav"; return 'audio/wav';
} }
return mime; return mime;
@ -355,11 +355,12 @@ export class FileInfoService {
* Check the file is SVG or not * Check the file is SVG or not
*/ */
@bindThis @bindThis
public async checkSvg(path: string) { public async checkSvg(path: string): Promise<boolean> {
try { try {
const size = await this.getFileSize(path); const size = await this.getFileSize(path);
if (size > 1 * 1024 * 1024) return false; if (size > 1 * 1024 * 1024) return false;
return isSvg(fs.readFileSync(path)); const buffer = await fs.promises.readFile(path);
return isSvg(buffer.toString());
} catch { } catch {
return false; return false;
} }

View File

@ -35,7 +35,7 @@ html
link(rel='prefetch' href=infoImageUrl) link(rel='prefetch' href=infoImageUrl)
link(rel='prefetch' href=notFoundImageUrl) link(rel='prefetch' href=notFoundImageUrl)
//- https://github.com/misskey-dev/misskey/issues/9842 //- https://github.com/misskey-dev/misskey/issues/9842
link(rel='stylesheet' href='/assets/tabler-icons/tabler-icons.min.css?v2.22.0') link(rel='stylesheet' href='/assets/tabler-icons/tabler-icons.min.css?v2.24.0')
link(rel='modulepreload' href=`/vite/${clientEntry.file}`) link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
if !config.clientManifestExists if !config.clientManifestExists

View File

@ -20,26 +20,26 @@
"url": "git+https://github.com/misskey-dev/misskey.js.git" "url": "git+https://github.com/misskey-dev/misskey.js.git"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "7.36.0", "@microsoft/api-extractor": "7.36.1",
"@swc/jest": "0.2.26", "@swc/jest": "0.2.26",
"@types/jest": "29.5.2", "@types/jest": "29.5.2",
"@types/node": "20.3.1", "@types/node": "20.4.0",
"@typescript-eslint/eslint-plugin": "5.60.0", "@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.60.0", "@typescript-eslint/parser": "5.61.0",
"eslint": "8.43.0", "eslint": "8.44.0",
"jest": "29.5.0", "jest": "29.6.1",
"jest-fetch-mock": "3.0.3", "jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.4.0", "jest-websocket-mock": "2.4.0",
"mock-socket": "9.2.1", "mock-socket": "9.2.1",
"tsd": "0.28.1", "tsd": "0.28.1",
"typescript": "5.1.3" "typescript": "5.1.6"
}, },
"files": [ "files": [
"built" "built"
], ],
"dependencies": { "dependencies": {
"@swc/cli": "0.1.62", "@swc/cli": "0.1.62",
"@swc/core": "1.3.66", "@swc/core": "1.3.68",
"eventemitter3": "5.0.1", "eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0" "reconnecting-websocket": "4.4.0"
} }

View File

@ -20,9 +20,9 @@
"@rollup/plugin-replace": "5.0.2", "@rollup/plugin-replace": "5.0.2",
"@rollup/pluginutils": "5.0.2", "@rollup/pluginutils": "5.0.2",
"@syuilo/aiscript": "0.13.3", "@syuilo/aiscript": "0.13.3",
"@tabler/icons-webfont": "2.22.0", "@tabler/icons-webfont": "2.24.0",
"@vitejs/plugin-vue": "4.2.3", "@vitejs/plugin-vue": "4.2.3",
"@vue-macros/reactivity-transform": "0.3.10", "@vue-macros/reactivity-transform": "0.3.11",
"@vue/compiler-sfc": "3.3.4", "@vue/compiler-sfc": "3.3.4",
"astring": "1.8.6", "astring": "1.8.6",
"autosize": "6.0.1", "autosize": "6.0.1",
@ -44,18 +44,18 @@
"escape-regexp": "0.0.1", "escape-regexp": "0.0.1",
"estree-walker": "^3.0.3", "estree-walker": "^3.0.3",
"eventemitter3": "5.0.1", "eventemitter3": "5.0.1",
"gsap": "3.12.1", "gsap": "3.12.2",
"idb-keyval": "6.2.1", "idb-keyval": "6.2.1",
"insert-text-at-cursor": "0.3.0", "insert-text-at-cursor": "0.3.0",
"is-file-animated": "1.0.2", "is-file-animated": "1.0.2",
"json5": "2.2.3", "json5": "2.2.3",
"matter-js": "0.19.0", "matter-js": "0.19.0",
"mitt": "3.0.0", "mitt": "3.0.0",
"photoswipe": "5.3.7", "photoswipe": "5.3.8",
"prismjs": "1.29.0", "prismjs": "1.29.0",
"punycode": "2.3.0", "punycode": "2.3.0",
"querystring": "0.2.1", "querystring": "0.2.1",
"rollup": "3.25.1", "rollup": "3.26.2",
"s-age": "1.1.2", "s-age": "1.1.2",
"sanitize-html": "2.11.0", "sanitize-html": "2.11.0",
"sass": "1.63.6", "sass": "1.63.6",
@ -63,83 +63,83 @@
"syuilo-password-strength": "0.0.1", "syuilo-password-strength": "0.0.1",
"temml": "0.10.13", "temml": "0.10.13",
"textarea-caret": "3.1.0", "textarea-caret": "3.1.0",
"three": "0.153.0", "three": "0.154.0",
"throttle-debounce": "5.0.0", "throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0", "tinycolor2": "1.6.0",
"tsc-alias": "1.8.6", "tsc-alias": "1.8.7",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"twemoji-parser": "14.0.0", "twemoji-parser": "14.0.0",
"typescript": "5.1.3", "typescript": "5.1.6",
"uuid": "9.0.0", "uuid": "9.0.0",
"vanilla-tilt": "1.8.0", "vanilla-tilt": "1.8.0",
"vite": "4.3.9", "vite": "4.4.1",
"vue": "3.3.4", "vue": "3.3.4",
"vue-prism-editor": "2.0.0-alpha.2", "vue-prism-editor": "2.0.0-alpha.2",
"vuedraggable": "next" "vuedraggable": "next"
}, },
"devDependencies": { "devDependencies": {
"@storybook/addon-actions": "7.0.18", "@storybook/addon-actions": "7.0.26",
"@storybook/addon-essentials": "7.0.18", "@storybook/addon-essentials": "7.0.26",
"@storybook/addon-interactions": "7.0.18", "@storybook/addon-interactions": "7.0.26",
"@storybook/addon-links": "7.0.18", "@storybook/addon-links": "7.0.26",
"@storybook/addon-storysource": "7.0.18", "@storybook/addon-storysource": "7.0.26",
"@storybook/addons": "7.0.18", "@storybook/addons": "7.0.26",
"@storybook/blocks": "7.0.18", "@storybook/blocks": "7.0.26",
"@storybook/core-events": "7.0.18", "@storybook/core-events": "7.0.26",
"@storybook/jest": "0.1.0", "@storybook/jest": "0.1.0",
"@storybook/manager-api": "7.0.18", "@storybook/manager-api": "7.0.26",
"@storybook/preview-api": "7.0.18", "@storybook/preview-api": "7.0.26",
"@storybook/react": "7.0.18", "@storybook/react": "7.0.26",
"@storybook/react-vite": "7.0.18", "@storybook/react-vite": "7.0.26",
"@storybook/testing-library": "0.1.0", "@storybook/testing-library": "0.2.0",
"@storybook/theming": "7.0.18", "@storybook/theming": "7.0.26",
"@storybook/types": "7.0.18", "@storybook/types": "7.0.26",
"@storybook/vue3": "7.0.18", "@storybook/vue3": "7.0.26",
"@storybook/vue3-vite": "7.0.18", "@storybook/vue3-vite": "7.0.26",
"@testing-library/jest-dom": "5.16.5", "@testing-library/jest-dom": "5.16.5",
"@testing-library/vue": "7.0.0", "@testing-library/vue": "7.0.0",
"@types/escape-regexp": "0.0.1", "@types/escape-regexp": "0.0.1",
"@types/estree": "1.0.1", "@types/estree": "1.0.1",
"@types/gulp": "4.0.10", "@types/gulp": "4.0.13",
"@types/gulp-rename": "2.0.2", "@types/gulp-rename": "2.0.2",
"@types/matter-js": "0.18.5", "@types/matter-js": "0.18.5",
"@types/micromatch": "4.0.2", "@types/micromatch": "4.0.2",
"@types/node": "20.3.1", "@types/node": "20.4.0",
"@types/punycode": "2.1.0", "@types/punycode": "2.1.0",
"@types/sanitize-html": "2.9.0", "@types/sanitize-html": "2.9.0",
"@types/testing-library__jest-dom": "^5.14.6", "@types/testing-library__jest-dom": "5.14.7",
"@types/throttle-debounce": "5.0.0", "@types/throttle-debounce": "5.0.0",
"@types/tinycolor2": "1.4.3", "@types/tinycolor2": "1.4.3",
"@types/uuid": "9.0.2", "@types/uuid": "9.0.2",
"@types/websocket": "1.0.5", "@types/websocket": "1.0.5",
"@types/ws": "8.5.5", "@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "5.60.0", "@typescript-eslint/eslint-plugin": "5.61.0",
"@typescript-eslint/parser": "5.60.0", "@typescript-eslint/parser": "5.61.0",
"@vitest/coverage-v8": "0.32.2", "@vitest/coverage-v8": "0.33.0",
"@vue/runtime-core": "3.3.4", "@vue/runtime-core": "3.3.4",
"acorn": "8.9.0", "acorn": "8.10.0",
"chokidar-cli": "3.0.0", "chokidar-cli": "3.0.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "12.15.0", "cypress": "12.17.0",
"eslint": "8.43.0", "eslint": "8.44.0",
"eslint-plugin-import": "2.27.5", "eslint-plugin-import": "2.27.5",
"eslint-plugin-vue": "9.15.0", "eslint-plugin-vue": "9.15.1",
"fast-glob": "3.2.12", "fast-glob": "3.3.0",
"happy-dom": "9.20.3", "happy-dom": "10.0.3",
"micromatch": "3.1.10", "micromatch": "4.0.5",
"msw": "1.2.2", "msw": "1.2.2",
"msw-storybook-addon": "1.8.0", "msw-storybook-addon": "1.8.0",
"prettier": "2.8.8", "prettier": "3.0.0",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"start-server-and-test": "2.0.0", "start-server-and-test": "2.0.0",
"storybook": "7.0.18", "storybook": "7.0.26",
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme", "storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
"summaly": "github:misskey-dev/summaly", "summaly": "github:misskey-dev/summaly",
"vite-plugin-turbosnap": "1.0.2", "vite-plugin-turbosnap": "1.0.2",
"vitest": "0.32.2", "vitest": "0.33.0",
"vitest-fetch-mock": "0.2.2", "vitest-fetch-mock": "0.2.2",
"vue-eslint-parser": "9.3.1", "vue-eslint-parser": "9.3.1",
"vue-tsc": "1.8.1" "vue-tsc": "1.8.4"
} }
} }

View File

@ -1,3 +1,4 @@
type EnumItem = string | {label: string; value: string;};
export type FormItem = { export type FormItem = {
label?: string; label?: string;
type: 'string'; type: 'string';
@ -20,7 +21,7 @@ export type FormItem = {
type: 'enum'; type: 'enum';
default: string | null; default: string | null;
hidden?: boolean; hidden?: boolean;
enum: string[]; enum: EnumItem[];
} | { } | {
label?: string; label?: string;
type: 'radio'; type: 'radio';

View File

@ -1,7 +1,15 @@
import isAnimated from 'is-file-animated'; import isAnimated from 'is-file-animated';
import { isWebpSupported } from './isWebpSupported';
import type { BrowserImageResizerConfig } from 'browser-image-resizer'; import type { BrowserImageResizerConfig } from 'browser-image-resizer';
const compressTypeMap = { const compressTypeMap = {
'image/jpeg': { quality: 0.90, mimeType: 'image/webp' },
'image/png': { quality: 1, mimeType: 'image/webp' },
'image/webp': { quality: 0.90, mimeType: 'image/webp' },
'image/svg+xml': { quality: 1, mimeType: 'image/webp' },
} as const;
const compressTypeMapFallback = {
'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' }, 'image/jpeg': { quality: 0.85, mimeType: 'image/jpeg' },
'image/png': { quality: 1, mimeType: 'image/png' }, 'image/png': { quality: 1, mimeType: 'image/png' },
'image/webp': { quality: 0.85, mimeType: 'image/jpeg' }, 'image/webp': { quality: 0.85, mimeType: 'image/jpeg' },
@ -9,7 +17,7 @@ const compressTypeMap = {
} as const; } as const;
export async function getCompressionConfig(file: File): Promise<BrowserImageResizerConfig | undefined> { export async function getCompressionConfig(file: File): Promise<BrowserImageResizerConfig | undefined> {
const imgConfig = compressTypeMap[file.type]; const imgConfig = (isWebpSupported() ? compressTypeMap : compressTypeMapFallback)[file.type];
if (!imgConfig || await isAnimated(file)) { if (!imgConfig || await isAnimated(file)) {
return; return;
} }

View File

@ -0,0 +1,10 @@
let isWebpSupportedCache: boolean | undefined;
export function isWebpSupported() {
if (isWebpSupportedCache === undefined) {
const canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
isWebpSupportedCache = canvas.toDataURL('image/webp').startsWith('data:image/webp');
}
return isWebpSupportedCache;
}

View File

@ -9,15 +9,15 @@
"lint": "pnpm typecheck && pnpm eslint" "lint": "pnpm typecheck && pnpm eslint"
}, },
"dependencies": { "dependencies": {
"esbuild": "0.17.18", "esbuild": "0.16.11",
"idb-keyval": "6.2.0", "idb-keyval": "6.2.1",
"cherrypick-js": "workspace:*" "cherrypick-js": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/parser": "5.60.0", "@typescript-eslint/parser": "5.61.0",
"@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67", "@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67",
"eslint": "8.43.0", "eslint": "8.44.0",
"eslint-plugin-import": "2.27.5", "eslint-plugin-import": "2.27.5",
"typescript": "5.1.3" "typescript": "5.1.6"
} }
} }

File diff suppressed because it is too large Load Diff