diff --git a/resources/js/index.js b/resources/js/index.js
index 807adc6..3cc82cc 100644
--- a/resources/js/index.js
+++ b/resources/js/index.js
@@ -16,7 +16,7 @@ const icons = [];
let services = [];
let selectedService = null;
-let statusButton, homeButton, forwardButton, backButton, reloadButton;
+let securityButton, homeButton, forwardButton, backButton, refreshButton;
let addButton, settingsButton;
let emptyPage;
let urlPreview;
@@ -119,7 +119,7 @@ function openServiceContextMenu(event, serviceId) {
}
-ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices, actualSelectedService, emptyUrl) => {
+ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualSelectedService, emptyUrl, config) => {
// App info
appInfo.title = appData.title;
@@ -132,7 +132,7 @@ ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices,
}
console.log('Updating services ...');
- services = actualServices;
+ services = config.services;
const nav = document.querySelector('#service-selector');
while (nav.children.length > 0) {
@@ -176,6 +176,19 @@ ipcRenderer.on('data', (event, appData, brandIcons, solidIcons, actualServices,
urlPreview.classList.add('right');
}
});
+
+ // History nav buttons
+ const buttons = {
+ securityButton: securityButton,
+ homeButton: homeButton,
+ backButton: backButton,
+ forwardButton: forwardButton,
+ refreshButton: refreshButton,
+ };
+ for (const k in buttons) {
+ if (config[k]) buttons[k].classList.remove('hidden');
+ else buttons[k].classList.add('hidden');
+ }
});
function removeServiceFeatures(id) {
@@ -364,7 +377,7 @@ function reorderService(serviceId, targetId) {
}
document.addEventListener('DOMContentLoaded', () => {
- statusButton = document.getElementById('status');
+ securityButton = document.getElementById('status');
homeButton = document.getElementById('home');
homeButton.addEventListener('click', () => goHome());
@@ -375,8 +388,8 @@ document.addEventListener('DOMContentLoaded', () => {
backButton = document.getElementById('back');
backButton.addEventListener('click', () => goBack());
- reloadButton = document.getElementById('reload');
- reloadButton.addEventListener('click', () => reload());
+ refreshButton = document.getElementById('reload');
+ refreshButton.addEventListener('click', () => reload());
addButton = document.getElementById('add-button');
addButton.addEventListener('click', () => ipcRenderer.send('openServiceSettings', null));
@@ -607,7 +620,7 @@ function updateNavigation() {
if (view && view.canGoBack()) backButton.classList.remove('disabled');
else backButton.classList.add('disabled');
- reloadButton.classList.remove('disabled');
+ refreshButton.classList.remove('disabled');
updateStatusButton();
}
@@ -618,7 +631,7 @@ function updateNavigation() {
function updateStatusButton() {
let protocol = services[selectedService].view.getURL().split('://')[0];
if (!protocol) protocol = 'unknown';
- for (const c of statusButton.children) {
+ for (const c of securityButton.children) {
if (c.classList.contains(protocol)) c.classList.add('active');
else c.classList.remove('active');
}
diff --git a/resources/js/settings.js b/resources/js/settings.js
index 8827d14..5dbd0ec 100644
--- a/resources/js/settings.js
+++ b/resources/js/settings.js
@@ -4,11 +4,23 @@ let currentVersion;
let updateStatus;
let updateInfo;
let updateButton;
+let config;
+
+let securityButtonField, homeButtonField, backButtonField, forwardButtonField, refreshButtonField;
ipcRenderer.on('current-version', (e, version) => {
currentVersion.innerText = `Version: ${version.version}`;
});
+ipcRenderer.on('config', (e, c) => {
+ config = c;
+ securityButtonField.checked = config.securityButton;
+ homeButtonField.checked = config.homeButton;
+ backButtonField.checked = config.backButton;
+ forwardButtonField.checked = config.forwardButton;
+ refreshButtonField.checked = config.refreshButton;
+});
+
ipcRenderer.on('updateStatus', (e, available, version) => {
console.log(available, version);
updateInfo = version;
@@ -22,6 +34,14 @@ ipcRenderer.on('updateStatus', (e, available, version) => {
function save() {
const formData = new FormData(document.querySelector('form'));
+
+ config.securityButton = formData.get('security-button') === 'on';
+ config.homeButton = formData.get('home-button') === 'on';
+ config.backButton = formData.get('back-button') === 'on';
+ config.forwardButton = formData.get('forward-button') === 'on';
+ config.refreshButton = formData.get('refresh-button') === 'on';
+
+ ipcRenderer.send('save-config', config);
remote.getCurrentWindow().close();
}
@@ -34,6 +54,12 @@ document.addEventListener('DOMContentLoaded', () => {
.catch(console.error);
});
+ securityButtonField = document.getElementById('security-button');
+ homeButtonField = document.getElementById('home-button');
+ backButtonField = document.getElementById('back-button');
+ forwardButtonField = document.getElementById('forward-button');
+ refreshButtonField = document.getElementById('refresh-button');
+
ipcRenderer.send('syncSettings');
ipcRenderer.send('checkForUpdates');
});
\ No newline at end of file
diff --git a/resources/settings.html b/resources/settings.html
index e3dfbf2..c021a9f 100644
--- a/resources/settings.html
+++ b/resources/settings.html
@@ -28,6 +28,19 @@
Loading...