Skip to content

Commit 8fc197b

Browse files
committed
Proposed fix for releaseNotes serialization #1039
1 parent 2010461 commit 8fc197b

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/ElectronNET.Host/api/autoUpdater.js

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

src/ElectronNET.Host/api/autoUpdater.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ElectronNET.Host/api/autoUpdater.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { autoUpdater } from "electron-updater";
33

44
let electronSocket: Socket;
55

6+
function normalize(updateInfo) {
7+
if (typeof updateInfo?.releaseNotes === "string") {
8+
updateInfo.releaseNotes = [updateInfo.releaseNotes];
9+
}
10+
}
11+
612
export = (socket: Socket) => {
713
electronSocket = socket;
814

@@ -20,12 +26,14 @@ export = (socket: Socket) => {
2026

2127
socket.on("register-autoUpdater-update-available", (id) => {
2228
autoUpdater.on("update-available", (updateInfo) => {
29+
normalize(updateInfo);
2330
electronSocket.emit("autoUpdater-update-available" + id, updateInfo);
2431
});
2532
});
2633

2734
socket.on("register-autoUpdater-update-not-available", (id) => {
2835
autoUpdater.on("update-not-available", (updateInfo) => {
36+
normalize(updateInfo);
2937
electronSocket.emit("autoUpdater-update-not-available" + id, updateInfo);
3038
});
3139
});
@@ -38,6 +46,7 @@ export = (socket: Socket) => {
3846

3947
socket.on("register-autoUpdater-update-downloaded", (id) => {
4048
autoUpdater.on("update-downloaded", (updateInfo) => {
49+
normalize(updateInfo);
4150
electronSocket.emit("autoUpdater-update-downloaded" + id, updateInfo);
4251
});
4352
});
@@ -143,6 +152,7 @@ export = (socket: Socket) => {
143152
autoUpdater
144153
.checkForUpdatesAndNotify()
145154
.then((updateCheckResult) => {
155+
normalize(updateCheckResult?.updateInfo);
146156
electronSocket.emit(
147157
"autoUpdater-checkForUpdatesAndNotify-completed" + guid,
148158
updateCheckResult,
@@ -160,6 +170,7 @@ export = (socket: Socket) => {
160170
autoUpdater
161171
.checkForUpdates()
162172
.then((updateCheckResult) => {
173+
normalize(updateCheckResult?.updateInfo);
163174
electronSocket.emit(
164175
"autoUpdater-checkForUpdates-completed" + guid,
165176
updateCheckResult,

0 commit comments

Comments
 (0)