Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: 動画・音声周りのUIと動作改良 #12925

Merged
merged 37 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2da19d9
wip
kakkokari-gtyih Jan 6, 2024
f159fc8
(fix) `/files` をバイトレンジリクエストに対応させる
kakkokari-gtyih Jan 6, 2024
fa93533
video
kakkokari-gtyih Jan 6, 2024
81b5049
audio
kakkokari-gtyih Jan 6, 2024
773f67e
fix
kakkokari-gtyih Jan 6, 2024
1ee3ebc
fix
kakkokari-gtyih Jan 6, 2024
31de7a5
spdx
kakkokari-gtyih Jan 6, 2024
99feef3
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 6, 2024
006aaf3
fix (rangeRequest)
kakkokari-gtyih Jan 6, 2024
488c0c2
fix
kakkokari-gtyih Jan 6, 2024
336e5ab
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 6, 2024
2628dc4
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 6, 2024
12ae4f9
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 7, 2024
4af18ff
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 7, 2024
10baee2
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 8, 2024
29d80c0
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 8, 2024
53e679b
Update CHANGELOG.md
kakkokari-gtyih Jan 8, 2024
132987d
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 8, 2024
919f499
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 10, 2024
9bbc525
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 12, 2024
6271f94
(add) ボリュームを保存できるように
kakkokari-gtyih Jan 12, 2024
a65002b
(fix) ミュート復帰時に音量が固定される
kakkokari-gtyih Jan 12, 2024
dcf8a00
named export
kakkokari-gtyih Jan 12, 2024
c6b5cbe
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 12, 2024
6a65170
tweak design
kakkokari-gtyih Jan 12, 2024
edd2c27
Merge branch 'feat-12909' of https://github.com/kakkokari-gtyih/missk…
kakkokari-gtyih Jan 12, 2024
5ca0483
Add sensitive class for audio component
kakkokari-gtyih Jan 12, 2024
92654a0
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 12, 2024
534cc1d
Merge branch 'develop' into feat-12909
syuilo Jan 14, 2024
0b903f6
Merge branch 'develop' into feat-12909
syuilo Jan 14, 2024
b002761
Merge branch 'develop' into feat-12909
syuilo Jan 14, 2024
7c120cd
Merge branch 'develop' into feat-12909
kakkokari-gtyih Jan 15, 2024
ec09bf2
Refactor seekbar styles
kakkokari-gtyih Jan 15, 2024
617ec11
Refactor hms
kakkokari-gtyih Jan 15, 2024
1d48491
Revert "(add) ボリュームを保存できるように"
kakkokari-gtyih Jan 15, 2024
31fdd1c
Revert "(fix) ミュート復帰時に音量が固定される"
kakkokari-gtyih Jan 15, 2024
87be116
revert revert changes
kakkokari-gtyih Jan 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

