Skip to content

[v2] Rewrite code-server to use new web stuff #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 136 commits into from
Sep 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
310bfe5
Delete all the things
code-asher Jul 2, 2019
4861405
Initial connection handling
code-asher Jun 27, 2019
68fe085
Add channels
code-asher Jun 28, 2019
98f0013
Add content types
code-asher Jun 28, 2019
a0121f2
Implement file provider
code-asher Jul 1, 2019
0d618bb
Use spdlog for log service
code-asher Jul 1, 2019
4e0a6d2
Partial extension host, some restructuring
code-asher Jul 1, 2019
7072bf1
Use new URI transformer everywhere
code-asher Jul 2, 2019
d808bfa
Set workspace and folder URIs
code-asher Jul 2, 2019
57a8186
Add development steps
code-asher Jul 2, 2019
a6703ec
Prevent sending disconnect if disposed
code-asher Jul 2, 2019
2e77c9d
Scan extensions
code-asher Jul 2, 2019
4685f67
Pass product configuration
code-asher Jul 2, 2019
3a78c09
Run log cleaner
code-asher Jul 2, 2019
6a35ab1
Add (unimplemented) webview server
code-asher Jul 2, 2019
770e0db
Add cli arguments
code-asher Jul 2, 2019
61c281e
Add arguments for ports
code-asher Jul 2, 2019
5677ff2
Add build scripts
code-asher Jul 3, 2019
f8f4bfd
Customize JSON files with code-server name
code-asher Jul 5, 2019
6156eb9
Don't wait to start main server
code-asher Jul 5, 2019
3ca90a5
Use nbin in forked processes
code-asher Jul 5, 2019
197d8db
Need to run `yarn compile` once
code-asher Jul 5, 2019
f51751a
Replace jq with some JavaScript
code-asher Jul 5, 2019
a20fa4a
Implement extensions channel
code-asher Jul 8, 2019
fe1d609
Make it possible to request absolute paths
code-asher Jul 8, 2019
f482087
Implement webview server
code-asher Jul 8, 2019
86e8ba1
Add gallery channel
code-asher Jul 10, 2019
54ffd1d
Make extension sidebar work
code-asher Jul 10, 2019
09e3cfd
Create extension directory on startup
code-asher Jul 10, 2019
2fdf09e
Include version when building
code-asher Jul 10, 2019
81862d4
Add back (most of) our old arguments
code-asher Jul 10, 2019
2b2aa9a
Add https server
code-asher Jul 11, 2019
97167e7
Add authentication
code-asher Jul 12, 2019
286f9a8
Implement multiple extension directories
code-asher Jul 12, 2019
e22791e
Fix interactive playground
code-asher Jul 12, 2019
8dcc1e3
Accept argument to change initial working directory
code-asher Jul 12, 2019
68c6208
Fix opening snippets
code-asher Jul 13, 2019
9446cc8
Update Dockerfile
code-asher Jul 15, 2019
9b0b337
Implement open flag
code-asher Jul 15, 2019
feabfc8
Fix different node binary warning
code-asher Jul 15, 2019
83819cb
Fix vscode-ripgrep rebuild error
code-asher Jul 15, 2019
1a3fc86
Reconnection works
code-asher Jul 15, 2019
b6fdb7d
Telemetry
code-asher Jul 16, 2019
db41f10
Fix open flag when using 0.0.0.0
code-asher Jul 17, 2019
4b0cceb
Extract ripgrep when inside binary
code-asher Jul 17, 2019
45d348b
Expose API on the client
code-asher Jul 17, 2019
b0e6c1c
Fix favicon
code-asher Jul 17, 2019
2be452d
Fix rg extraction in Docker build
code-asher Jul 17, 2019
e8cb6ff
Implement file uploads
code-asher Jul 19, 2019
9fdfacb
Quality check
code-asher Jul 19, 2019
36b8731
Add some missing development steps
code-asher Jul 19, 2019
078af59
Replace demo image with GIF (#863)
kylecarbs Jul 22, 2019
cd54aec
Fix login redirect when not using https
code-asher Jul 22, 2019
09cd1e8
Make sub-paths work
code-asher Jul 22, 2019
436ef7b
Fix VS Code version in readme and describe our changes
code-asher Jul 22, 2019
068e07b
Clean up the patch
code-asher Jul 23, 2019
92daabc
Open folder at base URL
code-asher Jul 23, 2019
7b7f5b5
Add base path argument
code-asher Jul 23, 2019
fd55139
Make flags additive and clean up docs
code-asher Jul 23, 2019
329acbb
Combine main and webview servers
code-asher Jul 24, 2019
a4f21fb
Install git during build
code-asher Jul 24, 2019
4c4a179
TLS socket still doesn't work
code-asher Jul 25, 2019
8ded89e
Firefox fixes
code-asher Jul 26, 2019
011530e
Proxy TLS sockets
code-asher Jul 30, 2019
87be3ac
Add comment explaining use of merge
code-asher Jul 30, 2019
0315b00
Add comment for the nbin shim
code-asher Jul 30, 2019
62719ab
Clean up client API
code-asher Jul 31, 2019
12af311
Use our logger instead of raw console.log
code-asher Jul 31, 2019
5944b84
Make it clearer what the tar code does
code-asher Jul 31, 2019
bd0f1d0
Support vscode-resource requests in webview
code-asher Jul 31, 2019
bce0cac
Document recent VS Code patch changes
code-asher Jul 31, 2019
60ed065
Reformat readme intro
code-asher Jul 31, 2019
712274d
Groundwork for language support
code-asher Aug 3, 2019
5b64cb3
Fix login page
code-asher Aug 3, 2019
950bfce
Add commit, date, and checksums to product.json
code-asher Aug 3, 2019
dde683d
Fix login submission when using a base path
code-asher Aug 5, 2019
590f699
Allow specifying the target
code-asher Aug 5, 2019
dc333d4
Fix extensions not being bundled into prebuilt
code-asher Aug 5, 2019
7e794bd
Fix favicon not being included in final build
code-asher Aug 5, 2019
01a9ab3
Set commit based on code-server instead of VS Code
code-asher Aug 7, 2019
f5a6f14
Implement update service
code-asher Aug 7, 2019
2b3e8e1
Don't exclude .git for Docker
code-asher Aug 7, 2019
d4ed2ef
Change default port to 8080
code-asher Aug 8, 2019
6b579d6
Fix webview address when using a proxy
code-asher Aug 8, 2019
b257c60
Fix websocket defaulting to port 80 when authority has no port
code-asher Aug 8, 2019
ba72851
Update VS Code to 1.37.0
code-asher Aug 9, 2019
2807ce4
Add tar-stream dependency
code-asher Aug 9, 2019
1d61cbe
Make release directory
code-asher Aug 10, 2019
7389d9e
Use current URL for webview
code-asher Aug 12, 2019
b566b66
Fix service worker scope when there is a base path
code-asher Aug 12, 2019
5539519
Remove extra slash when opening folder
code-asher Aug 12, 2019
90e8714
Preserve query variables when redirecting
code-asher Aug 12, 2019
c11d5fe
Fix error when passing empty extra extension dir flag
code-asher Aug 12, 2019
2470081
Exit when pipe closes
code-asher Aug 12, 2019
45ad7f0
Update logger
code-asher Aug 12, 2019
83f86a4
Load language bundles on the client
code-asher Aug 14, 2019
07ec4ca
Fix PHP syntax highlighting
code-asher Aug 14, 2019
a48c2fb
Handle webview service worker resource requests
code-asher Aug 15, 2019
72fe124
Fix loading resources in webviews
code-asher Aug 15, 2019
d1662d7
Ensure service workers are supported before use
code-asher Aug 15, 2019
f61a0ae
Set unexpected error handler on startup
code-asher Aug 15, 2019
6737384
Handle existing query when opening folder
code-asher Aug 15, 2019
b4e1a62
Fix tasks
code-asher Aug 16, 2019
ce3b7df
Use readlink -f if realpath isn't available
code-asher Aug 19, 2019
e53d6bc
Forward GitHub token to docker build if it exists
code-asher Aug 19, 2019
b9fc404
Forward minify environment variable to Docker build
code-asher Aug 19, 2019
534600c
Don't error when scanning nonexistent extension dir
code-asher Aug 21, 2019
ccc4f87
Don't package for release if we don't need to
code-asher Aug 21, 2019
c2be0ec
Fix Firefox when using extensions that insert styles
code-asher Aug 21, 2019
80050d0
Detect target automatically
code-asher Aug 21, 2019
c19223b
Fix error when building without first running yarn
code-asher Aug 21, 2019
950dad9
Simplify getting the absolute path during build
code-asher Aug 21, 2019
ddd5a9a
Update data and extension paths to match version one
code-asher Aug 21, 2019
3e2d12a
Fix scrolling on Firefox
code-asher Aug 22, 2019
4800ec6
Fix playground when behind a proxy with a sub-path
code-asher Aug 22, 2019
c4fd725
Fix built-in Typescript when bundled
code-asher Aug 22, 2019
78b6b3a
Add check for missing reconnection token
code-asher Aug 23, 2019
830ccfe
Fix toggling and hiding the menu bar
code-asher Aug 23, 2019
d33b2d2
Fix web view sometimes not loading correctly
code-asher Aug 27, 2019
a3ee7c9
Don't open cwd by default
code-asher Aug 27, 2019
c9ce9eb
Fix spawns against Node
code-asher Aug 28, 2019
624a4c0
Minify Docker build
code-asher Aug 28, 2019
b901043
Target a recent commit for VS Code
code-asher Aug 30, 2019
976a326
Update nbin
code-asher Aug 30, 2019
12bc26b
Implement status bar API
code-asher Sep 3, 2019
da7d8b0
Update VS Code
code-asher Sep 3, 2019
a26844e
Add package.json for publishing API types
code-asher Sep 3, 2019
9d8906d
Add version format flag
code-asher Sep 4, 2019
4400045
Add environment variable for telemetry endpoint
code-asher Sep 5, 2019
12e6084
Add caching
code-asher Sep 6, 2019
1164801
Keep a maximum number of connections instead of a timeout
code-asher Sep 9, 2019
e9fce80
Make extension host reconnect
code-asher Sep 9, 2019
0e1fed3
Make CI script work independently from your cwd
code-asher Sep 10, 2019
5b51999
resolve tree conflicts with master
sr229 Sep 12, 2019
8643bdc
fix further conflicts in README.md
sr229 Sep 12, 2019
cb0f9c5
re-add GH-969
sr229 Sep 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Open folder at base URL
  • Loading branch information
code-asher committed Jul 23, 2019
commit 92daabc75cf81db93e90d1ad9e9c44f6700ba43d
47 changes: 33 additions & 14 deletions scripts/vscode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ index ff62e0a65a..21cd50eaf9 100644
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

diff --git a/src/vs/code/browser/workbench/workbench.js b/src/vs/code/browser/workbench/workbench.js
index 34f321f90d..9fc63daab2 100644
index 34f321f90d..b1bd6a4ac9 100644
--- a/src/vs/code/browser/workbench/workbench.js
+++ b/src/vs/code/browser/workbench/workbench.js
@@ -7,14 +7,19 @@
Expand All @@ -76,7 +76,7 @@ index 34f321f90d..9fc63daab2 100644
- baseUrl: `${window.location.origin}/out`,
+ baseUrl: `${base}/out`,
+ baseScheme: window.location.protocol.replace(/:$/, ''),
+ basePath: basePath + "/resources",
+ basePath: basePath,
+ baseAuthority: window.location.host,
paths: {
- 'vscode-textmate': `${window.location.origin}/node_modules/vscode-textmate/release/main`,
Expand All @@ -93,39 +93,40 @@ index 34f321f90d..9fc63daab2 100644
});

