feat: add UserSecret

This commit is contained in:
2025-06-20 16:22:59 +08:00
parent d29f69452c
commit 633eee4bee
17 changed files with 588 additions and 526 deletions

View File

@@ -1,9 +1,8 @@
import { useFileStore } from '@kevisual/use-config/file-store';
import { checkAuth, error, router, writeEvents, getKey, getTaskId } from '../router.ts';
import { IncomingForm } from 'formidable';
import { app, minioClient } from '@/app.ts';
import { app, oss } from '@/app.ts';
import { bucketName } from '@/modules/minio.ts';
import { getContentType } from '@/utils/get-content-type.ts';
import { User } from '@/models/user.ts';
import fs from 'fs';
@@ -124,8 +123,9 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
if (share) {
metadata.share = 'public';
}
const bucketName = oss.bucketName;
// All chunks uploaded, now upload to MinIO
await minioClient.fPutObject(bucketName, minioPath, finalFilePath, {
await oss.client.fPutObject(bucketName, minioPath, finalFilePath, {
'Content-Type': getContentType(relativePath),
'app-source': 'user-app',
'Cache-Control': relativePath.endsWith('.html') ? 'no-cache' : 'max-age=31536000, immutable',

View File

@@ -35,6 +35,7 @@ router.post('/api/s1/resources/upload/check', async (req, res) => {
return;
}
console.log('data', req.url);
res.writeHead(200, { 'Content-Type': 'application/json' });
const data = await router.getBody(req);
type Data = {
appKey: string;