diff --git a/app/src/electron.js b/app/src/electron.js index 1c7dbf6b7..da666f81b 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -11,12 +11,22 @@ const url = require('url'); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow; +let splashWindow; + +function hideSplash() { + if (splashWindow) { + splashWindow.destroy(); + splashWindow = null; + } + mainWindow.show(); +} function createWindow() { // Create the browser window. mainWindow = new BrowserWindow({ - width: 800, - height: 600, + // width: 800, + // height: 600, + show: false, webPreferences: { nodeIntegration: true, }, @@ -30,9 +40,26 @@ function createWindow() { protocol: 'file:', slashes: true, }); + mainWindow.webContents.on('did-finish-load', function () { + hideSplash(); + }); mainWindow.loadURL(startUrl); } + splashWindow = new BrowserWindow({ + width: 300, + height: 120, + transparent: true, + frame: false, + }); + splashWindow.loadURL( + url.format({ + pathname: path.join(__dirname, '../packages/web/build/splash.html'), + protocol: 'file:', + slashes: true, + }) + ); + if (process.env.ELECTRON_START_URL) { loadMainWindow(); } else { diff --git a/packages/web/public/splash.css b/packages/web/public/splash.css new file mode 100644 index 000000000..3bc0c720f --- /dev/null +++ b/packages/web/public/splash.css @@ -0,0 +1,16 @@ +body { + background: #666; +} + +div { + color: white; + font-size: 25pt; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + text-align: center; + font-family: Arial, Helvetica, sans-serif; + margin-top: 40px; +} diff --git a/packages/web/public/splash.html b/packages/web/public/splash.html new file mode 100644 index 000000000..486dce245 --- /dev/null +++ b/packages/web/public/splash.html @@ -0,0 +1,12 @@ + + + + + + + + +
Starting DbGate...
+ + + \ No newline at end of file diff --git a/packages/web/src/utility/resolveApi.js b/packages/web/src/utility/resolveApi.js index 2fe739d6b..672c9469a 100644 --- a/packages/web/src/utility/resolveApi.js +++ b/packages/web/src/utility/resolveApi.js @@ -4,7 +4,9 @@ export default function resolveApi() { if (electron) { const port = electron.remote.getGlobal('port'); - return `http://localhost:${port}`; + if (port) { + return `http://localhost:${port}`; + } } }