Archived
1
0

feat: apply patch after setting up subtree

This commit is contained in:
Joe Previte
2020-12-15 15:53:52 -07:00
parent 41bee49d07
commit 51a2a2ad2d
84 changed files with 3360 additions and 191 deletions

View File

@ -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
});
}

View File

@ -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

View File

@ -112,6 +112,7 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve
/^VSCODE_.+$/,
/^SNAP(|_.*)$/,
/^GDK_PIXBUF_.+$/,
/^CODE_SERVER_.+$/,
];
const envKeys = Object.keys(env);
envKeys

View File

@ -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;
}
}

View File

@ -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.

View File

@ -0,0 +1 @@
../../../../../../src/node/proxy_agent.ts