fix: fix chunk

This commit is contained in:
xion 2025-03-31 21:22:13 +08:00
parent e0ac1b7d27
commit 466ac1bcf0
4 changed files with 15 additions and 11 deletions

View File

@ -12,5 +12,5 @@ export const config = dotenv.config({
}).parsed;
// const config = useConfig();
// export const config = process.env;
console.log('config', config);
// console.log('config', config);
export const port = config.PORT || 4005;

View File

@ -7,7 +7,7 @@ const minioConfig = {
accessKey: config.MINIO_ACCESS_KEY,
secretKey: config.MINIO_SECRET_KEY,
};
console.log('minioConfig', minioConfig);
// console.log('minioConfig', minioConfig);
export const minioClient = new Client(minioConfig);
export const bucketName = config.MINIO_BUCKET_NAME || 'resources';

View File

@ -134,6 +134,15 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
// Clean up the final file
fs.unlinkSync(finalFilePath);
const downloadBase = '/api/s1/share';
const uploadResult = {
name: relativePath,
path: `${downloadBase}/${minioPath}`,
appKey,
version,
username,
};
if (!noCheckAppFiles) {
// Notify the app
const r = await app.call({
@ -148,17 +157,11 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
},
},
});
const downloadBase = '/api/s1/share';
const data: any = {
code: r.code,
data: {
app: r.body,
upload: [
{
name: relativePath,
path: `${downloadBase}/${minioPath}`,
},
],
upload: [uploadResult],
},
};
if (r.message) {
@ -172,7 +175,7 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
res.end(
JSON.stringify({
message: 'Chunk uploaded successfully',
data: { chunkIndex, totalChunks },
data: { chunkIndex, totalChunks, upload: [uploadResult] },
}),
);
}
@ -180,6 +183,7 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(
JSON.stringify({
code: 200,
message: 'Chunk uploaded successfully',
data: {
chunkIndex,

@ -1 +1 @@
Subproject commit 60c5a986edd4add11b229b2d3c869dcdf32c0428
Subproject commit 162d4c72b409530c6789ea8b3efcc7963715bed8