feat: Projekt-Typ Vorlage (template) - login-geschuetzt, isTemplate-Flag
- neuer Typ template: hasWebsite wie preview, isPublic=false, isTemplate=true - deriveProjectType erkennt isTemplate; Appwrite-Update schreibt isTemplate - .webklar-preview.json bekommt template-Flag Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -316,9 +316,11 @@ export async function createProjectFromTemplate({
|
||||
* kein expliziter Typ mitgegeben wurde.
|
||||
* preview -> Website mit Login-geschuetzter Preview (Standard)
|
||||
* website -> oeffentliche Website ohne Login
|
||||
* template -> Website-Vorlage (login-geschuetzt, nur Admin, in Vorlagen-Ansicht)
|
||||
* project -> internes Projekt ohne Hosting/Subdomain
|
||||
*/
|
||||
function deriveProjectType(doc) {
|
||||
if (doc?.isTemplate) return 'template'
|
||||
if (doc?.isPublic) return 'website'
|
||||
if (doc?.subdomain) return 'preview'
|
||||
return 'project'
|
||||
@@ -354,8 +356,11 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
||||
|
||||
const nextName = String(projectName ?? doc.projectName ?? '').trim() || doc.projectName || repoSlug || ''
|
||||
const nextType = projectType || deriveProjectType(doc)
|
||||
const hasWebsite = nextType === 'preview' || nextType === 'website'
|
||||
// template = login-geschuetzte Vorlage: braucht Preview (wie 'preview'), aber
|
||||
// nicht oeffentlich; wird als isTemplate markiert.
|
||||
const hasWebsite = nextType === 'preview' || nextType === 'website' || nextType === 'template'
|
||||
const isPublic = nextType === 'website'
|
||||
const isTemplate = nextType === 'template'
|
||||
|
||||
const oldSubdomain = doc.subdomain || ''
|
||||
let nextSubdomain = ''
|
||||
@@ -394,6 +399,7 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
||||
templateName: doc.templateName || config.gitea.templateRepo,
|
||||
projectType: nextType,
|
||||
public: isPublic,
|
||||
template: isTemplate,
|
||||
...(hasWebsite && nextSubdomain ? { subdomain: nextSubdomain } : {}),
|
||||
}
|
||||
|
||||
@@ -437,6 +443,7 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
||||
previewUrl,
|
||||
projectType: nextType,
|
||||
isPublic,
|
||||
isTemplate,
|
||||
status: hasWebsite ? (deployResult.deployed ? 'deployed' : 'pending') : 'created',
|
||||
provisioningStatus: hasWebsite
|
||||
? (deployResult.deployed ? 'ready' : (deployResult.error ? 'deploy_failed' : 'pending'))
|
||||
|
||||
Reference in New Issue
Block a user