Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop
This commit is contained in:
commit
e8177ee311
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
||||||
submodules: true
|
submodules: true
|
||||||
- uses: pnpm/action-setup@v2
|
- uses: pnpm/action-setup@v2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
- uses: actions/setup-node@v3.6.0
|
- uses: actions/setup-node@v3.6.0
|
||||||
with:
|
with:
|
||||||
|
|
2
.github/workflows/storybook.yml
vendored
2
.github/workflows/storybook.yml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
- name: Use Node.js 18.x
|
- name: Use Node.js 18.x
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.6.0
|
||||||
|
|
2
.github/workflows/test-backend.yml
vendored
2
.github/workflows/test-backend.yml
vendored
|
@ -35,7 +35,7 @@ jobs:
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.6.0
|
||||||
|
|
2
.github/workflows/test-frontend.yml
vendored
2
.github/workflows/test-frontend.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: pnpm/action-setup@v2
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.6.0
|
||||||
|
|
|
@ -36,12 +36,15 @@
|
||||||
- 1枚だけのメディアリストの画像のアスペクト比を画像に応じて縦長にするように
|
- 1枚だけのメディアリストの画像のアスペクト比を画像に応じて縦長にするように
|
||||||
- Fix: リアクションをホバーした時のユーザーリストで猫耳が切れてしまっていた問題を修正
|
- Fix: リアクションをホバーした時のユーザーリストで猫耳が切れてしまっていた問題を修正
|
||||||
- 新しい実績を追加
|
- 新しい実績を追加
|
||||||
|
- Renoteしたユーザーの一覧を見れるように
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
|
- 環境変数MISSKEY_CONFIG_YMLで設定ファイルをdefault.ymlから変更可能に
|
||||||
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
|
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
|
||||||
- Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正
|
- Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正
|
||||||
- Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正
|
- Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正
|
||||||
- Fix: 1:1ではない画像のリアクション通知バッジが左や上に寄ってしまっていたのを中央に来るように修正
|
- Fix: 1:1ではない画像のリアクション通知バッジが左や上に寄ってしまっていたのを中央に来るように修正
|
||||||
|
- Fix: .wav, .flacが再生できない問題を修正(新しくアップロードされたファイルのみ修正が適用されます)
|
||||||
|
|
||||||
## 13.11.3
|
## 13.11.3
|
||||||
|
|
||||||
|
|
|
@ -1007,6 +1007,8 @@ accountMoved: "このユーザーは新しいアカウントに引っ越しま
|
||||||
forceShowAds: "常に広告を表示する"
|
forceShowAds: "常に広告を表示する"
|
||||||
addMemo: "メモを追加"
|
addMemo: "メモを追加"
|
||||||
editMemo: "メモを編集"
|
editMemo: "メモを編集"
|
||||||
|
reactionsList: "リアクション一覧"
|
||||||
|
renotesList: "Renote一覧"
|
||||||
notificationDisplay: "通知の表示"
|
notificationDisplay: "通知の表示"
|
||||||
leftTop: "左上"
|
leftTop: "左上"
|
||||||
rightTop: "右上"
|
rightTop: "右上"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { dirname } from 'node:path';
|
import { dirname, resolve } from 'node:path';
|
||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,10 +132,11 @@ const dir = `${_dirname}/../../../.config`;
|
||||||
/**
|
/**
|
||||||
* Path of configuration file
|
* Path of configuration file
|
||||||
*/
|
*/
|
||||||
const path = process.env.NODE_ENV === 'test'
|
const path = process.env.MISSKEY_CONFIG_YML
|
||||||
? `${dir}/test.yml`
|
? resolve(dir, process.env.MISSKEY_CONFIG_YML)
|
||||||
: `${dir}/default.yml`;
|
: process.env.NODE_ENV === 'test'
|
||||||
|
? resolve(dir, 'test.yml')
|
||||||
|
: resolve(dir, 'default.yml');
|
||||||
export function loadConfig() {
|
export function loadConfig() {
|
||||||
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
|
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
|
||||||
const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json');
|
const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json');
|
||||||
|
|
|
@ -56,6 +56,11 @@ export const FILE_TYPE_BROWSERSAFE = [
|
||||||
'audio/webm',
|
'audio/webm',
|
||||||
|
|
||||||
'audio/aac',
|
'audio/aac',
|
||||||
|
|
||||||
|
// see https://github.com/misskey-dev/misskey/pull/10686
|
||||||
|
'audio/flac',
|
||||||
|
'audio/wav',
|
||||||
|
// backward compatibility
|
||||||
'audio/x-flac',
|
'audio/x-flac',
|
||||||
'audio/vnd.wave',
|
'audio/vnd.wave',
|
||||||
];
|
];
|
||||||
|
|
|
@ -5,7 +5,7 @@ import * as stream from 'node:stream';
|
||||||
import * as util from 'node:util';
|
import * as util from 'node:util';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { FSWatcher } from 'chokidar';
|
import { FSWatcher } from 'chokidar';
|
||||||
import { fileTypeFromFile } from 'file-type';
|
import * as fileType from 'file-type';
|
||||||
import FFmpeg from 'fluent-ffmpeg';
|
import FFmpeg from 'fluent-ffmpeg';
|
||||||
import isSvg from 'is-svg';
|
import isSvg from 'is-svg';
|
||||||
import probeImageSize from 'probe-image-size';
|
import probeImageSize from 'probe-image-size';
|
||||||
|
@ -301,21 +301,34 @@ export class FileInfoService {
|
||||||
return fs.promises.access(path).then(() => true, () => false);
|
return fs.promises.access(path).then(() => true, () => false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public fixMime(mime: string | fileType.MimeType): string {
|
||||||
|
// see https://github.com/misskey-dev/misskey/pull/10686
|
||||||
|
if (mime === "audio/x-flac") {
|
||||||
|
return "audio/flac";
|
||||||
|
}
|
||||||
|
if (mime === "audio/vnd.wave") {
|
||||||
|
return "audio/wav";
|
||||||
|
}
|
||||||
|
|
||||||
|
return mime;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect MIME Type and extension
|
* Detect MIME Type and extension
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async detectType(path: string): Promise<{
|
public async detectType(path: string): Promise<{
|
||||||
mime: string;
|
mime: string;
|
||||||
ext: string | null;
|
ext: string | null;
|
||||||
}> {
|
}> {
|
||||||
// Check 0 byte
|
// Check 0 byte
|
||||||
const fileSize = await this.getFileSize(path);
|
const fileSize = await this.getFileSize(path);
|
||||||
if (fileSize === 0) {
|
if (fileSize === 0) {
|
||||||
return TYPE_OCTET_STREAM;
|
return TYPE_OCTET_STREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = await fileTypeFromFile(path);
|
const type = await fileType.fileTypeFromFile(path);
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
// XMLはSVGかもしれない
|
// XMLはSVGかもしれない
|
||||||
|
@ -324,7 +337,7 @@ export class FileInfoService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mime: type.mime,
|
mime: this.fixMime(type.mime),
|
||||||
ext: type.ext,
|
ext: type.ext,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,7 +454,8 @@ export class FileServerService {
|
||||||
fileRole: 'original',
|
fileRole: 'original',
|
||||||
file,
|
file,
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
mime: file.type,
|
// 古いファイルは修正前のmimeを持っているのでできるだけ修正してあげる
|
||||||
|
mime: this.fileInfoService.fixMime(file.type),
|
||||||
ext: null,
|
ext: null,
|
||||||
path,
|
path,
|
||||||
};
|
};
|
||||||
|
|
BIN
packages/backend/test/resources/kick_gaba7.aac
Normal file
BIN
packages/backend/test/resources/kick_gaba7.aac
Normal file
Binary file not shown.
BIN
packages/backend/test/resources/kick_gaba7.flac
Normal file
BIN
packages/backend/test/resources/kick_gaba7.flac
Normal file
Binary file not shown.
BIN
packages/backend/test/resources/kick_gaba7.mp3
Normal file
BIN
packages/backend/test/resources/kick_gaba7.mp3
Normal file
Binary file not shown.
BIN
packages/backend/test/resources/kick_gaba7.wav
Normal file
BIN
packages/backend/test/resources/kick_gaba7.wav
Normal file
Binary file not shown.
BIN
packages/backend/test/resources/kick_gaba7.webm
Normal file
BIN
packages/backend/test/resources/kick_gaba7.webm
Normal file
Binary file not shown.
|
@ -7,10 +7,10 @@ import { ModuleMocker } from 'jest-mock';
|
||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
import { GlobalModule } from '@/GlobalModule.js';
|
import { GlobalModule } from '@/GlobalModule.js';
|
||||||
import { FileInfoService } from '@/core/FileInfoService.js';
|
import { FileInfoService } from '@/core/FileInfoService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
//import { DI } from '@/di-symbols.js';
|
||||||
import { AiService } from '@/core/AiService.js';
|
import { AiService } from '@/core/AiService.js';
|
||||||
import type { TestingModule } from '@nestjs/testing';
|
import type { TestingModule } from '@nestjs/testing';
|
||||||
import type { jest } from '@jest/globals';
|
import { describe, beforeAll, afterAll, test } from '@jest/globals';
|
||||||
import type { MockFunctionMetadata } from 'jest-mock';
|
import type { MockFunctionMetadata } from 'jest-mock';
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
|
@ -74,164 +74,271 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Generic JPEG', async () => {
|
describe('IMAGE', () => {
|
||||||
const path = `${resources}/Lenna.jpg`;
|
test('Generic JPEG', async () => {
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const path = `${resources}/Lenna.jpg`;
|
||||||
delete info.warnings;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.blurhash;
|
delete info.warnings;
|
||||||
delete info.sensitive;
|
delete info.blurhash;
|
||||||
delete info.porn;
|
delete info.sensitive;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.porn;
|
||||||
size: 25360,
|
assert.deepStrictEqual(info, {
|
||||||
md5: '091b3f259662aa31e2ffef4519951168',
|
size: 25360,
|
||||||
type: {
|
md5: '091b3f259662aa31e2ffef4519951168',
|
||||||
mime: 'image/jpeg',
|
type: {
|
||||||
ext: 'jpg',
|
mime: 'image/jpeg',
|
||||||
},
|
ext: 'jpg',
|
||||||
width: 512,
|
},
|
||||||
height: 512,
|
width: 512,
|
||||||
orientation: undefined,
|
height: 512,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Generic APNG', async () => {
|
||||||
|
const path = `${resources}/anime.png`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 1868,
|
||||||
|
md5: '08189c607bea3b952704676bb3c979e0',
|
||||||
|
type: {
|
||||||
|
mime: 'image/apng',
|
||||||
|
ext: 'apng',
|
||||||
|
},
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Generic AGIF', async () => {
|
||||||
|
const path = `${resources}/anime.gif`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 2248,
|
||||||
|
md5: '32c47a11555675d9267aee1a86571e7e',
|
||||||
|
type: {
|
||||||
|
mime: 'image/gif',
|
||||||
|
ext: 'gif',
|
||||||
|
},
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('PNG with alpha', async () => {
|
||||||
|
const path = `${resources}/with-alpha.png`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 3772,
|
||||||
|
md5: 'f73535c3e1e27508885b69b10cf6e991',
|
||||||
|
type: {
|
||||||
|
mime: 'image/png',
|
||||||
|
ext: 'png',
|
||||||
|
},
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Generic SVG', async () => {
|
||||||
|
const path = `${resources}/image.svg`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 505,
|
||||||
|
md5: 'b6f52b4b021e7b92cdd04509c7267965',
|
||||||
|
type: {
|
||||||
|
mime: 'image/svg+xml',
|
||||||
|
ext: 'svg',
|
||||||
|
},
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('SVG with XML definition', async () => {
|
||||||
|
// https://github.com/misskey-dev/misskey/issues/4413
|
||||||
|
const path = `${resources}/with-xml-def.svg`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 544,
|
||||||
|
md5: '4b7a346cde9ccbeb267e812567e33397',
|
||||||
|
type: {
|
||||||
|
mime: 'image/svg+xml',
|
||||||
|
ext: 'svg',
|
||||||
|
},
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Dimension limit', async () => {
|
||||||
|
const path = `${resources}/25000x25000.png`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 75933,
|
||||||
|
md5: '268c5dde99e17cf8fe09f1ab3f97df56',
|
||||||
|
type: {
|
||||||
|
mime: 'application/octet-stream', // do not treat as image
|
||||||
|
ext: null,
|
||||||
|
},
|
||||||
|
width: 25000,
|
||||||
|
height: 25000,
|
||||||
|
orientation: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Rotate JPEG', async () => {
|
||||||
|
const path = `${resources}/rotate.jpg`;
|
||||||
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
delete info.warnings;
|
||||||
|
delete info.blurhash;
|
||||||
|
delete info.sensitive;
|
||||||
|
delete info.porn;
|
||||||
|
assert.deepStrictEqual(info, {
|
||||||
|
size: 12624,
|
||||||
|
md5: '68d5b2d8d1d1acbbce99203e3ec3857e',
|
||||||
|
type: {
|
||||||
|
mime: 'image/jpeg',
|
||||||
|
ext: 'jpg',
|
||||||
|
},
|
||||||
|
width: 512,
|
||||||
|
height: 256,
|
||||||
|
orientation: 8,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Generic APNG', async () => {
|
describe('AUDIO', () => {
|
||||||
const path = `${resources}/anime.png`;
|
test('MP3', async () => {
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const path = `${resources}/kick_gaba7.mp3`;
|
||||||
delete info.warnings;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.blurhash;
|
delete info.warnings;
|
||||||
delete info.sensitive;
|
delete info.blurhash;
|
||||||
delete info.porn;
|
delete info.sensitive;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.porn;
|
||||||
size: 1868,
|
delete info.width;
|
||||||
md5: '08189c607bea3b952704676bb3c979e0',
|
delete info.height;
|
||||||
type: {
|
delete info.orientation;
|
||||||
mime: 'image/apng',
|
assert.deepStrictEqual(info, {
|
||||||
ext: 'apng',
|
size: 19853,
|
||||||
},
|
md5: '4f557df8548bc3cecc794c652f690446',
|
||||||
width: 256,
|
type: {
|
||||||
height: 256,
|
mime: 'audio/mpeg',
|
||||||
orientation: undefined,
|
ext: 'mp3',
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
test('WAV', async () => {
|
||||||
test('Generic AGIF', async () => {
|
const path = `${resources}/kick_gaba7.wav`;
|
||||||
const path = `${resources}/anime.gif`;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
delete info.warnings;
|
||||||
delete info.warnings;
|
delete info.blurhash;
|
||||||
delete info.blurhash;
|
delete info.sensitive;
|
||||||
delete info.sensitive;
|
delete info.porn;
|
||||||
delete info.porn;
|
delete info.width;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.height;
|
||||||
size: 2248,
|
delete info.orientation;
|
||||||
md5: '32c47a11555675d9267aee1a86571e7e',
|
assert.deepStrictEqual(info, {
|
||||||
type: {
|
size: 87630,
|
||||||
mime: 'image/gif',
|
md5: '8bc9bb4fe5e77bb1871448209be635c1',
|
||||||
ext: 'gif',
|
type: {
|
||||||
},
|
mime: 'audio/wav',
|
||||||
width: 256,
|
ext: 'wav',
|
||||||
height: 256,
|
},
|
||||||
orientation: undefined,
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
test('AAC', async () => {
|
||||||
test('PNG with alpha', async () => {
|
const path = `${resources}/kick_gaba7.aac`;
|
||||||
const path = `${resources}/with-alpha.png`;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
delete info.warnings;
|
||||||
delete info.warnings;
|
delete info.blurhash;
|
||||||
delete info.blurhash;
|
delete info.sensitive;
|
||||||
delete info.sensitive;
|
delete info.porn;
|
||||||
delete info.porn;
|
delete info.width;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.height;
|
||||||
size: 3772,
|
delete info.orientation;
|
||||||
md5: 'f73535c3e1e27508885b69b10cf6e991',
|
assert.deepStrictEqual(info, {
|
||||||
type: {
|
size: 7291,
|
||||||
mime: 'image/png',
|
md5: '2789323f05e3392b648066f50be6a2a6',
|
||||||
ext: 'png',
|
type: {
|
||||||
},
|
mime: 'audio/aac',
|
||||||
width: 256,
|
ext: 'aac',
|
||||||
height: 256,
|
},
|
||||||
orientation: undefined,
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
test('FLAC', async () => {
|
||||||
test('Generic SVG', async () => {
|
const path = `${resources}/kick_gaba7.flac`;
|
||||||
const path = `${resources}/image.svg`;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
delete info.warnings;
|
||||||
delete info.warnings;
|
delete info.blurhash;
|
||||||
delete info.blurhash;
|
delete info.sensitive;
|
||||||
delete info.sensitive;
|
delete info.porn;
|
||||||
delete info.porn;
|
delete info.width;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.height;
|
||||||
size: 505,
|
delete info.orientation;
|
||||||
md5: 'b6f52b4b021e7b92cdd04509c7267965',
|
assert.deepStrictEqual(info, {
|
||||||
type: {
|
size: 108793,
|
||||||
mime: 'image/svg+xml',
|
md5: 'bc0f3adfe0e1ca99ae6c7528c46b3173',
|
||||||
ext: 'svg',
|
type: {
|
||||||
},
|
mime: 'audio/flac',
|
||||||
width: 256,
|
ext: 'flac',
|
||||||
height: 256,
|
},
|
||||||
orientation: undefined,
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/*
|
||||||
test('SVG with XML definition', async () => {
|
* video/webmとして検出されてしまう
|
||||||
// https://github.com/misskey-dev/misskey/issues/4413
|
test('WEBM AUDIO', async () => {
|
||||||
const path = `${resources}/with-xml-def.svg`;
|
const path = `${resources}/kick_gaba7.webm`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
delete info.blurhash;
|
delete info.blurhash;
|
||||||
delete info.sensitive;
|
delete info.sensitive;
|
||||||
delete info.porn;
|
delete info.porn;
|
||||||
assert.deepStrictEqual(info, {
|
delete info.width;
|
||||||
size: 544,
|
delete info.height;
|
||||||
md5: '4b7a346cde9ccbeb267e812567e33397',
|
delete info.orientation;
|
||||||
type: {
|
assert.deepStrictEqual(info, {
|
||||||
mime: 'image/svg+xml',
|
size: 8879,
|
||||||
ext: 'svg',
|
md5: '3350083dec312419cfdc06c16413aca7',
|
||||||
},
|
type: {
|
||||||
width: 256,
|
mime: 'audio/webm',
|
||||||
height: 256,
|
ext: 'webm',
|
||||||
orientation: undefined,
|
},
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
test('Dimension limit', async () => {
|
|
||||||
const path = `${resources}/25000x25000.png`;
|
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
|
||||||
delete info.warnings;
|
|
||||||
delete info.blurhash;
|
|
||||||
delete info.sensitive;
|
|
||||||
delete info.porn;
|
|
||||||
assert.deepStrictEqual(info, {
|
|
||||||
size: 75933,
|
|
||||||
md5: '268c5dde99e17cf8fe09f1ab3f97df56',
|
|
||||||
type: {
|
|
||||||
mime: 'application/octet-stream', // do not treat as image
|
|
||||||
ext: null,
|
|
||||||
},
|
|
||||||
width: 25000,
|
|
||||||
height: 25000,
|
|
||||||
orientation: undefined,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Rotate JPEG', async () => {
|
|
||||||
const path = `${resources}/rotate.jpg`;
|
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
|
||||||
delete info.warnings;
|
|
||||||
delete info.blurhash;
|
|
||||||
delete info.sensitive;
|
|
||||||
delete info.porn;
|
|
||||||
assert.deepStrictEqual(info, {
|
|
||||||
size: 12624,
|
|
||||||
md5: '68d5b2d8d1d1acbbce99203e3ec3857e',
|
|
||||||
type: {
|
|
||||||
mime: 'image/jpeg',
|
|
||||||
ext: 'jpg',
|
|
||||||
},
|
|
||||||
width: 512,
|
|
||||||
height: 256,
|
|
||||||
orientation: 8,
|
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@close="dialog.close()"
|
@close="dialog.close()"
|
||||||
@closed="emit('closed')"
|
@closed="emit('closed')"
|
||||||
>
|
>
|
||||||
<template #header>{{ i18n.ts.reactions }}</template>
|
<template #header>{{ i18n.ts.reactionsList }}</template>
|
||||||
|
|
||||||
<MkSpacer :margin-min="20" :margin-max="28">
|
<MkSpacer :margin-min="20" :margin-max="28">
|
||||||
<div v-if="note" class="_gaps">
|
<div v-if="note" class="_gaps">
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
|
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<MkA v-for="user in users" :key="user.id" :to="userPage(user)">
|
<MkA v-for="user in users" :key="user.id" :to="userPage(user)" @click="dialog.close()">
|
||||||
<MkUserCardMini :user="user" :with-chart="false"/>
|
<MkUserCardMini :user="user" :with-chart="false"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
|
|
65
packages/frontend/src/components/MkRenotedUsersDialog.vue
Normal file
65
packages/frontend/src/components/MkRenotedUsersDialog.vue
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<template>
|
||||||
|
<MkModalWindow
|
||||||
|
ref="dialog"
|
||||||
|
:width="400"
|
||||||
|
:height="450"
|
||||||
|
@close="dialog.close()"
|
||||||
|
@closed="emit('closed')"
|
||||||
|
>
|
||||||
|
<template #header>{{ i18n.ts.renotesList }}</template>
|
||||||
|
|
||||||
|
<MkSpacer :margin-min="20" :margin-max="28">
|
||||||
|
<div v-if="renotes" class="_gaps">
|
||||||
|
<div v-if="renotes.length === 0" class="_fullinfo">
|
||||||
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
||||||
|
<div>{{ i18n.ts.nothing }}</div>
|
||||||
|
</div>
|
||||||
|
<template v-else>
|
||||||
|
<MkA v-for="user in users" :key="user.id" :to="userPage(user)" @click="dialog.close()">
|
||||||
|
<MkUserCardMini :user="user" :with-chart="false"/>
|
||||||
|
</MkA>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<MkLoading/>
|
||||||
|
</div>
|
||||||
|
</MkSpacer>
|
||||||
|
</MkModalWindow>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
||||||
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||||
|
import { userPage } from '@/filters/user';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import * as os from '@/os';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: 'closed'): void,
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
noteId: misskey.entities.Note['id'];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const dialog = $shallowRef<InstanceType<typeof MkModalWindow>>();
|
||||||
|
|
||||||
|
let note = $ref<misskey.entities.Note>();
|
||||||
|
let renotes = $ref();
|
||||||
|
let users = $ref();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const res = await os.api('notes/renotes', {
|
||||||
|
noteId: props.noteId,
|
||||||
|
limit: 30,
|
||||||
|
});
|
||||||
|
|
||||||
|
renotes = res;
|
||||||
|
users = res.map(x => x.user);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
</style>
|
|
@ -35,6 +35,11 @@ export const FILE_TYPE_BROWSERSAFE = [
|
||||||
'audio/webm',
|
'audio/webm',
|
||||||
|
|
||||||
'audio/aac',
|
'audio/aac',
|
||||||
|
|
||||||
|
// see https://github.com/misskey-dev/misskey/pull/10686
|
||||||
|
'audio/flac',
|
||||||
|
'audio/wav',
|
||||||
|
// backward compatibility
|
||||||
'audio/x-flac',
|
'audio/x-flac',
|
||||||
'audio/vnd.wave',
|
'audio/vnd.wave',
|
||||||
];
|
];
|
||||||
|
|
|
@ -96,7 +96,9 @@ async function testEmail() {
|
||||||
const { canceled, result: destination } = await os.inputText({
|
const { canceled, result: destination } = await os.inputText({
|
||||||
title: i18n.ts.destination,
|
title: i18n.ts.destination,
|
||||||
type: 'email',
|
type: 'email',
|
||||||
placeholder: instance.maintainerEmail,
|
default: instance.maintainerEmail ?? '',
|
||||||
|
placeholder: 'test@example.com',
|
||||||
|
minLength: 1,
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
os.apiWithDialog('admin/send-email', {
|
os.apiWithDialog('admin/send-email', {
|
||||||
|
|
|
@ -305,6 +305,11 @@ const PRESET_TIMELINE = `/// @ 0.13.1
|
||||||
// それぞれのノートごとにUI要素作成
|
// それぞれのノートごとにUI要素作成
|
||||||
let noteEls = []
|
let noteEls = []
|
||||||
each (let note, notes) {
|
each (let note, notes) {
|
||||||
|
// 表示名を設定していないアカウントはidを表示
|
||||||
|
let userName = if Core:type(note.user.name) == "str" note.user.name else note.user.username
|
||||||
|
// リノートもしくはメディア・投票のみで本文が無いノートに代替表示文を設定
|
||||||
|
let noteText = if Core:type(note.text) == "str" note.text else "(リノートもしくはメディア・投票のみのノート)"
|
||||||
|
|
||||||
let el = Ui:C:container({
|
let el = Ui:C:container({
|
||||||
bgColor: "#444"
|
bgColor: "#444"
|
||||||
fgColor: "#fff"
|
fgColor: "#fff"
|
||||||
|
@ -312,11 +317,11 @@ const PRESET_TIMELINE = `/// @ 0.13.1
|
||||||
rounded: true
|
rounded: true
|
||||||
children: [
|
children: [
|
||||||
Ui:C:mfm({
|
Ui:C:mfm({
|
||||||
text: note.user.name
|
text: userName
|
||||||
bold: true
|
bold: true
|
||||||
})
|
})
|
||||||
Ui:C:mfm({
|
Ui:C:mfm({
|
||||||
text: note.text
|
text: noteText
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -211,6 +211,12 @@ export function getNoteMenu(props: {
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showRenotes(): void {
|
||||||
|
os.popup(defineAsyncComponent(() => import('@/components/MkRenotedUsersDialog.vue')), {
|
||||||
|
noteId: appearNote.id,
|
||||||
|
}, {}, 'closed');
|
||||||
|
}
|
||||||
|
|
||||||
async function translate(): Promise<void> {
|
async function translate(): Promise<void> {
|
||||||
if (props.translation.value != null) return;
|
if (props.translation.value != null) return;
|
||||||
props.translating.value = true;
|
props.translating.value = true;
|
||||||
|
@ -241,8 +247,12 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.details,
|
text: i18n.ts.details,
|
||||||
action: openDetail,
|
action: openDetail,
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-users',
|
icon: 'ti ti-repeat',
|
||||||
text: i18n.ts.reactions,
|
text: i18n.ts.renotesList,
|
||||||
|
action: showRenotes,
|
||||||
|
}, {
|
||||||
|
icon: 'ti ti-icons',
|
||||||
|
text: i18n.ts.reactionsList,
|
||||||
action: showReactions,
|
action: showReactions,
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-copy',
|
icon: 'ti ti-copy',
|
||||||
|
|
Loading…
Reference in a new issue