Add auto-update and display scale features

Integrates electron-updater for automatic app updates, including IPC and renderer APIs for update status and controls. Adds display scale (zoom) setting to settings UI, persists user preference in localStorage, and applies it on startup. Updates OAuth popup allowlist logic and upgrades Electron to v39.2.7.
This commit is contained in:
2025-12-27 22:23:14 +13:00
parent c864ca187c
commit 43ebed0ade
7 changed files with 320 additions and 29 deletions
+18
View File
@@ -1098,6 +1098,24 @@ window.addEventListener('DOMContentLoaded', () => {
console.error('Error applying saved theme:', err);
}
}
// Initialize display scale (zoom) from localStorage
const savedDisplayScale = localStorage.getItem('nebula-display-scale');
if (savedDisplayScale) {
try {
const scale = Number(savedDisplayScale);
if (scale > 0 && scale <= 300) {
const zoomFactor = scale / 100;
if (ipcRenderer && typeof ipcRenderer.invoke === 'function') {
ipcRenderer.invoke('set-zoom-factor', zoomFactor).catch(err => {
console.error('Error setting zoom factor:', err);
});
}
}
} catch (err) {
console.error('Error applying saved display scale:', err);
}
}
// Initial boot
createTab();
+12
View File
@@ -105,6 +105,18 @@
</div>
</div>
<!-- Display Scale -->
<div class="customization-group">
<h3>Display Scale</h3>
<div style="display: flex; flex-direction: column; gap: 12px;">
<div style="display: flex; align-items: center; gap: 12px;">
<input type="range" id="display-scale-slider" min="50" max="300" value="100" step="10" style="flex: 1; cursor: pointer;">
<span id="display-scale-value" style="min-width: 50px; text-align: right; font-weight: bold;">100%</span>
</div>
<p class="note">Adjust the default display scale (zoom) when opening the browser. Requires reload to take effect.</p>
</div>
</div>
<!-- Color Customization -->
<div class="customization-group">
<h3>Custom Colors</h3>
+22
View File
@@ -11,6 +11,7 @@ const WEATHER_UNIT_KEY = 'nebula-weather-unit'; // 'auto' | 'c' | 'f'
const HOME_SEARCH_Y_KEY = 'nebula-home-search-y'; // number (vh)
const HOME_BOOKMARKS_Y_KEY = 'nebula-home-bookmarks-y'; // number (vh)
const HOME_GLANCE_CORNER_KEY = 'nebula-home-glance-corner'; // 'br'|'bl'|'tr'|'tl'
const DISPLAY_SCALE_KEY = 'nebula-display-scale'; // number (50-300)
function showStatus(message) {
if (statusText && statusDiv) {
@@ -167,6 +168,27 @@ window.addEventListener('DOMContentLoaded', () => {
notify();
}));
} catch (e) { console.warn('Home layout control setup failed', e); }
// Display scale controls
try {
const scaleSlider = document.getElementById('display-scale-slider');
const scaleValue = document.getElementById('display-scale-value');
const initScale = Number(localStorage.getItem(DISPLAY_SCALE_KEY) || 100);
if (scaleSlider) {
scaleSlider.value = String(initScale);
if (scaleValue) scaleValue.textContent = initScale + '%';
}
if (scaleSlider) {
scaleSlider.addEventListener('input', () => {
const val = Number(scaleSlider.value);
if (scaleValue) scaleValue.textContent = val + '%';
localStorage.setItem(DISPLAY_SCALE_KEY, String(val));
showStatus(`Display scale set to ${val}%`);
});
}
} catch (e) { console.warn('Display scale setup failed', e); }
});
// Tabs: simple controller