Skip to content

Commit e8e6a06

Browse files
Don't attempt to check for updates when running in development
1 parent 0c43a94 commit e8e6a06

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

src/config.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@
33
* This file is used by both the main process and the build script
44
*/
55

6-
// Default configuration
7-
const config = {
8-
// Base URL for the application
9-
baseUrl: "https://www.sploder.net",
10-
11-
// Specific endpoints
12-
endpoints: {
13-
update: "/update",
14-
ping: "/php/ping.php"
15-
},
16-
17-
// Generate a full URL for an endpoint
18-
getUrl: function(endpoint) {
19-
return this.baseUrl + (this.endpoints[endpoint] || endpoint);
20-
}
21-
};
6+
// Create configuration factory function
7+
function createConfig(isDev = false) {
8+
return {
9+
// Base URL for the application
10+
baseUrl: "https://www.sploder.net",
11+
12+
// Specific endpoints
13+
endpoints: {
14+
update: isDev ? "/" : "/update",
15+
ping: "/php/ping.php"
16+
},
17+
18+
// Generate a full URL for an endpoint
19+
getUrl: function(endpoint) {
20+
return this.baseUrl + (this.endpoints[endpoint] || endpoint);
21+
}
22+
};
23+
}
24+
25+
// Default configuration (fallback detection for development)
26+
const config = createConfig(process.env.NODE_ENV === 'development' || !process.env.NODE_ENV);
2227

2328
// Allow overriding the base URL if needed
2429
function setBaseUrl(url) {
@@ -27,5 +32,6 @@ function setBaseUrl(url) {
2732

2833
module.exports = {
2934
config,
35+
createConfig,
3036
setBaseUrl
3137
};

src/main/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require("path");
33
const url = require("url");
44

55
// Import centralized configuration
6-
const { config } = require("../config");
6+
const { createConfig } = require("../config");
77

88
// Helper function to create proper file URLs
99
function pathToFileURL(filePath) {
@@ -20,6 +20,9 @@ let win;
2020
let pluginName;
2121
const isDev = !app.isPackaged;
2222

23+
// Create configuration with proper isDev detection
24+
const config = createConfig(isDev);
25+
2326
let rendererPath, preloadPath;
2427
if(isDev) {
2528
rendererPath = path.resolve(path.join(__dirname, '../renderer'));

0 commit comments

Comments
 (0)