chore(web): revert apps/web/src/index.ts changes

This commit is contained in:
yiling
2026-06-03 23:44:33 +08:00
parent 2afc6920ab
commit 08c61456c4
+9 -21
View File
@@ -9,8 +9,6 @@ import { metadataService } from '@shumai/core/src/metadata/metadata'
import { initTranscodeWorkflows } from '@shumai/transcode'
import { workflowService } from '@shumai/workflow-core'
import { app } from '@shumai/api'
import * as fs from 'fs'
import * as path from 'path'
// Initialize workflows and activities for local executor mode
initAgentWorkflows()
@@ -45,27 +43,17 @@ if (process.env.WORKFLOW_EXECUTOR === 'temporal') {
const server = Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url)
const pathname = url.pathname
fetch: app.fetch,
routes: {
// Serve index.html for root
'/': index,
if (pathname.startsWith('/api/') || pathname.startsWith('/files/')) {
return app.fetch(req)
}
// Proxy API requests to Hono
'/api/*': app.fetch,
'/files/*': app.fetch,
// Try serving from public folder
let publicFilePath = ''
if (pathname.startsWith('/public/')) {
publicFilePath = path.join(process.cwd(), 'packages/webui/public', pathname.substring(8))
} else {
publicFilePath = path.join(process.cwd(), 'packages/webui/public', pathname)
}
if (fs.existsSync(publicFilePath) && fs.statSync(publicFilePath).isFile()) {
return new Response(Bun.file(publicFilePath))
}
return new Response(index as unknown as BodyInit)
// Catch-all for SPA routing (fallback to index.html)
'/*': index,
},
development: process.env.NODE_ENV !== 'production',
})