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.10 (desktop menuler, macOS kisayollari, YakNet SSO)
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
Desktop Release / Build macos desktop (push) Canceled after 0s
CI / Typecheck and unit tests (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
Desktop Release / Build macos desktop (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
This commit is contained in:
@@ -1,7 +1,81 @@
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
contextBridge.exposeInMainWorld("sketchforgeDesktop", {
|
||||
function toUint8Array(data) {
|
||||
if (data instanceof Uint8Array) return data;
|
||||
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
||||
if (ArrayBuffer.isView(data)) {
|
||||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
||||
}
|
||||
return new Uint8Array(0);
|
||||
}
|
||||
|
||||
function subscribeChannel(channel, transform) {
|
||||
return (listener) => {
|
||||
if (typeof listener !== "function") return () => {};
|
||||
const wrapped = (_event, payload) => {
|
||||
listener(transform ? transform(payload) : payload);
|
||||
};
|
||||
ipcRenderer.on(channel, wrapped);
|
||||
return () => {
|
||||
ipcRenderer.removeListener(channel, wrapped);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeOpenedFile(payload) {
|
||||
if (!payload || typeof payload.filePath !== "string" || typeof payload.fileName !== "string") {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
filePath: payload.filePath,
|
||||
fileName: payload.fileName,
|
||||
bytes: toUint8Array(payload.bytes),
|
||||
};
|
||||
}
|
||||
|
||||
const desktopBridge = Object.freeze({
|
||||
isDesktop: true,
|
||||
platform: process.platform,
|
||||
getVersion: () => ipcRenderer.invoke("sketchforge:get-version"),
|
||||
checkForUpdates: () => ipcRenderer.invoke("sketchforge:check-for-updates"),
|
||||
installUpdate: () => ipcRenderer.invoke("sketchforge:install-update"),
|
||||
getUpdateState: () => ipcRenderer.invoke("snapcad:get-update-state"),
|
||||
onUpdateState: subscribeChannel("snapcad:update-state"),
|
||||
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"),
|
||||
startYakNetLogin: () => ipcRenderer.invoke("snapcad:yaknet-login"),
|
||||
logoutYakNet: () => ipcRenderer.invoke("snapcad:yaknet-logout"),
|
||||
cloudRequest: (options) =>
|
||||
ipcRenderer.invoke("snapcad:cloud-request", options && typeof options === "object" ? options : {}),
|
||||
onAuthUpdated: subscribeChannel("snapcad:auth-updated"),
|
||||
openSkfDialog: async () => normalizeOpenedFile(await ipcRenderer.invoke("snapcad:open-skf-dialog")),
|
||||
saveSkfDialog: (options) =>
|
||||
ipcRenderer.invoke("snapcad:save-skf-dialog", {
|
||||
defaultFileName: options?.defaultFileName,
|
||||
targetPath: options?.targetPath ?? null,
|
||||
forceDialog: Boolean(options?.forceDialog),
|
||||
bytes: toUint8Array(options?.bytes),
|
||||
}),
|
||||
saveExportFileDialog: (options) =>
|
||||
ipcRenderer.invoke("snapcad:save-export-dialog", {
|
||||
defaultFileName: options?.defaultFileName,
|
||||
filters: Array.isArray(options?.filters) ? options.filters : undefined,
|
||||
bytes: toUint8Array(options?.bytes),
|
||||
}),
|
||||
consumePendingOpenFile: async () =>
|
||||
normalizeOpenedFile(await ipcRenderer.invoke("snapcad:consume-pending-open-file")),
|
||||
onOpenFile: subscribeChannel("snapcad:open-file", normalizeOpenedFile),
|
||||
onMenuCommand: subscribeChannel("snapcad:menu-command"),
|
||||
setMenuState: (state) =>
|
||||
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 ?? "")),
|
||||
confirmCloseAfterSave: () => ipcRenderer.invoke("snapcad:confirm-close-after-save"),
|
||||
openExternal: (url) => ipcRenderer.invoke("snapcad:open-external", String(url ?? "")),
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld("snapcadDesktop", desktopBridge);
|
||||
contextBridge.exposeInMainWorld("sketchforgeDesktop", desktopBridge);
|
||||
Reference in New Issue
Block a user