### Client
- Feat: 新しいゲームを追加
- Feat: 音声・映像プレイヤーを追加
- Feat: 絵文字の詳細ダイアログを追加
- Feat: 枠線をつけるMFM`$[border.width=1,style=solid,color=fff,radius=0 ...]`を追加
- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように
Expand All @@ -38,6 +39,7 @@
- Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました
- Enhance: ActivityPub Deliver queueでBodyを事前処理するように (#12916)
- Enhance: クリップをエクスポートできるように
- Enhance: `/files`のファイルに対してHTTP Rangeリクエストを行えるように
- Enhance: `api.json`のOpenAPI Specificationを3.1.0に更新
- Fix: `drive/files/update`でファイル名のバリデーションが機能していない問題を修正
- Fix: `notes/create`で、`text`が空白文字のみで構成されているか`null`であって、かつ`text`だけであるリクエストに対するレスポンスが400になるように変更
Expand Down
2 changes: 2 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,8 @@ export interface Locale {
"noteIdOrUrl": string;
"video": string;
"videos": string;
"audio": string;
"audioFiles": string;
"dataSaver": string;
"accountMigration": string;
"accountMoved": string;
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,8 @@ limitWidthOfReaction: "リアクションの最大横幅を制限し、縮小し
noteIdOrUrl: "ノートIDまたはURL"
video: "動画"
videos: "動画"
audio: "音声"
audioFiles: "音声"
dataSaver: "データセーバー"
accountMigration: "アカウントの移行"
accountMoved: "このユーザーは新しいアカウントに移行しました:"
Expand Down
111 changes: 101 additions & 10 deletions packages/backend/src/server/FileServerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,35 @@ export class FileServerService {
}

if (!image) {
image = {
data: fs.createReadStream(file.path),
ext: file.ext,
type: file.mime,
};
if (request.headers.range && file.file.size > 0) {
const range = request.headers.range as string;
const parts = range.replace(/bytes=/, '').split('-');
const start = parseInt(parts[0], 10);
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
if (end > file.file.size) {
end = file.file.size - 1;
}
const chunksize = end - start + 1;

image = {
data: fs.createReadStream(file.path, {
start,
end,
}),
ext: file.ext,
type: file.mime,
};

reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
reply.header('Accept-Ranges', 'bytes');
reply.header('Content-Length', chunksize);
} else {
image = {
data: fs.createReadStream(file.path),
ext: file.ext,
type: file.mime,
};
}
}

if ('pipe' in image.data && typeof image.data.pipe === 'function') {
Expand Down Expand Up @@ -203,11 +227,54 @@ export class FileServerService {
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.mime) ? file.mime : 'application/octet-stream');
reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', contentDisposition('inline', filename));

if (request.headers.range && file.file.size > 0) {
const range = request.headers.range as string;
const parts = range.replace(/bytes=/, '').split('-');
const start = parseInt(parts[0], 10);
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
if (end > file.file.size) {
end = file.file.size - 1;
}
const chunksize = end - start + 1;
const fileStream = fs.createReadStream(file.path, {
start,
end,
});
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
reply.header('Accept-Ranges', 'bytes');
reply.header('Content-Length', chunksize);
reply.code(206);
return fileStream;
}

return fs.createReadStream(file.path);
} else {
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream');
reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', contentDisposition('inline', file.filename));

if (request.headers.range && file.file.size > 0) {
const range = request.headers.range as string;
const parts = range.replace(/bytes=/, '').split('-');
const start = parseInt(parts[0], 10);
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
console.log(end);
if (end > file.file.size) {
end = file.file.size - 1;
}
const chunksize = end - start + 1;
const fileStream = fs.createReadStream(file.path, {
start,
end,
});
reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
reply.header('Accept-Ranges', 'bytes');
reply.header('Content-Length', chunksize);
reply.code(206);
return fileStream;
}

return fs.createReadStream(file.path);
}
} catch (e) {
Expand Down Expand Up @@ -340,11 +407,35 @@ export class FileServerService {
}

if (!image) {
image = {
data: fs.createReadStream(file.path),
ext: file.ext,
type: file.mime,
};
if (request.headers.range && file.file && file.file.size > 0) {
const range = request.headers.range as string;
const parts = range.replace(/bytes=/, '').split('-');
const start = parseInt(parts[0], 10);
let end = parts[1] ? parseInt(parts[1], 10) : file.file.size - 1;
if (end > file.file.size) {
end = file.file.size - 1;
}
const chunksize = end - start + 1;

image = {
data: fs.createReadStream(file.path, {
start,
end,
}),
ext: file.ext,
type: file.mime,
};

reply.header('Content-Range', `bytes ${start}-${end}/${file.file.size}`);
reply.header('Accept-Ranges', 'bytes');
reply.header('Content-Length', chunksize);
} else {
image = {
data: fs.createReadStream(file.path),
ext: file.ext,
type: file.mime,
};
}
}

if ('cleanup' in file) {
Expand Down
Loading
Loading