update v2.5.4

This commit is contained in:
MarSeventh
2026-01-23 22:40:21 +08:00
parent 9d4d9fb7bf
commit 1625d32ff3
15 changed files with 76 additions and 10 deletions

View File

@@ -0,0 +1,66 @@
/**
* BatchIndexConfigAPI - 获取索引重建配置
*
* 返回根据数据库类型确定的分块大小等配置信息
*/
import { checkDatabaseConfig } from '../../../../utils/databaseAdapter.js';
// CORS 跨域响应头
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Max-Age': '86400',
};
// D1 单字段限制 2MBKV 限制 25MB
const INDEX_CHUNK_SIZE_D1 = 500;
const INDEX_CHUNK_SIZE_KV = 5000;
/**
* 创建 JSON 响应
*/
function jsonResponse(data, status = 200) {
return new Response(JSON.stringify(data), {
status,
headers: {
'Content-Type': 'application/json',
...corsHeaders,
},
});
}
/**
* 处理 GET 请求 - 获取索引配置
*/
export async function onRequestGet(context) {
const { env } = context;
try {
const config = checkDatabaseConfig(env);
const chunkSize = config.usingD1 ? INDEX_CHUNK_SIZE_D1 : INDEX_CHUNK_SIZE_KV;
return jsonResponse({
success: true,
chunkSize,
databaseType: config.usingD1 ? 'd1' : 'kv',
});
} catch (error) {
return jsonResponse({ success: false, error: error.message }, 500);
}
}
/**
* 处理 OPTIONS 请求 - CORS 预检
*/
export async function onRequestOptions() {
return new Response(null, { status: 204, headers: corsHeaders });
}
export async function onRequest(context) {
const { request } = context;
if (request.method === 'GET') return onRequestGet(context);
if (request.method === 'OPTIONS') return onRequestOptions();
return jsonResponse({ success: false, error: 'Method not allowed' }, 405);
}

View File

@@ -1 +1 @@
<!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/chunk-vendors.780b6559.js"></script><script defer="defer" src="/js/app.0ada2a3c.js"></script><link href="/css/chunk-vendors.4363ed49.css" rel="stylesheet"><link href="/css/app.7feab2de.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>
<!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/chunk-vendors.780b6559.js"></script><script defer="defer" src="/js/app.99d3a1f5.js"></script><link href="/css/chunk-vendors.4363ed49.css" rel="stylesheet"><link href="/css/app.7feab2de.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>

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

BIN
js/925.72de38b9.js.gz Normal file

Binary file not shown.

1
js/925.72de38b9.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
js/925.72de38b9.js.map.gz Normal file

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
js/app.99d3a1f5.js.map.gz Normal file

Binary file not shown.