英文:
How can I disable the Extension Gallery when making a custom VS Code build?
问题
I need to disable the online extension gallery cause I don't want developers to download any extension that could be potentially dangerous. Is there any simple setting that allow it?
Options:
-
I could use the --no-proxy-server option to avoid access to the extension gallery. However some extensions require it.
-
I could use a read-only extension folder and the --extensions-dir option. However some extensions need write permissions on that folder.
-
I found out that there is a a key called "extensionsGallery" in resources\app\product.json I think I could remove those URLs:
"nlsBaseUrl": "https://www.vscode-unpkg.net/_lp/",
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items",
"publisherUrl": "https://marketplace.visualstudio.com/publishers",
"resourceUrlTemplate": "https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",
"controlUrl": "https://az764295.vo.msecnd.net/extensions/marketplace.json",
"recommendationsUrl": "https://az764295.vo.msecnd.net/extensions/workspaceRecommendations.json.gz"
but I'm not sure if I break something important. Is it safe to remove those URLs?
Is there a setting I can just set to avoid installing extensions freely? I want to build a custom flavored VS Code with some extensions but not allowing users to do everything.
英文:
I need to disable the online extension gallery cause I don't want developers to download any extension that could be potentially dangerous. Is there any simple setting that allow it?
Options:
-
I could use the --no-proxy-server option to avoid access to the extension gallery. However some extensions require it.
-
I could use a read-only extension folder and the --extensions-dir option. However some extensions need write permissions on that folder.
-
I found out that there is a a key called "extensionsGallery" in resources\app\product.json I think I could remove those URLs:
"nlsBaseUrl": "https://www.vscode-unpkg.net/_lp/",
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items",
"publisherUrl": "https://marketplace.visualstudio.com/publishers",
"resourceUrlTemplate": "https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",
"controlUrl": "https://az764295.vo.msecnd.net/extensions/marketplace.json",
"recommendationsUrl": "https://az764295.vo.msecnd.net/extensions/workspaceRecommendations.json.gz"
but I'm not sure if I break something important. Is it safe to remove those URLs?
Is there a setting I can just set to avoid installing extensiones freely? I want to build a custom flavored VS Code with some extensions but not allowing users to do everything.
答案1
得分: 1
> 我想要构建一个自定义味道的 VS Code,带有一些扩展功能,但不允许用户做任何事情。
然后创建一个 product.json 文件来实现这一点。另请参阅@chrisdias(VS Code 团队成员)的这条评论。
> 我发现在 resources\app\product.json 中有一个名为 "extensionsGallery" 的键,我认为我可以删除这些URL,但我不确定是否会破坏重要内容。删除这些URL是否安全?
默认/模板 product.json 甚至没有定义这些属性,如果你查看 VS Code 的 IproductConfiguration
在src/vs/base/common/product.ts 中的类型定义,你会看到 extensionsGallery
属性是可为空的。如果类型定义表示 extensionsGallery
属性可以省略,我认为那意味着可以不写。扩展视图将不具备任何后端服务,但用户仍然可以通过下载 VSIX 文件并使用 code --install-extension
安装它们。
英文:
> I want to build a custom flavored VS Code with some extensions but not allowing users to do everything.
Then make a product.json that does that. See also this comment from @chrisdias (a member of the VS Code team).
> I found out that there is a a key called "extensionsGallery" in resources\app\product.json I think I could remove those URLs, but I'm not sure if I break something important. Is it safe to remove those URLs?
The default/template product.json doesn't even have those properties defined, and if you look at VS Code's type definition of IproductConfiguration
in src/vs/base/common/product.ts, you'll see that the extensionsGallery
property is nullable. If the type definition says the extensionsGallery
property can be left out, I think that means it's fine to leave out. The Extensions View will not have any backing service, but users will still be able to install extensions by downloading VSIXes and installing them with code --install-extension
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论