This commit is contained in:
熊潇 2025-05-23 18:59:34 +08:00
parent 262ef1d118
commit cd30e8af78

View File

@ -12,7 +12,6 @@ import { getContainerById } from '@/routes/container/module/get-container-file.t
import { router, error, checkAuth, clients, writeEvents } from './router.ts'; import { router, error, checkAuth, clients, writeEvents } from './router.ts';
import './index.ts'; import './index.ts';
const filePath = useFileStore('upload', { needExists: true });
const cacheFilePath = useFileStore('cache-file', { needExists: true }); const cacheFilePath = useFileStore('cache-file', { needExists: true });
// curl -X POST http://localhost:4000/api/upload -F "file=@readme.md" // curl -X POST http://localhost:4000/api/upload -F "file=@readme.md"
// curl -X POST http://localhost:4000/api/upload \ // curl -X POST http://localhost:4000/api/upload \
@ -178,13 +177,13 @@ router.get('/api/container/file/:id', async (req, res) => {
res.end(JSON.stringify(container)); res.end(JSON.stringify(container));
}); });
router.get('/api/code/version', async (req, res) => { // router.get('/api/code/version', async (req, res) => {
const version = VERSION; // const version = VERSION;
res.writeHead(200, { // res.writeHead(200, {
'Content-Type': 'application/json', // 'Content-Type': 'application/json',
}); // });
res.end(JSON.stringify({ code: 200, data: { version } })); // res.end(JSON.stringify({ code: 200, data: { version } }));
}); // });
export const uploadMiddleware = async (req: http.IncomingMessage, res: http.ServerResponse) => { export const uploadMiddleware = async (req: http.IncomingMessage, res: http.ServerResponse) => {
if (req.url?.startsWith('/api/router')) { if (req.url?.startsWith('/api/router')) {