diff --git a/src/app/error.html b/src/app/error.html new file mode 100644 index 0000000..be75987 --- /dev/null +++ b/src/app/error.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + Proxy Manager | Error + + + +

This service uses Internet Connection

+

Possible Reasons for Connection drop :

+
    +
  1. Usage of Incorrect Proxy
  2. +
  3. No Internet Connection
  4. +
  5. No Proxy used
  6. +
+ + + diff --git a/src/index.js b/src/index.js index 3efbac9..c6edee4 100644 --- a/src/index.js +++ b/src/index.js @@ -77,9 +77,11 @@ const createWindow = () => { }; // create dynamic window const createDynamicWindow = (file) => { + createSplashScreen(); dynamicWindow = new BrowserWindow({ width: isDev ? 1000 : 550, height: 600, + show: false, webPreferences: { preload: path.join(__dirname, "preload.js"), nodeIntegration: true, @@ -98,6 +100,19 @@ const createDynamicWindow = (file) => { if (isDev) { dynamicWindow.webContents.openDevTools(); } + + dynamicWindow.once("ready-to-show", () => { + // dynamicWindow.show(); + // if (splashScreen) { + // splashScreen.close(); + // } + setTimeout(() => { + dynamicWindow.show(); + if (splashScreen) { + splashScreen.close(); + } + }, 500); + }); }; function createSplashScreen() { @@ -110,6 +125,7 @@ function createSplashScreen() { webPreferences: { nodeIntegration: true, }, + icon: path.join(__dirname, "./assets/icons/icon_512.png"), roundedCorners: true, transparent: true, // Set the window to be transparent }); @@ -122,9 +138,11 @@ function createSplashScreen() { } const createURLWindow = (file) => { + createSplashScreen(); dynamicWindow = new BrowserWindow({ width: isDev ? 1000 : 550, height: 600, + show: false, webPreferences: { preload: path.join(__dirname, "preload.js"), nodeIntegration: true, @@ -140,9 +158,26 @@ const createURLWindow = (file) => { dynamicWindow.setIcon(path.join(__dirname, "./assets/icons/icon_512.png")); // and load the index.html of the app. dynamicWindow.loadURL("https://aethernex.vercel.app"); + // did-fail-load + dynamicWindow.webContents.on( + "did-fail-load", + (event, errorCode, errorDescription, validatedURL, isMainFrame) => { + // Load a local HTML file if URL loading fails + dynamicWindow.loadFile(path.join(__dirname, "./app/error.html")); + // console.log({event,errorCode,errorDescription,validatedURL,isMainFrame}); + } + ); if (isDev) { dynamicWindow.webContents.openDevTools(); } + dynamicWindow.once("ready-to-show", () => { + setTimeout(() => { + dynamicWindow.show(); + if (splashScreen) { + splashScreen.close(); + } + }, 500); + }); }; function showNotification({ title, body }) {