Compare commits

..

No commits in common. "c380db0815bc8ecec0cad13fc87dc87bdcfbd627" and "a107f832afa0231bafb0bf32448aba0d81c48feb" have entirely different histories.

5 changed files with 4 additions and 40 deletions

View file

@ -25,11 +25,6 @@ routes:
method: GET
handler: serveEditor
# Static assets route (for Vite build outputs)
- path: /assets/:filepath
method: GET
handler: serveAssets
# API routes for pages
- path: /api/pages
method: GET

View file

@ -47,7 +47,7 @@
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
@ -58,6 +58,6 @@
"supertest": "^7.1.4",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3",
"vite": "^6.1.6"
"vite": "^5.0.8"
}
}

View file

@ -110,14 +110,6 @@ if exist "%SOURCE_DIR%\dist" (
echo [OK] Copied dist directory (frontend build)
)
REM Copy assets to assets/ directory for BOSA automatic serving
REM BOSA automatically serves files from assets/ at /bp_wb/assets/
if exist "%SOURCE_DIR%\dist\assets" (
if not exist "%TARGET_DIR%\assets" mkdir "%TARGET_DIR%\assets"
xcopy /E /I /Y "%SOURCE_DIR%\dist\assets\*" "%TARGET_DIR%\assets\" >nul
echo [OK] Copied assets to assets/ directory (BOSA automatic serving)
)
REM Copy docs directory (optional, for documentation)
if exist "%SOURCE_DIR%\docs" (
xcopy /E /I /Y "%SOURCE_DIR%\docs" "%TARGET_DIR%\docs" >nul

View file

@ -72,35 +72,13 @@ import { initPagesAPI, createPagesRouter } from './backend/api/pages.js';
// Initialize pages API
initPagesAPI(bosa);
// Route handlers - order matters! More specific routes first
// Route handlers
app.get('/', serveEditor);
app.get('/editor', serveEditor);
app.use('/api/pages', createPagesRouter());
app.get('/preview/:id', previewPage);
// Serve static assets (Vite build outputs)
// BOSA forwards /bp_wb/assets/* to this plugin, Express receives /assets/*
// The base path in Vite config ensures assets are referenced as /bp_wb/assets/*
// Use static middleware first (faster), then fallback to handler
app.use('/assets', express.static(path.join(__dirname, 'dist', 'assets'), {
fallthrough: false, // Don't fall through if file not found
}));
// Also handle assets with parameterized route (for BOSA catch-all routing)
app.get('/assets/:filepath', serveAssets);
// Handler function for manifest route (BOSA calls this)
async function serveAssets(req, res) {
const filepath = req.params.filepath || req.path.replace('/assets/', '');
const assetPath = path.join(__dirname, 'dist', 'assets', filepath);
res.sendFile(assetPath, (err) => {
if (err) {
bosa.log?.error(`Failed to serve asset: ${filepath} | Error: ${err.message}`);
res.status(404).json({ error: 'Asset not found' });
}
});
}
// Placeholder route handlers
async function serveEditor(req, res) {
const indexPath = path.join(__dirname, 'dist', 'frontend', 'index.html');
res.sendFile(indexPath);

View file

@ -7,7 +7,6 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig({
base: '/bp_wb/',
plugins: [react()],
resolve: {
alias: {