Skip to content

Commit 35dc5c7

Browse files
committed
Properly set initial expressPort value
# Conflicts: # www/js/app.js
1 parent b9b7906 commit 35dc5c7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

www/js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ if (window.electronAPI) {
10711071
}
10721072
});
10731073
electronAPI.on('get-store-value', function (key, value) {
1074-
if (key === 'expressPort') {
1074+
if (value && key === 'expressPort') {
10751075
params.expressPort = value;
10761076
uiUtil.setExpressServerUI(value);
10771077
}
@@ -1981,7 +1981,7 @@ if (window.electronAPI) {
19811981
// Ensure the port is a number and the value matches a permitted value
19821982
var proposedPort = parseInt(e.target.value);
19831983
if (proposedPort !== e.target.value && (proposedPort < 1024 || proposedPort > 65535)) {
1984-
e.target.value = params.expressPort || 3000;
1984+
e.target.value = params.expressPort;
19851985
setTimeout(function () {
19861986
uiUtil.systemAlert('Please enter a valid port number between 1024 and 65535!');
19871987
}, 250);

www/js/init.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ params['cachedStartPages'] = {
8686
mdwiki_en_all_maxi: 'C/Wikipedia%253AWikiProject_Medicine/Open_Textbook_of_Medicine2',
8787
wikivoyage_en_all_maxi: 'C/Main_Page'
8888
};
89-
89+
if (window.electronAPI) {
90+
// Initial port for Express server in Electron: this will be different for base app (3000), WikiMed (3001) and Wikivoyage (3002)
91+
// This will be overridden by the actual port defined or stored in main.cjs
92+
params['expressPort'] = 3000;
93+
}
9094
params['win7ElectronVersion'] = '22.3'; // KEEP UP TO DATE!!! This is the last minor version to support Win 7/8/8.1. Auto-update is embargoed for values starting with this.
9195
params['kiwixDownloadServer'] = 'https://download.kiwix.org/zim/'; // Include final slash
9296
params['kiwixDownloadMirrors'] = ['https://ftp.fau.de/kiwix/zim/', 'https://mirrors.dotsrc.org/kiwix/zim/', 'https://www.mirrorservice.org/sites/download.kiwix.org/zim/', 'https://md.mirrors.hacktegic.com/kiwix-md/zim/', 'https://library.kiwix.org'];

0 commit comments

Comments
 (0)