Merge branch 'develop'
This commit is contained in:
commit
19e2ab8bc5
@ -15,7 +15,7 @@
|
||||
|
||||
<body>
|
||||
<h1>Oops</h1>
|
||||
<p>An error has occurred while loading this document.</p>
|
||||
<p>A connection error has occurred.</p>
|
||||
<p>Please check your internet connection and this service's URL.</p>
|
||||
<p>If you can load the actual URL in your favorite web browser, please file us a bug report.</p>
|
||||
</body>
|
20
frontend/file_not_found_error.html
Normal file
20
frontend/file_not_found_error.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>An error occured</title>
|
||||
<meta http-equiv="Content-Security-Policy"
|
||||
content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self'">
|
||||
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
|
||||
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
|
||||
|
||||
<link rel="stylesheet" href="css/layout.css">
|
||||
<link rel="stylesheet" href="css/error.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Oops</h1>
|
||||
<p>File not found.</p>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +1,6 @@
|
||||
import {
|
||||
clipboard,
|
||||
DidFailLoadEvent,
|
||||
ipcRenderer,
|
||||
PageFaviconUpdatedEvent,
|
||||
remote,
|
||||
@ -26,7 +27,7 @@ let securityButton: HTMLElement | null,
|
||||
backButton: HTMLElement | null,
|
||||
refreshButton: HTMLElement | null;
|
||||
let addButton, settingsButton;
|
||||
let emptyPage: string, errorPage: string;
|
||||
let pages: any;
|
||||
let urlPreview: HTMLElement | null;
|
||||
let serviceSelector: HTMLElement | null;
|
||||
|
||||
@ -128,7 +129,7 @@ function openServiceContextMenu(event: Event, serviceId: number) {
|
||||
}
|
||||
|
||||
|
||||
ipcRenderer.on('data', (event, appData, iconSets, actualSelectedService, emptyUrl, errorUrl, config) => {
|
||||
ipcRenderer.on('data', (event, appData, iconSets, actualSelectedService, urls, config) => {
|
||||
// App info
|
||||
appInfo.title = appData.title;
|
||||
|
||||
@ -178,8 +179,7 @@ ipcRenderer.on('data', (event, appData, iconSets, actualSelectedService, emptyUr
|
||||
setActiveService(actualSelectedService);
|
||||
|
||||
// Empty
|
||||
emptyPage = emptyUrl;
|
||||
errorPage = errorUrl;
|
||||
pages = urls;
|
||||
|
||||
// Url preview element
|
||||
urlPreview = document.getElementById("url-preview");
|
||||
@ -475,15 +475,21 @@ function loadService(serviceId: number, service: any) {
|
||||
service.view.setAttribute('enableRemoteModule', 'false');
|
||||
service.view.setAttribute('partition', 'persist:service_' + service.partition);
|
||||
service.view.setAttribute('autosize', 'true');
|
||||
service.view.setAttribute('src', emptyPage);
|
||||
service.view.setAttribute('src', pages?.empty);
|
||||
|
||||
// Enable context isolation. This is currently not used as there is no preload script; however it could prevent
|
||||
// eventual future human mistakes.
|
||||
service.view.setAttribute('webpreferences', 'contextIsolation=yes');
|
||||
|
||||
// Error handling
|
||||
service.view.addEventListener('did-fail-load', (e: Event) => {
|
||||
service.view.setAttribute('src', errorPage);
|
||||
service.view.addEventListener('did-fail-load', (e: DidFailLoadEvent) => {
|
||||
if (e.errorCode <= -100 && e.errorCode > -200) {
|
||||
service.view.setAttribute('src', pages?.connectionError);
|
||||
} else if (e.errorCode === -6) {
|
||||
service.view.setAttribute('src', pages?.fileNotFound);
|
||||
} else if (e.errorCode !== -3) {
|
||||
console.error('Unhandled error:', e);
|
||||
}
|
||||
});
|
||||
|
||||
// Append element to DOM
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tabs",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"description": "Persistent and separate browser tabs in one window.",
|
||||
"author": {
|
||||
"name": "Alice Gaudon",
|
||||
|
@ -146,8 +146,11 @@ export default class MainWindow extends Window {
|
||||
Meta.title,
|
||||
Meta.ICON_SETS,
|
||||
this.activeService,
|
||||
path.resolve(Meta.RESOURCES_PATH, 'empty.html'),
|
||||
path.resolve(Meta.RESOURCES_PATH, 'error.html'),
|
||||
{
|
||||
empty: path.resolve(Meta.RESOURCES_PATH, 'empty.html'),
|
||||
connectionError: path.resolve(Meta.RESOURCES_PATH, 'connection_error.html'),
|
||||
fileNotFound: path.resolve(Meta.RESOURCES_PATH, 'file_not_found_error.html'),
|
||||
},
|
||||
this.config
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user