Skip to content

Commit 9bf53dc

Browse files
committed
CI fixes
1 parent dceb0a6 commit 9bf53dc

File tree

8 files changed

+43
-34
lines changed

8 files changed

+43
-34
lines changed

docs/FAQ.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ You can change the config file's location using the `--config` flag or
8181

8282
The default location respects `$XDG_CONFIG_HOME`.
8383

84-
8584
## How do I make my keyboard shortcuts work?
8685

8786
Many shortcuts will not work by default, since they'll be "caught" by the browser.

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ code-server.
6161
We also have an in-depth [setup and
6262
configuration](https://coder.com/docs/code-server/latest/guide) guide.
6363

64-
6564
## Questions?
6665

6766
See answers to [frequently asked

docs/guide.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
- [Proxying to a Svelte app](#proxying-to-a-svelte-app)
2323
- [Prefixing `/absproxy/<port>` with a path](#prefixing-absproxyport-with-a-path)
2424
- [Preflight requests](#preflight-requests)
25+
- [Internationalization and customization](#internationalization-and-customization)
26+
- [Available keys and placeholders](#available-keys-and-placeholders)
27+
- [Legacy flag](#legacy-flag)
2528

2629
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2730
<!-- prettier-ignore-end -->
@@ -468,7 +471,7 @@ Create a JSON file with your custom strings:
468471
```json
469472
{
470473
"WELCOME": "Welcome to {{app}}",
471-
"LOGIN_TITLE": "{{app}} Access Portal",
474+
"LOGIN_TITLE": "{{app}} Access Portal",
472475
"LOGIN_BELOW": "Please log in to continue",
473476
"PASSWORD_PLACEHOLDER": "Enter Password"
474477
}

docs/install.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ docker run -it --name code-server -p 127.0.0.1:8080:8080 \
287287
codercom/code-server:latest
288288
```
289289

290-
291290
Our official image supports `amd64` and `arm64`. For `arm32` support, you can
292291
use a [community-maintained code-server
293292
alternative](https://hub.docker.com/r/linuxserver/code-server).

src/node/cli.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ export const options: Options<Required<UserProvidedArgs>> = {
285285
"app-name": {
286286
type: "string",
287287
short: "an",
288-
description: "Will replace the {{app}} placeholder in any strings, which by default includes the title bar and welcome message",
288+
description:
289+
"Will replace the {{app}} placeholder in any strings, which by default includes the title bar and welcome message",
289290
},
290291
"welcome-text": {
291292
type: "string",
@@ -465,7 +466,6 @@ export const parse = (
465466
throw new Error("--cert-key is missing")
466467
}
467468

468-
469469
logger.debug(() => [`parsed ${opts?.configFile ? "config" : "command line"}`, field("args", redactArgs(args))])
470470

471471
return args
@@ -600,7 +600,6 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
600600
args["disable-proxy"] = true
601601
}
602602

603-
604603
const usingEnvHashedPassword = !!process.env.HASHED_PASSWORD
605604
if (process.env.HASHED_PASSWORD) {
606605
args["hashed-password"] = process.env.HASHED_PASSWORD

src/node/i18n/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const defaultResources = {
2424
},
2525
}
2626

27-
2827
export async function loadCustomStrings(filePath: string): Promise<void> {
2928
try {
3029
// Read custom strings from file path only
@@ -36,12 +35,14 @@ export async function loadCustomStrings(filePath: string): Promise<void> {
3635
i18next.addResourceBundle(locale, "translation", customStringsData)
3736
})
3837
} catch (error) {
39-
if (error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT') {
38+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
4039
throw new Error(`Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable.`)
4140
} else if (error instanceof SyntaxError) {
4241
throw new Error(`Invalid JSON in custom strings file: ${filePath}\n${error.message}`)
4342
} else {
44-
throw new Error(`Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`)
43+
throw new Error(
44+
`Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
45+
)
4546
}
4647
}
4748
}

test/unit/node/i18n.test.ts

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ describe("i18n", () => {
1212
beforeEach(async () => {
1313
// Create temporary directory for test files
1414
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "code-server-i18n-test-"))
15-
15+
1616
// Create test files
1717
validJsonFile = path.join(tempDir, "valid.json")
1818
invalidJsonFile = path.join(tempDir, "invalid.json")
1919
nonExistentFile = path.join(tempDir, "does-not-exist.json")
2020

2121
// Write valid JSON file
22-
await fs.writeFile(validJsonFile, JSON.stringify({
23-
"WELCOME": "Custom Welcome",
24-
"LOGIN_TITLE": "My Custom App",
25-
"LOGIN_BELOW": "Please log in to continue"
26-
}))
22+
await fs.writeFile(
23+
validJsonFile,
24+
JSON.stringify({
25+
WELCOME: "Custom Welcome",
26+
LOGIN_TITLE: "My Custom App",
27+
LOGIN_BELOW: "Please log in to continue",
28+
}),
29+
)
2730

2831
// Write invalid JSON file
2932
await fs.writeFile(invalidJsonFile, '{"WELCOME": "Missing closing quote}')
@@ -42,44 +45,51 @@ describe("i18n", () => {
4245

4346
it("should throw clear error for non-existent file", async () => {
4447
await expect(loadCustomStrings(nonExistentFile)).rejects.toThrow(
45-
`Custom strings file not found: ${nonExistentFile}\nPlease ensure the file exists and is readable.`
48+
`Custom strings file not found: ${nonExistentFile}\nPlease ensure the file exists and is readable.`,
4649
)
4750
})
4851

4952
it("should throw clear error for invalid JSON", async () => {
5053
await expect(loadCustomStrings(invalidJsonFile)).rejects.toThrow(
51-
`Invalid JSON in custom strings file: ${invalidJsonFile}`
54+
`Invalid JSON in custom strings file: ${invalidJsonFile}`,
5255
)
5356
})
5457

5558
it("should handle empty JSON object", async () => {
5659
const emptyJsonFile = path.join(tempDir, "empty.json")
5760
await fs.writeFile(emptyJsonFile, "{}")
58-
61+
5962
await expect(loadCustomStrings(emptyJsonFile)).resolves.toBeUndefined()
6063
})
6164

6265
it("should handle nested JSON objects", async () => {
6366
const nestedJsonFile = path.join(tempDir, "nested.json")
64-
await fs.writeFile(nestedJsonFile, JSON.stringify({
65-
"WELCOME": "Hello World",
66-
"NESTED": {
67-
"KEY": "Value"
68-
}
69-
}))
70-
67+
await fs.writeFile(
68+
nestedJsonFile,
69+
JSON.stringify({
70+
WELCOME: "Hello World",
71+
NESTED: {
72+
KEY: "Value",
73+
},
74+
}),
75+
)
76+
7177
await expect(loadCustomStrings(nestedJsonFile)).resolves.toBeUndefined()
7278
})
7379

7480
it("should handle special characters and unicode", async () => {
7581
const unicodeJsonFile = path.join(tempDir, "unicode.json")
76-
await fs.writeFile(unicodeJsonFile, JSON.stringify({
77-
"WELCOME": "欢迎来到 code-server",
78-
"LOGIN_TITLE": "Willkommen bei {{app}}",
79-
"SPECIAL": "Special chars: àáâãäåæçèéêë 🚀 ♠️ ∆"
80-
}), "utf8")
81-
82+
await fs.writeFile(
83+
unicodeJsonFile,
84+
JSON.stringify({
85+
WELCOME: "欢迎来到 code-server",
86+
LOGIN_TITLE: "Willkommen bei {{app}}",
87+
SPECIAL: "Special chars: àáâãäåæçèéêë 🚀 ♠️ ∆",
88+
}),
89+
"utf8",
90+
)
91+
8292
await expect(loadCustomStrings(unicodeJsonFile)).resolves.toBeUndefined()
8393
})
8494
})
85-
})
95+
})

test/unit/node/routes/login.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,5 @@ describe("login", () => {
146146
expect(resp.status).toBe(200)
147147
expect(htmlContent).toContain(`欢迎来到 code-server`)
148148
})
149-
150149
})
151150
})

0 commit comments

Comments
 (0)