Skip to content

Commit dc1c016

Browse files
committed
fix: UI needs CORS for the preview
1 parent 5860da3 commit dc1c016

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

packages/cta-ui-base/src/components/webcontainer-preview.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ export function WebContainerPreview() {
100100
{/* Progress Steps */}
101101
<div className="space-y-4 mb-6">
102102
<div className="flex items-center gap-3">
103-
<div className="text-2xl">{getStepIcon('mounting')}</div>
103+
<div
104+
className={`text-2xl ${setupStep === 'mounting' ? 'animate-pulse' : ''}`}
105+
>
106+
{getStepIcon('mounting')}
107+
</div>
104108
<div
105109
className={`flex-1 ${getStepColor(setupStep === 'mounting' ? 'mounting' : setupStep === 'installing' || setupStep === 'starting' || setupStep === 'ready' ? 'ready' : 'mounting')}`}
106110
>
@@ -112,7 +116,11 @@ export function WebContainerPreview() {
112116
'✓'}
113117
</div>
114118
<div className="flex items-center gap-3">
115-
<div className="text-2xl">{getStepIcon('installing')}</div>
119+
<div
120+
className={`text-2xl ${setupStep === 'installing' ? 'animate-spin' : ''}`}
121+
>
122+
{getStepIcon('installing')}
123+
</div>
116124
<div
117125
className={`flex-1 ${getStepColor(setupStep === 'installing' ? 'installing' : setupStep === 'starting' || setupStep === 'ready' ? 'ready' : 'mounting')}`}
118126
>
@@ -121,7 +129,11 @@ export function WebContainerPreview() {
121129
{(setupStep === 'starting' || setupStep === 'ready') && '✓'}
122130
</div>
123131
<div className="flex items-center gap-3">
124-
<div className="text-2xl">{getStepIcon('starting')}</div>
132+
<div
133+
className={`text-2xl ${setupStep === 'starting' ? 'animate-bounce' : ''}`}
134+
>
135+
{getStepIcon('starting')}
136+
</div>
125137
<div
126138
className={`flex-1 ${getStepColor(setupStep === 'starting' ? 'starting' : setupStep === 'ready' ? 'ready' : 'mounting')}`}
127139
>

packages/cta-ui/lib/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ export function launchUI(
3434
app.use(express.json())
3535
app.use(express.urlencoded({ extended: true }))
3636

37+
// Add headers required for WebContainer (SharedArrayBuffer support)
38+
app.use((req, res, next) => {
39+
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
40+
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
41+
next()
42+
})
43+
3744
const packagePath = resolve(dirname(fileURLToPath(import.meta.url)), '..')
3845

3946
const launchUI = !process.env.CTA_DISABLE_UI

0 commit comments

Comments
 (0)