mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
- Fix indentation in Preview.tsx and normalize quotes - Remove unused import in selectStarterTemplate.ts - Improve code readability in api.github-template.ts
33 lines
989 B
TypeScript
33 lines
989 B
TypeScript
import { type LoaderFunction } from '@remix-run/cloudflare';
|
|
|
|
export const loader: LoaderFunction = async ({ request }) => {
|
|
const url = new URL(request.url);
|
|
const editorOrigin = url.searchParams.get('editorOrigin') || 'https://stackblitz.com';
|
|
console.log('editorOrigin', editorOrigin);
|
|
|
|
const htmlContent = `
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Connect to WebContainer</title>
|
|
</head>
|
|
<body>
|
|
<script type="module">
|
|
(async () => {
|
|
const { setupConnect } = await import('https://cdn.jsdelivr.net/npm/@webcontainer/api@latest/dist/connect.js');
|
|
setupConnect({
|
|
editorOrigin: '${editorOrigin}'
|
|
});
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|
|
`;
|
|
|
|
return new Response(htmlContent, {
|
|
headers: { 'Content-Type': 'text/html' },
|
|
});
|
|
};
|