Skip to content

Commit 0b0e1c6

Browse files
committed
[Feat] Rework Updater
1 parent 6505ecc commit 0b0e1c6

File tree

17 files changed

+736
-69
lines changed

17 files changed

+736
-69
lines changed

electron.vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default defineConfig({
6666
device: path.resolve(__dirname, 'src/device.html'),
6767
settings: path.resolve(__dirname, 'src/settings.html'),
6868
monsters: path.resolve(__dirname, 'src/monsters.html'),
69+
update: path.resolve(__dirname, 'src/update.html'),
6970
},
7071
output: {
7172
manualChunks(id: string) {

package-lock.json

Lines changed: 106 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bpsr-meter",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"description": "BPSR Meter",
55
"author": "Denoder",
66
"type": "module",
@@ -29,9 +29,11 @@
2929
"@electron-toolkit/utils": "^4.0.0",
3030
"@tailwindcss/vite": "^4.1.15",
3131
"@woheedev/bptimer-api-client": "^0.0.8",
32+
"adm-zip": "^0.5.16",
3233
"bindings": "^1.5.0",
3334
"cap": "^0.2.1",
3435
"cors": "^2.8.5",
36+
"electron-updater": "^6.6.2",
3537
"express": "^5.1.0",
3638
"google-protobuf": "^4.0.0",
3739
"is-admin": "^4.0.0",
@@ -45,6 +47,7 @@
4547
"tailwindcss": "^4.1.15"
4648
},
4749
"devDependencies": {
50+
"@types/adm-zip": "^0.5.7",
4851
"@types/bindings": "^1.5.5",
4952
"@types/cors": "^2.8.19",
5053
"@types/express": "^5.0.3",
@@ -89,6 +92,11 @@
8992
"**/*.sys"
9093
],
9194
"compression": "maximum",
95+
"publish": {
96+
"provider": "github",
97+
"owner": "Denoder",
98+
"repo": "BPSR-Meter"
99+
},
92100
"files": [
93101
"out/**/*",
94102
"algo/**/*",

src/css/style.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
--text-primary: #ffffff;
1010
--text-secondary: #b4bcc9;
1111
--text-muted: #6c7a89;
12+
--bg-warning: rgba(255, 193, 7, 0.1);
13+
--bg-warning-hover: rgba(255, 193, 7, 0.2);
14+
--border-warning: rgba(255, 193, 7, 0.3);
15+
--border-warning-hover: rgba(255, 193, 7, 0.4);
1216
--border: rgba(255, 255, 255, 0.08);
1317
--border-hover: rgba(74, 158, 255, 0.3);
1418
--gap-xs: 2px;
@@ -2530,3 +2534,24 @@ body.performance-mode .player-bar::before {
25302534
padding: 12px;
25312535
}
25322536
}
2537+
2538+
.update-window {
2539+
width: 100%;
2540+
height: 100%;
2541+
background: var(--bg-darker);
2542+
display: flex;
2543+
flex-direction: column;
2544+
gap: 1px;
2545+
border-radius: var(--radius);
2546+
box-sizing: border-box;
2547+
overflow: hidden;
2548+
position: relative;
2549+
pointer-events: auto;
2550+
}
2551+
2552+
.update-window-container {
2553+
max-width: 100%;
2554+
height: 100%;
2555+
overflow-y: auto;
2556+
overflow-x: hidden;
2557+
}

src/main/index.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import {
1111
checkForUpdates,
1212
checkForUpdatesSilent,
13-
showUpdateDialog,
13+
checkForUpdatesManual,
1414
} from "./updateChecker";
1515
import path from "path";
1616
import { exec, fork, ChildProcess } from "child_process";
@@ -29,6 +29,7 @@ const WINDOW_CONFIGS = {
2929
device: { defaultSize: { width: 600, height: 400 }, resizable: true },
3030
settings: { defaultSize: { width: 420, height: 520 }, resizable: true },
3131
monsters: { defaultSize: { width: 950, height: 600 }, resizable: true },
32+
update: { defaultSize: { width: 500, height: 650 }, resizable: false },
3233
} as const;
3334

3435
type WindowType = keyof typeof WINDOW_CONFIGS;
@@ -41,6 +42,7 @@ const windows: Record<WindowType, BrowserWindow | null> = {
4142
device: null,
4243
settings: null,
4344
monsters: null,
45+
update: null,
4446
};
4547

4648
const lastWindowSizes: Record<WindowType, WindowSize> = {
@@ -50,6 +52,7 @@ const lastWindowSizes: Record<WindowType, WindowSize> = {
5052
device: { width: 600, height: 400, scale: 1 },
5153
settings: { width: 420, height: 520, scale: 1 },
5254
monsters: { width: 950, height: 600, scale: 1 },
55+
update: { width: 500, height: 650, scale: 1 },
5356
};
5457

5558
let serverProcess: ChildProcess | null = null;
@@ -385,6 +388,11 @@ function setupIpcHandlers() {
385388
logToFile(`Error opening monsters window: ${err}`),
386389
),
387390
);
391+
ipcMain.on("open-update-window", () =>
392+
createOrFocusWindow("update").catch((err) =>
393+
logToFile(`Error opening update window: ${err}`),
394+
),
395+
);
388396

389397
ipcMain.on(
390398
"update-visible-columns",
@@ -727,13 +735,7 @@ function setupIpcHandlers() {
727735

728736
ipcMain.handle("check-for-updates-with-dialog", async () => {
729737
const currentVersion = app.getVersion();
730-
const updateInfo = await checkForUpdates(currentVersion);
731-
732-
if (updateInfo.available) {
733-
await showUpdateDialog(updateInfo);
734-
}
735-
736-
return updateInfo;
738+
return await checkForUpdatesManual(currentVersion);
737739
});
738740
}
739741

@@ -940,6 +942,7 @@ app.whenReady().then(() => {
940942

941943
createMainWindow();
942944

945+
// Check for updates after app starts
943946
setTimeout(() => {
944947
const currentVersion = app.getVersion();
945948
checkForUpdatesSilent(currentVersion).catch((err) => {

0 commit comments

Comments
 (0)