Add error.html if url can be reach and filter for all url
This commit is contained in:
15
error.html
Normal file
15
error.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body bgcolor="black">
|
||||
<br />
|
||||
<h1 style="text-align: center; color: white">
|
||||
Network or Configuration error.<br />Check your network connection or
|
||||
configuration.
|
||||
</h1>
|
||||
</body>
|
||||
</html>
|
||||
16
main.js
16
main.js
@@ -31,7 +31,6 @@ function loadConfig() {
|
||||
}
|
||||
|
||||
const config = { url_address: 'https://nexus.manage.backone.cloud/login/',
|
||||
url_filter: 'https://*.manage.backone.cloud/*',
|
||||
app_name: 'Client',
|
||||
user_agent: 'BackOne-Client'
|
||||
};
|
||||
@@ -39,17 +38,11 @@ const config = { url_address: 'https://nexus.manage.backone.cloud/login/',
|
||||
const loadValues = loadConfig() ?? config
|
||||
|
||||
config.url_address = loadValues.url_address ?? config.url_address
|
||||
config.url_filter = loadValues.url_filter ?? config.url_filter
|
||||
config.app_name = loadValues.app_name ?? config.app_name
|
||||
config.user_agent = loadValues.user_agent ?? config.user_agent
|
||||
|
||||
//console.log(config.url_address)
|
||||
//console.log(config.url_filter)
|
||||
//console.log(config.app_name)
|
||||
//console.log(config.user_agent)
|
||||
|
||||
const filter = {
|
||||
urls: [config.url_filter]
|
||||
urls: ['<all_urls>']
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +70,14 @@ const createWindow = () => {
|
||||
callback({ requestHeaders: details.requestHeaders })
|
||||
})
|
||||
|
||||
//win.loadFile('index.html')
|
||||
win.loadURL(config.url_address)
|
||||
|
||||
win.webContents.on('did-fail-load', (event, errorCode, errorDescription, validatedURL) => {
|
||||
|
||||
console.log(`Failed to load: ${validatedURL}. Error: ${errorDescription} (${errorCode})`);
|
||||
win.loadFile(path.join(__dirname, 'error.html'));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
app.on('ready', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Client",
|
||||
"version": "1.7.0",
|
||||
"version": "1.8.0",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
|
||||
Reference in New Issue
Block a user