Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
myhjmzy
code-server
提交
08b9e9ad
C
code-server
项目概览
myhjmzy
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
08b9e9ad
编写于
11月 19, 2020
作者:
A
Asher
提交者:
GitHub
11月 19, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2336 from cdr/webview-404
Fix 404 webviews and tar endpoint
上级
2a3608df
18279131
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
23 deletion
+23
-23
ci/dev/vscode.patch
ci/dev/vscode.patch
+2
-2
src/node/routes/static.ts
src/node/routes/static.ts
+21
-21
未找到文件。
ci/dev/vscode.patch
浏览文件 @
08b9e9ad
...
...
@@ -430,7 +430,7 @@ index 2c64061da7b01aef0bfe3cec851da232ca9461c8..c0ef8faedd406c38bf9c55bbbdbbb060
// Do nothing. If we can't read the file we have no
// language pack config.
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..
75d2ab3276049115829a38b8b7afee44bb748c2a
100644
index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..
62a79602a831bca0dc62ad57dc10a9375f8b9cdb
100644
--- a/src/vs/code/browser/workbench/workbench.ts
+++ b/src/vs/code/browser/workbench/workbench.ts
@@ -17,6 +17,7 @@
import { isStandalone } from 'vs/base/browser/browser';
...
...
@@ -468,7 +468,7 @@ index 0ef8b9dc81419b53b27cf111fb206d72ba56bada..75d2ab3276049115829a38b8b7afee44
- const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute);
+ const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = {
+ webviewEndpoint: `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview
/
`,
+ webviewEndpoint: `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview`,
+ ...JSON.parse(configElementAttribute),
+ };
+
...
...
src/node/routes/static.ts
浏览文件 @
08b9e9ad
...
...
@@ -7,13 +7,33 @@ import * as tarFs from "tar-fs"
import
*
as
zlib
from
"
zlib
"
import
{
HttpCode
,
HttpError
}
from
"
../../common/http
"
import
{
rootPath
}
from
"
../constants
"
import
{
authenticated
,
replaceTemplates
}
from
"
../http
"
import
{
authenticated
,
ensureAuthenticated
,
replaceTemplates
}
from
"
../http
"
import
{
getMediaMime
,
pathToFsPath
}
from
"
../util
"
export
const
router
=
Router
()
// The commit is for caching.
router
.
get
(
"
/(:commit)(/*)?
"
,
async
(
req
,
res
)
=>
{
// Used by VS Code to load extensions into the web worker.
const
tar
=
Array
.
isArray
(
req
.
query
.
tar
)
?
req
.
query
.
tar
[
0
]
:
req
.
query
.
tar
if
(
typeof
tar
===
"
string
"
)
{
ensureAuthenticated
(
req
)
let
stream
:
Readable
=
tarFs
.
pack
(
pathToFsPath
(
tar
))
if
(
req
.
headers
[
"
accept-encoding
"
]
&&
req
.
headers
[
"
accept-encoding
"
].
includes
(
"
gzip
"
))
{
logger
.
debug
(
"
gzipping tar
"
,
field
(
"
path
"
,
tar
))
const
compress
=
zlib
.
createGzip
()
stream
.
pipe
(
compress
)
stream
.
on
(
"
error
"
,
(
error
)
=>
compress
.
destroy
(
error
))
stream
.
on
(
"
close
"
,
()
=>
compress
.
end
())
stream
=
compress
res
.
header
(
"
content-encoding
"
,
"
gzip
"
)
}
res
.
set
(
"
Content-Type
"
,
"
application/x-tar
"
)
stream
.
on
(
"
close
"
,
()
=>
res
.
end
())
return
stream
.
pipe
(
res
)
}
// If not a tar use the remainder of the path to load the resource.
if
(
!
req
.
params
[
0
])
{
throw
new
HttpError
(
"
Not Found
"
,
HttpCode
.
NotFound
)
}
...
...
@@ -32,26 +52,6 @@ router.get("/(:commit)(/*)?", async (req, res) => {
res
.
header
(
"
Cache-Control
"
,
"
public, max-age=31536000
"
)
}
/**
* Used by VS Code to load extensions into the web worker.
*/
const
tar
=
Array
.
isArray
(
req
.
query
.
tar
)
?
req
.
query
.
tar
[
0
]
:
req
.
query
.
tar
if
(
typeof
tar
===
"
string
"
)
{
let
stream
:
Readable
=
tarFs
.
pack
(
pathToFsPath
(
tar
))
if
(
req
.
headers
[
"
accept-encoding
"
]
&&
req
.
headers
[
"
accept-encoding
"
].
includes
(
"
gzip
"
))
{
logger
.
debug
(
"
gzipping tar
"
,
field
(
"
path
"
,
resourcePath
))
const
compress
=
zlib
.
createGzip
()
stream
.
pipe
(
compress
)
stream
.
on
(
"
error
"
,
(
error
)
=>
compress
.
destroy
(
error
))
stream
.
on
(
"
close
"
,
()
=>
compress
.
end
())
stream
=
compress
res
.
header
(
"
content-encoding
"
,
"
gzip
"
)
}
res
.
set
(
"
Content-Type
"
,
"
application/x-tar
"
)
stream
.
on
(
"
close
"
,
()
=>
res
.
end
())
return
stream
.
pipe
(
res
)
}
res
.
set
(
"
Content-Type
"
,
getMediaMime
(
resourcePath
))
if
(
resourcePath
.
endsWith
(
"
manifest.json
"
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录