mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(electron): dev reload (#4911)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { shell } from 'electron';
|
||||
import { app } from 'electron';
|
||||
import log from 'electron-log';
|
||||
|
||||
export const logger = log.scope('main');
|
||||
@@ -12,3 +13,7 @@ export async function revealLogFile() {
|
||||
const filePath = getLogFilePath();
|
||||
return await shell.openPath(filePath);
|
||||
}
|
||||
|
||||
app.on('before-quit', () => {
|
||||
log.transports.console.level = false;
|
||||
});
|
||||
|
||||
@@ -10,6 +10,9 @@ import { updaterSubjects } from './event';
|
||||
const mode = process.env.NODE_ENV;
|
||||
const isDev = mode === 'development';
|
||||
|
||||
// skip auto update in dev mode & internal
|
||||
const disabled = buildType === 'internal' || isDev;
|
||||
|
||||
export const quitAndInstall = async () => {
|
||||
autoUpdater.quitAndInstall();
|
||||
};
|
||||
@@ -17,7 +20,7 @@ export const quitAndInstall = async () => {
|
||||
let lastCheckTime = 0;
|
||||
export const checkForUpdates = async (force = true) => {
|
||||
// check every 30 minutes (1800 seconds) at most
|
||||
if (force || lastCheckTime + 1000 * 1800 < Date.now()) {
|
||||
if (!disabled && (force || lastCheckTime + 1000 * 1800 < Date.now())) {
|
||||
lastCheckTime = Date.now();
|
||||
return await autoUpdater.checkForUpdates();
|
||||
}
|
||||
@@ -25,8 +28,7 @@ export const checkForUpdates = async (force = true) => {
|
||||
};
|
||||
|
||||
export const registerUpdater = async () => {
|
||||
// skip auto update in dev mode & internal
|
||||
if (buildType === 'internal' || isDev) {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +45,6 @@ export const registerUpdater = async () => {
|
||||
channel: buildType,
|
||||
// hack for custom provider
|
||||
provider: 'custom' as 'github',
|
||||
// @ts-expect-error - just ignore for now
|
||||
repo: buildType !== 'internal' ? 'AFFiNE' : 'AFFiNE-Releases',
|
||||
owner: 'toeverything',
|
||||
releaseType: buildType === 'stable' ? 'release' : 'prerelease',
|
||||
|
||||
Reference in New Issue
Block a user