diff --git a/src/vs/loader.js b/src/vs/loader.js
index 40b6d2aa32..5b12b272fe 100644
index 40b6d2aa32..f64b7e70d8 100644
--- a/src/vs/loader.js
+++ b/src/vs/loader.js
@@ -497,6 +497,28 @@ var AMDLoader;
@@ -497,6 +497,29 @@ var AMDLoader;
}
return this._addUrlArgsIfNecessaryToUrl(result);
};
+ /**
+ * Transform a url to use the site base.
+ * Transform a code-server:// URI, file:// URI, or plain path to use
+ * the site base.
+ */
+ Configuration.prototype.requireWithBase = function (resource) {
+ if (!this.options.baseScheme || !this.options.basePath || !this.options.baseAuthority) {
+ if (typeof this.options.basePath === "undefined" || typeof this.options.baseAuthority === "undefined" || typeof this.options.baseScheme === "undefined") {
+ return resource;
+ }
+ if (typeof resource === "string") {
+ return resource.replace(
+ /^(code-server|file):\/\/[^/]*/,
+ `${this.options.baseScheme}://${this.options.baseAuthority}${this.options.basePath}`
+ );
+ const base = `${this.options.baseScheme}://${this.options.baseAuthority}${this.options.basePath}`;
+ return resource.indexOf("/") !== 0
+ ? resource.replace(/^(code-server|file):\/\/[^/]*/, `${base}/resources`)
+ : `${base}${resource}`;
+ }
+ if (resource.scheme === this.options.baseScheme) {
+ if (resource.scheme !== "code-server" && resource.scheme !== "file") {
+ return resource;
+ }
+ return resource.with({
+ authority: this.options.baseAuthority,
+ scheme: this.options.baseScheme,
+ path: `${this.options.basePath}${resource.path}`,
+ path: `${this.options.basePath}/resources${resource.path}`,
+ });
+ };
/**
* Flag to indicate if current execution is as part of a build.
*/
@@ -1427,6 +1449,9 @@ var AMDLoader;
@@ -1427,6 +1450,9 @@ var AMDLoader;
result.getStats = function () {
return _this.getLoaderEvents();
};
Expand Down Expand Up @@ -585,7 +586,7 @@ index 1986fb6642..a3e4cbdb56 100644

const payload = await this.resolveWorkspaceInitializationPayload();
diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts
index b253e573ae..cc6bb2535f 100644
index b253e573ae..7a230fa3bd 100644
--- a/src/vs/workbench/browser/web.simpleservices.ts
+++ b/src/vs/workbench/browser/web.simpleservices.ts
@@ -53,6 +53,14 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
Expand Down Expand Up @@ -694,6 +695,24 @@ index b253e573ae..cc6bb2535f 100644

//#endregion

@@ -888,7 +924,7 @@ export class SimpleWindowService extends Disposable implements IWindowService {
for (let i = 0; i < _uris.length; i++) {
const uri = _uris[i];
if ('folderUri' in uri) {
- const newAddress = `${document.location.origin}/?folder=${uri.folderUri.path}`;
+ const newAddress = require.withBase(`/?folder=${uri.folderUri.path}`);
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -896,7 +932,7 @@ export class SimpleWindowService extends Disposable implements IWindowService {
}
}
if ('workspaceUri' in uri) {
- const newAddress = `${document.location.origin}/?workspace=${uri.workspaceUri.path}`;
+ const newAddress = require.withBase(`/?workspace=${uri.workspaceUri.path}`);
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
diff --git a/src/vs/workbench/contrib/comments/browser/commentNode.ts b/src/vs/workbench/contrib/comments/browser/commentNode.ts
index f4ac3fe8dd..3a3616b39e 100644
--- a/src/vs/workbench/contrib/comments/browser/commentNode.ts
Expand Down