@@ -57,9 +57,11 @@ const replacements = [
5757const assetReplacements = [
5858 { from : branding . faviconIco , to : "src/browser/media/favicon.ico" } ,
5959 { from : branding . faviconSvg , to : "src/browser/media/favicon.svg" } ,
60+ { from : branding . faviconSvg , to : "src/browser/media/favicon-dark-support.svg" } ,
6061 { from : branding . logoSvg , to : "src/browser/media/logo.svg" } ,
6162 { from : branding . pwaIcon192 , to : "src/browser/media/pwa-icon-192.png" } ,
6263 { from : branding . pwaIcon512 , to : "src/browser/media/pwa-icon-512.png" } ,
64+ { from : branding . tileImage , to : "src/browser/media/qbraid-tile.png" } ,
6365]
6466
6567// Directories that might contain prebuilt release artifacts we need to patch in-place.
@@ -81,9 +83,11 @@ function applyBrandingToReleaseArtifacts() {
8183 const relAssetTargets = [
8284 { from : branding . faviconIco , to : "src/browser/media/favicon.ico" } ,
8385 { from : branding . faviconSvg , to : "src/browser/media/favicon.svg" } ,
86+ { from : branding . faviconSvg , to : "src/browser/media/favicon-dark-support.svg" } ,
8487 { from : branding . logoSvg , to : "src/browser/media/logo.svg" } ,
8588 { from : branding . pwaIcon192 , to : "src/browser/media/pwa-icon-192.png" } ,
8689 { from : branding . pwaIcon512 , to : "src/browser/media/pwa-icon-512.png" } ,
90+ { from : branding . tileImage , to : "src/browser/media/qbraid-tile.png" } ,
8791 ]
8892
8993 for ( const asset of relAssetTargets ) {
@@ -106,6 +110,49 @@ function applyBrandingToReleaseArtifacts() {
106110 json . documentationUrl = `https://${ branding . companyDomain } `
107111 json . vendor = branding . companyName
108112 } )
113+
114+ // Patch compiled login.js to change default app-name.
115+ const loginJsPath = path . join ( dir , "out" , "node" , "routes" , "login.js" )
116+ if ( fs . existsSync ( loginJsPath ) ) {
117+ let js = fs . readFileSync ( loginJsPath , "utf8" )
118+ js = js . replace ( / \| \| \s * [ " ' ] c o d e - s e r v e r [ " ' ] / , `|| "${ branding . productName } "` )
119+ fs . writeFileSync ( loginJsPath , js )
120+ }
121+
122+ // Remove or replace Coder promotional link.
123+ const vscodeWebPath = path . join ( dir , "lib" , "vscode" )
124+ if ( fs . existsSync ( vscodeWebPath ) ) {
125+ const grepFiles = ( dirPath ) => {
126+ for ( const entry of fs . readdirSync ( dirPath , { withFileTypes : true } ) ) {
127+ const full = path . join ( dirPath , entry . name )
128+ if ( entry . isDirectory ( ) ) grepFiles ( full )
129+ else if ( entry . isFile ( ) ) {
130+ let content = fs . readFileSync ( full , "utf8" )
131+ if ( content . includes ( "code-server-to-coder" ) ) {
132+ content = content . replace (
133+ / h t t p s ? : \/ \/ [ ^ " ' ] * c o d e - s e r v e r - t o - c o d e r [ ^ " ' ] * / g,
134+ `https://${ branding . companyDomain } ` ,
135+ )
136+ fs . writeFileSync ( full , content )
137+ }
138+ }
139+ }
140+ }
141+ grepFiles ( vscodeWebPath )
142+ }
143+
144+ // Patch Getting Started promotional tile.
145+ const gsJsPath = path . join ( dir , "lib" , "vscode" , "out" , "vs" , "workbench" , "contrib" , "welcomeGettingStarted" , "browser" , "gettingStarted.js" )
146+ if ( fs . existsSync ( gsJsPath ) ) {
147+ let gs = fs . readFileSync ( gsJsPath , "utf8" )
148+ gs = gs
149+ . replace ( / h t t p s ? : \\ / \\/ [ ^ "']*code-server-to-coder[^" ']*/g, "https://" + branding.companyDomain + "/home/introduction")
150+ . replace ( / D e p l o y c o d e - s e r v e r f o r y o u r t e a m / g, "Learn more about qBraid" )
151+ . replace ( / P r o v i s i o n s o f t w a r e d e v e l o p m e n t e n v i r o n m e n t s o n y o u r i n f r a s t r u c t u r e w i t h C o d e r \. / g, "Discover the qBraid quantum development platform." )
152+ . replace ( / C o d e r i s a s e l f - s e r v i c e p o r t a l [ ^ " ' ] * \. / g, "qBraid provides managed quantum environments in the cloud." )
153+ . replace ( / s r c : ' \. \/ _ s t a t i c \/ s r c \/ b r o w s e r \/ m e d i a \/ t e m p l a t e s .p n g ' / g, "src: './_static/src/browser/media/qbraid-tile.png'" )
154+ fs . writeFileSync ( gsJsPath , gs )
155+ }
109156 }
110157}
111158
0 commit comments