@@ -20,7 +20,6 @@ import { createEffect, createResource, onCleanup, onMount, Show } from "solid-js
2020import { render } from "solid-js/web"
2121import pkg from "../../package.json"
2222import { initI18n , t } from "./i18n"
23- import { UPDATER_ENABLED } from "./updater"
2423import { webviewZoom } from "./webview-zoom"
2524import "./styles.css"
2625import { useTheme } from "@opencode-ai/ui/theme"
@@ -43,8 +42,7 @@ const emitDeepLinks = (urls: string[]) => {
4342}
4443
4544const listenForDeepLinks = ( ) => {
46- const startUrls = window . __OPENCODE__ ?. deepLinks ?? [ ]
47- if ( startUrls . length ) emitDeepLinks ( startUrls )
45+ void window . api . consumeInitialDeepLinks ( ) . then ( ( urls ) => emitDeepLinks ( urls ) )
4846 return window . api . onDeepLink ( ( urls ) => emitDeepLinks ( urls ) )
4947}
5048
@@ -57,13 +55,18 @@ const createPlatform = (): Platform => {
5755 return undefined
5856 } ) ( )
5957
58+ const isWslEnabled = async ( ) => {
59+ if ( os !== "windows" ) return false
60+ return window . api . getWslConfig ( ) . then ( ( config ) => config . enabled ) . catch ( ( ) => false )
61+ }
62+
6063 const wslHome = async ( ) => {
61- if ( os !== "windows" || ! window . __OPENCODE__ ?. wsl ) return undefined
64+ if ( ! ( await isWslEnabled ( ) ) ) return undefined
6265 return window . api . wslPath ( "~" , "windows" ) . catch ( ( ) => undefined )
6366 }
6467
6568 const handleWslPicker = async < T extends string | string [ ] > ( result : T | null ) : Promise < T | null > => {
66- if ( ! result || ! window . __OPENCODE__ ?. wsl ) return result
69+ if ( ! result || ! ( await isWslEnabled ( ) ) ) return result
6770 if ( Array . isArray ( result ) ) {
6871 return Promise . all ( result . map ( ( path ) => window . api . wslPath ( path , "linux" ) . catch ( ( ) => path ) ) ) as any
6972 }
@@ -137,7 +140,7 @@ const createPlatform = (): Platform => {
137140 if ( os === "windows" ) {
138141 const resolvedApp = app ? await window . api . resolveAppPath ( app ) . catch ( ( ) => null ) : null
139142 const resolvedPath = await ( async ( ) => {
140- if ( window . __OPENCODE__ ?. wsl ) {
143+ if ( await isWslEnabled ( ) ) {
141144 const converted = await window . api . wslPath ( path , "windows" ) . catch ( ( ) => null )
142145 if ( converted ) return converted
143146 }
@@ -159,12 +162,14 @@ const createPlatform = (): Platform => {
159162 storage,
160163
161164 checkUpdate : async ( ) => {
162- if ( ! UPDATER_ENABLED ( ) ) return { updateAvailable : false }
165+ const config = await window . api . getWindowConfig ( ) . catch ( ( ) => ( { updaterEnabled : false } ) )
166+ if ( ! config . updaterEnabled ) return { updateAvailable : false }
163167 return window . api . checkUpdate ( )
164168 } ,
165169
166170 update : async ( ) => {
167- if ( ! UPDATER_ENABLED ( ) ) return
171+ const config = await window . api . getWindowConfig ( ) . catch ( ( ) => ( { updaterEnabled : false } ) )
172+ if ( ! config . updaterEnabled ) return
168173 await window . api . installUpdate ( )
169174 } ,
170175
@@ -194,11 +199,7 @@ const createPlatform = (): Platform => {
194199 return fetch ( input , init )
195200 } ,
196201
197- getWslEnabled : async ( ) => {
198- const next = await window . api . getWslConfig ( ) . catch ( ( ) => null )
199- if ( next ) return next . enabled
200- return window . __OPENCODE__ ! . wsl ?? false
201- } ,
202+ getWslEnabled : ( ) => isWslEnabled ( ) ,
202203
203204 setWslEnabled : async ( enabled ) => {
204205 await window . api . setWslConfig ( { enabled } )
@@ -249,6 +250,7 @@ listenForDeepLinks()
249250
250251render ( ( ) => {
251252 const platform = createPlatform ( )
253+ const [ windowConfig ] = createResource ( ( ) => window . api . getWindowConfig ( ) . catch ( ( ) => ( { updaterEnabled : false } ) ) )
252254 const loadLocale = async ( ) => {
253255 const current = await platform . storage ?.( "opencode.global.dat" ) . getItem ( "language" )
254256 const legacy = current ? undefined : await platform . storage ?.( ) . getItem ( "language.v1" )
@@ -325,7 +327,7 @@ render(() => {
325327 return (
326328 < PlatformProvider value = { platform } >
327329 < AppBaseProviders locale = { locale . latest } >
328- < Show when = { ! defaultServer . loading && ! sidecar . loading && ! windowCount . loading && ! locale . loading } >
330+ < Show when = { ! defaultServer . loading && ! sidecar . loading && ! windowConfig . loading && ! windowCount . loading && ! locale . loading } >
329331 { ( _ ) => {
330332 return (
331333 < AppInterface
0 commit comments