Fix Update button being stuck on Electron with auto-updates turned off (#4154)
This commit is contained in:
parent
35ae18dddc
commit
8248de44a6
@ -83,7 +83,7 @@ function shouldPerformAutoUpdate(): Promise<boolean> {
|
|||||||
let contents = '';
|
let contents = '';
|
||||||
|
|
||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
resolve(getIsAppUpdateNeeded(contents, app.getVersion()));
|
resolve(getIsAppUpdateNeeded(contents, app.getVersion(), true));
|
||||||
});
|
});
|
||||||
|
|
||||||
response.on('data', (data: Buffer) => {
|
response.on('data', (data: Buffer) => {
|
||||||
|
|||||||
@ -1,7 +1,15 @@
|
|||||||
const APP_VERSION_REGEX = /^\d+\.\d+(\.\d+)?$/;
|
const APP_VERSION_REGEX = /^\d+\.\d+(\.\d+)?$/;
|
||||||
|
|
||||||
export default function getIsAppUpdateNeeded(remoteVersion: string, appVersion: string) {
|
export default function getIsAppUpdateNeeded(remoteVersion: string, appVersion: string, isStrict?: boolean) {
|
||||||
const sanitizedRemoteVersion = remoteVersion.trim();
|
const sanitizedRemoteVersion = remoteVersion.trim();
|
||||||
|
|
||||||
return APP_VERSION_REGEX.test(sanitizedRemoteVersion) && sanitizedRemoteVersion !== appVersion;
|
if (!APP_VERSION_REGEX.test(sanitizedRemoteVersion)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStrict) {
|
||||||
|
return sanitizedRemoteVersion.localeCompare(appVersion, undefined, { numeric: true, sensitivity: 'base' }) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sanitizedRemoteVersion !== appVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user