feat: apply patch after setting up subtree
This commit is contained in:
@ -113,16 +113,17 @@ class RemoteAuthoritiesImpl {
|
||||
if (host && host.indexOf(':') !== -1) {
|
||||
host = `[${host}]`;
|
||||
}
|
||||
const port = this._ports[authority];
|
||||
// const port = this._ports[authority];
|
||||
const connectionToken = this._connectionTokens[authority];
|
||||
let query = `path=${encodeURIComponent(uri.path)}`;
|
||||
if (typeof connectionToken === 'string') {
|
||||
query += `&tkn=${encodeURIComponent(connectionToken)}`;
|
||||
}
|
||||
// NOTE@coder: Changed this to work against the current path.
|
||||
return URI.from({
|
||||
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
|
||||
authority: `${host}:${port}`,
|
||||
path: `/vscode-remote-resource`,
|
||||
authority: window.location.host,
|
||||
path: `${window.location.pathname.replace(/\/+$/, '')}/vscode-remote-resource`,
|
||||
query
|
||||
});
|
||||
}
|
||||
|
@ -71,6 +71,18 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
|
||||
_isWeb = true;
|
||||
_locale = navigator.language;
|
||||
_language = _locale;
|
||||
|
||||
// NOTE@coder: Make languages work.
|
||||
const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration');
|
||||
const rawNlsConfig = el && el.getAttribute('data-settings');
|
||||
if (rawNlsConfig) {
|
||||
try {
|
||||
const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig);
|
||||
_locale = nlsConfig.locale;
|
||||
_translationsConfigFile = nlsConfig._translationsConfigFile;
|
||||
_language = nlsConfig.availableLanguages['*'] || LANGUAGE_DEFAULT;
|
||||
} catch (error) { /* Oh well. */ }
|
||||
}
|
||||
}
|
||||
|
||||
// Native environment
|
||||
|
@ -112,6 +112,7 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve
|
||||
/^VSCODE_.+$/,
|
||||
/^SNAP(|_.*)$/,
|
||||
/^GDK_PIXBUF_.+$/,
|
||||
/^CODE_SERVER_.+$/,
|
||||
];
|
||||
const envKeys = Object.keys(env);
|
||||
envKeys
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { MarshalledObject } from 'vs/base/common/marshalling';
|
||||
import { Schemas } from './network';
|
||||
|
||||
export interface IURITransformer {
|
||||
transformIncoming(uri: UriComponents): UriComponents;
|
||||
@ -31,29 +32,35 @@ function toJSON(uri: URI): UriComponents {
|
||||
|
||||
export class URITransformer implements IURITransformer {
|
||||
|
||||
private readonly _uriTransformer: IRawURITransformer;
|
||||
|
||||
constructor(uriTransformer: IRawURITransformer) {
|
||||
this._uriTransformer = uriTransformer;
|
||||
constructor(private readonly remoteAuthority: string) {
|
||||
}
|
||||
|
||||
// NOTE@coder: Coming in from the browser it'll be vscode-remote so it needs
|
||||
// to be transformed into file.
|
||||
public transformIncoming(uri: UriComponents): UriComponents {
|
||||
const result = this._uriTransformer.transformIncoming(uri);
|
||||
return (result === uri ? uri : toJSON(URI.from(result)));
|
||||
return uri.scheme === Schemas.vscodeRemote
|
||||
? toJSON(URI.file(uri.path))
|
||||
: uri;
|
||||
}
|
||||
|
||||
// NOTE@coder: Going out to the browser it'll be file so it needs to be
|
||||
// transformed into vscode-remote.
|
||||
public transformOutgoing(uri: UriComponents): UriComponents {
|
||||
const result = this._uriTransformer.transformOutgoing(uri);
|
||||
return (result === uri ? uri : toJSON(URI.from(result)));
|
||||
return uri.scheme === Schemas.file
|
||||
? toJSON(URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path: uri.path }))
|
||||
: uri;
|
||||
}
|
||||
|
||||
public transformOutgoingURI(uri: URI): URI {
|
||||
const result = this._uriTransformer.transformOutgoing(uri);
|
||||
return (result === uri ? uri : URI.from(result));
|
||||
return uri.scheme === Schemas.file
|
||||
? URI.from({ authority: this.remoteAuthority, scheme: Schemas.vscodeRemote, path:uri.path })
|
||||
: uri;
|
||||
}
|
||||
|
||||
public transformOutgoingScheme(scheme: string): string {
|
||||
return this._uriTransformer.transformOutgoingScheme(scheme);
|
||||
return scheme === Schemas.file
|
||||
? Schemas.vscodeRemote
|
||||
: scheme;
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,4 +159,4 @@ export function transformAndReviveIncomingURIs<T>(obj: T, transformer: IURITrans
|
||||
return obj;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,10 @@ function factory(nodeRequire, path, fs, perf) {
|
||||
function getLanguagePackConfigurations(userDataPath) {
|
||||
const configFile = path.join(userDataPath, 'languagepacks.json');
|
||||
try {
|
||||
return nodeRequire(configFile);
|
||||
// NOTE@coder: Swapped require with readFile since require is cached and
|
||||
// we don't restart the server-side portion of code-server when the
|
||||
// language changes.
|
||||
return JSON.parse(fs.readFileSync(configFile, 'utf8'));
|
||||
} catch (err) {
|
||||
// Do nothing. If we can't read the file we have no
|
||||
// language pack config.
|
||||
|
1
lib/vscode/src/vs/base/node/proxy_agent.ts
Symbolic link
1
lib/vscode/src/vs/base/node/proxy_agent.ts
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../../src/node/proxy_agent.ts
|
Reference in New Issue
Block a user