Stelle Website-Projekte und Admin-Tabs nach Auto-Deploy-Reset wieder her.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Webklar Deploy
2026-05-25 06:41:35 +00:00
parent 8d62e353cb
commit fda673702e
10 changed files with 543 additions and 110 deletions

View File

@@ -11,41 +11,6 @@ export const projectId = (
/** Demo-Modus nur wenn wirklich keine Projekt-ID (sollte mit Defaults nie passieren) */
export const isDemoMode = !projectId
// #region agent log
if (typeof window !== 'undefined') {
const _dbg = {
sessionId: '252827',
runId: 'pre-fix',
hypothesisId: 'A',
location: 'appwrite.js:init',
message: 'Appwrite env at runtime',
data: {
mode: import.meta.env.MODE,
isDemoMode,
projectIdPrefix: projectId ? projectId.slice(0, 8) : '',
fromEnv: Boolean((import.meta.env.VITE_APPWRITE_PROJECT_ID || '').trim()),
endpointHost: (() => {
try {
return new URL(endpoint).host
} catch {
return 'invalid'
}
})(),
pageHost: window.location.host,
},
timestamp: Date.now(),
}
fetch('http://127.0.0.1:7284/ingest/0747da40-b90b-4354-9b84-c9b550a81ec9', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '252827' },
body: JSON.stringify(_dbg),
}).catch(() => {})
if (import.meta.env.DEV) {
console.info('[DEBUG 252827]', _dbg)
}
}
// #endregion
if (import.meta.env.DEV) {
console.log('🔧 Appwrite Konfiguration:')
console.log('Endpoint:', endpoint)
@@ -74,8 +39,12 @@ export const COLLECTIONS = {
WORKSHEETS: 'worksheets',
USERS: 'users',
ATTACHMENTS: 'attachments',
WEBSITE_PROJECTS: 'websiteProjects',
}
export const WEBPAGE_TICKET_TYPE = 'Webpage'
export const PREVIEW_TEMPLATE_NAME = 'webklar-preview-template'
export const BUCKET_ID = import.meta.env.VITE_APPWRITE_BUCKET_ID || 'woms-attachments'
/** Prüft ob vermutlich eine Session existiert (cookieFallback oder Same-Origin-Cookie). */

View File

@@ -0,0 +1,22 @@
import { account } from './appwrite'
const PROJECT_ADMIN_URL =
import.meta.env.VITE_PROJECT_ADMIN_URL || 'https://project.webklar.com'
export async function createProjectFromTemplate(payload) {
const jwt = await account.createJWT()
const response = await fetch(
`${PROJECT_ADMIN_URL}/api/admin/website-projects/create-from-template`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${jwt.jwt}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
}
)
const data = await response.json().catch(() => ({}))
if (!response.ok) throw new Error(data.error || `API-Fehler ${response.status}`)
return data
}