File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,21 @@ async function loadFrontend({ preferredPath = '/', reason = '' } = {}) {
106106
107107 const safePath = String ( preferredPath || '/' ) . startsWith ( '/' ) ? String ( preferredPath || '/' ) : '/' ;
108108
109+ // Load the local desktop UI with sidebar + file explorer connected to live API
110+ const localUIUrl = `file://${ LOCAL_UI_INDEX } ` ;
111+ console . log ( '[FileShot] Loading desktop UI:' , localUIUrl , reason ? `(${ reason } )` : '' ) ;
112+ await mainWindow . loadFile ( LOCAL_UI_INDEX ) ;
113+ mainWindow . webContents . on ( 'did-finish-load' , ( ) => {
114+ mainWindow . webContents . send ( 'api-config' , { apiUrl : API_URL } ) ;
115+ } ) ;
116+ return ;
117+ }
118+
119+ async function loadFrontendFallback ( { preferredPath = '/' , reason = '' } = { } ) {
120+ if ( ! mainWindow ) return ;
121+
122+ const safePath = String ( preferredPath || '/' ) . startsWith ( '/' ) ? String ( preferredPath || '/' ) : '/' ;
123+
109124 // Dev: always use local dev server.
110125 if ( isDev ) {
111126 const url = `http://localhost:8080${ safePath } ` ;
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ const { contextBridge, ipcRenderer } = require('electron');
88contextBridge . exposeInMainWorld ( 'electronAPI' , {
99 // API configuration
1010 getApiUrl : ( ) => ipcRenderer . invoke ( 'get-api-url' ) ,
11+ onApiConfig : ( callback ) => {
12+ ipcRenderer . on ( 'api-config' , ( _event , config ) => {
13+ try { callback ( config ) ; } catch ( _ ) { }
14+ } ) ;
15+ } ,
1116
1217 // Authentication
1318 getAuthToken : ( ) => ipcRenderer . invoke ( 'get-auth-token' ) ,
Original file line number Diff line number Diff line change 11/**
2- * FileShot Offline Desktop App - Main Application Logic
3- * Handles sidebar navigation, drag-drop, storage management, and secure shredding
2+ * FileShot Desktop App - Hybrid UI
3+ * Local sidebar + file explorer connected to live API
44 */
55
6+ // ============================================================================
7+ // API CONFIGURATION
8+ // ============================================================================
9+
10+ let API_URL = 'https://api.fileshot.io/api' ; // Default to live API
11+
12+ // Receive API config from main process
13+ if ( window . electronAPI ) {
14+ window . electronAPI . onApiConfig ?. ( ( config ) => {
15+ API_URL = config . apiUrl ;
16+ console . log ( '[FileShot Desktop] API configured:' , API_URL ) ;
17+ } ) ;
18+ }
19+
620// ============================================================================
721// STATE MANAGEMENT
822// ============================================================================
@@ -16,7 +30,9 @@ const state = {
1630 settings : {
1731 autoLock : false ,
1832 requirePin : false
19- }
33+ } ,
34+ authToken : localStorage . getItem ( 'fileshot_token' ) || null ,
35+ userId : localStorage . getItem ( 'fileshot_userId' ) || null
2036} ;
2137
2238// ============================================================================
You can’t perform that action at this time.
0 commit comments