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.
|
* kein expliziter Typ mitgegeben wurde.
|
||||||
* preview -> Website mit Login-geschuetzter Preview (Standard)
|
* preview -> Website mit Login-geschuetzter Preview (Standard)
|
||||||
* website -> oeffentliche Website ohne Login
|
* website -> oeffentliche Website ohne Login
|
||||||
|
* template -> Website-Vorlage (login-geschuetzt, nur Admin, in Vorlagen-Ansicht)
|
||||||
* project -> internes Projekt ohne Hosting/Subdomain
|
* project -> internes Projekt ohne Hosting/Subdomain
|
||||||
*/
|
*/
|
||||||
function deriveProjectType(doc) {
|
function deriveProjectType(doc) {
|
||||||
|
if (doc?.isTemplate) return 'template'
|
||||||
if (doc?.isPublic) return 'website'
|
if (doc?.isPublic) return 'website'
|
||||||
if (doc?.subdomain) return 'preview'
|
if (doc?.subdomain) return 'preview'
|
||||||
return 'project'
|
return 'project'
|
||||||
@@ -354,8 +356,11 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
|||||||
|
|
||||||
const nextName = String(projectName ?? doc.projectName ?? '').trim() || doc.projectName || repoSlug || ''
|
const nextName = String(projectName ?? doc.projectName ?? '').trim() || doc.projectName || repoSlug || ''
|
||||||
const nextType = projectType || deriveProjectType(doc)
|
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 isPublic = nextType === 'website'
|
||||||
|
const isTemplate = nextType === 'template'
|
||||||
|
|
||||||
const oldSubdomain = doc.subdomain || ''
|
const oldSubdomain = doc.subdomain || ''
|
||||||
let nextSubdomain = ''
|
let nextSubdomain = ''
|
||||||
@@ -394,6 +399,7 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
|||||||
templateName: doc.templateName || config.gitea.templateRepo,
|
templateName: doc.templateName || config.gitea.templateRepo,
|
||||||
projectType: nextType,
|
projectType: nextType,
|
||||||
public: isPublic,
|
public: isPublic,
|
||||||
|
template: isTemplate,
|
||||||
...(hasWebsite && nextSubdomain ? { subdomain: nextSubdomain } : {}),
|
...(hasWebsite && nextSubdomain ? { subdomain: nextSubdomain } : {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,6 +443,7 @@ export async function updateWebsiteProject(projectId, { projectName, subdomain,
|
|||||||
previewUrl,
|
previewUrl,
|
||||||
projectType: nextType,
|
projectType: nextType,
|
||||||
isPublic,
|
isPublic,
|
||||||
|
isTemplate,
|
||||||
status: hasWebsite ? (deployResult.deployed ? 'deployed' : 'pending') : 'created',
|
status: hasWebsite ? (deployResult.deployed ? 'deployed' : 'pending') : 'created',
|
||||||
provisioningStatus: hasWebsite
|
provisioningStatus: hasWebsite
|
||||||
? (deployResult.deployed ? 'ready' : (deployResult.error ? 'deploy_failed' : 'pending'))
|
? (deployResult.deployed ? 'ready' : (deployResult.error ? 'deploy_failed' : 'pending'))
|
||||||
|
|||||||
Reference in New Issue
Block a user