forked from mirror/misskey
Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop
This commit is contained in:
commit
aef7b0238b
3
.gitignore
vendored
3
.gitignore
vendored
@ -64,3 +64,6 @@ temp
|
|||||||
*.blend3
|
*.blend3
|
||||||
*.blend4
|
*.blend4
|
||||||
*.blend5
|
*.blend5
|
||||||
|
|
||||||
|
# VSCode addon
|
||||||
|
.favorites.json
|
||||||
|
10
package.json
10
package.json
@ -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": {
|
||||||
|
@ -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,21 +64,21 @@
|
|||||||
"@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",
|
||||||
"@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",
|
||||||
"accepts": "1.3.8",
|
"accepts": "1.3.8",
|
||||||
"ajv": "8.12.0",
|
"ajv": "8.12.0",
|
||||||
"archiver": "5.3.1",
|
"archiver": "5.3.1",
|
||||||
"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",
|
||||||
@ -90,18 +90,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",
|
||||||
@ -118,9 +118,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",
|
||||||
@ -144,14 +144,14 @@
|
|||||||
"strict-event-emitter-types": "2.0.0",
|
"strict-event-emitter-types": "2.0.0",
|
||||||
"stringz": "2.1.0",
|
"stringz": "2.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",
|
||||||
@ -161,7 +161,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",
|
||||||
@ -178,14 +178,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",
|
||||||
@ -202,14 +202,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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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",
|
||||||
@ -42,7 +42,7 @@
|
|||||||
"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",
|
||||||
@ -50,94 +50,94 @@
|
|||||||
"matter-js": "0.19.0",
|
"matter-js": "0.19.0",
|
||||||
"mfm-js": "0.23.3",
|
"mfm-js": "0.23.3",
|
||||||
"misskey-js": "workspace:*",
|
"misskey-js": "workspace:*",
|
||||||
"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",
|
||||||
"strict-event-emitter-types": "2.0.0",
|
"strict-event-emitter-types": "2.0.0",
|
||||||
"syuilo-password-strength": "0.0.1",
|
"syuilo-password-strength": "0.0.1",
|
||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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';
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
10
packages/frontend/src/scripts/upload/isWebpSupported.ts
Normal file
10
packages/frontend/src/scripts/upload/isWebpSupported.ts
Normal 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;
|
||||||
|
}
|
@ -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"
|
||||||
}
|
}
|
||||||
|
@ -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",
|
||||||
"misskey-js": "workspace:*"
|
"misskey-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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4716
pnpm-lock.yaml
generated
4716
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user