diff --git a/.gitignore b/.gitignore index 52a909d..47e91a1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,13 @@ node_modules dist dist-ssr /release +!/release/ +/release/* +!/release/AUTO-UPDATE-GUIDE.md +!/release/AUTO-UPDATE-TEST-REPORT.md +!/release/RELEASE_NOTES.md +!/release/README.txt +!/release/VERSION.txt *.local # Editor directories and files diff --git a/electron/main.cjs b/electron/main.cjs index 80a8c61..148b31d 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -17,6 +17,7 @@ const { randomUUID } = require("crypto"); const { fileURLToPath } = require("url"); const { isSafeUrl, shouldBlockWebsiteNavigation } = require("./url-policy.cjs"); const { safeDownloadFilename } = require("./download-policy.cjs"); +const { createUpdateManager } = require("./update-manager.cjs"); // Keep the existing browser-pro userData directory stable across the product rename. const appDataDirectory = process.platform === "win32" && process.env.APPDATA @@ -24,12 +25,14 @@ const appDataDirectory = process.platform === "win32" && process.env.APPDATA : app.getPath("appData"); app.setPath("userData", path.join(appDataDirectory, "browser-pro")); app.setName("DevFlow"); +const { autoUpdater } = require("electron-updater"); if (process.platform === "win32") app.setAppUserModelId("com.devflow.browser"); const database = require("./database.cjs"); const { isValidIpcArguments } = require("./ipc-payload.cjs"); let mainWindow; +let updateManager = null; let toolsWindow = null; let toolsWindowReady = false; let toolsWindowRequested = false; @@ -106,6 +109,20 @@ function secureOn(channel, handler) { }); } +updateManager = createUpdateManager({ + app, + autoUpdater, + send: state => { + if (mainWindow && !mainWindow.isDestroyed() && !mainWindow.webContents.isDestroyed()) { + mainWindow.webContents.send("updates:state", state); + } + } +}); +secureHandle("updates:get-version", () => ({ version: app.getVersion(), enabled: app.isPackaged })); +secureHandle("updates:check", () => updateManager.check()); +secureHandle("updates:download", () => updateManager.download()); +secureHandle("updates:install", () => updateManager.install()); + function browserShortcutForInput(input) { if (!input || input.type !== "keyDown") return null; const key = String(input.key || "").toLowerCase(); @@ -3940,8 +3957,11 @@ app.whenReady().then(() => { setupNetworkMonitoring(); setupDownloadManager(); createWindow(); + updateManager.initialize(); }); +app.on("before-quit", () => updateManager?.dispose()); + app.on("window-all-closed", () => { if (process.platform !== "darwin") app.quit(); }); diff --git a/electron/preload.cjs b/electron/preload.cjs index f03d690..a6ac99d 100644 --- a/electron/preload.cjs +++ b/electron/preload.cjs @@ -4,6 +4,16 @@ const initialTheme = process.argv.find(argument => argument.startsWith("--devflo contextBridge.exposeInMainWorld("browserAPI", { initialTheme, + getAppVersion: () => ipcRenderer.invoke("updates:get-version"), + checkForUpdates: () => ipcRenderer.invoke("updates:check"), + downloadUpdate: () => ipcRenderer.invoke("updates:download"), + restartAndInstallUpdate: () => ipcRenderer.invoke("updates:install"), + onUpdateState: (callback) => { + if (typeof callback !== "function") return () => {}; + const listener = (_, state) => callback(state); + ipcRenderer.on("updates:state", listener); + return () => ipcRenderer.removeListener("updates:state", listener); + }, navigate: (url) => ipcRenderer.invoke("browser:navigate", url), back: () => ipcRenderer.invoke("browser:back"), forward: () => ipcRenderer.invoke("browser:forward"), diff --git a/electron/update-manager.cjs b/electron/update-manager.cjs new file mode 100644 index 0000000..4c5f7eb --- /dev/null +++ b/electron/update-manager.cjs @@ -0,0 +1,102 @@ +const STARTUP_DELAY_MS = 30_000; +const CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000; + +function createUpdateManager({ app, autoUpdater, send, setTimeoutFn = setTimeout, setIntervalFn = setInterval }) { + let initialized = false; + let checkInFlight = false; + let downloadInFlight = false; + let available = false; + let downloaded = false; + let errorReported = false; + let startupTimer; + let periodicTimer; + + function publish(status, details = {}) { + send({ status, version: details.version || null, percent: details.percent ?? null, transferred: details.transferred ?? null, total: details.total ?? null, message: details.message || null, phase: details.phase || null }); + } + + function reportError(message, phase) { + if (errorReported) return; + errorReported = true; + publish("error", { message, phase }); + } + + async function check() { + if (!initialized || checkInFlight) return { success: false, reason: "unavailable-or-in-progress" }; + checkInFlight = true; + errorReported = false; + publish("checking"); + try { + await autoUpdater.checkForUpdates(); + return { success: true }; + } catch { + reportError("Could not check for updates. Check your connection and try again.", "check"); + return { success: false }; + } finally { + checkInFlight = false; + } + } + + function initialize() { + if (initialized || !app.isPackaged) return false; + initialized = true; + autoUpdater.autoDownload = false; + autoUpdater.autoInstallOnAppQuit = false; + autoUpdater.allowPrerelease = false; + autoUpdater.on("checking-for-update", () => publish("checking")); + autoUpdater.on("update-available", info => { + available = true; + downloaded = false; + publish("available", { version: info?.version }); + }); + autoUpdater.on("update-not-available", info => { + available = false; + publish("up-to-date", { version: info?.version }); + }); + autoUpdater.on("download-progress", progress => publish("downloading", progress)); + autoUpdater.on("update-downloaded", info => { + downloaded = true; + publish("downloaded", { version: info?.version }); + }); + autoUpdater.on("error", _error => { + const isChecking = checkInFlight; + const message = isChecking + ? "Could not check for updates. Check your connection and try again." + : "The update could not be downloaded. Check your connection and try again."; + reportError(message, isChecking ? "check" : "download"); + }); + startupTimer = setTimeoutFn(() => { void check(); }, STARTUP_DELAY_MS); + periodicTimer = setIntervalFn(() => { void check(); }, CHECK_INTERVAL_MS); + return true; + } + + async function download() { + if (!initialized || !available || downloaded || downloadInFlight) return { success: false }; + downloadInFlight = true; + errorReported = false; + try { + await autoUpdater.downloadUpdate(); + return { success: true }; + } catch { + reportError("The update could not be downloaded. Check your connection and try again.", "download"); + return { success: false }; + } finally { + downloadInFlight = false; + } + } + + function install() { + if (!initialized || !downloaded) return { success: false }; + autoUpdater.quitAndInstall(); + return { success: true }; + } + + function dispose() { + if (startupTimer) clearTimeout(startupTimer); + if (periodicTimer) clearInterval(periodicTimer); + } + + return { initialize, check, download, install, dispose }; +} + +module.exports = { createUpdateManager, STARTUP_DELAY_MS, CHECK_INTERVAL_MS }; diff --git a/package-lock.json b/package-lock.json index 966f502..0a4dd47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,15 @@ { "name": "devflow", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "devflow", - "version": "1.0.0", - "dependencies": {}, + "version": "1.0.1", + "dependencies": { + "electron-updater": "^6.8.11" + }, "devDependencies": { "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", @@ -58,9 +60,9 @@ "license": "MIT" }, "node_modules/@electron/asar/node_modules/brace-expansion": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", - "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", "dev": true, "license": "MIT", "dependencies": { @@ -293,9 +295,9 @@ "license": "MIT" }, "node_modules/@electron/universal/node_modules/brace-expansion": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", - "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", "dev": true, "license": "MIT", "dependencies": { @@ -1433,9 +1435,9 @@ } }, "node_modules/app-builder-lib": { - "version": "26.18.0", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-26.18.0.tgz", - "integrity": "sha512-lx+KkuCSZHcbECf4R3IAcC9VOFk0+cMUwljO63s5y8yqS1Lw0sRGmjPaWsPwP3zv3ohZYbMhUvjXeiQXXZhJXA==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-26.18.1.tgz", + "integrity": "sha512-HxHcSQoy8RmiFCSxgKyt5Lrwx8HCURh5834TRaHEjkDkVS2wVt3RnkQDkG0zaQZfhz3d8WQtF8zv914xSm0ZpA==", "dev": true, "license": "MIT", "dependencies": { @@ -1453,15 +1455,15 @@ "ajv": "^8.18.0", "asn1js": "^3.0.10", "async-exit-hook": "^2.0.1", - "builder-util": "26.16.0", - "builder-util-runtime": "9.7.0", + "builder-util": "26.18.1", + "builder-util-runtime": "9.7.1", "chromium-pickle-js": "^0.2.0", "ci-info": "4.3.1", "debug": "^4.3.4", "dotenv": "^16.4.5", "dotenv-expand": "^11.0.6", "ejs": "^3.1.8", - "electron-publish": "26.18.0", + "electron-publish": "26.18.1", "fs-extra": "^10.1.0", "hosted-git-info": "^4.1.0", "isbinaryfile": "^5.0.0", @@ -1485,8 +1487,8 @@ "node": ">=14.0.0" }, "peerDependencies": { - "dmg-builder": "26.18.0", - "electron-builder-squirrel-windows": "26.18.0" + "dmg-builder": "26.18.1", + "electron-builder-squirrel-windows": "26.18.1" } }, "node_modules/app-builder-lib/node_modules/@electron/get": { @@ -1536,6 +1538,20 @@ "semver": "bin/semver.js" } }, + "node_modules/app-builder-lib/node_modules/builder-util-runtime": { + "version": "9.7.1", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.1.tgz", + "integrity": "sha512-LLAn0Ddqz0YIyysCysBkg18qEdAzMASiADSZl5G8gpxsqu1RJrdFAqoAW9suwg0GHKMqrycISFSD/9RqSm5d6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/app-builder-lib/node_modules/ci-info": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", @@ -1599,7 +1615,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, "license": "Python-2.0" }, "node_modules/asn1js": { @@ -1746,9 +1761,9 @@ "optional": true }, "node_modules/brace-expansion": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", - "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.2.tgz", + "integrity": "sha512-ELhY3JEerIBbhgW+rh0/8glkZAaMqn1x3BAvp3yTULSEGozMK/5PT6WTdBgsdvJqwwmv7MAQNOydfYbvK1Vgfw==", "dev": true, "license": "MIT", "dependencies": { @@ -1766,14 +1781,14 @@ "license": "MIT" }, "node_modules/builder-util": { - "version": "26.16.0", - "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-26.16.0.tgz", - "integrity": "sha512-RLyJhB7Si3YkzKR9ubQslWuXW3Vhs3CGe1i+SeixBZ0qTd1mk3XBmssvY22TlB6CS5blyko8Gu1JzpYk8UkYAg==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-26.18.1.tgz", + "integrity": "sha512-t+1Xnzj8jQ2FnJWtQOKVCuzv3QGjvNhE6er757omlKFysQexdrCVI9eM/uu4+39IiMCtM2l/30O1Yrqqbt4HQw==", "dev": true, "license": "MIT", "dependencies": { "@types/debug": "^4.1.6", - "builder-util-runtime": "9.7.0", + "builder-util-runtime": "9.7.1", "chalk": "^4.1.2", "cross-spawn": "^7.0.6", "debug": "^4.3.4", @@ -1795,7 +1810,6 @@ "version": "9.7.0", "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.0.tgz", "integrity": "sha512-g/kR520giAFYkSXTzcmF3kqQq7wi8F6N6SzeDgZrqTBN+VHdmgWOyTdD1yD7AATDId/yXLvuP34CxW46/BwCdw==", - "dev": true, "license": "MIT", "dependencies": { "debug": "^4.3.4", @@ -1821,6 +1835,20 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/builder-util/node_modules/builder-util-runtime": { + "version": "9.7.1", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.1.tgz", + "integrity": "sha512-LLAn0Ddqz0YIyysCysBkg18qEdAzMASiADSZl5G8gpxsqu1RJrdFAqoAW9suwg0GHKMqrycISFSD/9RqSm5d6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/builder-util/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2080,9 +2108,9 @@ "peer": true }, "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz", + "integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==", "dev": true, "license": "MIT", "dependencies": { @@ -2128,7 +2156,6 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -2266,9 +2293,9 @@ "license": "MIT" }, "node_modules/dir-compare/node_modules/brace-expansion": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", - "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2290,14 +2317,14 @@ } }, "node_modules/dmg-builder": { - "version": "26.18.0", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-26.18.0.tgz", - "integrity": "sha512-ozCGC54wi2C1RkS2v69y9lQxvoQ1Coh+iT8CmWiyY8y1ZuOKVvuNson2Hd+HEOs9+EZNNsOBbzKgQZ4SNqWd0w==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-26.18.1.tgz", + "integrity": "sha512-ihBAAhXUQiO+fIQGirYSLuKfgGa81zIrIzgSSkbm1fPcE0cXqnxNLtUQgxYHpezxWOaeXxmh9AuPemONZuMKbg==", "dev": true, "license": "MIT", "dependencies": { - "app-builder-lib": "26.18.0", - "builder-util": "26.16.0", + "app-builder-lib": "26.18.1", + "builder-util": "26.18.1", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0" } @@ -2392,18 +2419,18 @@ } }, "node_modules/electron-builder": { - "version": "26.18.0", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-26.18.0.tgz", - "integrity": "sha512-ASgIuQnOq4RuD8jMhS9hI0LS3EMRT1I/M5R6utqifB/BHN80IcCjBdt+DED+NmNPvmBgEtrlExXZitNdA7kXOg==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-26.18.1.tgz", + "integrity": "sha512-uA3To9X/D4ozwP8k/o/MCfKi/xETyPV0FkhTaqdgIT679uexsQ8QFE+PhF8x6PY8W1jIJrw9/yadTuOWTpmAew==", "dev": true, "license": "MIT", "dependencies": { - "app-builder-lib": "26.18.0", - "builder-util": "26.16.0", - "builder-util-runtime": "9.7.0", + "app-builder-lib": "26.18.1", + "builder-util": "26.18.1", + "builder-util-runtime": "9.7.1", "chalk": "^4.1.2", "ci-info": "^4.2.0", - "dmg-builder": "26.18.0", + "dmg-builder": "26.18.1", "fs-extra": "^10.1.0", "lazy-val": "^1.0.5", "simple-update-notifier": "2.0.0", @@ -2418,15 +2445,15 @@ } }, "node_modules/electron-builder-squirrel-windows": { - "version": "26.18.0", - "resolved": "https://registry.npmjs.org/electron-builder-squirrel-windows/-/electron-builder-squirrel-windows-26.18.0.tgz", - "integrity": "sha512-a2elgTipboXNIsxqS1HOmHMGp4Pd3LJgIZOdIFTOskBSawvxKyZWYWQ1d7KKA4CtINSchYCYEKzhxRqiKZev9Q==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/electron-builder-squirrel-windows/-/electron-builder-squirrel-windows-26.18.1.tgz", + "integrity": "sha512-EZmCBoO1nJbtzTPTPcbQEqo1IGiu2iGID/qeFTQZsJ1ETPPdXHZSxvu9ie0+XhjjQWbK4JxzYyUtRB/qw+lSVQ==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "app-builder-lib": "26.18.0", - "builder-util": "26.16.0", + "app-builder-lib": "26.18.1", + "builder-util": "26.18.1", "electron-winstaller": "5.4.0" } }, @@ -2456,6 +2483,20 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/electron-builder/node_modules/builder-util-runtime": { + "version": "9.7.1", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.1.tgz", + "integrity": "sha512-LLAn0Ddqz0YIyysCysBkg18qEdAzMASiADSZl5G8gpxsqu1RJrdFAqoAW9suwg0GHKMqrycISFSD/9RqSm5d6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/electron-builder/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2584,16 +2625,16 @@ } }, "node_modules/electron-publish": { - "version": "26.18.0", - "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-26.18.0.tgz", - "integrity": "sha512-MagnqaZSALSWjcdKu5HEVhYUZD/2BDL3q7XzrqWwub6gf/UfD3ItMgmthVDv9w5y9E0gH1C3JWqKaXwf6f4ROg==", + "version": "26.18.1", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-26.18.1.tgz", + "integrity": "sha512-VlAkMx9kgPP/TGn5q5sgCSYwKtMUXBGhXT2XwFi3p3lMJZDgCIWErikWBaI6tJg8PbMeXZ6vK1eR2+DzcZsb5w==", "dev": true, "license": "MIT", "dependencies": { "@types/fs-extra": "^9.0.11", "aws4": "^1.13.2", - "builder-util": "26.16.0", - "builder-util-runtime": "9.7.0", + "builder-util": "26.18.1", + "builder-util-runtime": "9.7.1", "chalk": "^4.1.2", "form-data": "^4.0.5", "fs-extra": "^10.1.0", @@ -2617,6 +2658,20 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/electron-publish/node_modules/builder-util-runtime": { + "version": "9.7.1", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.7.1.tgz", + "integrity": "sha512-LLAn0Ddqz0YIyysCysBkg18qEdAzMASiADSZl5G8gpxsqu1RJrdFAqoAW9suwg0GHKMqrycISFSD/9RqSm5d6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/electron-publish/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2647,6 +2702,34 @@ "node": ">=8" } }, + "node_modules/electron-updater": { + "version": "6.8.11", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.8.11.tgz", + "integrity": "sha512-12U/mbzaIKQS3Q543aQ7DjyAZMXeVJy1Wpu0qdq5ne4RXpIQDpWYm25zRjgXngAoo6swMrm4C4owGyiIipelsg==", + "license": "MIT", + "dependencies": { + "builder-util-runtime": "9.7.0", + "fs-extra": "^10.1.0", + "js-yaml": "^4.1.0", + "lazy-val": "^1.0.5", + "lodash.escaperegexp": "^4.1.2", + "lodash.isequal": "^4.5.0", + "semver": "~7.7.3", + "tiny-typed-emitter": "^2.1.0" + } + }, + "node_modules/electron-updater/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/electron-winstaller": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/electron-winstaller/-/electron-winstaller-5.4.0.tgz", @@ -2892,9 +2975,9 @@ "license": "MIT" }, "node_modules/filelist/node_modules/brace-expansion": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", - "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.8.tgz", + "integrity": "sha512-BnlDzDYQoplTsZSvPi86CNzmbcb07X8ufR8fk1zivaiEJlXJkiq1MQyDCVmlWcsWbj6aWXqHnrwwevbrm/Saig==", "dev": true, "license": "MIT", "dependencies": { @@ -2956,7 +3039,6 @@ "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", @@ -3107,9 +3189,9 @@ "license": "MIT" }, "node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", - "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz", + "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3210,7 +3292,6 @@ "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, "license": "ISC" }, "node_modules/has-flag": { @@ -3451,7 +3532,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", - "dev": true, "funding": [ { "type": "github", @@ -3509,7 +3589,6 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==", - "dev": true, "license": "MIT", "dependencies": { "universalify": "^2.0.0" @@ -3532,7 +3611,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.5.tgz", "integrity": "sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==", - "dev": true, "license": "MIT" }, "node_modules/lightningcss": { @@ -3815,6 +3893,19 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==", + "license": "MIT" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.", + "license": "MIT" + }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -3975,7 +4066,6 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, "license": "MIT" }, "node_modules/nanoid": { @@ -3998,9 +4088,9 @@ } }, "node_modules/node-abi": { - "version": "4.40.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.40.0.tgz", - "integrity": "sha512-GuvqvtrOk+AC27RidBxBsMzVNkwNl7PjHgc4NXbmdvSVLgIUjpaqcG1FjNRYnt2Yn9Ytq+Ln37XsBaglUcte/w==", + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.43.0.tgz", + "integrity": "sha512-sey5XPoGJ2VBCcwtHhvwSbMMkYvXyvZkn+FjHsoFij3bcWjJRN4+3Zt7GsZOkgZ8J0maJFCWsYtralZDJVQncg==", "dev": true, "license": "MIT", "dependencies": { @@ -4484,6 +4574,7 @@ "version": "19.3.1", "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4493,6 +4584,7 @@ "version": "19.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "dev": true, "license": "MIT", "dependencies": { "scheduler": "^0.28.0" @@ -4684,9 +4776,9 @@ "license": "MIT" }, "node_modules/sanitize-filename": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.4.tgz", - "integrity": "sha512-9ZyI08PsvdQl2r/bBIGubpVdR3RR9sY6RDiWFPreA21C/EFlQhmgo20UZlNjZMMZNubusLhAQozkA0Od5J21Eg==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.5.tgz", + "integrity": "sha512-+dVApt46/oAFWRP0KBSnYNLRw1peY7o/b12tmpllPNFpjfwkPuZut1+DiKaD9zYx5r2SHwc+XMLSBaDiyUJw3g==", "dev": true, "license": "WTFPL OR ISC", "dependencies": { @@ -4697,7 +4789,6 @@ "version": "1.6.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", - "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" @@ -4707,6 +4798,7 @@ "version": "0.28.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "dev": true, "license": "MIT" }, "node_modules/semver": { @@ -4923,9 +5015,9 @@ } }, "node_modules/tar": { - "version": "7.5.22", - "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.22.tgz", - "integrity": "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==", + "version": "7.5.24", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.24.tgz", + "integrity": "sha512-to/OxuCk5DeVONcjjODT7aeoRq5NIPPlfPc0tNML+wLlnf6u5BcJz97Uukv3pT3jzorkFhUevylkAiBr+ZmV2w==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -4995,6 +5087,12 @@ "semver": "bin/semver" } }, + "node_modules/tiny-typed-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", + "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==", + "license": "MIT" + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -5095,7 +5193,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, "license": "MIT", "engines": { "node": ">= 10.0.0" diff --git a/package.json b/package.json index a227437..79b5852 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "devflow", "private": true, - "version": "1.0.0", + "version": "1.0.1", "productName": "DevFlow", "description": "Developer-Focused Desktop Browser", "type": "module", @@ -12,6 +12,7 @@ "start": "concurrently \"npm run dev\" \"wait-on http://localhost:5173 && electron .\"", "lint": "oxlint", "test:security": "node tests/ipc-payload.test.cjs && node tests/url-policy.test.cjs && node tests/download-policy.test.cjs && node tests/database-recovery.test.cjs", + "test:update": "node tests/update-manager.test.cjs", "test:startup-recovery": "node tests/startup-recovery-smoke.cjs", "test:phase1": "node tests/phase1-runtime.cjs", "test:packaged": "node tests/packaged-smoke.cjs", @@ -19,7 +20,9 @@ "generate:icon:win": "electron scripts/icon-generator", "dist:win": "npm run build && electron-builder --win nsis --x64" }, - "dependencies": {}, + "dependencies": { + "electron-updater": "^6.8.11" + }, "main": "electron/main.cjs", "devDependencies": { "@types/react": "^19.3.0", @@ -49,6 +52,14 @@ "!**/*.map" ], "asar": true, + "publish": [ + { + "provider": "github", + "owner": "Vikasboolean", + "repo": "devflow-", + "releaseType": "release" + } + ], "win": { "target": [ { diff --git a/release/AUTO-UPDATE-GUIDE.md b/release/AUTO-UPDATE-GUIDE.md new file mode 100644 index 0000000..1ee8081 --- /dev/null +++ b/release/AUTO-UPDATE-GUIDE.md @@ -0,0 +1,91 @@ +# DevFlow automatic updates + +## Architecture + +The packaged Windows x64 application uses `electron-updater` with Electron Builder's GitHub Releases provider. The verified Git remote is `https://github.com/Vikasboolean/devflow-.git`; the configured release repository is `Vikasboolean/devflow-`. Updates use HTTPS and the provider's normal certificate validation. There is no token, signing key, or update URL in application or renderer code. + +`electron/update-manager.cjs` initializes only when `app.isPackaged` is true. It waits 30 seconds after startup, checks every four hours, and serializes concurrent checks. Checks report availability without downloading. The user can start a download from the update card, watch progress while continuing to browse, then explicitly choose **Restart & Update** after the download completes. No update forces an exit. Errors are shown in the card without native dialog loops. electron-updater handles interrupted and incomplete downloads; installation is offered only after its `update-downloaded` event. + +The preload exposes only version, check, download, install, and update-state subscription methods. The existing `secureHandle` trusted-renderer check and payload validation guard renderer requests. No raw `ipcRenderer` is exposed. The update provider is fixed by the builder configuration; the renderer cannot provide a URL. + +The existing `app.setPath("userData", ...browser-pro)` path remains stable, so updates do not reset browser data. Existing NSIS install settings and the current v1.0.0 baseline are retained. + +### First updater-enabled release + +Version 1.0.1 is the first release containing this updater. Existing 1.0.0 installations do not contain `electron-updater` or the GitHub feed metadata and cannot discover 1.0.1. Users must download and run the 1.0.1 NSIS installer manually once. Subsequent updater-enabled versions can be discovered and installed through DevFlow. + +## Dependencies and configuration + +`electron-updater` is a production dependency. Electron Builder's GitHub provider is configured in `package.json` with `owner: Vikasboolean`, `repo: devflow-`, and `releaseType: release`. The existing Windows x64 NSIS target is unchanged. Electron Builder generates `latest.yml` and the installer blockmap when building with update metadata enabled by the configured provider. + +GitHub publishing requires a credential in the build/release environment with permission to create releases. Supply it through the environment or `gh` authentication; never commit it or put it in renderer files. This task does not publish a release or build an installer. + +## Release procedure + +1. Make and review the DevFlow changes. +2. Set the next version in `package.json` and `package-lock.json`, then commit the release source. The first updater-enabled release uses 1.0.1; for a later release after 1.0.1: + + ```powershell + npm version 1.0.2 --no-git-tag-version + git add package.json package-lock.json + git commit -m "Release v1.0.2" + ``` + + Do not reuse an old `latest.yml`. +3. On Windows, build the x64 NSIS installer and update metadata: + + ```powershell + npm ci + npm run build + npx electron-builder --win nsis --x64 --publish never + ``` + +4. Confirm the output versioned installer, matching `.blockmap`, and `latest.yml` are present in `release/`. Inspect `latest.yml`; its version and referenced filename must match this exact installer. +5. Create and publish the matching GitHub release, uploading those generated files. For example, after setting the version to `1.0.2` and confirming filenames: + + ```powershell + gh release create v1.0.2 ` + release/DevFlow-Setup-1.0.2-x64.exe ` + release/DevFlow-Setup-1.0.2-x64.exe.blockmap ` + release/latest.yml ` + --title "DevFlow 1.0.2" ` + --notes-file release/RELEASE_NOTES.md + ``` + + `gh release create` publishes the release by default. Do not pass `--draft`. Verify the release page lists all three assets and is not marked draft before announcing it. If the generated artifact names differ, use the actual matching names from `latest.yml` and the build output. +6. Installed packaged clients check at startup after the delay and then every four hours. Users can also select **Check for updates** in the update card. + +Never upload a stale `latest.yml` or blockmap with a different installer. Do not overwrite the existing `v1.0.0` release. The first updater-enabled 1.0.1 installer must be distributed to current 1.0.0 users manually. + +## Testing + +Automated, offline manager checks: + +```powershell +node tests/update-manager.test.cjs +node tests/update-ipc.test.cjs +npm run test:security +``` + +`update-manager.test.cjs` covers development-mode non-initialization, packaged initialization, no-update and available events, check overlap, download progress/completion, duplicate error suppression, and the explicit install gate. `update-ipc.test.cjs` checks that update IPC uses the existing trusted-renderer and payload validation path and exposes no raw IPC or URL parameter. When running an Electron environment, also use: + +```powershell +npm run test:packaged +npm run test:phase1 +``` + +For an updater integration test, use an isolated Windows VM or test account and a dedicated test GitHub repository. Since the original v1.0.0 baseline has no updater, use an updater-enabled 1.0.1 test build as the starting installation, then publish a 1.0.2 test release to the test repository. Configure the test builds' GitHub owner/repository at build time; do not change the production repository configuration in the release build. Attach each test build's matching installer, blockmap, and `latest.yml`, then verify check, download, progress, restart approval, and successful relaunch. This test configuration is build-time-only and must never ship. No test release is created by this release-preparation task. + +For user-data preservation, seed bookmarks, history, settings, a saved login/session, and open tabs in the isolated v1.0.0 install. Record the files under the app's existing userData directory, update to v1.0.1, then confirm the records and session are still present. Never point the test at a daily-use profile. + +## Troubleshooting + +- **No update is found:** confirm the release is published, its tag matches `package.json`, `latest.yml` is attached, and its referenced installer and blockmap are attached with exact names. +- **Download fails:** verify connectivity to GitHub and retry from the update card. Do not install manually downloaded metadata from another host. +- **A version is skipped:** compare the installed version, release tag, `latest.yml` version, and artifact names. Publish a new version rather than reusing an existing version's metadata. +- **Development mode shows no updater:** this is expected. The updater is deliberately disabled when `app.isPackaged` is false. +- **GitHub publishing fails:** check the release environment's `gh` login or publishing credential and repository permissions. Do not put credentials in source or logs. + +## Windows signing + +The current project has no configured Windows code-signing identity. Windows may display SmartScreen or publisher warnings for unsigned installers, and update trust is weaker for users. Before public distribution, sign the NSIS installer with a trusted code-signing certificate, protect the private key in the release environment, and verify the signature before publishing. Never commit the certificate or key. HTTPS and update metadata validation remain enabled regardless of signing status. diff --git a/release/AUTO-UPDATE-TEST-REPORT.md b/release/AUTO-UPDATE-TEST-REPORT.md new file mode 100644 index 0000000..d6f53ae --- /dev/null +++ b/release/AUTO-UPDATE-TEST-REPORT.md @@ -0,0 +1,95 @@ +# DevFlow automatic updater verification report + +**Verification date:** 2026-12-02 +**Result:** Not ready to call the existing v1.0.0 → v1.0.1 upgrade path verified. The configured updater implementation passes its unit and source-wiring checks, but the installed v1.0.0 baseline does not contain updater support, and several end-to-end checks require a packaged build and isolated test release. + +No source changes, tags, releases, or production installers were made during this verification. `npm run build` regenerated the ignored renderer `dist/` output only. + +## Files in the implementation and verification working tree + +- `.gitignore` +- `electron/main.cjs` +- `electron/preload.cjs` +- `electron/update-manager.cjs` +- `package.json` +- `package-lock.json` +- `src/App.jsx` +- `src/theme.css` +- `tests/update-manager.test.cjs` +- `tests/update-ipc.test.cjs` +- `release/AUTO-UPDATE-GUIDE.md` +- `release/AUTO-UPDATE-TEST-REPORT.md` (this report) + +## Configuration inspection + +- `electron-updater` is installed in `dependencies` at `^6.8.11`. +- The local Git remote and connected GitHub repository lookup agree on the public repository `Vikasboolean/devflow-` (default branch `main`). The package builder provider uses that owner and repository, with `releaseType: release`. +- The x64 NSIS target, artifact naming, assisted installer settings, and shortcut behavior remain configured. The existing updater uses Electron Builder's GitHub provider and electron-updater's stable-release channel (`allowPrerelease = false`). +- The updater manager is initialized after app readiness and returns without initializing unless `app.isPackaged` is true. Its unit test verifies that development initialization schedules no checks. +- Update IPC handlers use `secureHandle`, which checks the trusted main renderer and validates IPC arguments. The preload exposes specific methods, not `ipcRenderer`, and accepts no update URL. +- A source scan found no GitHub token/PAT/private-key literals or `GITHUB_TOKEN`/`GH_TOKEN` references in the application source and package files. Release authentication is documented as an environment/CLI responsibility. +- The user's existing data path remains explicitly set to the pre-existing `browser-pro` user-data directory. +- `electron-updater` delegates version parsing and update comparison to semver (`parse`, `eq`, `gt`, `lt`) in its installed `AppUpdater`. The project test suite does not independently test version ordering. + +## Automated command results + +| Command/check | Result | Notes | +|---|---|---| +| `npm run build` | Passed | Vite built 38 modules. The first sandboxed attempt failed with Windows `spawn EPERM`; rerunning with the local helper-process permission succeeded. | +| `npm run test:security` | Passed | IPC payload (4), URL policy (2), download filename policy (1), and database recovery (1) checks passed. | +| `npm run test:update` | Passed | Covers dev-mode skip, packaged initialization, no-update and available events, progress, downloaded state, overlapping checks, offline failure suppression, and install gating. | +| `node tests/update-ipc.test.cjs` | Passed, static only | Checks secure-handler wiring and narrow preload API from source text. It does not launch Electron or send a request from an unauthorized frame. | +| `npm run lint` | Passed with warnings | Exit code 0. Existing warnings remain in `main.cjs`, browser components, and `download-policy.cjs`; no updater-manager warning was emitted. | +| `git diff --check` | Passed | No whitespace errors. | + +## Requested scenarios and coverage gaps + +- **No update, available, download progress, download completed:** exercised by the manager unit test with a mocked updater. +- **Network failure:** simulated by rejecting `checkForUpdates`; one generic error is emitted. A real offline GitHub check/download was not run. +- **Invalid update metadata:** not exercised. The manager listens for electron-updater errors, but no malformed `latest.yml` or invalid version fixture was supplied. +- **Duplicate update checks:** exercised with a pending mocked check; the second request is rejected while the first is in progress. +- **Unauthorized renderer IPC:** source wiring is statically checked, not dynamically tested with an untrusted `WebContents` sender. Existing `secureHandle` supplies the trusted-frame gate. +- **Restart and install:** the unit test confirms install is rejected before `update-downloaded` and invokes `quitAndInstall()` after that event. A running Electron app/user-click flow was not exercised. +- **User-data preservation:** not verified through an actual upgrade. Source inspection confirms the established `browser-pro` path remains; only an isolated installed v1.0.0 → v1.0.1 test can establish preservation of real bookmarks, history, settings, credentials, and sessions. +- **Published release lookup:** the repository is public and configured as the provider target, but no release query was completed: `gh` is not installed in this environment and the connected GitHub search capability does not expose release assets. Do not treat remote release discoverability as verified here. + +## Findings and remaining blockers + +1. **Existing v1.0.0 clients cannot self-update to the first updater-enabled release.** The packaged `release/win-unpacked/resources/app.asar` reports version `1.0.0` with `dependencies: {}`; the packaged resources have no `app-update.yml`. The v1.0.0 installer therefore predates both `electron-updater` and the GitHub feed configuration. It cannot poll for v1.0.1. Distributing the first updater-enabled build requires a one-time manual installer upgrade or another already-supported delivery route. Later builds can update only clients that have installed an updater-enabled version. +2. **Current `latest.yml` generation is configured but not verified.** There is no `release/latest.yml`, `app-update.yml`, or `release/win-unpacked/resources/app-update.yml` in the workspace. The existing v1.0.0 installer and blockmaps are present, but no current metadata was generated because production packaging is prohibited for this task. The old `builder-effective-config.yaml` also predates the new `publish` entry, so it is not evidence of the current builder output. +3. **Download retry UI state is dropped.** `update-manager.cjs`'s `publish()` payload does not include `details.phase`, while `src/App.jsx` shows “Retry Download” only when `updateState.phase === "download"`. The retry button therefore cannot appear for the download error event. Manual rechecking can recover by finding the update again, but the documented direct retry state is broken. +4. **End-to-end coverage remains incomplete.** Invalid metadata, real unauthorized-frame IPC, release discovery, version ordering through app integration, restart UX, and user-data preservation require more than the current offline/static tests. +5. **Windows code signing is not configured.** Existing installer metadata says unsigned. Public distribution will show publisher/SmartScreen warnings and provides weaker assurance that the installer came from DevFlow. Sign the installer in the release environment before public distribution. + +## Update metadata and release discoverability + +The `build.publish` GitHub configuration is present and is expected to make Electron Builder emit `latest.yml` plus the installer blockmap on a production packaging run. This expectation is based on configuration inspection only; this task did not build an installer. GitHub release asset discovery was not verified remotely. The next packaging run must check that `latest.yml` references the exact versioned NSIS executable and that the matching `.blockmap` and metadata are included on the published, non-draft release. + +The release target is fixed in the packaged builder config; the renderer cannot provide an arbitrary host. `quitAndInstall()` is reached only through the update install handler after the manager observed `update-downloaded`; the renderer exposes it from its **Restart & Update** button. + +## Exact commands for a future v1.0.1 release + +These commands are documentation only and were not run. First resolve the v1.0.0 onboarding blocker and complete the isolated test procedure. Then, from the reviewed release commit on Windows: + +```powershell +npm version 1.0.1 --no-git-tag-version +git add package.json package-lock.json +git commit -m "Release v1.0.1" +npm ci +npm run build +npx electron-builder --win nsis --x64 --publish never +``` + +Inspect `release/latest.yml` and confirm its version and referenced `path`/hash match the generated `DevFlow-Setup-1.0.1-x64.exe`. Confirm `release/DevFlow-Setup-1.0.1-x64.exe.blockmap` and `release/latest.yml` are present. After release notes are ready and the assets have been reviewed, publish with: + +```powershell +gh release create v1.0.1 ` + release/DevFlow-Setup-1.0.1-x64.exe ` + release/DevFlow-Setup-1.0.1-x64.exe.blockmap ` + release/latest.yml ` + --title "DevFlow 1.0.1" ` + --notes-file release/RELEASE_NOTES.md +gh release view v1.0.1 --repo Vikasboolean/devflow- --json tagName,isDraft,isPrerelease,assets,url +``` + +`gh release create` publishes by default. Verify the release is not a draft and all three matching assets are attached. Do not reuse metadata or overwrite v1.0.0. No publishing command was executed during this verification. diff --git a/release/README.txt b/release/README.txt new file mode 100644 index 0000000..006123b --- /dev/null +++ b/release/README.txt @@ -0,0 +1,18 @@ +DevFlow 1.0.1 - Windows x64 + +Installer +1. Run DevFlow-Setup-1.0.1-x64.exe. +2. Choose an installation directory and shortcut options in the NSIS installer. +3. Launch DevFlow from the Start Menu or desktop shortcut. + +One-time upgrade from 1.0.0 +DevFlow 1.0.0 does not include automatic updater support. Download and run the 1.0.1 installer manually. Future updater-enabled versions can be downloaded by DevFlow and installed after you choose Restart & Update. + +User data +Browser data is stored outside the installation directory under %APPDATA%\browser-pro. An in-place application update preserves this directory. Do not uninstall if you need to preserve your existing data; back up the directory before a clean uninstall/reinstall. + +Integrity +Verify DevFlow-Setup-1.0.1-x64.exe against the SHA-256 entry in SHA256SUMS.txt before installation. + +Signing +This installer is unsigned because no code-signing certificate is configured. Windows may show an unknown-publisher or SmartScreen warning. diff --git a/release/RELEASE_NOTES.md b/release/RELEASE_NOTES.md new file mode 100644 index 0000000..5c94978 --- /dev/null +++ b/release/RELEASE_NOTES.md @@ -0,0 +1,18 @@ +# DevFlow 1.0.1 + +DevFlow 1.0.1 is the first release with automatic update support. + +## Updates + +- Packaged DevFlow checks GitHub Releases after startup and every four hours. +- Users can check manually, review available versions, download in the background, and choose when to restart and install. +- Update checks are limited to the configured `Vikasboolean/devflow-` GitHub repository. + +## Upgrade from 1.0.0 + +DevFlow 1.0.0 does not contain the updater. Install the 1.0.1 Windows x64 installer manually once. The installer upgrades DevFlow in its existing installation location; browser data remains under `%APPDATA%\browser-pro` and is not reset by the update. + +## Security and compatibility + +- Existing NSIS directory-selection and shortcut behavior is retained. +- The Windows installer is unsigned. Windows may show SmartScreen or unknown-publisher warnings. diff --git a/release/VERSION.txt b/release/VERSION.txt new file mode 100644 index 0000000..b637892 --- /dev/null +++ b/release/VERSION.txt @@ -0,0 +1,9 @@ +Product: DevFlow +Version: 1.0.1 +Platform: Windows x64 +Architecture: x64 +Installer: DevFlow-Setup-1.0.1-x64.exe +Update support: First updater-enabled release +Upgrade from 1.0.0: Manual installer run required once +User data: %APPDATA%\browser-pro (preserved by in-place update) +Signing: unsigned (no publisher certificate configured) diff --git a/src/App.jsx b/src/App.jsx index ff95eaa..a96d473 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -89,6 +89,11 @@ function App() { const [clock, setClock] = useState(new Date()); const [popupNotice, setPopupNotice] = useState(null); const [toasts, setToasts] = useState([]); + const [updateState, setUpdateState] = useState(null); + const [updateDismissed, setUpdateDismissed] = useState(false); + const [appVersion, setAppVersion] = useState(""); + const [updatesEnabled, setUpdatesEnabled] = useState(false); + const updateStateRef = useRef(null); const inspectorViewportRef = useRef(null); function resetAutocomplete() { @@ -204,6 +209,22 @@ function App() { return () => window.removeEventListener("devflow:toast", listener); }, []); + useEffect(() => { + window.browserAPI.getAppVersion().then(result => { setAppVersion(result?.version || ""); setUpdatesEnabled(Boolean(result?.enabled)); }).catch(() => {}); + return window.browserAPI.onUpdateState(state => { + const previous = updateStateRef.current; + if (previous?.status !== state?.status || previous?.version !== state?.version) setUpdateDismissed(false); + updateStateRef.current = state; + setUpdateState(state); + }); + }, []); + + async function manuallyCheckForUpdates() { + setUpdateDismissed(false); + setUpdateState({ status: "checking" }); + await window.browserAPI.checkForUpdates(); + } + useEffect(() => { if (!isAddressFocused || !isAddressSuggestionsOpen || activeTab?.isPrivate || !url.trim() || /^https?:\/\//i.test(url)) return; let cancelled = false; @@ -653,6 +674,20 @@ function App() { }}> {popupNotice &&