Update auto updater config (#514)
* update autoupdater config * update deps * update window size
This commit is contained in:
@@ -262,6 +262,10 @@
|
||||
"currentVersion": "Current version",
|
||||
"checkUpdate": "Check update",
|
||||
"checkingLatestVersion": "Checking latest version",
|
||||
"updateAvailable": "Update available",
|
||||
"updateDownloaded": "A new version has been downloaded. Restart the application to apply the updates.",
|
||||
"restart": "Restart",
|
||||
"later": "Later",
|
||||
"userGuide": "User guide",
|
||||
"feedback": "Feedback",
|
||||
"alreadyLatestVersion": "Already latest version",
|
||||
|
||||
@@ -262,6 +262,10 @@
|
||||
"currentVersion": "当前版本",
|
||||
"checkUpdate": "检查更新",
|
||||
"checkingLatestVersion": "正在检查最新版本",
|
||||
"updateAvailable": "有新版本可用",
|
||||
"updateDownloaded": "新版本已下载,点击重新启动以更新",
|
||||
"restart": "Restart",
|
||||
"later": "Later",
|
||||
"userGuide": "用户指南",
|
||||
"feedback": "反馈",
|
||||
"alreadyLatestVersion": "已经是最新版本",
|
||||
|
||||
@@ -3,12 +3,16 @@ import path from "path";
|
||||
import fs from "fs-extra";
|
||||
import settings from "@main/settings";
|
||||
import "@main/i18n";
|
||||
import log from "@main/logger";
|
||||
import mainWindow from "@main/window";
|
||||
import ElectronSquirrelStartup from "electron-squirrel-startup";
|
||||
import contextMenu from "electron-context-menu";
|
||||
import { t } from "i18next";
|
||||
import * as Sentry from "@sentry/electron";
|
||||
import { SENTRY_DSN } from "@/constants";
|
||||
import { updateElectronApp, UpdateSourceType } from "update-electron-app";
|
||||
|
||||
const logger = log.scope("main");
|
||||
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
@@ -16,6 +20,17 @@ Sentry.init({
|
||||
|
||||
app.commandLine.appendSwitch("enable-features", "SharedArrayBuffer");
|
||||
|
||||
// config auto updater
|
||||
updateElectronApp({
|
||||
updateSource: {
|
||||
type: UpdateSourceType.StaticStorage,
|
||||
baseUrl: `https://dl.enjoy.bot/app/${process.platform}/${process.arch}`,
|
||||
},
|
||||
updateInterval: "1 hour",
|
||||
logger: logger,
|
||||
notifyUser: true,
|
||||
});
|
||||
|
||||
// Add context menu
|
||||
contextMenu({
|
||||
showSearchWithGoogle: false,
|
||||
|
||||
@@ -23,7 +23,6 @@ import { Waveform } from "./waveform";
|
||||
import url from "url";
|
||||
import echogarden from "./echogarden";
|
||||
import camdict from "./camdict";
|
||||
import { updateElectronApp, UpdateSourceType } from "update-electron-app";
|
||||
|
||||
const __filename = url.fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -387,15 +386,6 @@ ${log}
|
||||
);
|
||||
});
|
||||
|
||||
ipcMain.handle("app-update", () => {
|
||||
return updateElectronApp({
|
||||
updateSource: {
|
||||
type: UpdateSourceType.StaticStorage,
|
||||
baseUrl: `https://dl.enjoy.bot/enjoy-updates/${process.platform}/${process.arch}`,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.handle(
|
||||
"system-preferences-media-access",
|
||||
async (_event, mediaType: "microphone" | "camera") => {
|
||||
@@ -456,8 +446,8 @@ ${log}
|
||||
icon: "./assets/icon.png",
|
||||
width: 1280,
|
||||
height: 720,
|
||||
minWidth: 720,
|
||||
minHeight: 576,
|
||||
minWidth: 800,
|
||||
minHeight: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
spellcheck: false,
|
||||
|
||||
@@ -32,9 +32,6 @@ contextBridge.exposeInMainWorld("__ENJOY_APP__", {
|
||||
createIssue: (title: string, body: string) => {
|
||||
return ipcRenderer.invoke("app-create-issue", title, body);
|
||||
},
|
||||
update: () => {
|
||||
return ipcRenderer.invoke("app-update");
|
||||
},
|
||||
version,
|
||||
},
|
||||
window: {
|
||||
|
||||
@@ -7,15 +7,7 @@ export const About = () => {
|
||||
const { version, EnjoyApp } = useContext(AppSettingsProviderContext);
|
||||
|
||||
const checkUpdate = async () => {
|
||||
toast.promise(
|
||||
EnjoyApp.app.update().catch((error) => {
|
||||
toast.error(error);
|
||||
EnjoyApp.shell.openExternal("https://1000h.org/enjoy-app/install.html");
|
||||
}),
|
||||
{
|
||||
loading: t("checkingLatestVersion"),
|
||||
}
|
||||
);
|
||||
EnjoyApp.shell.openExternal("https://1000h.org/enjoy-app/install.html");
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
1
enjoy/src/types/enjoy-app.d.ts
vendored
1
enjoy/src/types/enjoy-app.d.ts
vendored
@@ -9,7 +9,6 @@ type EnjoyAppType = {
|
||||
quit: () => Promise<void>;
|
||||
openDevTools: () => Promise<void>;
|
||||
createIssue: (title: string, body: string) => Promise<void>;
|
||||
update: () => Promise<void>;
|
||||
version: string;
|
||||
};
|
||||
window: {
|
||||
|
||||
Reference in New Issue
Block a user