File tree Expand file tree Collapse file tree 2 files changed +26
-17
lines changed
Expand file tree Collapse file tree 2 files changed +26
-17
lines changed Original file line number Diff line number Diff line change 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
2429function setBaseUrl ( url ) {
@@ -27,5 +32,6 @@ function setBaseUrl(url) {
2732
2833module . exports = {
2934 config,
35+ createConfig,
3036 setBaseUrl
3137} ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const path = require("path");
33const 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
99function pathToFileURL ( filePath ) {
@@ -20,6 +20,9 @@ let win;
2020let pluginName ;
2121const isDev = ! app . isPackaged ;
2222
23+ // Create configuration with proper isDev detection
24+ const config = createConfig ( isDev ) ;
25+
2326let rendererPath , preloadPath ;
2427if ( isDev ) {
2528 rendererPath = path . resolve ( path . join ( __dirname , '../renderer' ) ) ;
You can’t perform that action at this time.
0 commit comments