From f58b8b2897c11dd40aff524c61ff127223547997 Mon Sep 17 00:00:00 2001 From: Nikhil Solanki Date: Thu, 25 Dec 2025 02:00:06 +0530 Subject: [PATCH] Mega gitignore --- .gitignore | 371 +++++++++++++++++++++++++++++++-- .kiro/settings/mcp.json | 13 -- .vscode/settings.json | 2 + dist-electron/main.js | 423 -------------------------------------- dist-electron/preload.mjs | 63 ------ 5 files changed, 358 insertions(+), 514 deletions(-) delete mode 100644 .kiro/settings/mcp.json create mode 100644 .vscode/settings.json delete mode 100644 dist-electron/main.js delete mode 100644 dist-electron/preload.mjs diff --git a/.gitignore b/.gitignore index ea2ff9e..7f1fdb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,368 @@ -# Logs -logs +# ============================================================================ +# OpenScreen - Comprehensive .gitignore +# Electron + Vite + React + TypeScript + Tailwind + Vitest +# ============================================================================ + +# ============================================================================ +# DEPENDENCIES +# ============================================================================ +node_modules/ +bower_components/ +jspm_packages/ + +# ============================================================================ +# LOGS +# ============================================================================ +logs/ *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* +debug.log +error.log +combined.log -node_modules -dist -dist-ssr +# ============================================================================ +# BUILD OUTPUTS +# ============================================================================ +# Vite build output +dist/ +dist-ssr/ + +# Electron compiled files +dist-electron/ + +# Generic build directories +build/ +out/ +.output/ + +# ============================================================================ +# ELECTRON BUILDER +# ============================================================================ +# Release/installer output +release/ + +# Platform-specific installers +*.exe +*.msi +*.dmg +*.pkg +*.AppImage +*.deb +*.rpm +*.snap +*.flatpak + +# Electron builder metadata +*.blockmap +builder-effective-config.yaml +builder-debug.yml + +# Auto-update manifests +latest.yml +latest-mac.yml +latest-linux.yml + +# ============================================================================ +# CACHE DIRECTORIES +# ============================================================================ +# Vite cache +.vite/ +node_modules/.vite/ +vite.config.ts.timestamp-* +vite.config.*.timestamp-* + +# General cache +.cache/ +.parcel-cache/ +.turbo/ + +# Build tool caches +.webpack/ +.esbuild/ +.swc/ + +# Electron cache +.electron/ +.cache/electron/ +.cache/electron-builder/ + +# ============================================================================ +# TYPESCRIPT +# ============================================================================ +*.tsbuildinfo +tsconfig.tsbuildinfo + +# ============================================================================ +# TESTING (Vitest + Fast-Check) +# ============================================================================ +# Coverage reports +coverage/ +.coverage/ +.nyc_output/ +*.lcov + +# Vitest cache +.vitest/ +node_modules/.vitest/ + +# Test results +test-results/ +junit.xml +test-report.xml +*.junit.xml +vitest-results.json + +# Fast-check +.fast-check-* +fast-check-report.json + +# ============================================================================ +# LINTING +# ============================================================================ +.eslintcache +.stylelintcache + +# ============================================================================ +# SOURCE MAPS +# ============================================================================ +*.map +*.js.map +*.css.map + +# ============================================================================ +# ENVIRONMENT & SECRETS (CRITICAL!) +# ============================================================================ +# Environment files +.env +.env.local +.env.*.local +.env.development +.env.development.local +.env.test +.env.test.local +.env.production +.env.production.local +.env.staging + +# API Keys & Credentials +*.pem +*.key +*.p12 +*.pfx +*.crt +*.cer +*.der +credentials.json +secrets.json +*-credentials.json +*-secrets.json +service-account*.json +firebase-adminsdk*.json +google-credentials.json + +# SSL Certificates +certs/ +certificates/ +ssl/ + +# ============================================================================ +# LOCAL CONFIGURATION +# ============================================================================ *.local +*.local.json +*.local.yaml +*.local.yml +config.local.* +local.settings.json -# Editor directories and files +# ============================================================================ +# KIRO AI ASSISTANT +# ============================================================================ +# Settings contain personal API tokens - NEVER commit +.kiro + +# Keep specs, steering, and hooks (shared with team) +# .kiro/specs/ - COMMIT +# .kiro/steering/ - COMMIT +# .kiro/hooks/ - COMMIT + +# ============================================================================ +# TEMPORARY & BACKUP FILES +# ============================================================================ +*.tmp +*.temp +*.bak +*.backup +*.orig +*.old +*~ +.tmp/ +temp/ + +# ============================================================================ +# EDITOR & IDE +# ============================================================================ +# VS Code .vscode/* !.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? -release/** +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +.history/ +*.vsix -# npx electron-builder --mac --win \ No newline at end of file +# JetBrains IDEs (IntelliJ, WebStorm, etc.) +.idea/ +*.iml +*.iws +*.ipr +cmake-build-*/ + +# Vim/Neovim +*.swp +*.swo +*.swn +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +Session.vim +Sessionx.vim +.netrwhist +.nvimlog +tags +GTAGS +GRTAGS +GPATH + +# Sublime Text +*.sublime-project +*.sublime-workspace + +# Emacs +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# ============================================================================ +# OPERATING SYSTEM FILES +# ============================================================================ +# macOS +.DS_Store +.DS_Store? +.AppleDouble +.LSOverride +._* +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk +Icon? + +# Windows +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db +*.stackdump +[Dd]esktop.ini +$RECYCLE.BIN/ +*.cab +*.msix +*.msm +*.msp +*.lnk + +# Linux +.fuse_hidden* +.directory +.Trash-* +.nfs* + +# ============================================================================ +# NATIVE MODULES +# ============================================================================ +*.node +build/Release/ + +# ============================================================================ +# CRASH REPORTS +# ============================================================================ +*.dmp +crash-reports/ + +# ============================================================================ +# DATABASE FILES +# ============================================================================ +*.sqlite +*.sqlite3 +*.db +*.sql +dump.sql +*.dump + +# ============================================================================ +# PACKAGE MANAGER SPECIFIC +# ============================================================================ +# npm +.npm + +# Yarn v1 +.yarn-integrity + +# Yarn v2+ (Berry) +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions +.pnp +.pnp.js +.pnp.cjs +.pnp.loader.mjs + +# pnpm +.pnpm-store/ +.pnpm-debug.log + +# ============================================================================ +# MISCELLANEOUS +# ============================================================================ +# Node REPL history +.node_repl_history + +# Nx cache +.nx/cache + +# Storybook +storybook-static/ + +# Serverless +.serverless/ + +# FuseBox +.fusebox/ + +# DynamoDB Local +.dynamodb/ + +# TernJS +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test diff --git a/.kiro/settings/mcp.json b/.kiro/settings/mcp.json deleted file mode 100644 index 4d75655..0000000 --- a/.kiro/settings/mcp.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "mcpServers": { - "figma": { - "command": "npx", - "args": ["-y", "@anthropic-ai/figma-mcp@latest"], - "env": { - "FIGMA_ACCESS_TOKEN": "figd_1ru7zU6NCqkHoAeJlqV4CUX7diuVibxuNpAvBBjQ" - }, - "disabled": false, - "autoApprove": [] - } - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/dist-electron/main.js b/dist-electron/main.js deleted file mode 100644 index 515edf4..0000000 --- a/dist-electron/main.js +++ /dev/null @@ -1,423 +0,0 @@ -import { ipcMain, screen, BrowserWindow, desktopCapturer, shell, app, dialog, nativeImage, Tray, Menu } from "electron"; -import { fileURLToPath } from "node:url"; -import path from "node:path"; -import fs from "node:fs/promises"; -const __dirname$1 = path.dirname(fileURLToPath(import.meta.url)); -const APP_ROOT = path.join(__dirname$1, ".."); -const VITE_DEV_SERVER_URL$1 = process.env["VITE_DEV_SERVER_URL"]; -const RENDERER_DIST$1 = path.join(APP_ROOT, "dist"); -let hudOverlayWindow = null; -ipcMain.on("hud-overlay-hide", () => { - if (hudOverlayWindow && !hudOverlayWindow.isDestroyed()) { - hudOverlayWindow.minimize(); - } -}); -function createHudOverlayWindow() { - const primaryDisplay = screen.getPrimaryDisplay(); - const { workArea } = primaryDisplay; - const windowWidth = 500; - const windowHeight = 100; - const x = Math.floor(workArea.x + (workArea.width - windowWidth) / 2); - const y = Math.floor(workArea.y + workArea.height - windowHeight - 5); - const win = new BrowserWindow({ - width: windowWidth, - height: windowHeight, - minWidth: 500, - maxWidth: 500, - minHeight: 100, - maxHeight: 100, - x, - y, - frame: false, - transparent: true, - resizable: false, - alwaysOnTop: true, - skipTaskbar: true, - hasShadow: false, - webPreferences: { - preload: path.join(__dirname$1, "preload.mjs"), - nodeIntegration: false, - contextIsolation: true, - backgroundThrottling: false - } - }); - win.webContents.on("did-finish-load", () => { - win == null ? void 0 : win.webContents.send("main-process-message", (/* @__PURE__ */ new Date()).toLocaleString()); - }); - hudOverlayWindow = win; - win.on("closed", () => { - if (hudOverlayWindow === win) { - hudOverlayWindow = null; - } - }); - if (VITE_DEV_SERVER_URL$1) { - win.loadURL(VITE_DEV_SERVER_URL$1 + "?windowType=hud-overlay"); - } else { - win.loadFile(path.join(RENDERER_DIST$1, "index.html"), { - query: { windowType: "hud-overlay" } - }); - } - return win; -} -function createEditorWindow() { - const isMac = process.platform === "darwin"; - const win = new BrowserWindow({ - width: 1200, - height: 800, - minWidth: 800, - minHeight: 600, - ...isMac && { - titleBarStyle: "hiddenInset", - trafficLightPosition: { x: 12, y: 12 } - }, - transparent: false, - resizable: true, - alwaysOnTop: false, - skipTaskbar: false, - title: "OpenScreen", - backgroundColor: "#000000", - webPreferences: { - preload: path.join(__dirname$1, "preload.mjs"), - nodeIntegration: false, - contextIsolation: true, - webSecurity: false, - backgroundThrottling: false - } - }); - win.maximize(); - win.webContents.on("did-finish-load", () => { - win == null ? void 0 : win.webContents.send("main-process-message", (/* @__PURE__ */ new Date()).toLocaleString()); - }); - if (VITE_DEV_SERVER_URL$1) { - win.loadURL(VITE_DEV_SERVER_URL$1 + "?windowType=editor"); - } else { - win.loadFile(path.join(RENDERER_DIST$1, "index.html"), { - query: { windowType: "editor" } - }); - } - return win; -} -function createSourceSelectorWindow() { - const { width, height } = screen.getPrimaryDisplay().workAreaSize; - const win = new BrowserWindow({ - width: 620, - height: 420, - minHeight: 350, - maxHeight: 500, - x: Math.round((width - 620) / 2), - y: Math.round((height - 420) / 2), - frame: false, - resizable: false, - alwaysOnTop: true, - transparent: true, - backgroundColor: "#00000000", - webPreferences: { - preload: path.join(__dirname$1, "preload.mjs"), - nodeIntegration: false, - contextIsolation: true - } - }); - if (VITE_DEV_SERVER_URL$1) { - win.loadURL(VITE_DEV_SERVER_URL$1 + "?windowType=source-selector"); - } else { - win.loadFile(path.join(RENDERER_DIST$1, "index.html"), { - query: { windowType: "source-selector" } - }); - } - return win; -} -let selectedSource = null; -function registerIpcHandlers(createEditorWindow2, createSourceSelectorWindow2, getMainWindow, getSourceSelectorWindow, onRecordingStateChange) { - ipcMain.handle("get-sources", async (_, opts) => { - const sources = await desktopCapturer.getSources(opts); - return sources.map((source) => ({ - id: source.id, - name: source.name, - display_id: source.display_id, - thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null, - appIcon: source.appIcon ? source.appIcon.toDataURL() : null - })); - }); - ipcMain.handle("select-source", (_, source) => { - selectedSource = source; - const sourceSelectorWin = getSourceSelectorWindow(); - if (sourceSelectorWin) { - sourceSelectorWin.close(); - } - return selectedSource; - }); - ipcMain.handle("get-selected-source", () => { - return selectedSource; - }); - ipcMain.handle("open-source-selector", () => { - const sourceSelectorWin = getSourceSelectorWindow(); - if (sourceSelectorWin) { - sourceSelectorWin.focus(); - return; - } - createSourceSelectorWindow2(); - }); - ipcMain.handle("switch-to-editor", () => { - const mainWin = getMainWindow(); - if (mainWin) { - mainWin.close(); - } - createEditorWindow2(); - }); - ipcMain.handle("store-recorded-video", async (_, videoData, fileName) => { - try { - const videoPath = path.join(RECORDINGS_DIR, fileName); - await fs.writeFile(videoPath, Buffer.from(videoData)); - currentVideoPath = videoPath; - return { - success: true, - path: videoPath, - message: "Video stored successfully" - }; - } catch (error) { - console.error("Failed to store video:", error); - return { - success: false, - message: "Failed to store video", - error: String(error) - }; - } - }); - ipcMain.handle("get-recorded-video-path", async () => { - try { - const files = await fs.readdir(RECORDINGS_DIR); - const videoFiles = files.filter((file) => file.endsWith(".webm")); - if (videoFiles.length === 0) { - return { success: false, message: "No recorded video found" }; - } - const latestVideo = videoFiles.sort().reverse()[0]; - const videoPath = path.join(RECORDINGS_DIR, latestVideo); - return { success: true, path: videoPath }; - } catch (error) { - console.error("Failed to get video path:", error); - return { success: false, message: "Failed to get video path", error: String(error) }; - } - }); - ipcMain.handle("set-recording-state", (_, recording) => { - const source = selectedSource || { name: "Screen" }; - if (onRecordingStateChange) { - onRecordingStateChange(recording, source.name); - } - }); - ipcMain.handle("open-external-url", async (_, url) => { - try { - await shell.openExternal(url); - return { success: true }; - } catch (error) { - console.error("Failed to open URL:", error); - return { success: false, error: String(error) }; - } - }); - ipcMain.handle("get-asset-base-path", () => { - try { - if (app.isPackaged) { - return path.join(process.resourcesPath, "assets"); - } - return path.join(app.getAppPath(), "public", "assets"); - } catch (err) { - console.error("Failed to resolve asset base path:", err); - return null; - } - }); - ipcMain.handle("save-exported-video", async (_, videoData, fileName) => { - try { - const mainWindow2 = getMainWindow(); - const isGif = fileName.toLowerCase().endsWith(".gif"); - const filters = isGif ? [{ name: "GIF Image", extensions: ["gif"] }] : [{ name: "MP4 Video", extensions: ["mp4"] }]; - const result = await dialog.showSaveDialog(mainWindow2 || void 0, { - title: isGif ? "Save Exported GIF" : "Save Exported Video", - defaultPath: path.join(app.getPath("downloads"), fileName), - filters, - properties: ["createDirectory", "showOverwriteConfirmation"] - }); - if (result.canceled || !result.filePath) { - return { - success: false, - cancelled: true, - message: "Export cancelled" - }; - } - await fs.writeFile(result.filePath, Buffer.from(videoData)); - return { - success: true, - path: result.filePath, - message: "Video exported successfully" - }; - } catch (error) { - console.error("Failed to save exported video:", error); - return { - success: false, - message: "Failed to save exported video", - error: String(error) - }; - } - }); - ipcMain.handle("open-video-file-picker", async () => { - try { - const result = await dialog.showOpenDialog({ - title: "Select Video File", - defaultPath: RECORDINGS_DIR, - filters: [ - { name: "Video Files", extensions: ["webm", "mp4", "mov", "avi", "mkv"] }, - { name: "All Files", extensions: ["*"] } - ], - properties: ["openFile"] - }); - if (result.canceled || result.filePaths.length === 0) { - return { success: false, cancelled: true }; - } - return { - success: true, - path: result.filePaths[0] - }; - } catch (error) { - console.error("Failed to open file picker:", error); - return { - success: false, - message: "Failed to open file picker", - error: String(error) - }; - } - }); - let currentVideoPath = null; - ipcMain.handle("set-current-video-path", (_, path2) => { - currentVideoPath = path2; - return { success: true }; - }); - ipcMain.handle("get-current-video-path", () => { - return currentVideoPath ? { success: true, path: currentVideoPath } : { success: false }; - }); - ipcMain.handle("clear-current-video-path", () => { - currentVideoPath = null; - return { success: true }; - }); - ipcMain.handle("get-platform", () => { - return process.platform; - }); -} -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const RECORDINGS_DIR = path.join(app.getPath("userData"), "recordings"); -async function ensureRecordingsDir() { - try { - await fs.mkdir(RECORDINGS_DIR, { recursive: true }); - console.log("RECORDINGS_DIR:", RECORDINGS_DIR); - console.log("User Data Path:", app.getPath("userData")); - } catch (error) { - console.error("Failed to create recordings directory:", error); - } -} -process.env.APP_ROOT = path.join(__dirname, ".."); -const VITE_DEV_SERVER_URL = process.env["VITE_DEV_SERVER_URL"]; -const MAIN_DIST = path.join(process.env.APP_ROOT, "dist-electron"); -const RENDERER_DIST = path.join(process.env.APP_ROOT, "dist"); -process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, "public") : RENDERER_DIST; -let mainWindow = null; -let sourceSelectorWindow = null; -let tray = null; -let selectedSourceName = ""; -const defaultTrayIcon = getTrayIcon("openscreen.png"); -const recordingTrayIcon = getTrayIcon("rec-button.png"); -function createWindow() { - mainWindow = createHudOverlayWindow(); -} -function createTray() { - tray = new Tray(defaultTrayIcon); -} -function getTrayIcon(filename) { - return nativeImage.createFromPath(path.join(process.env.VITE_PUBLIC || RENDERER_DIST, filename)).resize({ - width: 24, - height: 24, - quality: "best" - }); -} -function updateTrayMenu(recording = false) { - if (!tray) return; - const trayIcon = recording ? recordingTrayIcon : defaultTrayIcon; - const trayToolTip = recording ? `Recording: ${selectedSourceName}` : "OpenScreen"; - const menuTemplate = recording ? [ - { - label: "Stop Recording", - click: () => { - if (mainWindow && !mainWindow.isDestroyed()) { - mainWindow.webContents.send("stop-recording-from-tray"); - } - } - } - ] : [ - { - label: "Open", - click: () => { - if (mainWindow && !mainWindow.isDestroyed()) { - mainWindow.isMinimized() && mainWindow.restore(); - } else { - createWindow(); - } - } - }, - { - label: "Quit", - click: () => { - app.quit(); - } - } - ]; - tray.setImage(trayIcon); - tray.setToolTip(trayToolTip); - tray.setContextMenu(Menu.buildFromTemplate(menuTemplate)); -} -function createEditorWindowWrapper() { - if (mainWindow) { - mainWindow.close(); - mainWindow = null; - } - mainWindow = createEditorWindow(); -} -function createSourceSelectorWindowWrapper() { - sourceSelectorWindow = createSourceSelectorWindow(); - sourceSelectorWindow.on("closed", () => { - sourceSelectorWindow = null; - }); - return sourceSelectorWindow; -} -app.on("window-all-closed", () => { -}); -app.on("activate", () => { - if (BrowserWindow.getAllWindows().length === 0) { - createWindow(); - } -}); -app.whenReady().then(async () => { - const { ipcMain: ipcMain2 } = await import("electron"); - ipcMain2.on("hud-overlay-close", () => { - app.quit(); - }); - createTray(); - updateTrayMenu(); - await ensureRecordingsDir(); - registerIpcHandlers( - createEditorWindowWrapper, - createSourceSelectorWindowWrapper, - () => mainWindow, - () => sourceSelectorWindow, - (recording, sourceName) => { - selectedSourceName = sourceName; - if (!tray) createTray(); - updateTrayMenu(recording); - if (!recording) { - if (mainWindow) mainWindow.restore(); - } - } - ); - createWindow(); -}); -export { - MAIN_DIST, - RECORDINGS_DIR, - RENDERER_DIST, - VITE_DEV_SERVER_URL -}; diff --git a/dist-electron/preload.mjs b/dist-electron/preload.mjs deleted file mode 100644 index cb59604..0000000 --- a/dist-electron/preload.mjs +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -const electron = require("electron"); -electron.contextBridge.exposeInMainWorld("electronAPI", { - hudOverlayHide: () => { - electron.ipcRenderer.send("hud-overlay-hide"); - }, - hudOverlayClose: () => { - electron.ipcRenderer.send("hud-overlay-close"); - }, - getAssetBasePath: async () => { - return await electron.ipcRenderer.invoke("get-asset-base-path"); - }, - getSources: async (opts) => { - return await electron.ipcRenderer.invoke("get-sources", opts); - }, - switchToEditor: () => { - return electron.ipcRenderer.invoke("switch-to-editor"); - }, - openSourceSelector: () => { - return electron.ipcRenderer.invoke("open-source-selector"); - }, - selectSource: (source) => { - return electron.ipcRenderer.invoke("select-source", source); - }, - getSelectedSource: () => { - return electron.ipcRenderer.invoke("get-selected-source"); - }, - storeRecordedVideo: (videoData, fileName) => { - return electron.ipcRenderer.invoke("store-recorded-video", videoData, fileName); - }, - getRecordedVideoPath: () => { - return electron.ipcRenderer.invoke("get-recorded-video-path"); - }, - setRecordingState: (recording) => { - return electron.ipcRenderer.invoke("set-recording-state", recording); - }, - onStopRecordingFromTray: (callback) => { - const listener = () => callback(); - electron.ipcRenderer.on("stop-recording-from-tray", listener); - return () => electron.ipcRenderer.removeListener("stop-recording-from-tray", listener); - }, - openExternalUrl: (url) => { - return electron.ipcRenderer.invoke("open-external-url", url); - }, - saveExportedVideo: (videoData, fileName) => { - return electron.ipcRenderer.invoke("save-exported-video", videoData, fileName); - }, - openVideoFilePicker: () => { - return electron.ipcRenderer.invoke("open-video-file-picker"); - }, - setCurrentVideoPath: (path) => { - return electron.ipcRenderer.invoke("set-current-video-path", path); - }, - getCurrentVideoPath: () => { - return electron.ipcRenderer.invoke("get-current-video-path"); - }, - clearCurrentVideoPath: () => { - return electron.ipcRenderer.invoke("clear-current-video-path"); - }, - getPlatform: () => { - return electron.ipcRenderer.invoke("get-platform"); - } -});