File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,24 @@ export class Browser extends StatefulClass {
7676 } else {
7777 tab . title = "New Tab" ;
7878 }
79+ const favicon = framedoc . querySelector (
80+ "link[rel='icon'], link[rel='shortcut icon']"
81+ ) ;
82+ if ( favicon ) {
83+ const iconhref = favicon . getAttribute ( "href" ) ;
84+ if ( iconhref ) {
85+ const rewritten = scramjet . encodeUrl (
86+ new URL ( iconhref , frame . client . url )
87+ ) ;
88+ tab . icon = rewritten ;
89+ } else {
90+ tab . icon = "/vite.svg" ;
91+ }
92+ } else {
93+ tab . icon = scramjet . encodeUrl (
94+ new URL ( "/favicon.ico" , frame . client . url )
95+ ) ;
96+ }
7997 } ) ;
8098 observer . observe ( head , {
8199 childList : true ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const scramjet = new ScramjetController({
2222 naiiveRewriter : false ,
2323 } ,
2424 siteFlags : {
25- "https://www.google.com/.*" : {
25+ "https://www.google.com/(search|sorry) .*" : {
2626 naiiveRewriter : true ,
2727 } ,
2828 "https://worker-playground.glitch.me/.*" : {
Original file line number Diff line number Diff line change @@ -168,13 +168,15 @@ export class Tab {
168168
169169 width : number ;
170170 pos : number ;
171+ icon : string ;
171172
172173 constructor ( title : string , frame : ScramjetFrame ) {
173174 return createState ( {
174175 id : id ++ ,
175176 frame,
176177 title,
177178 url : "puter://blank" ,
179+ icon : "/vite.svg" ,
178180 dragoffset : - 1 ,
179181 dragpos : - 1 ,
180182 width : 0 ,
@@ -361,8 +363,8 @@ export const Tabs: Component<
361363 { use ( this . tabs ) . mapEach ( ( tab ) => (
362364 < DragTab
363365 id = { tab . id }
364- title = { tab . title }
365- icon = "/vite.svg"
366+ title = { use ( tab . title ) }
367+ icon = { use ( tab . icon ) }
366368 active = { use ( this . activetab ) . map ( ( x ) => x === tab ) }
367369 mousedown = { ( e ) => mouseDown ( e , tab ) }
368370 click = { ( ) => {
You can’t perform that action at this time.
0 commit comments