Skip to content

Commit 055e564

Browse files
author
FileShot
committed
fix: load live site by default and wire Go Online
1 parent 33d0a32 commit 055e564

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

main.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,11 @@ function createWindow() {
166166
autoHideMenuBar: true
167167
});
168168

169-
// v1.2+: Local-first UI is the default.
170-
// "Go Online" explicitly loads the hosted web app.
171-
try {
172-
mainWindow.loadFile(LOCAL_UI_INDEX);
173-
} catch (e) {
174-
console.error('[FileShot] Failed to load local UI, falling back:', e);
175-
loadFrontend({ preferredPath: '/', reason: 'startup-fallback' }).catch(() => {});
176-
}
169+
// Primary behavior: load the live cloud app first.
170+
// If offline/unreachable, load bundled/offline fallbacks inside loadFrontend.
171+
loadFrontend({ preferredPath: '/', reason: 'startup' }).catch((e) => {
172+
console.error('[FileShot] Failed initial load, will rely on fallback handler', e);
173+
});
177174

178175
if (isDev) {
179176
console.log('[FileShot] Development mode enabled');

renderer/local/app.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DOM = {
2828
sidebar: () => document.getElementById('sidebar'),
2929
btnCollapse: () => document.getElementById('btnCollapse'),
3030
navItems: () => document.querySelectorAll('.nav-item'),
31+
goOnlineBtn: () => document.getElementById('btnGoOnline'),
3132

3233
// Main content
3334
topbarLeft: () => document.querySelector('.topbar-left'),
@@ -86,6 +87,7 @@ function fmtBytes(n) {
8687

8788
window.addEventListener('DOMContentLoaded', () => {
8889
initSidebar();
90+
initGoOnline();
8991
initDropZone();
9092
initToolPanels();
9193
initVaultTool();
@@ -103,6 +105,14 @@ window.addEventListener('DOMContentLoaded', () => {
103105

104106
function initSidebar() {
105107
DOM.btnCollapse().addEventListener('click', toggleSidebar);
108+
109+
// Hide unfinished tools to avoid placeholders
110+
['pdf', 'image', 'text'].forEach(tool => {
111+
const nav = document.querySelector(`.nav-item[data-tool="${tool}"]`);
112+
const panel = DOM.toolPanel(tool);
113+
if (nav) nav.style.display = 'none';
114+
if (panel) panel.hidden = true;
115+
});
106116

107117
DOM.navItems().forEach(item => {
108118
item.addEventListener('click', (e) => {
@@ -112,6 +122,20 @@ function initSidebar() {
112122
});
113123
}
114124

125+
function initGoOnline() {
126+
const btn = DOM.goOnlineBtn();
127+
if (!btn || !window.electronAPI || typeof window.electronAPI.goOnline !== 'function') return;
128+
129+
btn.addEventListener('click', async () => {
130+
btn.disabled = true;
131+
try {
132+
await window.electronAPI.goOnline();
133+
} finally {
134+
btn.disabled = false;
135+
}
136+
});
137+
}
138+
115139
function toggleSidebar() {
116140
state.sidebarCollapsed = !state.sidebarCollapsed;
117141
DOM.sidebar().classList.toggle('collapsed', state.sidebarCollapsed);

0 commit comments

Comments
 (0)