From 49fb4c68b6499590f1831a9bf133ab45c5efe9ed Mon Sep 17 00:00:00 2001 From: V Date: Mon, 26 Jun 2023 01:42:51 +0200 Subject: [PATCH] Updater Popup: Add Changelog; Make about page prettier --- package.json | 2 +- src/main/about.ts | 12 ++++++------ src/updater/main.ts | 25 ++++++++++++++++--------- static/views/about.html | 15 ++++++++++++--- static/views/first-launch.html | 31 ++----------------------------- static/views/splash.html | 13 +++---------- static/views/style.css | 30 ++++++++++++++++++++++++++++++ static/views/updater.html | 34 +++++++++++++++++++++------------- 8 files changed, 91 insertions(+), 71 deletions(-) create mode 100644 static/views/style.css diff --git a/package.json b/package.json index ef7043c..7ecf48d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "VencordDesktop", - "version": "0.2.4", + "version": "0.2.5", "private": true, "description": "", "keywords": [], diff --git a/src/main/about.ts b/src/main/about.ts index c15f2b8..84ac4ad 100644 --- a/src/main/about.ts +++ b/src/main/about.ts @@ -4,8 +4,7 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -import { app, BrowserWindow } from "electron"; -import { readFileSync } from "fs"; +import { BrowserWindow } from "electron"; import { join } from "path"; import { ICON_PATH, VIEW_DIR } from "shared/paths"; @@ -15,14 +14,15 @@ export function createAboutWindow() { const about = new BrowserWindow({ center: true, autoHideMenuBar: true, - icon: ICON_PATH + icon: ICON_PATH, + webPreferences: { + preload: join(__dirname, "updaterPreload.js") + } }); makeLinksOpenExternally(about); - const html = readFileSync(join(VIEW_DIR, "about.html"), "utf-8").replaceAll("%VERSION%", app.getVersion()); - - about.loadURL("data:text/html;charset=utf-8," + html); + about.loadFile(join(VIEW_DIR, "about.html")); return about; } diff --git a/src/updater/main.ts b/src/updater/main.ts index 2c74d83..243364d 100644 --- a/src/updater/main.ts +++ b/src/updater/main.ts @@ -6,9 +6,9 @@ import { app, BrowserWindow, ipcMain, shell } from "electron"; import { Settings } from "main/settings"; +import { makeLinksOpenExternally } from "main/utils/makeLinksOpenExternally"; import { githubGet, ReleaseData } from "main/utils/vencordLoader"; import { join } from "path"; -import { SplashProps } from "shared/browserWinProperties"; import { IpcEvents } from "shared/IpcEvents"; import { VIEW_DIR } from "shared/paths"; @@ -79,13 +79,13 @@ export async function checkUpdates() { const oldVersion = app.getVersion(); const newVersion = data.tag_name.replace(/^v/, ""); - if (Settings.store.skippedUpdate !== newVersion && isOutdated(oldVersion, newVersion)) { - updateData = { - currentVersion: oldVersion, - latestVersion: newVersion, - release: data - }; + updateData = { + currentVersion: oldVersion, + latestVersion: newVersion, + release: data + }; + if (Settings.store.skippedUpdate !== newVersion && isOutdated(oldVersion, newVersion)) { openNewUpdateWindow(); } } catch (e) { @@ -95,11 +95,18 @@ export async function checkUpdates() { function openNewUpdateWindow() { const win = new BrowserWindow({ - ...SplashProps, + width: 500, + autoHideMenuBar: true, + alwaysOnTop: true, webPreferences: { - preload: join(__dirname, "updaterPreload.js") + preload: join(__dirname, "updaterPreload.js"), + nodeIntegration: false, + contextIsolation: true, + sandbox: true } }); + makeLinksOpenExternally(win); + win.loadFile(join(VIEW_DIR, "updater.html")); } diff --git a/static/views/about.html b/static/views/about.html index 489cea7..45501ca 100644 --- a/static/views/about.html +++ b/static/views/about.html @@ -1,9 +1,9 @@ + +