feat: Kaydet artık siteyi otomatik yayınlıyor (kuyruklu re-publish ile)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
bd75fdf4aa
commit
368864d368
@@ -43,7 +43,7 @@
|
||||
"description": "Kişi başı ücretlendirilir. (Sahanda Yumurta, Pişi, Köy peyniri, Ezine peyniri, Çökelek, Edremit yeşil zeytin, Siyah sele zeytin, Kırma zeytin, Acı sos, Çam balı, Köy tereyağı, Ev yapımı reçel, Reçelli lor, Kaymak, Çerez tabağı, Domates, Salatalık, Haşlanmış patates, Mevsim yeşillikleri, Termos Çay)"
|
||||
}
|
||||
],
|
||||
"title": "Serpme Kahvaltılar",
|
||||
"title": "Serpme Kahvaltılarm",
|
||||
"parent": {
|
||||
"id": 1,
|
||||
"image": {
|
||||
|
||||
@@ -311,6 +311,8 @@ const showPublishLog = computed(
|
||||
() => publishing.value || publishState.value?.ok === false,
|
||||
);
|
||||
let publishTimer: ReturnType<typeof setInterval> | null = null;
|
||||
// Yayın sürerken kaydedilen içerik için: mevcut yayın bitince bir tur daha
|
||||
let pendingRepublish = false;
|
||||
|
||||
const grouped = computed(() => {
|
||||
const g: Record<string, Dataset[]> = {};
|
||||
@@ -446,8 +448,9 @@ async function save() {
|
||||
savedText.value = JSON.stringify(content);
|
||||
editorText.value = JSON.stringify(content, null, 2);
|
||||
selectedUpdatedAt.value = row.updated_at;
|
||||
flash("Kaydedildi ✓ (Siteye yansıtmak için 'DB → JSON Dosyalarına Aktar')");
|
||||
flash("Kaydedildi ✓ — site yayınlanıyor...");
|
||||
await loadDatasets();
|
||||
await startPublishFlow();
|
||||
} catch (e: any) {
|
||||
flash(e.message);
|
||||
} finally {
|
||||
@@ -476,21 +479,36 @@ async function refreshPublishState() {
|
||||
if (!publishState.value?.running && publishTimer) {
|
||||
clearInterval(publishTimer);
|
||||
publishTimer = null;
|
||||
if (pendingRepublish) {
|
||||
pendingRepublish = false;
|
||||
startPublishFlow();
|
||||
return;
|
||||
}
|
||||
if (publishState.value?.ok) flash("Site yayınlandı ✓");
|
||||
}
|
||||
}
|
||||
|
||||
// Yayını başlat (onay sormadan); zaten sürüyorsa bitince tekrarlanmak üzere işaretle
|
||||
async function startPublishFlow() {
|
||||
try {
|
||||
await api("/publish", { method: "POST" });
|
||||
} catch (e: any) {
|
||||
if (/running/i.test(e.message)) {
|
||||
pendingRepublish = true;
|
||||
} else {
|
||||
flash(e.message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await refreshPublishState();
|
||||
publishTimer ??= setInterval(refreshPublishState, 3000);
|
||||
}
|
||||
|
||||
async function publish() {
|
||||
if (publishing.value) return;
|
||||
if (!confirm("Site DB'deki içerikle yeniden build edilip yayınlanacak. Devam?"))
|
||||
return;
|
||||
try {
|
||||
await api("/publish", { method: "POST" });
|
||||
await refreshPublishState();
|
||||
publishTimer ??= setInterval(refreshPublishState, 3000);
|
||||
} catch (e: any) {
|
||||
flash(e.message);
|
||||
}
|
||||
await startPublishFlow();
|
||||
}
|
||||
|
||||
async function importFiles() {
|
||||
|
||||
Reference in New Issue
Block a user