diff --git a/ci/dev/vscode.patch b/ci/dev/vscode.patch index 378b0e33..60e95dfe 100644 --- a/ci/dev/vscode.patch +++ b/ci/dev/vscode.patch @@ -494,9 +494,18 @@ index 0000000000000000000000000000000000000000..3fd94e050108d5c52ad8a104cb5e0484 +../../../../../../src/node/proxy_agent.ts \ No newline at end of file diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts -index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..e490cf7449623f96c780a65d538fad72cf9306e4 100644 +index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..779971e2cc6e5394cdd4b079630238e80b352f33 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts +@@ -3,7 +3,7 @@ + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +-import { IWorkbenchConstructionOptions, create, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace, IWindowIndicator, IHomeIndicator, IProductQualityChangeHandler, ISettingsSyncOptions } from 'vs/workbench/workbench.web.api'; ++import { IWorkbenchConstructionOptions, create, ICredentialsProvider, IURLCallbackProvider, IWorkspaceProvider, IWorkspace, IWindowIndicator, IProductQualityChangeHandler, ISettingsSyncOptions } from 'vs/workbench/workbench.web.api'; + import { URI, UriComponents } from 'vs/base/common/uri'; + import { Event, Emitter } from 'vs/base/common/event'; + import { generateUuid } from 'vs/base/common/uuid'; @@ -17,6 +17,7 @@ import { isStandalone } from 'vs/base/browser/browser'; import { localize } from 'vs/nls'; import { Schemas } from 'vs/base/common/network'; @@ -592,6 +601,28 @@ index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..e490cf7449623f96c780a65d538fad72 // If no workspace is provided through the URL, check for config attribute from server if (!foundWorkspace) { +@@ -465,13 +454,6 @@ class WindowIndicator implements IWindowIndicator { + // Workspace Provider + const workspaceProvider = new WorkspaceProvider(workspace, payload); + +- // Home Indicator +- const homeIndicator: IHomeIndicator = { +- href: 'https://github.com/microsoft/vscode', +- icon: 'code', +- title: localize('home', "Home") +- }; +- + // Window indicator (unless connected to a remote) + let windowIndicator: WindowIndicator | undefined = undefined; + if (!workspaceProvider.hasRemote()) { +@@ -515,7 +497,6 @@ class WindowIndicator implements IWindowIndicator { + create(document.body, { + ...config, + settingsSyncOptions, +- homeIndicator, + windowIndicator, + productQualityChangeHandler, + workspaceProvider, diff --git a/src/vs/platform/environment/common/argv.ts b/src/vs/platform/environment/common/argv.ts index 409bb7e1960c9c06485a6f6d7f39b2efce451d56..f27b651c49ea3fc92b03e31eb64c1cf27c7e4433 100644 --- a/src/vs/platform/environment/common/argv.ts @@ -1468,10 +1499,10 @@ index 0000000000000000000000000000000000000000..56331ff1fc32bbd82e769aaecb551e42 +require('../../bootstrap-amd').load('vs/server/entry'); diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts new file mode 100644 -index 0000000000000000000000000000000000000000..c8a613ac2db1ff154a49aa7b6da5f7d2af902ec7 +index 0000000000000000000000000000000000000000..bf45e75aaf0dc8953ee6fee97fe02149879d3d72 --- /dev/null +++ b/src/vs/server/ipc.d.ts -@@ -0,0 +1,133 @@ +@@ -0,0 +1,139 @@ +/** + * External interfaces for integration into code-server over IPC. No vs imports + * should be made in this file. @@ -1544,6 +1575,7 @@ index 0000000000000000000000000000000000000000..c8a613ac2db1ff154a49aa7b6da5f7d2 + + log?: string; + verbose?: boolean; ++ home?: string; + + _: string[]; +} @@ -1587,6 +1619,11 @@ index 0000000000000000000000000000000000000000..c8a613ac2db1ff154a49aa7b6da5f7d2 + ['enableProposedApi', string], + ]; + }; ++ readonly homeIndicator?: { ++ href: string, ++ icon: string, ++ title: string, ++ }, + }; + readonly remoteUserDataUri: UriComponents; + readonly productConfiguration: { @@ -3293,10 +3330,10 @@ index 0000000000000000000000000000000000000000..57213f92828fafefcab0e3c401a1e8ed +} diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts new file mode 100644 -index 0000000000000000000000000000000000000000..5521d51a92d1b1e3469e890bae41277b560d08a2 +index 0000000000000000000000000000000000000000..0f4d31a961be1c055163b0cf29d550d7af5146e6 --- /dev/null +++ b/src/vs/server/node/server.ts -@@ -0,0 +1,302 @@ +@@ -0,0 +1,308 @@ +import { field } from '@coder/logger'; +import * as fs from 'fs'; +import * as net from 'net'; @@ -3357,6 +3394,7 @@ index 0000000000000000000000000000000000000000..5521d51a92d1b1e3469e890bae41277b +import { REMOTE_TERMINAL_CHANNEL_NAME } from 'vs/workbench/contrib/terminal/common/remoteTerminalChannel'; +import { REMOTE_FILE_SYSTEM_CHANNEL_NAME } from 'vs/workbench/services/remote/common/remoteAgentFileSystemChannel'; +import { RemoteExtensionLogFileName } from 'vs/workbench/services/remote/common/remoteAgentService'; ++import { localize } from 'vs/nls'; + +export class Vscode { + public readonly _onDidClientConnect = new Emitter(); @@ -3405,6 +3443,11 @@ index 0000000000000000000000000000000000000000..5521d51a92d1b1e3469e890bae41277b + ['enableProposedApi', JSON.stringify(options.args['enable-proposed-api'] || [])] + ], + }, ++ homeIndicator: { ++ href: options.args.home || 'https://github.com/cdr/code-server', ++ icon: 'code', ++ title: localize('home', "Home"), ++ }, + }, + remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)), + productConfiguration: product, @@ -3859,16 +3902,13 @@ index 021af6e0f8983c492f9cdd048ba2dcae7640bc1d..4474a93beba03365709c3cda98b68213 module = module.with({ path: ensureSuffix(module.path, '.js') }); const response = await fetch(module.toString(true)); diff --git a/src/vs/workbench/browser/actions/navigationActions.ts b/src/vs/workbench/browser/actions/navigationActions.ts -index 7344a3a29b32f7b370b99bf0cfdc79a322195ff8..dc21396e83e2f53914447d3460c2ee1103ecb28e 100644 +index 7344a3a29b32f7b370b99bf0cfdc79a322195ff8..46c900da7610d9ca6ddff4556b5d93b8dd58588c 100644 --- a/src/vs/workbench/browser/actions/navigationActions.ts +++ b/src/vs/workbench/browser/actions/navigationActions.ts -@@ -310,4 +310,8 @@ actionsRegistry.registerWorkbenchAction(SyncActionDescriptor.from(FocusNextPart, - actionsRegistry.registerWorkbenchAction(SyncActionDescriptor.from(FocusPreviousPart, { primary: KeyMod.Shift | KeyCode.F6 }), 'View: Focus Previous Part', CATEGORIES.View.value); +@@ -311,3 +311,6 @@ actionsRegistry.registerWorkbenchAction(SyncActionDescriptor.from(FocusPreviousP const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); --workbenchRegistry.registerWorkbenchContribution(GoHomeContributor, LifecyclePhase.Ready); -+// See https://github.com/cdr/code-server/issues/2328 -+// workbenchRegistry.registerWorkbenchContribution(GoHomeContributor, LifecyclePhase.Ready); + workbenchRegistry.registerWorkbenchContribution(GoHomeContributor, LifecyclePhase.Ready); +export const _1 = workbenchRegistry; +export const _2 = GoHomeContributor; +export const _3 = LifecyclePhase.Ready; diff --git a/doc/FAQ.md b/doc/FAQ.md index 8e1e32a7..edd337a9 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -23,6 +23,7 @@ - [Heartbeat File](#heartbeat-file) - [Healthz endpoint](#healthz-endpoint) - [How does the config file work?](#how-does-the-config-file-work) +- [How do I customize the "Go Home" button?](#how-do-i-customize-the-go-home-button) - [Isn't an install script piped into sh insecure?](#isnt-an-install-script-piped-into-sh-insecure) - [How do I make my keyboard shortcuts work?](#how-do-i-make-my-keyboard-shortcuts-work) - [Differences compared to Theia?](#differences-compared-to-theia) @@ -297,6 +298,16 @@ The `--config` flag or `$CODE_SERVER_CONFIG` can be used to change the config fi The default location also respects `$XDG_CONFIG_HOME`. +## How do I customize the "Go Home" button? + +You can pass a URL to the `--home` flag like this: + +``` +code-server --home=https://my-website.com +``` + +Or you can define it in the config file with `home`. + ## Isn't an install script piped into sh insecure? Please give diff --git a/src/node/cli.ts b/src/node/cli.ts index 3fae9adb..695d5aa6 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -57,6 +57,7 @@ export interface Args extends VsArgs { "new-window"?: boolean link?: OptionalString + home?: string } interface Option { @@ -201,6 +202,10 @@ const options: Options> = { `, beta: true, }, + home: { + type: "string", + description: "Set a custom link for the 'Go Home' button in the Application Menu", + }, } export const optionDescriptions = (): string[] => { diff --git a/test/cli.test.ts b/test/cli.test.ts index 6e22e65a..dd0c97a8 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -55,6 +55,7 @@ describe("parser", () => { "--log", "error", "--help", + "--home=http://localhost:8080/", "--open", "--socket=mumble", "3", @@ -85,6 +86,7 @@ describe("parser", () => { "extra-builtin-extensions-dir": [path.resolve("bazzle")], "extra-extensions-dir": [path.resolve("nozzle")], help: true, + home: "http://localhost:8080/", host: "0.0.0.0", json: true, log: "error",