File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 10
10
http-equiv ="Content-Security-Policy "
11
11
content ="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:; "
12
12
/>
13
- < title > code-server login</ title >
13
+ < title > {{APP_NAME}} login</ title >
14
14
< link rel ="icon " href ="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg " />
15
15
< link rel ="alternate icon " href ="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico " />
16
16
< link rel ="manifest " href ="{{BASE}}/manifest.json " crossorigin ="use-credentials " />
24
24
< div class ="center-container ">
25
25
< div class ="card-box ">
26
26
< div class ="header ">
27
- < h1 class ="main "> Welcome to code-server </ h1 >
27
+ < h1 class ="main "> {{WELCOME_TEXT}} </ h1 >
28
28
< div class ="sub "> Please log in below. {{PASSWORD_MSG}}</ div >
29
29
</ div >
30
30
< div class ="content ">
Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ export interface UserProvidedArgs extends UserProvidedCodeArgs {
84
84
"ignore-last-opened" ?: boolean
85
85
link ?: OptionalString
86
86
verbose ?: boolean
87
+ "app-name" ?: string
88
+ "welcome-text" ?: string
87
89
/* Positional arguments. */
88
90
_ ?: string [ ]
89
91
}
@@ -233,7 +235,16 @@ export const options: Options<Required<UserProvidedArgs>> = {
233
235
234
236
log : { type : LogLevel } ,
235
237
verbose : { type : "boolean" , short : "vvv" , description : "Enable verbose logging." } ,
236
-
238
+ "app-name" : {
239
+ type : "string" ,
240
+ short : "an" ,
241
+ description : "The name to use in branding. Will be shown in titlebar and welcome message" ,
242
+ } ,
243
+ "welcome-text" : {
244
+ type : "string" ,
245
+ short : "w" ,
246
+ description : "Text to show on login page" ,
247
+ } ,
237
248
link : {
238
249
type : OptionalString ,
239
250
description : `
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ export class RateLimiter {
28
28
29
29
const getRoot = async ( req : Request , error ?: Error ) : Promise < string > => {
30
30
const content = await fs . readFile ( path . join ( rootPath , "src/browser/pages/login.html" ) , "utf8" )
31
+ const appName = req . args [ "app-name" ] || "code-server"
32
+ const welcomeText = req . args [ "welcome-text" ] || `Welcome to ${ appName } `
31
33
let passwordMsg = `Check the config file at ${ humanPath ( os . homedir ( ) , req . args . config ) } for the password.`
32
34
if ( req . args . usingEnvPassword ) {
33
35
passwordMsg = "Password was set from $PASSWORD."
@@ -38,6 +40,8 @@ const getRoot = async (req: Request, error?: Error): Promise<string> => {
38
40
return replaceTemplates (
39
41
req ,
40
42
content
43
+ . replace ( / { { APP_ N A M E } } / g, appName )
44
+ . replace ( / { { WELCOME_ T E X T } } / g, welcomeText )
41
45
. replace ( / { { PASSWORD_ M S G } } / g, passwordMsg )
42
46
. replace ( / { { ERROR} } / , error ? `<div class="error">${ escapeHtml ( error . message ) } </div>` : "" ) ,
43
47
)
You can’t perform that action at this time.
0 commit comments