mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Compare commits
4
Commits
wholeImport
...
webpm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b22a19e6e | ||
|
|
71f82ed717 | ||
|
|
2e68c54dbe | ||
|
|
33a1747a65 |
No files matched your search
Generated
+1242
-73
File diff suppressed because it is too large.
Load diff
+5
-1
@@ -17,7 +17,6 @@
|
|||||||
"@fontsource-variable/inter": "^5.2.6",
|
"@fontsource-variable/inter": "^5.2.6",
|
||||||
"@getalby/sdk": "^6.0.1",
|
"@getalby/sdk": "^6.0.1",
|
||||||
"@hookform/resolvers": "^3.9.0",
|
"@hookform/resolvers": "^3.9.0",
|
||||||
"@icons-pack/react-simple-icons": "^13.8.0",
|
|
||||||
"@isomorphic-git/lightning-fs": "^4.6.2",
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
||||||
"@mozilla/readability": "^0.6.0",
|
"@mozilla/readability": "^0.6.0",
|
||||||
"@nostrify/nostrify": "npm:@jsr/nostrify__nostrify@^0.46.5",
|
"@nostrify/nostrify": "npm:@jsr/nostrify__nostrify@^0.46.5",
|
||||||
@@ -53,6 +52,8 @@
|
|||||||
"@tanstack/react-query": "^5.56.2",
|
"@tanstack/react-query": "^5.56.2",
|
||||||
"@unhead/addons": "^2.0.10",
|
"@unhead/addons": "^2.0.10",
|
||||||
"@unhead/react": "^2.0.10",
|
"@unhead/react": "^2.0.10",
|
||||||
|
"@webpm/store": "file:../webpm/packages/store",
|
||||||
|
"@webpm/webpm": "file:../webpm/packages/webpm",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
"decimal.js": "^10.6.0",
|
"decimal.js": "^10.6.0",
|
||||||
"embla-carousel-react": "^8.3.0",
|
"embla-carousel-react": "^8.3.0",
|
||||||
"esbuild-wasm": "^0.25.8",
|
"esbuild-wasm": "^0.25.8",
|
||||||
|
"fflate": "^0.8.2",
|
||||||
"i18next": "^25.5.2",
|
"i18next": "^25.5.2",
|
||||||
"ignore": "^7.0.5",
|
"ignore": "^7.0.5",
|
||||||
"input-otp": "^1.2.4",
|
"input-otp": "^1.2.4",
|
||||||
@@ -87,10 +89,12 @@
|
|||||||
"tailwind-merge": "^2.5.2",
|
"tailwind-merge": "^2.5.2",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"tailwindcss-safe-area": "^0.8.0",
|
"tailwindcss-safe-area": "^0.8.0",
|
||||||
|
"tar-stream": "^3.1.7",
|
||||||
"turndown": "^7.2.1",
|
"turndown": "^7.2.1",
|
||||||
"uri-templates": "^0.2.0",
|
"uri-templates": "^0.2.0",
|
||||||
"use-stick-to-bottom": "^1.1.1",
|
"use-stick-to-bottom": "^1.1.1",
|
||||||
"vaul": "^0.9.3",
|
"vaul": "^0.9.3",
|
||||||
|
"vite-plugin-node-polyfills": "^0.24.0",
|
||||||
"webln": "^0.3.2",
|
"webln": "^0.3.2",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const defaultConfig: AppConfig = {
|
|||||||
projectTemplate: "https://gitlab.com/soapbox-pub/mkstack.git",
|
projectTemplate: "https://gitlab.com/soapbox-pub/mkstack.git",
|
||||||
esmUrl: "https://esm.shakespeare.diy",
|
esmUrl: "https://esm.shakespeare.diy",
|
||||||
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
||||||
|
faviconUrl: "https://external-content.duckduckgo.com/ip3/{hostname}.ico",
|
||||||
previewDomain: "local-shakespeare.dev",
|
previewDomain: "local-shakespeare.dev",
|
||||||
showcaseEnabled: true,
|
showcaseEnabled: true,
|
||||||
showcaseModerator: "npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc",
|
showcaseModerator: "npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const AppConfigSchema = z.object({
|
|||||||
projectTemplate: z.string().url(),
|
projectTemplate: z.string().url(),
|
||||||
esmUrl: z.string().url(),
|
esmUrl: z.string().url(),
|
||||||
corsProxy: z.string().url(),
|
corsProxy: z.string().url(),
|
||||||
|
faviconUrl: z.string().url(),
|
||||||
previewDomain: z.string().min(1),
|
previewDomain: z.string().min(1),
|
||||||
language: z.string(),
|
language: z.string(),
|
||||||
showcaseEnabled: z.boolean(),
|
showcaseEnabled: z.boolean(),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect, useCallback } from 'react';
|
import { useState, useEffect, useCallback } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Rocket, ExternalLink, AlertCircle } from 'lucide-react';
|
import { Rocket, ExternalLink, AlertCircle } from 'lucide-react';
|
||||||
import { SiNetlify, SiVercel } from '@icons-pack/react-simple-icons';
|
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -28,12 +28,62 @@ import { useAppContext } from '@/hooks/useAppContext';
|
|||||||
import { useNostr } from '@nostrify/react';
|
import { useNostr } from '@nostrify/react';
|
||||||
import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, DeployAdapter } from '@/lib/deploy';
|
import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, DeployAdapter } from '@/lib/deploy';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { ShakespeareDeployProvider, NetlifyProvider, VercelProvider } from '@/contexts/DeploySettingsContext';
|
import type { DeployProvider, ShakespeareDeployProvider, NetlifyProvider, VercelProvider } from '@/contexts/DeploySettingsContext';
|
||||||
import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm';
|
import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm';
|
||||||
import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm';
|
import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm';
|
||||||
import { VercelDeployForm } from '@/components/deploy/VercelDeployForm';
|
import { VercelDeployForm } from '@/components/deploy/VercelDeployForm';
|
||||||
import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm';
|
import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to get provider URL for favicon
|
||||||
|
*/
|
||||||
|
function getProviderUrl(provider: DeployProvider): string | null {
|
||||||
|
switch (provider.type) {
|
||||||
|
case 'shakespeare':
|
||||||
|
if (provider.host) {
|
||||||
|
return `https://${provider.host}`;
|
||||||
|
}
|
||||||
|
return 'https://shakespeare.diy';
|
||||||
|
|
||||||
|
case 'netlify':
|
||||||
|
if (provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://netlify.com';
|
||||||
|
|
||||||
|
case 'vercel':
|
||||||
|
if (provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://vercel.com';
|
||||||
|
|
||||||
|
case 'nsite':
|
||||||
|
return null;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render provider icon using favicon or fallback
|
||||||
|
*/
|
||||||
|
function renderProviderIcon(provider: DeployProvider, size = 14) {
|
||||||
|
const url = getProviderUrl(provider);
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
return (
|
||||||
|
<ExternalFavicon
|
||||||
|
url={url}
|
||||||
|
size={size}
|
||||||
|
fallback={<Rocket size={size} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Rocket size={size} />;
|
||||||
|
}
|
||||||
|
|
||||||
interface DeployDialogProps {
|
interface DeployDialogProps {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
projectName: string;
|
projectName: string;
|
||||||
@@ -388,8 +438,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
<SelectTrigger id="provider">
|
<SelectTrigger id="provider">
|
||||||
{selectedProvider ? (
|
{selectedProvider ? (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{selectedProvider.id === 'netlify' && <SiNetlify size={14} />}
|
{renderProviderIcon(selectedProvider, 14)}
|
||||||
{selectedProvider.id === 'vercel' && <SiVercel size={14} />}
|
|
||||||
<span>{selectedProvider.name}</span>
|
<span>{selectedProvider.name}</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -400,8 +449,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
|||||||
{settings.providers.map((provider) => (
|
{settings.providers.map((provider) => (
|
||||||
<SelectItem key={provider.id} value={provider.id}>
|
<SelectItem key={provider.id} value={provider.id}>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{provider.id === 'netlify' && <SiNetlify size={14} />}
|
{renderProviderIcon(provider, 14)}
|
||||||
{provider.id === 'vercel' && <SiVercel size={14} />}
|
|
||||||
<span>{provider.name}</span>
|
<span>{provider.name}</span>
|
||||||
</div>
|
</div>
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { useAppContext } from '@/hooks/useAppContext';
|
||||||
|
import { faviconUrl, normalizeUrl } from '@/lib/faviconUrl';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
|
interface ExternalFaviconProps {
|
||||||
|
/** The URL to fetch the favicon for */
|
||||||
|
url: string;
|
||||||
|
/** Size of the favicon in pixels */
|
||||||
|
size?: number;
|
||||||
|
/** Fallback element to display if favicon fails to load */
|
||||||
|
fallback?: ReactNode;
|
||||||
|
/** Additional CSS classes */
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ExternalFavicon component that fetches and displays a favicon for a given URL
|
||||||
|
* using the configurable favicon service from app settings.
|
||||||
|
*/
|
||||||
|
export function ExternalFavicon({
|
||||||
|
url,
|
||||||
|
size = 16,
|
||||||
|
fallback,
|
||||||
|
className = '',
|
||||||
|
}: ExternalFaviconProps) {
|
||||||
|
const { config } = useAppContext();
|
||||||
|
|
||||||
|
// Normalize the URL to ensure it has a protocol
|
||||||
|
const normalizedUrl = normalizeUrl(url);
|
||||||
|
|
||||||
|
// Generate the favicon URL using the configured template
|
||||||
|
const faviconSrc = faviconUrl(config.faviconUrl, normalizedUrl);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span className={`inline-flex items-center justify-center ${className}`}>
|
||||||
|
<img
|
||||||
|
src={faviconSrc}
|
||||||
|
alt=""
|
||||||
|
className="object-contain"
|
||||||
|
style={{ width: size, height: size }}
|
||||||
|
onError={(e) => {
|
||||||
|
// Hide the image and show the fallback on error
|
||||||
|
e.currentTarget.style.display = 'none';
|
||||||
|
const fallbackElement = e.currentTarget.nextElementSibling as HTMLElement;
|
||||||
|
if (fallbackElement) {
|
||||||
|
fallbackElement.style.display = 'inline-block';
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{fallback && (
|
||||||
|
<span style={{ display: 'none' }}>
|
||||||
|
{fallback}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@ export interface AppConfig {
|
|||||||
esmUrl: string;
|
esmUrl: string;
|
||||||
/** HTTP proxy used to bypass CORS for AI and Git operations */
|
/** HTTP proxy used to bypass CORS for AI and Git operations */
|
||||||
corsProxy: string;
|
corsProxy: string;
|
||||||
|
/** Favicon URL template (e.g., "https://external-content.duckduckgo.com/ip3/{hostname}.ico") */
|
||||||
|
faviconUrl: string;
|
||||||
/** Preview domain for iframe sandboxing (e.g., "local-shakespeare.dev") */
|
/** Preview domain for iframe sandboxing (e.g., "local-shakespeare.dev") */
|
||||||
previewDomain: string;
|
previewDomain: string;
|
||||||
/** Selected language */
|
/** Selected language */
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ describe('useAIProjectId', () => {
|
|||||||
projectTemplate: 'https://github.com/example/template',
|
projectTemplate: 'https://github.com/example/template',
|
||||||
esmUrl: 'https://esm.sh',
|
esmUrl: 'https://esm.sh',
|
||||||
corsProxy: 'https://proxy.example.com/{href}',
|
corsProxy: 'https://proxy.example.com/{href}',
|
||||||
|
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||||
previewDomain: 'local-shakespeare.dev',
|
previewDomain: 'local-shakespeare.dev',
|
||||||
showcaseEnabled: true,
|
showcaseEnabled: true,
|
||||||
showcaseModerator: 'npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc',
|
showcaseModerator: 'npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc',
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ function createWrapper(corsProxy: string) {
|
|||||||
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
||||||
esmUrl: 'https://esm.test',
|
esmUrl: 'https://esm.test',
|
||||||
corsProxy,
|
corsProxy,
|
||||||
|
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||||
previewDomain: 'local-test.dev',
|
previewDomain: 'local-test.dev',
|
||||||
showcaseEnabled: true,
|
showcaseEnabled: true,
|
||||||
showcaseModerator: 'npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc',
|
showcaseModerator: 'npub1jvnpg4c6ljadf5t6ry0w9q0rnm4mksde87kglkrc993z46c39axsgq89sc',
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import UriTemplate from 'uri-templates';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a favicon URL from a template and input URL
|
||||||
|
* @param template - URL template with placeholders like {hostname}, {origin}, etc.
|
||||||
|
* @param url - The URL to extract parts from
|
||||||
|
* @returns The hydrated favicon URL
|
||||||
|
*/
|
||||||
|
export function faviconUrl(template: string, url: string | URL): string {
|
||||||
|
const u = new URL(url);
|
||||||
|
|
||||||
|
return UriTemplate(template).fill({
|
||||||
|
href: u.href,
|
||||||
|
origin: u.origin,
|
||||||
|
protocol: u.protocol,
|
||||||
|
username: u.username,
|
||||||
|
password: u.password,
|
||||||
|
host: u.host,
|
||||||
|
hostname: u.hostname,
|
||||||
|
port: u.port,
|
||||||
|
pathname: u.pathname,
|
||||||
|
hash: u.hash,
|
||||||
|
search: u.search,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a URL string to ensure it has a protocol
|
||||||
|
* @param url - The URL string to normalize
|
||||||
|
* @returns A fully-qualified URL string
|
||||||
|
*/
|
||||||
|
export function normalizeUrl(url: string): string {
|
||||||
|
// If it already has a protocol, return as-is
|
||||||
|
if (/^https?:\/\//i.test(url)) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add https:// prefix
|
||||||
|
return `https://${url}`;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import { webpm, fileContentStore } from '@webpm/webpm';
|
||||||
|
|
||||||
// Import polyfills first
|
// Import polyfills first
|
||||||
import './lib/polyfills.ts';
|
import './lib/polyfills.ts';
|
||||||
|
|||||||
+32
-15
@@ -1,7 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Check, Bot, ArrowLeft, Trash2, GripVertical } from 'lucide-react';
|
import { Check, Bot, ArrowLeft, Trash2, GripVertical } from 'lucide-react';
|
||||||
import { SiOpenai, SiAnthropic, SiGoogle, SiX } from '@icons-pack/react-simple-icons';
|
|
||||||
import {
|
import {
|
||||||
DndContext,
|
DndContext,
|
||||||
closestCenter,
|
closestCenter,
|
||||||
@@ -36,19 +35,25 @@ import { useCurrentUser } from '@/hooks/useCurrentUser';
|
|||||||
import { useNavigate, Link } from 'react-router-dom';
|
import { useNavigate, Link } from 'react-router-dom';
|
||||||
import type { AIProvider } from '@/contexts/AISettingsContext';
|
import type { AIProvider } from '@/contexts/AISettingsContext';
|
||||||
import { AI_PROVIDER_PRESETS, type PresetProvider } from '@/lib/aiProviderPresets';
|
import { AI_PROVIDER_PRESETS, type PresetProvider } from '@/lib/aiProviderPresets';
|
||||||
|
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||||
|
|
||||||
function renderIcon(providerId: string, size = 16) {
|
/** A few provider-specific icon hacks */
|
||||||
switch (providerId) {
|
function getProviderIconUrl(provider: { id: string; baseURL: string }): string {
|
||||||
case 'openai':
|
if (provider.id === 'ollama' && provider.baseURL === 'http://localhost:11434/v1') {
|
||||||
return <SiOpenai size={size} />;
|
return 'https://ollama.com/';
|
||||||
case 'anthropic':
|
} else if (provider.baseURL === 'https://generativelanguage.googleapis.com/v1beta/openai') {
|
||||||
return <SiAnthropic size={size} />;
|
return 'https://gemini.google.com/';
|
||||||
case 'google':
|
} else if (provider.baseURL === 'https://api.z.ai/api/paas/v4') {
|
||||||
return <SiGoogle size={size} />;
|
return 'https://docs.z.ai/';
|
||||||
case 'xai':
|
}
|
||||||
return <SiX size={size} />;
|
try {
|
||||||
default:
|
// Strip .ai and .api subdomains for a better chance at finding a favicon
|
||||||
return null;
|
const urlObj = new URL(provider.baseURL);
|
||||||
|
urlObj.hostname = urlObj.hostname.replace(/^(ai\.|api\.)/, '');
|
||||||
|
return urlObj.toString();
|
||||||
|
} catch {
|
||||||
|
// Fallback to baseURL
|
||||||
|
return provider.baseURL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +101,15 @@ function SortableProviderItem({ provider, preset, onRemove, onSetProvider, onOpe
|
|||||||
<GripVertical className="h-4 w-4" />
|
<GripVertical className="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{renderIcon(provider.id)}
|
{provider.baseURL ? (
|
||||||
|
<ExternalFavicon
|
||||||
|
url={getProviderIconUrl(provider)}
|
||||||
|
size={16}
|
||||||
|
fallback={<Bot size={16} />}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Bot size={16} />
|
||||||
|
)}
|
||||||
<span className="font-medium">
|
<span className="font-medium">
|
||||||
{preset?.name || provider.id}
|
{preset?.name || provider.id}
|
||||||
</span>
|
</span>
|
||||||
@@ -376,7 +389,11 @@ export function AISettings() {
|
|||||||
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{renderIcon(preset.id)}
|
<ExternalFavicon
|
||||||
|
url={getProviderIconUrl(preset)}
|
||||||
|
size={16}
|
||||||
|
fallback={<Bot size={16} />}
|
||||||
|
/>
|
||||||
<h5 className="font-medium">{preset.name}</h5>
|
<h5 className="font-medium">{preset.name}</h5>
|
||||||
</div>
|
</div>
|
||||||
{(preset.apiKeysURL && preset.id !== "routstr") && (
|
{(preset.apiKeysURL && preset.id !== "routstr") && (
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Rocket, ArrowLeft, Trash2, Check, GripVertical } from 'lucide-react';
|
import { Rocket, ArrowLeft, Trash2, Check, GripVertical, ChevronDown } from 'lucide-react';
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
import { SiNetlify, SiVercel } from '@icons-pack/react-simple-icons';
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/components/ui/dropdown-menu';
|
||||||
import {
|
import {
|
||||||
DndContext,
|
DndContext,
|
||||||
closestCenter,
|
closestCenter,
|
||||||
@@ -35,6 +40,8 @@ import { useCurrentUser } from '@/hooks/useCurrentUser';
|
|||||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||||
import { useNavigate, Link } from 'react-router-dom';
|
import { useNavigate, Link } from 'react-router-dom';
|
||||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||||
|
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||||
|
import { normalizeUrl } from '@/lib/faviconUrl';
|
||||||
|
|
||||||
interface PresetProvider {
|
interface PresetProvider {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -89,7 +96,18 @@ function SortableProviderItem({ provider, index, preset, onRemove, onUpdate, sho
|
|||||||
<GripVertical className="h-4 w-4" />
|
<GripVertical className="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{renderIcon(provider.id)}
|
{(() => {
|
||||||
|
const url = getProviderUrl(provider);
|
||||||
|
return url ? (
|
||||||
|
<ExternalFavicon
|
||||||
|
url={url}
|
||||||
|
size={16}
|
||||||
|
fallback={<Rocket size={16} />}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Rocket size={16} />
|
||||||
|
);
|
||||||
|
})()}
|
||||||
<span className="font-medium">
|
<span className="font-medium">
|
||||||
{provider.name}
|
{provider.name}
|
||||||
</span>
|
</span>
|
||||||
@@ -265,12 +283,33 @@ function generateCustomProviderId(type: string): string {
|
|||||||
return `${type}-${randomSegment}`;
|
return `${type}-${randomSegment}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderIcon(providerId: string, size = 16) {
|
function getProviderUrl(provider: DeployProvider | PresetProvider): string | null {
|
||||||
switch (providerId) {
|
switch (provider.type) {
|
||||||
|
case 'shakespeare':
|
||||||
|
// For Shakespeare providers, check for custom host first, then use default
|
||||||
|
if ('host' in provider && provider.host) {
|
||||||
|
return normalizeUrl(provider.host);
|
||||||
|
}
|
||||||
|
return 'https://shakespeare.diy';
|
||||||
|
|
||||||
case 'netlify':
|
case 'netlify':
|
||||||
return <SiNetlify size={size} />;
|
// For Netlify providers, check for custom baseURL first, then use default
|
||||||
|
if ('baseURL' in provider && provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://netlify.com';
|
||||||
|
|
||||||
case 'vercel':
|
case 'vercel':
|
||||||
return <SiVercel size={size} />;
|
// For Vercel providers, check for custom baseURL first, then use default
|
||||||
|
if ('baseURL' in provider && provider.baseURL) {
|
||||||
|
return provider.baseURL;
|
||||||
|
}
|
||||||
|
return 'https://vercel.com';
|
||||||
|
|
||||||
|
case 'nsite':
|
||||||
|
// nsite uses Rocket icon fallback
|
||||||
|
return null;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -288,6 +327,7 @@ export function DeploySettings() {
|
|||||||
const vercelOAuth = useVercelOAuth();
|
const vercelOAuth = useVercelOAuth();
|
||||||
|
|
||||||
const [presetApiKeys, setPresetApiKeys] = useState<Record<string, string>>({});
|
const [presetApiKeys, setPresetApiKeys] = useState<Record<string, string>>({});
|
||||||
|
const [forceManualEntry, setForceManualEntry] = useState<Record<string, boolean>>({});
|
||||||
|
|
||||||
// Custom provider form state
|
// Custom provider form state
|
||||||
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | ''>('');
|
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | ''>('');
|
||||||
@@ -554,7 +594,18 @@ export function DeploySettings() {
|
|||||||
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{renderIcon(preset.id)}
|
{(() => {
|
||||||
|
const url = getProviderUrl(preset);
|
||||||
|
return url ? (
|
||||||
|
<ExternalFavicon
|
||||||
|
url={url}
|
||||||
|
size={16}
|
||||||
|
fallback={<Rocket size={16} />}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Rocket size={16} />
|
||||||
|
);
|
||||||
|
})()}
|
||||||
<h5 className="font-medium">{preset.name}</h5>
|
<h5 className="font-medium">{preset.name}</h5>
|
||||||
</div>
|
</div>
|
||||||
{preset.apiKeyURL && !isOAuthConfigured && (
|
{preset.apiKeyURL && !isOAuthConfigured && (
|
||||||
@@ -580,13 +631,14 @@ export function DeploySettings() {
|
|||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : isOAuthConfigured ? (
|
) : isOAuthConfigured && !forceManualEntry[preset.id] ? (
|
||||||
// Show OAuth button if OAuth is configured
|
// Show OAuth button if OAuth is configured and not forced to manual
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
|
<div className="flex gap-0">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => oauthHook?.initiateOAuth()}
|
onClick={() => oauthHook?.initiateOAuth()}
|
||||||
disabled={isOAuthLoading}
|
disabled={isOAuthLoading}
|
||||||
className="w-full max-w-full gap-2"
|
className="flex-1 rounded-r-none gap-2"
|
||||||
variant="default"
|
variant="default"
|
||||||
>
|
>
|
||||||
{isOAuthLoading ? (
|
{isOAuthLoading ? (
|
||||||
@@ -596,13 +648,43 @@ export function DeploySettings() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{renderIcon(preset.id)}
|
{(() => {
|
||||||
|
const url = getProviderUrl(preset);
|
||||||
|
return url ? (
|
||||||
|
<ExternalFavicon
|
||||||
|
url={url}
|
||||||
|
size={16}
|
||||||
|
fallback={<Rocket size={16} />}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Rocket size={16} />
|
||||||
|
);
|
||||||
|
})()}
|
||||||
<span className="truncate text-ellipsis overflow-hidden">
|
<span className="truncate text-ellipsis overflow-hidden">
|
||||||
Connect to {preset.name}
|
Connect to {preset.name}
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
className="rounded-l-none border-l border-primary-foreground/20 px-2"
|
||||||
|
disabled={isOAuthLoading}
|
||||||
|
>
|
||||||
|
<ChevronDown className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => setForceManualEntry(prev => ({ ...prev, [preset.id]: true }))}
|
||||||
|
>
|
||||||
|
Enter API key
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
{oauthError && (
|
{oauthError && (
|
||||||
<p className="text-sm text-destructive">
|
<p className="text-sm text-destructive">
|
||||||
{oauthError}
|
{oauthError}
|
||||||
|
|||||||
+46
-18
@@ -1,19 +1,25 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Check, GitBranch, ArrowLeft, Trash2 } from 'lucide-react';
|
import { Check, GitBranch, ArrowLeft, Trash2, ChevronDown } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { SiGithub, SiGitlab } from '@icons-pack/react-simple-icons';
|
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||||
import { Switch } from '@/components/ui/switch';
|
import { Switch } from '@/components/ui/switch';
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/components/ui/dropdown-menu';
|
||||||
import { useGitSettings } from '@/hooks/useGitSettings';
|
import { useGitSettings } from '@/hooks/useGitSettings';
|
||||||
import { useGitHubOAuth } from '@/hooks/useGitHubOAuth';
|
import { useGitHubOAuth } from '@/hooks/useGitHubOAuth';
|
||||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import type { GitCredential } from '@/contexts/GitSettingsContext';
|
import type { GitCredential } from '@/contexts/GitSettingsContext';
|
||||||
import { PasswordInput } from '@/components/ui/password-input';
|
import { PasswordInput } from '@/components/ui/password-input';
|
||||||
|
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||||
|
|
||||||
interface PresetProvider {
|
interface PresetProvider {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -40,17 +46,6 @@ const PRESET_PROVIDERS: PresetProvider[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function renderIcon(providerId: string, size = 16) {
|
|
||||||
switch (providerId) {
|
|
||||||
case 'github':
|
|
||||||
return <SiGithub size={size} />;
|
|
||||||
case 'gitlab':
|
|
||||||
return <SiGitlab size={size} />;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function GitSettings() {
|
export function GitSettings() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { settings, addCredential, removeCredential, updateCredential, updateSettings } = useGitSettings();
|
const { settings, addCredential, removeCredential, updateCredential, updateSettings } = useGitSettings();
|
||||||
@@ -61,6 +56,7 @@ export function GitSettings() {
|
|||||||
const [customUsername, setCustomUsername] = useState('');
|
const [customUsername, setCustomUsername] = useState('');
|
||||||
const [customPassword, setCustomPassword] = useState('');
|
const [customPassword, setCustomPassword] = useState('');
|
||||||
const [presetTokens, setPresetTokens] = useState<Record<string, string>>({});
|
const [presetTokens, setPresetTokens] = useState<Record<string, string>>({});
|
||||||
|
const [forceManualEntry, setForceManualEntry] = useState<Record<string, boolean>>({});
|
||||||
|
|
||||||
const handleAddPresetProvider = (preset: PresetProvider) => {
|
const handleAddPresetProvider = (preset: PresetProvider) => {
|
||||||
const token = presetTokens[preset.id] as string | undefined;
|
const token = presetTokens[preset.id] as string | undefined;
|
||||||
@@ -163,7 +159,11 @@ export function GitSettings() {
|
|||||||
<AccordionItem key={origin} value={origin} className="border rounded-lg">
|
<AccordionItem key={origin} value={origin} className="border rounded-lg">
|
||||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{preset && renderIcon(preset.id)}
|
<ExternalFavicon
|
||||||
|
url={origin}
|
||||||
|
size={16}
|
||||||
|
fallback={<GitBranch size={16} />}
|
||||||
|
/>
|
||||||
<span className="font-medium">
|
<span className="font-medium">
|
||||||
{preset?.name || new URL(origin).hostname}
|
{preset?.name || new URL(origin).hostname}
|
||||||
</span>
|
</span>
|
||||||
@@ -226,7 +226,11 @@ export function GitSettings() {
|
|||||||
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
<div key={preset.id} className="border rounded-lg p-4 space-y-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{renderIcon(preset.id)}
|
<ExternalFavicon
|
||||||
|
url={preset.origin}
|
||||||
|
size={16}
|
||||||
|
fallback={<GitBranch size={16} />}
|
||||||
|
/>
|
||||||
<h5 className="font-medium">{preset.name}</h5>
|
<h5 className="font-medium">{preset.name}</h5>
|
||||||
</div>
|
</div>
|
||||||
{preset.tokenURL && (preset.id !== 'github' || !isOAuthConfigured) && (
|
{preset.tokenURL && (preset.id !== 'github' || !isOAuthConfigured) && (
|
||||||
@@ -242,12 +246,13 @@ export function GitSettings() {
|
|||||||
|
|
||||||
{preset.id === 'github' ? (
|
{preset.id === 'github' ? (
|
||||||
// Special rendering for GitHub - OAuth button if configured, otherwise token input
|
// Special rendering for GitHub - OAuth button if configured, otherwise token input
|
||||||
isOAuthConfigured ? (
|
isOAuthConfigured && !forceManualEntry[preset.id] ? (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
|
<div className="flex gap-0">
|
||||||
<Button
|
<Button
|
||||||
onClick={initiateOAuth}
|
onClick={initiateOAuth}
|
||||||
disabled={isOAuthLoading}
|
disabled={isOAuthLoading}
|
||||||
className="w-full max-w-full gap-2"
|
className="flex-1 rounded-r-none gap-2"
|
||||||
variant="default"
|
variant="default"
|
||||||
>
|
>
|
||||||
{isOAuthLoading ? (
|
{isOAuthLoading ? (
|
||||||
@@ -257,13 +262,36 @@ export function GitSettings() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<SiGithub size={16} />
|
<ExternalFavicon
|
||||||
|
url="https://github.com"
|
||||||
|
size={16}
|
||||||
|
fallback={<GitBranch size={16} />}
|
||||||
|
/>
|
||||||
<span className="truncate text-ellipsis overflow-hidden">
|
<span className="truncate text-ellipsis overflow-hidden">
|
||||||
Connect to GitHub
|
Connect to GitHub
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
className="rounded-l-none border-l border-primary-foreground/20 px-2"
|
||||||
|
disabled={isOAuthLoading}
|
||||||
|
>
|
||||||
|
<ChevronDown className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent align="end">
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => setForceManualEntry(prev => ({ ...prev, [preset.id]: true }))}
|
||||||
|
>
|
||||||
|
Enter API key
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
{oauthError && (
|
{oauthError && (
|
||||||
<p className="text-sm text-destructive">
|
<p className="text-sm text-destructive">
|
||||||
{oauthError}
|
{oauthError}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams, useSearchParams } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { type Project } from '@/lib/ProjectsManager';
|
import { type Project } from '@/lib/ProjectsManager';
|
||||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||||
@@ -19,16 +19,20 @@ import { StarButton } from '@/components/StarButton';
|
|||||||
import { useBuildProject } from '@/hooks/useBuildProject';
|
import { useBuildProject } from '@/hooks/useBuildProject';
|
||||||
import { useIsProjectPreviewable } from '@/hooks/useIsProjectPreviewable';
|
import { useIsProjectPreviewable } from '@/hooks/useIsProjectPreviewable';
|
||||||
import { useConsoleError } from '@/hooks/useConsoleError';
|
import { useConsoleError } from '@/hooks/useConsoleError';
|
||||||
|
import { webpm } from '@webpm/webpm';
|
||||||
|
import { useFS } from '@/hooks/useFS';
|
||||||
|
|
||||||
export function ProjectView() {
|
export function ProjectView() {
|
||||||
const { projectId } = useParams<{ projectId: string }>();
|
const { projectId } = useParams<{ projectId: string }>();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { fs } = useFS();
|
||||||
const [project, setProject] = useState<Project | null>(null);
|
const [project, setProject] = useState<Project | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [activeTab, setActiveTab] = useState<'preview' | 'code'>('preview');
|
const [activeTab, setActiveTab] = useState<'preview' | 'code'>('preview');
|
||||||
const [mobileView, setMobileView] = useState<'chat' | 'preview' | 'code'>('chat');
|
const [mobileView, setMobileView] = useState<'chat' | 'preview' | 'code'>('chat');
|
||||||
const [isAILoading, setIsAILoading] = useState(false);
|
const [isAILoading, setIsAILoading] = useState(false);
|
||||||
const [isProjectDetailsOpen, setIsProjectDetailsOpen] = useState(false);
|
const [isProjectDetailsOpen, setIsProjectDetailsOpen] = useState(false);
|
||||||
|
const [searchParams] = useSearchParams();
|
||||||
|
|
||||||
// Use console error state from provider
|
// Use console error state from provider
|
||||||
const { consoleError, dismissConsoleError, clearErrors } = useConsoleError();
|
const { consoleError, dismissConsoleError, clearErrors } = useConsoleError();
|
||||||
@@ -112,6 +116,24 @@ export function ProjectView() {
|
|||||||
navigate('/');
|
navigate('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
(async () => {
|
||||||
|
if (project && searchParams.get('build')) {
|
||||||
|
const packageJson = await fs.readFile(`/projects/${project.id}/package.json`, 'utf8');
|
||||||
|
await webpm.installWithUntarHandler(JSON.parse(packageJson), {
|
||||||
|
onProgress: (e) => {
|
||||||
|
console.log(`Build progress:`, e.currentProgress);
|
||||||
|
},
|
||||||
|
onComplete: () => {
|
||||||
|
console.log('Build complete');
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
includeDevDependencies: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}, [fs, project, searchParams]);
|
||||||
|
|
||||||
if (!project && !isLoading) {
|
if (!project && !isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background flex items-center justify-center">
|
<div className="min-h-screen bg-background flex items-center justify-center">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export function SystemSettings() {
|
|||||||
const [projectTemplateInput, setProjectTemplateInput] = useState(config.projectTemplate);
|
const [projectTemplateInput, setProjectTemplateInput] = useState(config.projectTemplate);
|
||||||
const [esmUrlInput, setEsmUrlInput] = useState(config.esmUrl);
|
const [esmUrlInput, setEsmUrlInput] = useState(config.esmUrl);
|
||||||
const [corsProxyInput, setCorsProxyInput] = useState(config.corsProxy);
|
const [corsProxyInput, setCorsProxyInput] = useState(config.corsProxy);
|
||||||
|
const [faviconUrlInput, setFaviconUrlInput] = useState(config.faviconUrl);
|
||||||
const [previewDomainInput, setPreviewDomainInput] = useState(config.previewDomain);
|
const [previewDomainInput, setPreviewDomainInput] = useState(config.previewDomain);
|
||||||
const [showcaseModeratorInput, setShowcaseModeratorInput] = useState(config.showcaseModerator);
|
const [showcaseModeratorInput, setShowcaseModeratorInput] = useState(config.showcaseModerator);
|
||||||
|
|
||||||
@@ -119,6 +120,36 @@ export function SystemSettings() {
|
|||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
|
{/* Favicon URL Configuration */}
|
||||||
|
<Accordion type="single" collapsible className="w-full">
|
||||||
|
<AccordionItem value="favicon-url" className="border rounded-lg">
|
||||||
|
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||||
|
<h4 className="text-sm font-medium">Favicon URL</h4>
|
||||||
|
</AccordionTrigger>
|
||||||
|
<AccordionContent className="px-4 pb-4">
|
||||||
|
<div className="py-1 space-y-2">
|
||||||
|
<Input
|
||||||
|
id="favicon-url"
|
||||||
|
type="url"
|
||||||
|
placeholder="https://external-content.duckduckgo.com/ip3/{hostname}.ico"
|
||||||
|
value={faviconUrlInput}
|
||||||
|
onChange={(e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
setFaviconUrlInput(value);
|
||||||
|
updateConfig((current) => ({
|
||||||
|
...current,
|
||||||
|
faviconUrl: value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
URL template for fetching favicons. Available variables: {'{hostname}'}, {'{origin}'}, {'{href}'}, {'{protocol}'}, {'{pathname}'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</AccordionContent>
|
||||||
|
</AccordionItem>
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
{/* JavaScript CDN Configuration */}
|
{/* JavaScript CDN Configuration */}
|
||||||
<Accordion type="single" collapsible className="w-full">
|
<Accordion type="single" collapsible className="w-full">
|
||||||
<AccordionItem value="esm-url" className="border rounded-lg">
|
<AccordionItem value="esm-url" className="border rounded-lg">
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export function TestApp({ children }: TestAppProps) {
|
|||||||
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
||||||
esmUrl: 'https://esm.shakespeare.diy',
|
esmUrl: 'https://esm.shakespeare.diy',
|
||||||
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
|
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
|
||||||
|
faviconUrl: 'https://external-content.duckduckgo.com/ip3/{hostname}.ico',
|
||||||
previewDomain: 'local-shakespeare.dev',
|
previewDomain: 'local-shakespeare.dev',
|
||||||
language: 'en',
|
language: 'en',
|
||||||
showcaseEnabled: true,
|
showcaseEnabled: true,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import path from "node:path";
|
|||||||
|
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(() => ({
|
export default defineConfig(() => ({
|
||||||
@@ -10,6 +11,16 @@ export default defineConfig(() => ({
|
|||||||
port: 8080,
|
port: 8080,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
nodePolyfills({
|
||||||
|
include: ["buffer", "process", "stream", "module"],
|
||||||
|
exclude: ["http", "https", "net", "tls", "child_process"],
|
||||||
|
globals: {
|
||||||
|
Buffer: true,
|
||||||
|
global: true,
|
||||||
|
process: true,
|
||||||
|
},
|
||||||
|
protocolImports: true,
|
||||||
|
}),
|
||||||
react(),
|
react(),
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
@@ -52,4 +63,7 @@ export default defineConfig(() => ({
|
|||||||
"@": path.resolve(__dirname, "./src"),
|
"@": path.resolve(__dirname, "./src"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
optimizeDeps: {
|
||||||
|
include: ["tar-stream", "fflate"],
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
Reference in new issue
Block a user