Opt:优化大文件上传和访问

This commit is contained in:
MarSeventh
2025-07-27 23:06:46 +08:00
parent d00916bf92
commit 4d9c618ff7
19 changed files with 19 additions and 14 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
.wrangler/*
data/*
node_modules
node_modules
.DS_Store
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
+8 -4
View File
@@ -341,15 +341,19 @@ async function handleR2File(context, fileId, encodedFileName, fileType) {
let object;
if (range) {
// 处理Range请求(用于大文件流式传输)
// 处理Range请求
const matches = range.match(/bytes=(\d+)-(\d*)/);
if (matches) {
const start = parseInt(matches[1]);
const end = matches[2] ? parseInt(matches[2]) : undefined;
const rangeOptions = { offset: start };
const rangeOptions = {
range: {
offset: start
}
};
if (end !== undefined) {
rangeOptions.length = end - start + 1;
rangeOptions.range.length = end - start + 1;
}
object = await R2DataBase.get(fileId, rangeOptions);
+1 -1
View File
@@ -1,4 +1,4 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/logo.png"><link rel="apple-touch-icon" href="/logo.png"><link rel="mask-icon" href="/logo.png" color="#f4b400"><meta name="description" content="Sanyue ImgHub - A modern file hosting platform"><meta name="keywords" content="Sanyue, ImgHub, file hosting, image hosting, cloud storage"><meta name="author" content="SanyueQi"><title>Sanyue ImgHub</title><script defer="defer" src="/js/app.09736f66.js"></script><link href="/css/app.10673e72.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but sanyue_imghub doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html><style>/* 下拉菜单样式 */
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/logo.png"><link rel="apple-touch-icon" href="/logo.png"><link rel="mask-icon" href="/logo.png" color="#f4b400"><meta name="description" content="Sanyue ImgHub - A modern file hosting platform"><meta name="keywords" content="Sanyue, ImgHub, file hosting, image hosting, cloud storage"><meta name="author" content="SanyueQi"><title>Sanyue ImgHub</title><script defer="defer" src="/js/app.317242a7.js"></script><link href="/css/app.10673e72.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but sanyue_imghub doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html><style>/* 下拉菜单样式 */
.el-dropdown__popper.el-popper {
border-radius: 12px;
border: none;
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long