Skip to content

Commit 76f1aae

Browse files
authored
Merge pull request #3 from runcode-io/1_91_1
1 91 1
2 parents 0939c14 + 5024f01 commit 76f1aae

File tree

11 files changed

+150
-104
lines changed

11 files changed

+150
-104
lines changed

README.md

Lines changed: 89 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,64 @@
1-
# Visual Studio Code - Open Source ("Code - OSS")
1+
# OpenVSCode Web Server
22

3-
[![Feature Requests](https://img.shields.io/github/issues/microsoft/vscode/feature-request.svg)](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc)
4-
[![Bugs](https://img.shields.io/github/issues/microsoft/vscode/bug.svg)](https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug)
5-
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-yellow.svg)](https://gitter.im/Microsoft/vscode)
3+
[![GitHub](https://img.shields.io/github/license/runcode-io/openvscode-web-server)](https://github.com/runcode-io/openvscode-web-server/blob/main/LICENSE.txt)
64

7-
## The Repository
5+
## What is this?
86

9-
This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Studio Code](https://code.visualstudio.com) product together with the community. Not only do we work on code and issues here, we also publish our [roadmap](https://github.com/microsoft/vscode/wiki/Roadmap), [monthly iteration plans](https://github.com/microsoft/vscode/wiki/Iteration-Plans), and our [endgame plans](https://github.com/microsoft/vscode/wiki/Running-the-Endgame). This source code is available to everyone under the standard [MIT license](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
7+
This project provides a version of VS Code that runs as a server on a remote machine, accessible through a modern web browser. It utilizes the same architecture used by [RunCode](https://runcode.io) to deliver scalable remote development environments.
108

11-
## Visual Studio Code
9+
## Why?
1210

13-
<p align="center">
14-
<img alt="VS Code in action" src="https://user-images.githubusercontent.com/35271042/118224532-3842c400-b438-11eb-923d-a5f66fa6785a.png">
15-
</p>
11+
VS Code was originally developed as a desktop IDE using web technologies. As remote development gained popularity, the community began adapting it for remote access via web browsers. However, these adaptations were often complex and error-prone due to the extensive changes required across VS Code's large codebase.
1612

17-
[Visual Studio Code](https://code.visualstudio.com) is a distribution of the `Code - OSS` repository with Microsoft-specific customizations released under a traditional [Microsoft product license](https://code.visualstudio.com/License/).
13+
In 2019, the VS Code team began restructuring its architecture to natively support a browser-based environment. While platforms like Gitpod and GitHub adopted this architecture, the key components remained closed-source until recently. Consequently, many developers continued to use the older, more difficult methods.
1814

19-
[Visual Studio Code](https://code.visualstudio.com) combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. It provides comprehensive code editing, navigation, and understanding support along with lightweight debugging, a rich extensibility model, and lightweight integration with existing tools.
15+
At RunCode, we've frequently been asked about our approach. To support the community, we're sharing the minimal set of changes required to utilize the latest version of VS Code, ensuring easier upgrades and reduced maintenance.
2016

21-
Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on [Visual Studio Code's website](https://code.visualstudio.com/Download). To get the latest releases every day, install the [Insiders build](https://code.visualstudio.com/insiders).
17+
## Getting started
2218

23-
## Contributing
19+
### Docker
2420

25-
There are many ways in which you can participate in this project, for example:
21+
- Start the server:
22+
```bash
23+
docker run -it --init -p 8000:8000 -v "$(pwd):/home/runcode/workspace:cached" runcode/runcode-server
24+
```
25+
- Visit the URL printed in your terminal.
2626

27-
* [Submit bugs and feature requests](https://github.com/microsoft/vscode/issues), and help us verify as they are checked in
28-
* Review [source code changes](https://github.com/microsoft/vscode/pulls)
29-
* Review the [documentation](https://github.com/microsoft/vscode-docs) and make pull requests for anything from typos to additional and new content
3027

31-
If you are interested in fixing issues and contributing directly to the code base,
32-
please see the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute), which covers the following:
3328

34-
* [How to build and run from source](https://github.com/microsoft/vscode/wiki/How-to-Contribute)
35-
* [The development workflow, including debugging and running tests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#debugging)
36-
* [Coding guidelines](https://github.com/microsoft/vscode/wiki/Coding-Guidelines)
37-
* [Submitting pull requests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests)
38-
* [Finding an issue to work on](https://github.com/microsoft/vscode/wiki/How-to-Contribute#where-to-contribute)
39-
* [Contributing to translations](https://aka.ms/vscodeloc)
29+
#### Custom Environment
30+
- For additional possibilities, please consult the `Dockerfile` for OpenVSCode Web Server at https://github.com/runcode-io/runcode-releases/
4031

41-
## Feedback
4232

43-
* Ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode)
44-
* [Request a new feature](CONTRIBUTING.md)
45-
* Upvote [popular feature requests](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc)
46-
* [File an issue](https://github.com/microsoft/vscode/issues)
47-
* Connect with the extension author community on [GitHub Discussions](https://github.com/microsoft/vscode-discussions/discussions) or [Slack](https://aka.ms/vscode-dev-community)
48-
* Follow [@code](https://twitter.com/code) and let us know what you think!
33+
### Web Server
4934

50-
See our [wiki](https://github.com/microsoft/vscode/wiki/Feedback-Channels) for a description of each of these channels and information on some other available community-driven channels.
35+
- [Download the latest release](https://github.com/runcode-io/openvscode-web-server/releases/latest)
36+
- Untar and run the server
37+
```bash
38+
unzip openvscode-web-server-v${OPENVSCODE_SERVER_VERSION}.zip
39+
cd vscode-reh-web-linux-x64
40+
./bin/runcode-server # you can add arguments here, use --help to list all of the possible options
41+
```
5142

52-
## Related Projects
43+
From the possible entrypoint arguments, the most notable ones are
44+
- `--port` - the port number to start the server on, this is 8000 by default
45+
- `--without-connection-token` - used by default in the docker image
46+
- `--connection-token` & `--connection-token-file` for securing access to the IDE, you can read more about it in [Securing access to your IDE](#securing-access-to-your-ide).
47+
- `--host` - determines the host the server is listening on. It defaults to `localhost`, so for accessing remotely it's a good idea to add `--host 0.0.0.0` to your launch arguments.
5348

54-
Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) repositories are separate from each other. For a complete list, please visit the [Related Projects](https://github.com/microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/microsoft/vscode/wiki).
49+
- Visit the URL printed in your terminal.
50+
51+
### Securing access to your IDE
52+
53+
You can access the Web UI without authentication (anyone can access the IDE using just the hostname and port), if you need some kind of basic authentication then you can start the server with `--connection-token YOUR_TOKEN`, the provided `YOUR_TOKEN` will be used and the authenticated URL will be displayed in your terminal once you start the server. You can also create a plaintext file with the desired token as its contents and provide it to the server with `--connection-token-file YOUR_SECRET_TOKEN_FILE`.
54+
55+
If you want to use a connection token and are working with OpenVSCode Web Server via [the Docker image](https://hub.docker.com/r/runcode/runcode-server), you will have to edit the `ENTRYPOINT` in [the Dockerfile](https://github.com/runcode-io/runcode-releases/blob/main/Dockerfile) or modify it with the [`entrypoint` option](https://docs.docker.com/compose/compose-file/compose-file-v3/#entrypoint) when working with `docker-compose`.
56+
57+
## The scope of this project
58+
59+
This project only adds minimal bits required to run VS Code in a server scenario. We have no intention of changing VS Code in any way or to add additional features to VS Code itself. Please report feature requests, bug fixes, etc. in the upstream repository.
60+
61+
> **For any feature requests, bug reports, or contributions that are not specific to running VS Code in a server context, please go to [Visual Studio Code - Open Source "OSS"](https://github.com/microsoft/vscode)**
5562
5663
## Bundled Extensions
5764

@@ -61,19 +68,56 @@ VS Code includes a set of built-in extensions located in the [extensions](extens
6168

6269
This repository includes a Visual Studio Code Dev Containers / GitHub Codespaces development container.
6370

64-
* For [Dev Containers](https://aka.ms/vscode-remote/download/containers), use the **Dev Containers: Clone Repository in Container Volume...** command which creates a Docker volume for better disk I/O on macOS and Windows.
65-
* If you already have VS Code and Docker installed, you can also click [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode) to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
66-
67-
* For Codespaces, install the [GitHub Codespaces](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) extension in VS Code, and use the **Codespaces: Create New Codespace** command.
71+
- For [Dev Containers](https://aka.ms/vscode-remote/download/containers), use the **Dev Containers: Clone Repository in Container Volume...** command which creates a Docker volume for better disk I/O on macOS and Windows.
72+
- If you already have VS Code and Docker installed, you can also click [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode) to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
73+
- For Codespaces, install the [GitHub Codespaces](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) extension in VS Code, and use the **Codespaces: Create New Codespace** command.
6874

6975
Docker / the Codespace should have at least **4 Cores and 6 GB of RAM (8 GB recommended)** to run full build. See the [development container README](.devcontainer/README.md) for more information.
7076

71-
## Code of Conduct
77+
## Legal
78+
This project is not affiliated with Microsoft Corporation.
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
docker run -it --network=host -v "$(pwd):/home/" ubuntu:22.04
95+
96+
97+
apt update && apt install sudo git wget build-essential
98+
99+
sudo apt update && sudo apt upgrade -y
100+
sudo apt-get install -y libkrb5-dev libx11-dev libxkbfile-dev pkg-config libsecret-1-dev
101+
102+
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
103+
104+
source /root/.bashrc
105+
106+
nvm install 20.14.0
107+
108+
corepack enable
109+
110+
git config --global --add safe.directory /home
111+
112+
113+
72114

73-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
115+
docker run -itd -p 8000:8000 -v "$(pwd):/home" ubuntu:22.04
116+
apt update && apt upgrade -y && apt install unzip sudo -y
74117

75-
## License
118+
./vscode-reh-web-linux-x64/bin/runcode-server --default-folder=/home/ --host=0.0.0.0
76119

77-
Copyright (c) Microsoft Corporation. All rights reserved.
78120

79-
Licensed under the [MIT](LICENSE.txt) license.
121+
apt-get update && apt-get install -y software-properties-common
122+
add-apt-repository ppa:ubuntu-toolchain-r/test
123+
apt-get update && apt-get install -y libstdc++6

build/.cachesalt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-07-04T16:31:11.121Z
1+
2024-07-05T08:35:22.799Z

build/lib/compilation.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import { Mangler } from './mangle/index';
2121
import { RawSourceMap } from 'source-map';
2222
import { gulpPostcss } from './postcss';
2323
const watch = require('./watch');
24-
24+
const packageJson = require('../../package.json');
25+
const productJson = require('../../product.json');
26+
const replace = require('gulp-replace');
2527

2628
// --- gulp-tsb: compile and transpile --------------------------------
2729

@@ -77,8 +79,20 @@ function createCompile(src: string, { build, emitError, transpileOnly, preserveE
7779

7880
const postcssNesting = require('postcss-nesting');
7981

82+
const productJsFilter = util.filter(data => !build && data.path.endsWith('vs/platform/product/common/product.ts'));
83+
const productConfiguration = JSON.stringify({
84+
...productJson,
85+
version: `${packageJson.version}-dev`,
86+
nameShort: `${productJson.nameShort} Dev`,
87+
nameLong: `${productJson.nameLong} Dev`,
88+
dataFolderName: `${productJson.dataFolderName}-dev`
89+
});
90+
8091
const input = es.through();
8192
const output = input
93+
.pipe(productJsFilter)
94+
.pipe(replace(/{\s*\/\*BUILD->INSERT_PRODUCT_CONFIGURATION\*\/\s*}/, productConfiguration, { skipBinary: true }))
95+
.pipe(productJsFilter.restore)
8296
.pipe(util.$if(isUtf8Test, bom())) // this is required to preserve BOM in test files that loose it otherwise
8397
.pipe(util.$if(!build && isRuntimeJs, util.appendOwnPathSourceURL()))
8498
.pipe(util.$if(isCSS, gulpPostcss([postcssNesting()], err => reporter(String(err)))))

extensions/git/src/historyProvider.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,37 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
173173
this.logger.error(`[GitHistoryProvider][provideHistoryItems2] Failed to get history items '${options.limit.id}..': ${err}`);
174174
return [];
175175
}
176+
177+
const historyItems: SourceControlHistoryItem[] = [];
178+
179+
try {
180+
// Get the commits
181+
const commits = await this.repository.log({ range: `${refsMergeBase}^..`, refNames });
182+
183+
await ensureEmojis();
184+
185+
historyItems.push(...commits.map(commit => {
186+
const newLineIndex = commit.message.indexOf('\n');
187+
const subject = newLineIndex !== -1 ? commit.message.substring(0, newLineIndex) : commit.message;
188+
189+
const labels = this.resolveHistoryItemLabels(commit, refNames);
190+
191+
return {
192+
id: commit.hash,
193+
parentIds: commit.parents,
194+
message: emojify(subject),
195+
author: commit.authorName,
196+
icon: new ThemeIcon('git-commit'),
197+
timestamp: commit.authorDate?.getTime(),
198+
statistics: commit.shortStat ?? { files: 0, insertions: 0, deletions: 0 },
199+
labels: labels.length !== 0 ? labels : undefined
200+
};
201+
}));
202+
} catch (err) {
203+
this.logger.error(`[GitHistoryProvider][provideHistoryItems2] Failed to get history items '${refsMergeBase}^..': ${err}`);
204+
}
205+
206+
return historyItems;
176207
}
177208

178209
async provideHistoryItemSummary(historyItemId: string, historyItemParentId: string | undefined): Promise<SourceControlHistoryItem> {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
3-
"version": "1.93.0",
4-
"distro": "a08b8e0a3ee750481000d63bf36e5a206fe6aecf",
3+
"version": "1.91.1",
4+
"distro": "a08799837ca498c02f445ca7a896f446419af238",
55
"author": {
66
"name": "Microsoft Corporation"
77
},

product.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"nameShort": "RunCode Server",
33
"nameLong": "RunCode Server",
4-
"applicationName": "runcode",
5-
"dataFolderName": ".runcode",
6-
"win32MutexName": "runcode",
4+
"applicationName": "runcode-server",
5+
"dataFolderName": ".runcode-server",
6+
"win32MutexName": "runcodeserver",
77
"licenseName": "MIT",
88
"licenseUrl": "https://github.com/runcode-io/openvscode-web-server/blob/main/LICENSE.txt",
99
"serverLicenseUrl": "https://github.com/runcode-io/openvscode-web-server/blob/main/LICENSE.txt",
1010
"serverGreeting": [],
1111
"serverLicense": [],
1212
"serverLicensePrompt": "",
13-
"serverApplicationName": "runcode",
14-
"serverDataFolderName": ".runcode",
15-
"tunnelApplicationName": "runcode-tunnel",
13+
"serverApplicationName": "runcode-server",
14+
"serverDataFolderName": ".runcode-server",
15+
"tunnelApplicationName": "runcode-server-tunnel",
1616
"win32DirName": "RunCode",
1717
"win32NameVersion": "RunCode",
1818
"win32RegValueName": "RunCode",

src/vs/workbench/contrib/webview/browser/pre/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<meta charset="UTF-8">
66

77
<meta http-equiv="Content-Security-Policy"
8-
content="default-src 'none'; script-src 'sha256-DXeP32g8BdMsVuVabYTmznoTH59F7M7UtV0vXemEFqc=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
98

9+
content="default-src 'none'; script-src 'sha256-dvxt5dlghGbz8hrqqochfoKEaHIMZ+yJVRvjJnGopzs=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
1010

1111
<!-- Disable pinch zooming -->
1212
<meta name="viewport"
@@ -796,7 +796,6 @@
796796
}
797797
}
798798

799-
800799
function handleInnerDragEvent(/** @type {DragEvent} */ e) {
801800
/**
802801
* To ensure that the drop event always fires as expected, you should always include a preventDefault() call in the part of your code which handles the dragover event.
@@ -916,7 +915,6 @@
916915
window.addEventListener('drag', handleInnerDragEvent);
917916
window.addEventListener('drop', handleInnerDropEvent);
918917

919-
920918
onDomReady(() => {
921919
if (!document.body) {
922920
return;

src/vs/workbench/contrib/webview/browser/webviewElement.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { loadLocalResource, WebviewResourceResponse } from 'vs/workbench/contrib
3434
import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/browser/themeing';
3535
import { areWebviewContentOptionsEqual, IWebview, WebviewContentOptions, WebviewExtensionDescription, WebviewInitInfo, WebviewMessageReceivedEvent, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview';
3636
import { WebviewFindDelegate, WebviewFindWidget } from 'vs/workbench/contrib/webview/browser/webviewFindWidget';
37-
import { FromWebviewMessage, KeyEvent, ToWebviewMessage, WebViewDragEvent } from 'vs/workbench/contrib/webview/browser/webviewMessages';
37+
import { FromWebviewMessage, KeyEvent, ToWebviewMessage } from 'vs/workbench/contrib/webview/browser/webviewMessages';
3838
import { decodeAuthority, webviewGenericCspSource, webviewRootResourceAuthority } from 'vs/workbench/contrib/webview/common/webview';
3939
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
4040
import { CodeWindow } from 'vs/base/browser/window';
@@ -310,10 +310,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
310310
this._startBlockingIframeDragEvents();
311311
}));
312312

313-
this._register(this.on('drag', (event) => {
314-
this.handleDragEvent('drag', event);
315-
}));
316-
317313
if (initInfo.options.enableFindWidget) {
318314
this._webviewFindWidget = this._register(instantiationService.createInstance(WebviewFindWidget, this));
319315
}
@@ -701,17 +697,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
701697
this.window?.dispatchEvent(emulatedKeyboardEvent);
702698
}
703699

704-
private handleDragEvent(type: 'drag', event: WebViewDragEvent) {
705-
// Create a fake DragEvent from the data provided
706-
const emulatedDragEvent = new DragEvent(type, event);
707-
// Force override the target
708-
Object.defineProperty(emulatedDragEvent, 'target', {
709-
get: () => this.element,
710-
});
711-
// And re-dispatch
712-
this.window?.dispatchEvent(emulatedDragEvent);
713-
}
714-
715700
windowDidDragStart(): void {
716701
// Webview break drag and dropping around the main window (no events are generated when you are over them)
717702
// Work around this by disabling pointer events during the drag.

src/vs/workbench/contrib/webview/browser/webviewMessages.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ type KeyEvent = {
1717
repeat: boolean;
1818
}
1919

20-
type WebViewDragEvent = {
21-
shiftKey: boolean;
22-
}
23-
2420
export type FromWebviewMessage = {
2521
'onmessage': { message: any; transfer?: ArrayBuffer[] };
2622
'did-click-link': { uri: string };
@@ -40,7 +36,6 @@ export type FromWebviewMessage = {
4036
'did-keyup': KeyEvent;
4137
'did-context-menu': { clientX: number; clientY: number; context: { [key: string]: unknown } };
4238
'drag-start': void;
43-
'drag': WebViewDragEvent
4439
};
4540

4641
interface UpdateContentEvent {

0 commit comments

Comments
 (0)