Skip to content

Commit

Permalink
add auto updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed Jul 4, 2024
1 parent 021aca4 commit 281885a
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 165 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"updateMeta": "tsx scripts/utils/updateMeta.mts"
},
"dependencies": {
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24"
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24",
"electron-updater": "^6.2.1"
},
"optionalDependencies": {
"@vencord/venmic": "^6.1.0"
Expand Down
36 changes: 36 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions scripts/build/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ await Promise.all([
outfile: "dist/js/preload.js",
footer: { js: "//# sourceURL=VCDPreload" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/updater/preload.ts"],
outfile: "dist/js/updaterPreload.js",
footer: { js: "//# sourceURL=VCDUpdaterPreload" }
}),
createContext({
...CommonOpts,
globalName: "Vesktop",
Expand Down
5 changes: 3 additions & 2 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import "./ipc";

import { app, BrowserWindow, nativeTheme } from "electron";
import { checkUpdates } from "updater/main";
import { autoUpdater } from "electron-updater";

import { DATA_DIR } from "./constants";
import { createFirstLaunchTour } from "./firstLaunch";
Expand All @@ -21,6 +21,8 @@ if (IS_DEV) {
require("source-map-support").install();
}

autoUpdater.checkForUpdatesAndNotify();

// Make the Vencord files use our DATA_DIR
process.env.VENCORD_USER_DATA_DIR = DATA_DIR;

Expand Down Expand Up @@ -74,7 +76,6 @@ function init() {
});

app.whenReady().then(async () => {
checkUpdates();
if (process.platform === "win32") app.setAppUserModelId("dev.vencord.vesktop");

registerScreenShareHandler();
Expand Down
9 changes: 1 addition & 8 deletions src/main/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord
if (Object.hasOwn(Settings.plain, "firstLaunch") && !existsSync(STATE_FILE)) {
console.warn("legacy state in settings.json detected. migrating to state.json");
const state = {} as TState;
for (const prop of [
"firstLaunch",
"maximized",
"minimized",
"skippedUpdate",
"steamOSLayoutVersion",
"windowBounds"
] as const) {
for (const prop of ["firstLaunch", "maximized", "minimized", "steamOSLayoutVersion", "windowBounds"] as const) {
state[prop] = Settings.plain[prop];
delete Settings.plain[prop];
}
Expand Down
10 changes: 1 addition & 9 deletions src/renderer/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,7 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
defaultValue: false
}
],
"Notifications & Updates": [
NotificationBadgeToggle,
{
key: "checkUpdates",
title: "Check for updates",
description: "Automatically check for Vesktop updates",
defaultValue: true
}
],
Notifications: [NotificationBadgeToggle],
Miscelleanous: [
{
key: "arRPC",
Expand Down
3 changes: 0 additions & 3 deletions src/shared/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export interface Settings {
clickTrayToShowHide?: boolean;
customTitleBar?: boolean;

checkUpdates?: boolean;

splashTheming?: boolean;
splashColor?: string;
splashBackground?: string;
Expand All @@ -49,7 +47,6 @@ export interface State {
windowBounds?: Rectangle;
displayid: int;

skippedUpdate?: string;
firstLaunch?: boolean;

steamOSLayoutVersion?: number;
Expand Down
115 changes: 0 additions & 115 deletions src/updater/main.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/updater/preload.ts

This file was deleted.

0 comments on commit 281885a

Please sign in to comment.