Update server.js via upload script - 2026-10-12 15:23:06
This commit is contained in:
parent
862f0f0f2b
commit
ca828988c1
10
server.js
10
server.js
|
|
@ -780,15 +780,10 @@ app.delete('/api/uploads/:customerId/:fileName', requireAuth, (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const mountPublicApi = require('./public-api');
|
const mountPublicApi = require('./public-api');
|
||||||
mountPublicApi(app, { dataFile: DATA_FILE, uploadsDir: UPLOADS_DIR, requireAuth });
|
mountPublicApi(app, { dataFile: DATA_FILE, uploadsDir: UPLOADS_DIR, requireAuth, ai: { loadAiConfig, callDeepSeekWithRetry, extractJson } });
|
||||||
|
|
||||||
app.use('/uploads', requireAuth, express.static(UPLOADS_DIR));
|
app.use('/uploads', requireAuth, express.static(UPLOADS_DIR));
|
||||||
|
|
||||||
const { registerMicUploadRoutes, attachMicUploadWebSocket } = require('./mic-upload/micUploadRoutes');
|
|
||||||
const micSessions = registerMicUploadRoutes(app, {
|
|
||||||
requireAuth, readData, writeData, callDeepSeekWithRetry, loadAiConfig, encrypt, decrypt,
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(express.static(FRONTEND_DIST));
|
app.use(express.static(FRONTEND_DIST));
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.join(FRONTEND_DIST, 'index.html'));
|
res.sendFile(path.join(FRONTEND_DIST, 'index.html'));
|
||||||
|
|
@ -809,9 +804,6 @@ const server = app.listen(PORT, HOST, () => {
|
||||||
console.log(`[customer-crm] running at http://${HOST}:${PORT}`);
|
console.log(`[customer-crm] running at http://${HOST}:${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
attachMicUploadWebSocket(server, micSessions);
|
|
||||||
|
|
||||||
|
|
||||||
server.on('error', (e) => {
|
server.on('error', (e) => {
|
||||||
if (e.code === 'EADDRINUSE') {
|
if (e.code === 'EADDRINUSE') {
|
||||||
console.log('[customer-crm] another instance is already running on this port, exiting.');
|
console.log('[customer-crm] another instance is already running on this port, exiting.');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue