mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Make project template (mkstack itself) configurable in System Settings
This commit is contained in:
10 files changed
+55
-6
No files matched your search
@@ -42,6 +42,7 @@ const queryClient = new QueryClient({
|
||||
const defaultConfig: AppConfig = {
|
||||
theme: "system",
|
||||
relayUrl: "wss://relay.primal.net",
|
||||
projectTemplate: "https://gitlab.com/soapbox-pub/mkstack.git",
|
||||
deployServer: "shakespeare.wtf",
|
||||
esmUrl: "https://esm.shakespeare.diy",
|
||||
corsProxy: "https://proxy.shakespeare.diy/?url={href}",
|
||||
|
||||
@@ -18,6 +18,7 @@ interface AppProviderProps {
|
||||
const AppConfigSchema = z.object({
|
||||
theme: z.enum(['dark', 'light', 'system']),
|
||||
relayUrl: z.string().url(),
|
||||
projectTemplate: z.string().url(),
|
||||
deployServer: z.string().min(1),
|
||||
esmUrl: z.string().url(),
|
||||
corsProxy: z.string().url(),
|
||||
|
||||
@@ -7,6 +7,8 @@ export interface AppConfig {
|
||||
theme: Theme;
|
||||
/** Selected relay URL */
|
||||
relayUrl: string;
|
||||
/** Git repository URL to use as project template */
|
||||
projectTemplate: string;
|
||||
/** Deploy server domain (e.g., "shakespeare.wtf") */
|
||||
deployServer: string;
|
||||
/** ESM CDN URL for package imports */
|
||||
|
||||
@@ -34,6 +34,7 @@ function createWrapper(corsProxy: string) {
|
||||
const defaultConfig: AppConfig = {
|
||||
theme: 'light',
|
||||
relayUrl: 'wss://relay.test',
|
||||
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
||||
deployServer: 'test.com',
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy,
|
||||
|
||||
@@ -15,6 +15,7 @@ function Wrapper({ children }: { children: React.ReactNode }) {
|
||||
const defaultConfig: AppConfig = {
|
||||
theme: 'light',
|
||||
relayUrl: 'wss://relay.test',
|
||||
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
||||
deployServer: 'test.com',
|
||||
esmUrl: 'https://esm.test',
|
||||
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
|
||||
|
||||
@@ -9,9 +9,6 @@ if (typeof window !== 'undefined') {
|
||||
(window as { Buffer?: typeof Buffer }).Buffer = Buffer;
|
||||
}
|
||||
|
||||
// const GIT_TEMPLATE_URL = 'https://relay.ngit.dev/npub1q3sle0kvfsehgsuexttt3ugjd8xdklxfwwkh559wxckmzddywnws6cd26p/mkstack.git';
|
||||
const GIT_TEMPLATE_URL = 'https://gitlab.com/soapbox-pub/mkstack.git';
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -43,8 +40,8 @@ export class ProjectsManager {
|
||||
}
|
||||
}
|
||||
|
||||
async createProject(name: string, customId?: string): Promise<Project> {
|
||||
const project = await this.cloneProject(name, GIT_TEMPLATE_URL, customId, { depth: 1 });
|
||||
async createProject(name: string, templateUrl: string, customId?: string): Promise<Project> {
|
||||
const project = await this.cloneProject(name, templateUrl, customId, { depth: 1 });
|
||||
|
||||
// Delete README.md if it exists
|
||||
try {
|
||||
|
||||
@@ -32,6 +32,8 @@ const resources = {
|
||||
systemSettingsDescription: 'Configure system-level settings and advanced options.',
|
||||
esmUrl: 'Javascript CDN',
|
||||
esmUrlDescription: 'Javascript CDN URL for package imports.',
|
||||
projectTemplate: 'Project Template',
|
||||
projectTemplateDescription: 'Git repository URL to use as the starting template for new projects.',
|
||||
previewDomain: 'Preview Domain',
|
||||
previewDomainDescription: 'Domain used for iframe preview sandboxing.',
|
||||
corsProxy: 'CORS Proxy',
|
||||
@@ -524,6 +526,8 @@ const resources = {
|
||||
password: 'Senha',
|
||||
enterPassword: 'Digite sua senha/token',
|
||||
credentialsExist: 'Credenciais para esta origem já existem',
|
||||
projectTemplate: 'Modelo de Projeto',
|
||||
projectTemplateDescription: 'URL do repositório Git a ser usado como modelo inicial para novos projetos.',
|
||||
corsProxy: 'Proxy CORS',
|
||||
corsProxyDescription: 'Proxy usado para contornar CORS para operações de IA e Git.',
|
||||
|
||||
@@ -841,6 +845,8 @@ const resources = {
|
||||
password: '密码',
|
||||
enterPassword: '输入您的密码/令牌',
|
||||
credentialsExist: '此源的凭据已存在',
|
||||
projectTemplate: '项目模板',
|
||||
projectTemplateDescription: '用作新项目起始模板的Git仓库URL。',
|
||||
corsProxy: 'CORS代理',
|
||||
corsProxyDescription: '用于绕过CORS的代理,适用于AI和Git操作。',
|
||||
|
||||
@@ -1158,6 +1164,8 @@ const resources = {
|
||||
password: 'Kalmar sirri',
|
||||
enterPassword: 'Shigar da kalmar sirri/alamar ku',
|
||||
credentialsExist: 'Bayanan shaidar wannan asali sun riga sun wanzu',
|
||||
projectTemplate: 'Samfurin Aikin',
|
||||
projectTemplateDescription: 'URL ɗin ma\'ajin Git da za a yi amfani da shi azaman samfurin farawa don sababbin ayyuka.',
|
||||
corsProxy: 'CORS Proxy',
|
||||
corsProxyDescription: 'Proxy da ake amfani da shi don ketare CORS don ayyukan AI da Git.',
|
||||
|
||||
@@ -1475,6 +1483,8 @@ const resources = {
|
||||
password: 'Ọrọ igbaniwọle',
|
||||
enterPassword: 'Tẹ ọrọ igbaniwọle/token rẹ sinu',
|
||||
credentialsExist: 'Awọn ẹri fun ipilẹṣẹ yii ti wa tẹlẹ',
|
||||
projectTemplate: 'Awoṣe Iṣẹ akanṣe',
|
||||
projectTemplateDescription: 'URL ibi ipamọ Git lati lo bi awoṣe ibẹrẹ fun awọn iṣẹ akanṣe tuntun.',
|
||||
corsProxy: 'CORS Proxy',
|
||||
corsProxyDescription: 'Olupin proxy ti a lo lati kọja CORS fun awọn iṣẹ AI ati Git.',
|
||||
|
||||
@@ -1787,6 +1797,8 @@ const resources = {
|
||||
password: 'Okwuntughe',
|
||||
enterPassword: 'Tinye okwuntughe/token gị',
|
||||
credentialsExist: 'Nzere maka mmalite a adịlarị',
|
||||
projectTemplate: 'Ụdịdị Ọrụ',
|
||||
projectTemplateDescription: 'URL nchekwa Git iji mee ka ụdịdị mmalite maka ọrụ ọhụrụ.',
|
||||
corsProxy: 'CORS Proxy',
|
||||
corsProxyDescription: 'Sava proxy ejiri gafere CORS maka ọrụ AI na Git.',
|
||||
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@ import { useFS } from '@/hooks/useFS';
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
import { useAISettings } from '@/hooks/useAISettings';
|
||||
import { useAppContext } from '@/hooks/useAppContext';
|
||||
import { AppLayout } from '@/components/AppLayout';
|
||||
import { OnboardingDialog } from '@/components/OnboardingDialog';
|
||||
import { Act1Dialog } from '@/components/Act1Dialog';
|
||||
@@ -35,6 +36,7 @@ export default function Index() {
|
||||
const { fs } = useFS();
|
||||
const { generateProjectId, isLoading: isGeneratingId } = useAIProjectId();
|
||||
const { settings, addRecentlyUsedModel } = useAISettings();
|
||||
const { config } = useAppContext();
|
||||
const [providerModel, setProviderModel] = useState(() => {
|
||||
// Initialize with first recently used model if available, otherwise empty
|
||||
return settings.recentlyUsedModels?.[0] || '';
|
||||
@@ -196,7 +198,7 @@ export default function Index() {
|
||||
addRecentlyUsedModel(providerModel.trim());
|
||||
|
||||
// Create project with AI-generated ID
|
||||
const project = await projectsManager.createProject(prompt.trim(), projectId);
|
||||
const project = await projectsManager.createProject(prompt.trim(), config.projectTemplate, projectId);
|
||||
|
||||
// Build message content as text parts (same as ChatPane)
|
||||
const contentParts: Array<OpenAI.Chat.Completions.ChatCompletionContentPartText> = [];
|
||||
|
||||
@@ -13,6 +13,7 @@ export function SystemSettings() {
|
||||
const isMobile = useIsMobile();
|
||||
const navigate = useNavigate();
|
||||
const { config, updateConfig } = useAppContext();
|
||||
const [projectTemplateInput, setProjectTemplateInput] = useState(config.projectTemplate);
|
||||
const [esmUrlInput, setEsmUrlInput] = useState(config.esmUrl);
|
||||
const [corsProxyInput, setCorsProxyInput] = useState(config.corsProxy);
|
||||
const [previewDomainInput, setPreviewDomainInput] = useState(config.previewDomain);
|
||||
@@ -55,6 +56,36 @@ export function SystemSettings() {
|
||||
)}
|
||||
|
||||
<div className="space-y-3 max-w-xl">
|
||||
{/* Project Template Configuration */}
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="project-template" className="border rounded-lg">
|
||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||
<h4 className="text-sm font-medium">{t('projectTemplate')}</h4>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="py-1 space-y-2">
|
||||
<Input
|
||||
id="project-template"
|
||||
type="url"
|
||||
placeholder="https://gitlab.com/soapbox-pub/mkstack.git"
|
||||
value={projectTemplateInput}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
setProjectTemplateInput(value);
|
||||
updateConfig((current) => ({
|
||||
...current,
|
||||
projectTemplate: value,
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('projectTemplateDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
||||
{/* CORS Proxy Configuration */}
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="cors-proxy" className="border rounded-lg">
|
||||
|
||||
@@ -30,6 +30,7 @@ export function TestApp({ children }: TestAppProps) {
|
||||
const defaultConfig: AppConfig = {
|
||||
theme: 'light',
|
||||
relayUrl: 'wss://relay.nostr.band',
|
||||
projectTemplate: 'https://gitlab.com/soapbox-pub/mkstack.git',
|
||||
deployServer: 'shakespeare.wtf',
|
||||
esmUrl: 'https://esm.shakespeare.diy',
|
||||
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
|
||||
|
||||
Reference in new issue
Block a user