Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
release: SnapCAD Studio 1.0.11 (Mimari BIM & Metraj Studyosu, IFC4 ihraci, canli guncelleme ilerlemesi, YakNet SSO iyilestirmesi)
Build and Push Docker Images / build (push) Canceled after 0s
Desktop Release / Build linux desktop (push) Canceled after 0s
Desktop Release / Build windows desktop (push) Canceled after 0s
Desktop Release / Attach packages to release (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
Desktop Release / Build macos desktop (push) Canceled after 0s
Build and Push Docker Images / build (push) Canceled after 0s
Desktop Release / Build linux desktop (push) Canceled after 0s
Desktop Release / Build windows desktop (push) Canceled after 0s
Desktop Release / Attach packages to release (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
Desktop Release / Build macos desktop (push) Canceled after 0s
This commit is contained in:
+291
-18
@@ -48,6 +48,8 @@ let updateCheckInFlight = false;
|
||||
let manualUpdateCheck = false;
|
||||
let downloadedUpdateReady = false;
|
||||
let updateInstallRequested = false;
|
||||
let updatePrepareInFlight = null;
|
||||
let pendingUpdateInstallAfterSave = false;
|
||||
let lastUpdateCheckResult = null;
|
||||
let lastUpdateCheckError = "";
|
||||
let pendingOpenFilePath = null;
|
||||
@@ -58,6 +60,24 @@ const desktopCloudCookies = new Map();
|
||||
let pendingOAuthServer = null;
|
||||
let pendingOAuthTimeout = null;
|
||||
let desktopMenuBuilt = false;
|
||||
const VALID_ACTIVE_WORK_KINDS = new Set([
|
||||
"none",
|
||||
"3d-project",
|
||||
"drawing-studio",
|
||||
"circuits-studio",
|
||||
"codeblocks-studio",
|
||||
]);
|
||||
let activeWorkState = {
|
||||
hasOpenWork: false,
|
||||
workKind: "none",
|
||||
projectName: null,
|
||||
shapeCount: 0,
|
||||
hasDiskFile: false,
|
||||
diskFileName: null,
|
||||
hasUnsavedDiskChanges: false,
|
||||
pendingLocalSaveCount: 0,
|
||||
};
|
||||
const pendingUpdatePrepareResolvers = new Map();
|
||||
const VALID_VISUAL_STYLES = new Set([
|
||||
"shaded",
|
||||
"wireframe",
|
||||
@@ -644,6 +664,14 @@ function setUpdateState(patch = {}) {
|
||||
};
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.webContents.send("snapcad:update-state", { ...updateState });
|
||||
if (updateState.status === "downloading") {
|
||||
const pct = Math.max(0, Math.min(100, Number(updateState.progressPercent || 0)));
|
||||
mainWindow.setProgressBar(pct / 100);
|
||||
} else if (updateState.status === "checking" && updateInstallRequested) {
|
||||
mainWindow.setProgressBar(2);
|
||||
} else {
|
||||
mainWindow.setProgressBar(-1);
|
||||
}
|
||||
}
|
||||
return { ...updateState };
|
||||
}
|
||||
@@ -666,10 +694,101 @@ function desktopUpdatePayload(result = lastUpdateCheckResult, errorMessage = las
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizeActiveWorkState(raw) {
|
||||
const input = raw && typeof raw === "object" ? raw : {};
|
||||
const workKind =
|
||||
typeof input.workKind === "string" && VALID_ACTIVE_WORK_KINDS.has(input.workKind)
|
||||
? input.workKind
|
||||
: "none";
|
||||
const projectName =
|
||||
typeof input.projectName === "string" && input.projectName.trim()
|
||||
? input.projectName.replace(/[\r\n\t\u0000-\u001f\u007f]+/g, " ").trim().slice(0, 140)
|
||||
: null;
|
||||
const diskFileName =
|
||||
typeof input.diskFileName === "string" && input.diskFileName.trim()
|
||||
? input.diskFileName.replace(/[\r\n\t\u0000-\u001f\u007f]+/g, " ").trim().slice(0, 140)
|
||||
: null;
|
||||
const shapeCount = Number.isFinite(Number(input.shapeCount)) ? Math.max(0, Math.round(Number(input.shapeCount))) : 0;
|
||||
const pendingLocalSaveCount = Number.isFinite(Number(input.pendingLocalSaveCount))
|
||||
? Math.max(0, Math.round(Number(input.pendingLocalSaveCount)))
|
||||
: 0;
|
||||
return {
|
||||
hasOpenWork: Boolean(input.hasOpenWork) && workKind !== "none",
|
||||
workKind,
|
||||
projectName,
|
||||
shapeCount,
|
||||
hasDiskFile: Boolean(input.hasDiskFile),
|
||||
diskFileName,
|
||||
hasUnsavedDiskChanges: Boolean(input.hasUnsavedDiskChanges),
|
||||
pendingLocalSaveCount,
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizePrepareBeforeUpdateResult(raw) {
|
||||
const base = sanitizeActiveWorkState(raw);
|
||||
const input = raw && typeof raw === "object" ? raw : {};
|
||||
const cloudStatusText =
|
||||
typeof input.cloudStatusText === "string" && input.cloudStatusText.trim()
|
||||
? input.cloudStatusText.trim().slice(0, 220)
|
||||
: desktopAuthSession?.user
|
||||
? "YakNet Bulut senkronizasyonu tamamlanamadı."
|
||||
: "YakNet oturumu açık değil (yalnızca yerel depolamaya kaydedilir).";
|
||||
return {
|
||||
...base,
|
||||
localSaved: typeof input.localSaved === "boolean" ? input.localSaved : base.pendingLocalSaveCount === 0,
|
||||
cloudAttempted: Boolean(input.cloudAttempted),
|
||||
cloudSynced: Boolean(input.cloudSynced),
|
||||
cloudStatusText,
|
||||
};
|
||||
}
|
||||
|
||||
async function requestRendererPrepareBeforeUpdate(timeoutMs = 8500) {
|
||||
const fallback = sanitizePrepareBeforeUpdateResult({
|
||||
...activeWorkState,
|
||||
localSaved: !isDocumentDirty && activeWorkState.pendingLocalSaveCount === 0,
|
||||
cloudAttempted: false,
|
||||
cloudSynced: false,
|
||||
cloudStatusText: desktopAuthSession?.user
|
||||
? "Yerel değişiklikler kuyruklandı; YakNet Bulut durumu doğrulanamadı."
|
||||
: "YakNet oturumu açık değil (yalnızca yerel depolamaya kaydedilir).",
|
||||
});
|
||||
|
||||
if (!mainWindow || mainWindow.isDestroyed() || mainWindow.webContents.isLoadingMainFrame()) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
const requestId = crypto.randomBytes(12).toString("hex");
|
||||
return new Promise((resolve) => {
|
||||
const timer = setTimeout(() => {
|
||||
pendingUpdatePrepareResolvers.delete(requestId);
|
||||
resolve(fallback);
|
||||
}, timeoutMs);
|
||||
timer.unref?.();
|
||||
|
||||
pendingUpdatePrepareResolvers.set(requestId, (result) => {
|
||||
clearTimeout(timer);
|
||||
pendingUpdatePrepareResolvers.delete(requestId);
|
||||
resolve(result);
|
||||
});
|
||||
|
||||
try {
|
||||
mainWindow.webContents.send("snapcad:prepare-before-update", requestId);
|
||||
} catch {
|
||||
clearTimeout(timer);
|
||||
pendingUpdatePrepareResolvers.delete(requestId);
|
||||
resolve(fallback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function installDownloadedUpdate() {
|
||||
if (!downloadedUpdateReady) return;
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
explicitQuit = true;
|
||||
isQuitting = true;
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.setProgressBar(-1);
|
||||
}
|
||||
stopPackagedWebServer();
|
||||
if (tray) {
|
||||
try {
|
||||
@@ -682,6 +801,98 @@ function installDownloadedUpdate() {
|
||||
setImmediate(() => autoUpdater.quitAndInstall(false, true));
|
||||
}
|
||||
|
||||
async function prepareAndInstallDownloadedUpdate() {
|
||||
if (!downloadedUpdateReady) return { started: false };
|
||||
if (updatePrepareInFlight) return updatePrepareInFlight;
|
||||
|
||||
updatePrepareInFlight = (async () => {
|
||||
const prep = await requestRendererPrepareBeforeUpdate();
|
||||
const has3dProject = prep.workKind === "3d-project";
|
||||
const isSecondaryStudio =
|
||||
prep.workKind === "drawing-studio" ||
|
||||
prep.workKind === "circuits-studio" ||
|
||||
prep.workKind === "codeblocks-studio";
|
||||
|
||||
if (!has3dProject && !isSecondaryStudio && !isDocumentDirty) {
|
||||
installDownloadedUpdate();
|
||||
return { started: true };
|
||||
}
|
||||
|
||||
showMainWindow();
|
||||
|
||||
if (isSecondaryStudio) {
|
||||
const studioLabel =
|
||||
prep.workKind === "drawing-studio"
|
||||
? "Teknik Çizim Stüdyosu"
|
||||
: prep.workKind === "circuits-studio"
|
||||
? "Elektronik Devreler Stüdyosu"
|
||||
: "Kod Blokları Stüdyosu";
|
||||
const { response } = await dialog.showMessageBox(visibleDialogParent(), {
|
||||
type: "warning",
|
||||
buttons: ["İptal (Önce Çalışmamı Dışa Aktarayım)", "Yine de Güncelle ve Yeniden Başlat"],
|
||||
defaultId: 0,
|
||||
cancelId: 0,
|
||||
noLink: true,
|
||||
title: `Açık Çalışma Uyarısı — ${APP_DISPLAY_NAME}`,
|
||||
message: `${studioLabel} içinde açık bir çalışma var.`,
|
||||
detail: [
|
||||
"Teknik Çizim, Devreler ve Kod Blokları çalışma alanları buluta otomatik olarak anlık yedeklenmez.",
|
||||
"Güncelleme için uygulama yeniden başlatılmadan önce çalışmanızı dışa aktarmanız önerilir.",
|
||||
].join("\n"),
|
||||
});
|
||||
if (response === 1) {
|
||||
isDocumentDirty = false;
|
||||
installDownloadedUpdate();
|
||||
return { started: true };
|
||||
}
|
||||
updateInstallRequested = false;
|
||||
return { started: false, canceled: true };
|
||||
}
|
||||
|
||||
const label = prep.projectName || "Açık 3B Proje";
|
||||
const detailLines = [
|
||||
`• Yerel uygulama depolaması (IndexedDB): ${prep.localSaved ? "Son değişiklikler kaydedildi." : "Bekleyen yerel yazma tamamlanamadı."}`,
|
||||
`• YakNet Bulut: ${prep.cloudStatusText}`,
|
||||
prep.hasDiskFile && prep.hasUnsavedDiskChanges
|
||||
? `• "${prep.diskFileName || label}" dosyasında henüz diske yazılmamış değişiklikler var.`
|
||||
: "• İsterseniz yeni sürüm kurulmadan önce çalışmanızı .skf proje dosyası olarak da kaydedebilirsiniz.",
|
||||
"",
|
||||
"Güncelleme kurulmadan önce projenizi .skf dosyasına kaydetmek ister misiniz?",
|
||||
];
|
||||
|
||||
const { response } = await dialog.showMessageBox(visibleDialogParent(), {
|
||||
type: "question",
|
||||
buttons: ["Kaydet (.skf) ve Güncelle", "Kaydetmeden Güncelle ve Yeniden Başlat", "İptal (Daha Sonra Kur)"],
|
||||
defaultId: 0,
|
||||
cancelId: 2,
|
||||
noLink: true,
|
||||
title: `Güncellemeden Önce Kaydet — ${APP_DISPLAY_NAME}`,
|
||||
message: `"${label}" çalışması şu anda açık.`,
|
||||
detail: detailLines.join("\n"),
|
||||
});
|
||||
|
||||
if (response === 0) {
|
||||
pendingUpdateInstallAfterSave = true;
|
||||
sendMenuCommand("file:save-and-update");
|
||||
return { started: true, awaitingSave: true };
|
||||
}
|
||||
if (response === 1) {
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
isDocumentDirty = false;
|
||||
installDownloadedUpdate();
|
||||
return { started: true };
|
||||
}
|
||||
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
updateInstallRequested = false;
|
||||
return { started: false, canceled: true };
|
||||
})().finally(() => {
|
||||
updatePrepareInFlight = null;
|
||||
});
|
||||
|
||||
return updatePrepareInFlight;
|
||||
}
|
||||
|
||||
async function downloadAndInstallDesktopUpdate() {
|
||||
if (!app.isPackaged) {
|
||||
return desktopUpdatePayload(
|
||||
@@ -692,7 +903,7 @@ async function downloadAndInstallDesktopUpdate() {
|
||||
}
|
||||
|
||||
if (downloadedUpdateReady) {
|
||||
installDownloadedUpdate();
|
||||
void prepareAndInstallDownloadedUpdate();
|
||||
return desktopUpdatePayload(lastUpdateCheckResult, "", { status: "downloaded", progressPercent: 100 });
|
||||
}
|
||||
|
||||
@@ -700,11 +911,13 @@ async function downloadAndInstallDesktopUpdate() {
|
||||
try {
|
||||
let result = lastUpdateCheckResult;
|
||||
if (!result?.isUpdateAvailable) {
|
||||
updateInstallRequested = true;
|
||||
setUpdateState({ status: "checking", checkedAt: new Date().toISOString(), error: undefined });
|
||||
result = await autoUpdater.checkForUpdates();
|
||||
lastUpdateCheckResult = result;
|
||||
}
|
||||
if (!result?.isUpdateAvailable) {
|
||||
updateInstallRequested = false;
|
||||
setUpdateState({
|
||||
status: "not-available",
|
||||
latestVersion: result?.updateInfo?.version || null,
|
||||
@@ -717,11 +930,15 @@ async function downloadAndInstallDesktopUpdate() {
|
||||
}
|
||||
|
||||
updateInstallRequested = true;
|
||||
const expectedTotal = Number(result?.updateInfo?.files?.[0]?.size || 0);
|
||||
setUpdateState({
|
||||
status: "downloading",
|
||||
latestVersion: result?.updateInfo?.version || null,
|
||||
updateAvailable: true,
|
||||
progressPercent: 0,
|
||||
transferred: 0,
|
||||
total: Number.isFinite(expectedTotal) && expectedTotal > 0 ? expectedTotal : 0,
|
||||
bytesPerSecond: 0,
|
||||
error: undefined,
|
||||
});
|
||||
await autoUpdater.downloadUpdate();
|
||||
@@ -764,19 +981,7 @@ async function checkForDesktopUpdates(manual = false) {
|
||||
}
|
||||
if (downloadedUpdateReady) {
|
||||
if (manual) {
|
||||
const choice = await dialog.showMessageBox(visibleDialogParent(), {
|
||||
type: "info",
|
||||
title: `${APP_DISPLAY_NAME} Güncellemesi Hazır`,
|
||||
buttons: ["Şimdi Yeniden Başlat ve Kur", "Daha Sonra"],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
noLink: true,
|
||||
message: `${APP_DISPLAY_NAME} ${updateState.latestVersion || ""} kurulumu tamamlanmaya hazır.`,
|
||||
detail: "Uygulama kapatılıp yeni sürüm kurulacak ve ardından yeniden başlatılacaktır.",
|
||||
});
|
||||
if (choice.response === 0) {
|
||||
installDownloadedUpdate();
|
||||
}
|
||||
void prepareAndInstallDownloadedUpdate();
|
||||
}
|
||||
return desktopUpdatePayload();
|
||||
}
|
||||
@@ -1358,6 +1563,7 @@ function buildNativeApplicationMenu() {
|
||||
{ label: "STL 3B Yazıcı Modeli (.stl)…", click: () => sendMenuCommand("file:export-stl") },
|
||||
{ label: "3MF Baskı Paketi (.3mf)…", click: () => sendMenuCommand("file:export-3mf") },
|
||||
{ label: "STEP B-Rep Katı Model (.step)…", click: () => sendMenuCommand("file:export-step") },
|
||||
{ label: "IFC4 Mimari BIM Modeli (.ifc)…", click: () => sendMenuCommand("file:export-ifc") },
|
||||
{ label: "Wavefront 3B Mesh (.obj)…", click: () => sendMenuCommand("file:export-obj") },
|
||||
{ label: "Binary glTF 3B Model (.glb)…", click: () => sendMenuCommand("file:export-glb") },
|
||||
{ label: "AutoCAD 2B/3B DXF (.dxf)…", click: () => sendMenuCommand("file:export-dxf") },
|
||||
@@ -1642,6 +1848,10 @@ function buildNativeApplicationMenu() {
|
||||
{ type: "separator" },
|
||||
{ label: "Duvar Kapı / Pencere Boşluğu Aç…", click: () => sendMenuCommand("tool:wall-opening") },
|
||||
{ label: "Arazi & Yükselti Üreticisi…", click: () => sendMenuCommand("tool:terrain") },
|
||||
{ label: "Mimari BIM, Kat & Metraj Stüdyosu…", accelerator: "Alt+M", registerAccelerator: false, click: () => sendMenuCommand("tool:bim-studio") },
|
||||
{ label: "Çok Katlı Bina & Kot Yöneticisi…", click: () => sendMenuCommand("tool:bim-storeys") },
|
||||
{ label: "Otomatik Metraj, Mahal Alanı & Keşif (BOQ)…", click: () => sendMenuCommand("tool:bim-boq") },
|
||||
{ label: "İmar Yönetmeliği & TS 9111 Denetçisi…", click: () => sendMenuCommand("tool:bim-code-audit") },
|
||||
{ label: "Statik & Deprem Dayanım Testi…", click: () => sendMenuCommand("tool:structural-test") },
|
||||
{ label: "Masamda Gör (AR Ön İzleme)…", click: () => sendMenuCommand("tool:ar-preview") },
|
||||
{ type: "separator" },
|
||||
@@ -1784,6 +1994,18 @@ function setupDesktopIpc() {
|
||||
return true;
|
||||
});
|
||||
|
||||
ipcMain.on("snapcad:get-auth-state-sync", (event) => {
|
||||
event.returnValue = {
|
||||
authenticated: Boolean(desktopAuthSession?.user),
|
||||
user: desktopAuthSession?.user ? { ...desktopAuthSession.user } : null,
|
||||
};
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:get-auth-state", () => ({
|
||||
authenticated: Boolean(desktopAuthSession?.user),
|
||||
user: desktopAuthSession?.user ? { ...desktopAuthSession.user } : null,
|
||||
}));
|
||||
|
||||
ipcMain.handle("snapcad:yaknet-login", () => startYakNetDesktopLogin());
|
||||
ipcMain.handle("snapcad:yaknet-logout", () => logoutYakNetDesktop());
|
||||
ipcMain.handle("snapcad:cloud-request", (_event, options) => proxyDesktopCloudRequest(options));
|
||||
@@ -1889,6 +2111,18 @@ function setupDesktopIpc() {
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:set-active-work-state", (_event, rawState) => {
|
||||
activeWorkState = sanitizeActiveWorkState(rawState);
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:prepare-before-update-result", (_event, payload) => {
|
||||
const requestId = typeof payload?.requestId === "string" ? payload.requestId : "";
|
||||
const resolver = pendingUpdatePrepareResolvers.get(requestId);
|
||||
if (resolver) {
|
||||
resolver(sanitizePrepareBeforeUpdateResult(payload?.result));
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:confirm-close-after-save", () => {
|
||||
isDocumentDirty = false;
|
||||
explicitQuit = true;
|
||||
@@ -1900,6 +2134,19 @@ function setupDesktopIpc() {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:confirm-update-after-save", () => {
|
||||
if (!pendingUpdateInstallAfterSave) return false;
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
isDocumentDirty = false;
|
||||
installDownloadedUpdate();
|
||||
return true;
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:cancel-pending-update-install", () => {
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
updateInstallRequested = false;
|
||||
});
|
||||
|
||||
ipcMain.handle("snapcad:open-external", (_event, rawUrl) => {
|
||||
if (!isAllowedExternalUrl(rawUrl)) return false;
|
||||
void shell.openExternal(String(rawUrl));
|
||||
@@ -1960,6 +2207,21 @@ function setupDesktopUpdater() {
|
||||
.then(({ response }) => {
|
||||
if (response === 0) {
|
||||
showMainWindow();
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
const expectedTotal = Number(info?.files?.[0]?.size || 0);
|
||||
mainWindow.webContents.send(
|
||||
"snapcad:open-update-progress",
|
||||
desktopUpdatePayload(null, "", {
|
||||
status: "downloading",
|
||||
latestVersion: info?.version || updateState.latestVersion || null,
|
||||
updateAvailable: true,
|
||||
progressPercent: 0,
|
||||
transferred: 0,
|
||||
total: Number.isFinite(expectedTotal) && expectedTotal > 0 ? expectedTotal : 0,
|
||||
bytesPerSecond: 0,
|
||||
}),
|
||||
);
|
||||
}
|
||||
void downloadAndInstallDesktopUpdate();
|
||||
} else if (response === 1) {
|
||||
sendMenuCommand("window:settings");
|
||||
@@ -2011,7 +2273,8 @@ function setupDesktopUpdater() {
|
||||
error: undefined,
|
||||
});
|
||||
if (updateInstallRequested) {
|
||||
installDownloadedUpdate();
|
||||
updateInstallRequested = false;
|
||||
void prepareAndInstallDownloadedUpdate();
|
||||
return;
|
||||
}
|
||||
void dialog
|
||||
@@ -2027,12 +2290,14 @@ function setupDesktopUpdater() {
|
||||
})
|
||||
.then(({ response }) => {
|
||||
if (response === 0) {
|
||||
installDownloadedUpdate();
|
||||
void prepareAndInstallDownloadedUpdate();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
autoUpdater.on("error", (error) => {
|
||||
updateInstallRequested = false;
|
||||
pendingUpdateInstallAfterSave = false;
|
||||
const friendly = formatFriendlyUpdateError(error);
|
||||
lastUpdateCheckError = friendly;
|
||||
if (tray) tray.setToolTip(APP_DISPLAY_NAME);
|
||||
@@ -2077,7 +2342,7 @@ function updateTrayMenu() {
|
||||
downloadedUpdateReady
|
||||
? {
|
||||
label: "Güncellemeyi Kur ve Yeniden Başlat",
|
||||
click: installDownloadedUpdate,
|
||||
click: () => void prepareAndInstallDownloadedUpdate(),
|
||||
}
|
||||
: {
|
||||
label: "Güncellemeleri Denetle…",
|
||||
@@ -2088,7 +2353,7 @@ function updateTrayMenu() {
|
||||
label: "Tamamen Çıkış Yap",
|
||||
click: () => {
|
||||
if (downloadedUpdateReady) {
|
||||
installDownloadedUpdate();
|
||||
void prepareAndInstallDownloadedUpdate();
|
||||
return;
|
||||
}
|
||||
requestForceQuit();
|
||||
@@ -2314,6 +2579,14 @@ function createMainWindow(url) {
|
||||
});
|
||||
|
||||
mainWindow.on("closed", () => {
|
||||
for (const resolvePending of pendingUpdatePrepareResolvers.values()) {
|
||||
try {
|
||||
resolvePending(sanitizePrepareBeforeUpdateResult({ ...activeWorkState, localSaved: false }));
|
||||
} catch {
|
||||
// Ignore resolver cleanup failures.
|
||||
}
|
||||
}
|
||||
pendingUpdatePrepareResolvers.clear();
|
||||
mainWindow = null;
|
||||
updateTrayMenu();
|
||||
});
|
||||
|
||||
@@ -41,11 +41,27 @@ const desktopBridge = Object.freeze({
|
||||
installUpdate: () => ipcRenderer.invoke("sketchforge:install-update"),
|
||||
getUpdateState: () => ipcRenderer.invoke("snapcad:get-update-state"),
|
||||
onUpdateState: subscribeChannel("snapcad:update-state"),
|
||||
onOpenUpdateProgress: subscribeChannel("snapcad:open-update-progress"),
|
||||
getDesktopPrefs: () => ipcRenderer.invoke("snapcad:get-desktop-prefs"),
|
||||
setDesktopPrefs: (patch) =>
|
||||
ipcRenderer.invoke("snapcad:set-desktop-prefs", patch && typeof patch === "object" ? patch : {}),
|
||||
hideToTray: () => ipcRenderer.invoke("snapcad:hide-to-tray"),
|
||||
onDesktopPrefsChanged: subscribeChannel("snapcad:prefs-changed"),
|
||||
getAuthStateSync: () => {
|
||||
try {
|
||||
const result = ipcRenderer.sendSync("snapcad:get-auth-state-sync");
|
||||
if (result && typeof result === "object") {
|
||||
return {
|
||||
authenticated: Boolean(result.authenticated && result.user),
|
||||
user: result.user || null,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// Fallback cleanly when synchronous auth read fails.
|
||||
}
|
||||
return { authenticated: false, user: null };
|
||||
},
|
||||
getAuthState: () => ipcRenderer.invoke("snapcad:get-auth-state"),
|
||||
startYakNetLogin: () => ipcRenderer.invoke("snapcad:yaknet-login"),
|
||||
logoutYakNet: () => ipcRenderer.invoke("snapcad:yaknet-logout"),
|
||||
cloudRequest: (options) =>
|
||||
@@ -73,7 +89,17 @@ const desktopBridge = Object.freeze({
|
||||
ipcRenderer.invoke("snapcad:set-menu-state", state && typeof state === "object" ? state : {}),
|
||||
setDirty: (dirty) => ipcRenderer.invoke("snapcad:set-dirty", Boolean(dirty)),
|
||||
setWindowTitle: (title) => ipcRenderer.invoke("snapcad:set-window-title", String(title ?? "")),
|
||||
setActiveWorkState: (state) =>
|
||||
ipcRenderer.invoke("snapcad:set-active-work-state", state && typeof state === "object" ? state : {}),
|
||||
onPrepareBeforeUpdate: subscribeChannel("snapcad:prepare-before-update"),
|
||||
sendPrepareBeforeUpdateResult: (requestId, result) =>
|
||||
ipcRenderer.invoke("snapcad:prepare-before-update-result", {
|
||||
requestId: String(requestId ?? ""),
|
||||
result: result && typeof result === "object" ? result : {},
|
||||
}),
|
||||
confirmCloseAfterSave: () => ipcRenderer.invoke("snapcad:confirm-close-after-save"),
|
||||
confirmUpdateAfterSave: () => ipcRenderer.invoke("snapcad:confirm-update-after-save"),
|
||||
cancelPendingUpdateInstall: () => ipcRenderer.invoke("snapcad:cancel-pending-update-install"),
|
||||
openExternal: (url) => ipcRenderer.invoke("snapcad:open-external", String(url ?? "")),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user