偷渡 VS Code Server

2022-07-15 22:30:45 +08:00
 kouhe3

0.前言

有些人可能申请了 https://aka.ms/vscode-server-signup 但是还没有通过,一直在等。

那我这里直接水一篇写教程出来好了。

1.下载 code server launcher

Linux 和 macOS 运行

wget -O- https://aka.ms/install-vscode-server/setup.sh | sh

Windows x64 运行

New-Item "$HOME\.vscode-server-launcher\bin" -ItemType "directory" -Force
Invoke-WebRequest "https://aka.ms/vscode-server-launcher/x86_64-pc-windows-msvc" -OutFile "$HOME\.vscode-server-launcher\bin\code-server.exe"
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$HOME\.vscode-server-launcher\bin", "User")

Windows ARM 运行

New-Item "$HOME\.vscode-server-launcher\bin" -ItemType "directory" -Force
Invoke-WebRequest "https://aka.ms/vscode-server-launcher/aarch64-pc-windows-msvc" -OutFile "$HOME\.vscode-server-launcher\bin\code-server.exe"
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$HOME\.vscode-server-launcher\bin", "User")

2.启动

刷新环境变量

运行

code-server serve-local

然后 launcher 会去下载

https://update.code.visualstudio.com/commit:b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a/server-win32-x64-web/stable

并启动 server.cmd

3.使用

浏览器打开 localhost:8000

4.总结

如果不想用微软的 tunnel 做端口映射, 其实完全不需要申请就能用...

7383 次点击
所在节点    Visual Studio Code
37 条回复
whitegerry
2022-07-17 13:52:50 +08:00
官方的这个怎么支持 pwa ?
honus
2022-07-17 13:54:03 +08:00
linux 版只支持 tkn 加密吗?要是类似 code-server 那种输入密码进入好一点
lichao
2022-07-17 14:20:16 +08:00
@honus 这两种方式并没有什么区别吧
corvofeng
2022-07-17 16:33:42 +08:00
欢迎你试用我写的工具

https://www.v2ex.com/t/864877

https://corvo.myseu.cn/2022/06/18/2022-06-18-%E6%94%B9%E9%80%A0upterm%E6%94%AF%E6%8C%81VSCodeWeb/


我还是准备把这个工具继续做下去的, 想办法支持在 vscode.dev 上面连接
MasterMonkey
2022-07-17 23:10:57 +08:00
怎么启用 https 模式? ip 模式好像不让用剪切板
raysonlu
2022-07-18 00:47:01 +08:00
所以,其实就是一个可以用官方插件市场的 code-server?那么,有 docker 版本吗?
kouhe3
2022-07-18 01:21:54 +08:00
@MasterMonkey
加个反代上 https
kouhe3
2022-07-18 01:22:22 +08:00
@raysonlu 好像没有 docker 版
raysonlu
2022-07-18 09:13:57 +08:00
@kouhe3 安装在系统上,就几乎变得远程服务器所有文件可读
kouhe3
2022-07-18 09:19:46 +08:00
@raysonlu 你觉得所有文件可读很危险吗?
raysonlu
2022-07-18 10:54:28 +08:00
@kouhe3 不危险吗?
kouhe3
2022-07-18 11:14:41 +08:00
@raysonlu 那你需要 dev container,
而不是这个东西, 这个东西和 remote ssh dev 是一样的
whitegerry
2022-07-20 16:18:32 +08:00
@kouhe3 怎么以 pwa 的方式来用?一直没搞定这个。
kouhe3
2022-07-20 17:26:13 +08:00
@whitegerry 自己写一个 PWA 网页开在 localhost:8000, 然后打开 Chrome 安装 App.
然后再在 8000 启动 vs code server ,Chrome 会提示更新网页。
whitegerry
2022-07-21 09:20:22 +08:00
@kouhe3 搞定了,用之前 code-server 那个端口就 ok 了
xqdoo00o
2022-08-11 14:37:34 +08:00
@kkocdko nginx 反代之后打不开
xqdoo00o
2022-08-11 17:37:46 +08:00
解决了,还要代理下 websocket. 参考 http://nginx.org/en/docs/http/websocket.html
还要加个 header, proxy_set_header Host $host;

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/866535

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX