Use default Wails asset handler + GetStoredConfig binding
- Remove custom asset handler — it broke Wails IPC routing - Use application.AssetFileServerFS(distFS) so Wails serves its own runtime - Add GetStoredConfig binding: SPA calls it on startup to retrieve keychain config - main.ts: loadDesktopConfig() fetches stored creds before mounting - Remove runtime.js embed (Wails serves it internally)
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
import { mount } from 'svelte'
|
||||
import App from './App.svelte'
|
||||
import './app.css'
|
||||
import { initConfig } from '$lib/config'
|
||||
import { initConfig, setConfig } from '$lib/config'
|
||||
|
||||
initConfig()
|
||||
async function loadDesktopConfig() {
|
||||
const wails = (window as any).wails
|
||||
if (!wails?.Call?.ByName) return
|
||||
|
||||
requestAnimationFrame(() => import('./lib/renderers'))
|
||||
try {
|
||||
const cfg = await wails.Call.ByName('GetStoredConfig')
|
||||
if (cfg?.apiUrl && cfg?.token) {
|
||||
setConfig({ apiUrl: cfg.apiUrl, token: cfg.token, isDesktop: true })
|
||||
}
|
||||
} catch {
|
||||
// no stored config — Config page will handle it
|
||||
}
|
||||
}
|
||||
|
||||
const app = mount(App, { target: document.getElementById('app')! })
|
||||
export default app
|
||||
async function start() {
|
||||
initConfig()
|
||||
await loadDesktopConfig()
|
||||
|
||||
requestAnimationFrame(() => import('./lib/renderers'))
|
||||
|
||||
mount(App, { target: document.getElementById('app')! })
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
Reference in New Issue
Block a user