Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/misskey-dev/misskey into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
syuilo committed Apr 29, 2023
2 parents b2a28ad + 8fbca63 commit e8177ee
Show file tree
Hide file tree
Showing 22 changed files with 393 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
version: 8
run_install: false
- uses: actions/setup-node@v3.6.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
run_install: false
- name: Use Node.js 18.x
uses: actions/setup-node@v3.6.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.6.0
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@
- 1枚だけのメディアリストの画像のアスペクト比を画像に応じて縦長にするように
- Fix: リアクションをホバーした時のユーザーリストで猫耳が切れてしまっていた問題を修正
- 新しい実績を追加
- Renoteしたユーザーの一覧を見れるように

### Server
- 環境変数MISSKEY_CONFIG_YMLで設定ファイルをdefault.ymlから変更可能に
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
- Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正
- Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正
- Fix: 1:1ではない画像のリアクション通知バッジが左や上に寄ってしまっていたのを中央に来るように修正
- Fix: .wav, .flacが再生できない問題を修正(新しくアップロードされたファイルのみ修正が適用されます)

## 13.11.3

Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,8 @@ accountMoved: "このユーザーは新しいアカウントに引っ越しま
forceShowAds: "常に広告を表示する"
addMemo: "メモを追加"
editMemo: "メモを編集"
reactionsList: "リアクション一覧"
renotesList: "Renote一覧"
notificationDisplay: "通知の表示"
leftTop: "左上"
rightTop: "右上"
Expand Down
11 changes: 6 additions & 5 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { dirname, resolve } from 'node:path';
import * as yaml from 'js-yaml';

/**
Expand Down Expand Up @@ -132,10 +132,11 @@ const dir = `${_dirname}/../../../.config`;
/**
* Path of configuration file
*/
const path = process.env.NODE_ENV === 'test'
? `${dir}/test.yml`
: `${dir}/default.yml`;

const path = process.env.MISSKEY_CONFIG_YML
? resolve(dir, process.env.MISSKEY_CONFIG_YML)
: process.env.NODE_ENV === 'test'
? resolve(dir, 'test.yml')
: resolve(dir, 'default.yml');
export function loadConfig() {
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json');
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export const FILE_TYPE_BROWSERSAFE = [
'audio/webm',

'audio/aac',

// see https://github.com/misskey-dev/misskey/pull/10686
'audio/flac',
'audio/wav',
// backward compatibility
'audio/x-flac',
'audio/vnd.wave',
];
Expand Down
25 changes: 19 additions & 6 deletions packages/backend/src/core/FileInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as stream from 'node:stream';
import * as util from 'node:util';
import { Injectable } from '@nestjs/common';
import { FSWatcher } from 'chokidar';
import { fileTypeFromFile } from 'file-type';
import * as fileType from 'file-type';
import FFmpeg from 'fluent-ffmpeg';
import isSvg from 'is-svg';
import probeImageSize from 'probe-image-size';
Expand Down Expand Up @@ -301,21 +301,34 @@ export class FileInfoService {
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
*/
@bindThis
public async detectType(path: string): Promise<{
mime: string;
ext: string | null;
}> {
mime: string;
ext: string | null;
}> {
// Check 0 byte
const fileSize = await this.getFileSize(path);
if (fileSize === 0) {
return TYPE_OCTET_STREAM;
}

const type = await fileTypeFromFile(path);
const type = await fileType.fileTypeFromFile(path);

if (type) {
// XMLはSVGかもしれない
Expand All @@ -324,7 +337,7 @@ export class FileInfoService {
}

return {
mime: type.mime,
mime: this.fixMime(type.mime),
ext: type.ext,
};
}
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/server/FileServerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ export class FileServerService {
fileRole: 'original',
file,
filename: file.name,
mime: file.type,
// 古いファイルは修正前のmimeを持っているのでできるだけ修正してあげる
mime: this.fileInfoService.fixMime(file.type),
ext: null,
path,
};
Expand Down
Binary file added packages/backend/test/resources/kick_gaba7.aac
Binary file not shown.
Binary file added packages/backend/test/resources/kick_gaba7.flac
Binary file not shown.
Binary file added packages/backend/test/resources/kick_gaba7.mp3
Binary file not shown.
Binary file added packages/backend/test/resources/kick_gaba7.wav
Binary file not shown.
Binary file added packages/backend/test/resources/kick_gaba7.webm
Binary file not shown.
Loading

0 comments on commit e8177ee

Please sign in to comment.