diff --git a/lib/vscode b/lib/vscode index 0870c2a0c..ce099c1ed 160000 --- a/lib/vscode +++ b/lib/vscode @@ -1 +1 @@ -Subproject commit 0870c2a0c7c0564e7631bfed2675573a94ba4455 +Subproject commit ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb diff --git a/package.json b/package.json index 4be33a777..a64d736d3 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "express": "^5.0.1", "http-proxy": "^1.18.1", "httpolyglot": "^0.1.2", - "i18next": "^25.3.0", + "i18next": "^25.8.3", "js-yaml": "^4.1.0", "limiter": "^2.1.0", "pem": "^1.14.8", diff --git a/patches/fix-build.diff b/patches/fix-build.diff index 38befaace..436e488c5 100644 --- a/patches/fix-build.diff +++ b/patches/fix-build.diff @@ -14,7 +14,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/ch =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.ts -@@ -301,7 +301,7 @@ export class ChatDebugEditor extends Edi +@@ -303,7 +303,7 @@ export class ChatDebugEditor extends Edi } } diff --git a/patches/local-storage.diff b/patches/local-storage.diff index 65e1c81bd..6c8423f33 100644 --- a/patches/local-storage.diff +++ b/patches/local-storage.diff @@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/configuration/browser/co }); })); -@@ -555,6 +557,12 @@ export class WorkspaceService extends Di +@@ -559,6 +561,12 @@ export class WorkspaceService extends Di previousFolders = this.workspace.folders; this.workspace.update(workspace); } else { diff --git a/src/browser/pages/error.html b/src/browser/pages/error.html index b3ad56757..f44df0539 100644 --- a/src/browser/pages/error.html +++ b/src/browser/pages/error.html @@ -11,7 +11,7 @@ content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> - {{ERROR_TITLE}} - code-server + {{ERROR_TITLE}} - {{APP_NAME}} diff --git a/src/node/cli.ts b/src/node/cli.ts index 7e4674eaa..8b1c9bfd7 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -519,6 +519,7 @@ export interface DefaultedArgs extends ConfigArgs { "extensions-dir": string "user-data-dir": string "session-socket": string + "app-name": string /* Positional arguments. */ _: string[] } @@ -665,6 +666,10 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config } args["proxy-domain"] = finalProxies + if (!args["app-name"]) { + args["app-name"] = "code-server" + } + args._ = getResolvedPathsFromArgs(args) return { diff --git a/src/node/i18n/index.ts b/src/node/i18n/index.ts index e8186067b..a7f9f17bc 100644 --- a/src/node/i18n/index.ts +++ b/src/node/i18n/index.ts @@ -54,6 +54,7 @@ init({ lowerCaseLng: true, debug: process.env.NODE_ENV === "development", resources: defaultResources, + showSupportNotice: false, }) export default i18next diff --git a/src/node/routes/errors.ts b/src/node/routes/errors.ts index c1439d6ad..47286210a 100644 --- a/src/node/routes/errors.ts +++ b/src/node/routes/errors.ts @@ -57,7 +57,8 @@ export const errorHandler: express.ErrorRequestHandler = async (err, req, res, n replaceTemplates(req, content) .replace(/{{ERROR_TITLE}}/g, statusCode.toString()) .replace(/{{ERROR_HEADER}}/g, statusCode.toString()) - .replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)), + .replace(/{{ERROR_BODY}}/g, escapeHtml(err.message)) + .replace(/{{APP_NAME}}/g, req.args["app-name"]), ) } else { res.json({ diff --git a/src/node/routes/login.ts b/src/node/routes/login.ts index db4d1c45d..6d9f33161 100644 --- a/src/node/routes/login.ts +++ b/src/node/routes/login.ts @@ -29,8 +29,7 @@ const getRoot = async (req: Request, error?: Error): Promise => { const content = await fs.readFile(path.join(rootPath, "src/browser/pages/login.html"), "utf8") const locale = req.args["locale"] || "en" i18n.changeLanguage(locale) - const appName = req.args["app-name"] || "code-server" - const welcomeText = req.args["welcome-text"] || (i18n.t("WELCOME", { app: appName }) as string) + const welcomeText = req.args["welcome-text"] || (i18n.t("WELCOME", { app: req.args["app-name"] }) as string) // Determine password message using i18n let passwordMsg = i18n.t("LOGIN_PASSWORD", { configFile: req.args.config }) @@ -43,7 +42,7 @@ const getRoot = async (req: Request, error?: Error): Promise => { return replaceTemplates( req, content - .replace(/{{I18N_LOGIN_TITLE}}/g, i18n.t("LOGIN_TITLE", { app: appName })) + .replace(/{{I18N_LOGIN_TITLE}}/g, i18n.t("LOGIN_TITLE", { app: req.args["app-name"] })) .replace(/{{WELCOME_TEXT}}/g, welcomeText) .replace(/{{PASSWORD_MSG}}/g, passwordMsg) .replace(/{{I18N_LOGIN_BELOW}}/g, i18n.t("LOGIN_BELOW")) diff --git a/src/node/routes/vscode.ts b/src/node/routes/vscode.ts index 33d1287a7..3ff64a179 100644 --- a/src/node/routes/vscode.ts +++ b/src/node/routes/vscode.ts @@ -172,7 +172,6 @@ router.get("/", ensureVSCodeLoaded, async (req, res, next) => { }) router.get("/manifest.json", async (req, res) => { - const appName = req.args["app-name"] || "code-server" res.writeHead(200, { "Content-Type": "application/manifest+json" }) res.end( @@ -180,8 +179,8 @@ router.get("/manifest.json", async (req, res) => { req, JSON.stringify( { - name: appName, - short_name: appName, + name: req.args["app-name"], + short_name: req.args["app-name"], start_url: ".", display: "fullscreen", display_override: ["window-controls-overlay"], diff --git a/test/unit/node/cli.test.ts b/test/unit/node/cli.test.ts index 668a3c557..44a0bd1c7 100644 --- a/test/unit/node/cli.test.ts +++ b/test/unit/node/cli.test.ts @@ -38,6 +38,7 @@ const defaults = { "extensions-dir": path.join(paths.data, "extensions"), "user-data-dir": paths.data, "session-socket": path.join(paths.data, "code-server-ipc.sock"), + "app-name": "code-server", _: [], } diff --git a/test/unit/node/routes/errors.test.ts b/test/unit/node/routes/errors.test.ts index ffa8f4791..94657abf9 100644 --- a/test/unit/node/routes/errors.test.ts +++ b/test/unit/node/routes/errors.test.ts @@ -1,4 +1,5 @@ import express from "express" +import { UserProvidedArgs, setDefaults } from "../../../../src/node/cli" import { errorHandler } from "../../../../src/node/routes/errors" describe("error page is rendered for text/html requests", () => { @@ -9,7 +10,7 @@ describe("error page is rendered for text/html requests", () => { statusCode: 404, message: ";>hello", } - const req = createRequest() + const req = await createRequest() const res = { status: jest.fn().mockReturnValue(this), send: jest.fn().mockReturnValue(this), @@ -20,9 +21,41 @@ describe("error page is rendered for text/html requests", () => { expect(res.status).toHaveBeenCalledWith(404) expect(res.send).toHaveBeenCalledWith(expect.not.stringContaining("