@@ -301,11 +301,25 @@ describe("HttpApi UI fallback", () => {
301301 expect ( response . status ) . toBe ( 404 )
302302 } )
303303
304- test ( "requires server password for the web UI" , async ( ) => {
304+ test ( "serves the web UI shell without auth even when a server password is set " , async ( ) => {
305305 Flag . OPENCODE_EXPERIMENTAL_HTTPAPI = true
306306 Flag . OPENCODE_DISABLE_EMBEDDED_WEB_UI = true
307307
308- const response = await uiApp ( { password : "secret" , username : "opencode" } ) . request ( "/" )
308+ const response = await uiApp ( {
309+ password : "secret" ,
310+ username : "opencode" ,
311+ client : httpClient ( new Response ( "<html>opencode</html>" , { headers : { "content-type" : "text/html" } } ) ) ,
312+ } ) . request ( "/" )
313+
314+ expect ( response . status ) . toBe ( 200 )
315+ expect ( await response . text ( ) ) . toBe ( "<html>opencode</html>" )
316+ } )
317+
318+ test ( "keeps non-public UI fallback paths protected without auth" , async ( ) => {
319+ Flag . OPENCODE_EXPERIMENTAL_HTTPAPI = true
320+ Flag . OPENCODE_DISABLE_EMBEDDED_WEB_UI = true
321+
322+ const response = await uiApp ( { password : "secret" , username : "opencode" } ) . request ( "/session" )
309323
310324 expect ( response . status ) . toBe ( 401 )
311325 expect ( response . headers . get ( "www-authenticate" ) ) . toBe ( 'Basic realm="Secure Area"' )
@@ -336,16 +350,16 @@ describe("HttpApi UI fallback", () => {
336350 expect ( response . status ) . toBe ( 200 )
337351 } )
338352
339- // Regression for #25698 (Ope): the browser fetches the PWA manifest and
340- // its icons via flows that don't carry app-managed credentials (the
341- // `<link rel="manifest">` request is not under page-auth control), so the
342- // server returning 401 breaks PWA install. These specific public assets
343- // should bypass auth.
344- test ( "serves the PWA manifest without auth even when a server password is set" , async ( ) => {
353+ test ( "serves public UI assets without auth even when a server password is set" , async ( ) => {
345354 Flag . OPENCODE_EXPERIMENTAL_HTTPAPI = true
346355 Flag . OPENCODE_DISABLE_EMBEDDED_WEB_UI = true
347356
348- for ( const path of [ "/site.webmanifest" , "/web-app-manifest-192x192.png" , "/web-app-manifest-512x512.png" ] ) {
357+ for ( const path of [
358+ "/assets/app.js" ,
359+ "/site.webmanifest" ,
360+ "/web-app-manifest-192x192.png" ,
361+ "/web-app-manifest-512x512.png" ,
362+ ] ) {
349363 const response = await uiApp ( {
350364 password : "secret" ,
351365 username : "opencode" ,
0 commit comments