diff --git a/repo/code-marketplace/PKGBUILD b/repo/code-marketplace/PKGBUILD index 6736c9d..c125ba1 100644 --- a/repo/code-marketplace/PKGBUILD +++ b/repo/code-marketplace/PKGBUILD @@ -1,20 +1,23 @@ # Maintainer: Sainnhe Park pkgname=code-marketplace -pkgver=1.78.0 +pkgver=1.81.1 pkgrel=1 pkgdesc='Enable vscode marketplace in Code OSS' arch=('any') url='https://marketplace.visualstudio.com/vscode' license=('unknown') -depends=('code' 'sed' 'grep') +depends=('code' 'python') optdepends=('code-features: unblock some extensions specific to the official build') install="${pkgname}.install" source=('code-marketplace.hook' - 'patch.sh') -md5sums=('2f5ebcc1795bb5eac95162059a9a496e' - 'bdbc94a53d8cbdabac97054b0a2ad92b') + 'patch.py' + 'patch.json') +md5sums=('ce502275aa945985182b51420fc6037c' + 'f11f7ccd925de0398ef2e28b127bb063' + '007961321f2c9f066b2c55a9cd3899cf') package() { install -Dm 644 "${srcdir}"/code-marketplace.hook "${pkgdir}"/usr/share/libalpm/hooks/code-marketplace.hook - install -Dm 755 "${srcdir}"/patch.sh "${pkgdir}"/usr/share/code-marketplace/patch.sh + install -Dm 755 "${srcdir}"/patch.py "${pkgdir}"/usr/share/code-marketplace/patch.py + install -Dm 644 "${srcdir}"/patch.json "${pkgdir}"/usr/share/code-marketplace/patch.json } diff --git a/repo/code-marketplace/code-marketplace.hook b/repo/code-marketplace/code-marketplace.hook index a720f0a..81757e0 100644 --- a/repo/code-marketplace/code-marketplace.hook +++ b/repo/code-marketplace/code-marketplace.hook @@ -6,5 +6,5 @@ Target = usr/lib/code/product.json [Action] Description = [code-marketplace] Patching product.json... -Exec = /usr/share/code-marketplace/patch.sh +Exec = /usr/share/code-marketplace/patch.py code-marketplace patch When = PostTransaction diff --git a/repo/code-marketplace/code-marketplace.install b/repo/code-marketplace/code-marketplace.install index 4f43e28..dd20d9c 100644 --- a/repo/code-marketplace/code-marketplace.install +++ b/repo/code-marketplace/code-marketplace.install @@ -1,15 +1,16 @@ post_install() { - /usr/share/code-marketplace/patch.sh + /usr/share/code-marketplace/patch.py code-marketplace patch } pre_upgrade() { - /usr/share/code-marketplace/patch.sh -R + /usr/share/code-marketplace/patch.py code-marketplace restore } post_upgrade() { - /usr/share/code-marketplace/patch.sh + /usr/share/code-marketplace/patch.py code-marketplace patch } pre_remove() { - /usr/share/code-marketplace/patch.sh -R + /usr/share/code-marketplace/patch.py code-marketplace restore + /usr/bin/rm -f /usr/share/code-marketplace/cache.json } diff --git a/repo/code-marketplace/patch.json b/repo/code-marketplace/patch.json new file mode 100644 index 0000000..5aaeb79 --- /dev/null +++ b/repo/code-marketplace/patch.json @@ -0,0 +1,909 @@ +{ + "extensionsGallery": { + "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" + }, + "extensionRecommendations": { + "ms-dotnettools.csharp": { + "onFileOpen": [ + { + "pathGlob": "{**/*.cs,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln}", + "important": true + }, + { + "languages": [ + "csharp" + ], + "important": true + }, + { + "pathGlob": "{**/project.json,**/appsettings.json}" + } + ] + }, + "ms-python.python": { + "onFileOpen": [ + { + "pathGlob": "{**/*.py}", + "important": true + }, + { + "languages": [ + "python" + ], + "important": true + }, + { + "pathGlob": "{**/*.ipynb}" + } + ] + }, + "ms-toolsai.jupyter": { + "onFileOpen": [ + { + "pathGlob": "{**/*.py}", + "contentPattern": "^#\\s*%%$", + "important": true, + "whenInstalled": [ + "ms-python.python" + ] + }, + { + "pathGlob": "{**/*.ipynb}" + } + ] + }, + "golang.Go": { + "onFileOpen": [ + { + "pathGlob": "**/*.go", + "important": true + }, + { + "languages": [ + "go" + ], + "important": true + } + ] + }, + "vscjava.vscode-java-pack": { + "onFileOpen": [ + { + "pathGlob": "{**/*.java}", + "important": true, + "whenNotInstalled": [ + "ASF.apache-netbeans-java" + ] + }, + { + "languages": [ + "java" + ], + "important": true, + "whenNotInstalled": [ + "ASF.apache-netbeans-java" + ] + } + ] + }, + "ms-vscode.PowerShell": { + "onFileOpen": [ + { + "pathGlob": "{**/*.ps1,**/*.psd1,**/*.psm1}", + "important": true + }, + { + "languages": [ + "powershell" + ], + "important": true + }, + { + "pathGlob": "{**/*.ps.config,**/*.ps1.config}" + } + ] + }, + "ms-vscode.cpptools-extension-pack": { + "onFileOpen": [ + { + "pathGlob": "{**/*.c,**/*.cpp,**/*.cc,**/.cxx,**/*.hh,**/*.hpp,**/*.hxx,**/*.h}", + "important": true, + "whenNotInstalled": [ + "llvm-vs-code-extensions.vscode-clangd" + ] + }, + { + "languages": [ + "c", + "cpp" + ], + "important": true, + "whenNotInstalled": [ + "llvm-vs-code-extensions.vscode-clangd" + ] + } + ] + }, + "ms-azuretools.vscode-docker": { + "onFileOpen": [ + { + "pathGlob": "{**/dockerfile,**/Dockerfile,**/docker-compose.yml,**/docker-compose.*.yml}", + "important": true + }, + { + "languages": [ + "dockerfile" + ], + "important": true + }, + { + "pathGlob": "{**/*.cs,**/project.json,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln,**/appsettings.json,**/*.py,**/*.ipynb,**/*.js,**/*.ts,**/package.json}" + } + ] + }, + "vue.volar": { + "onFileOpen": [ + { + "pathGlob": "{**/*.vue}", + "important": true + }, + { + "languages": [ + "vue" + ], + "important": true + } + ] + }, + "ms-vscode.makefile-tools": { + "onFileOpen": [ + { + "pathGlob": "{**/makefile,**/Makefile}", + "important": true + }, + { + "languages": [ + "makefile" + ], + "important": true + } + ] + }, + "ms-vscode.cmake-tools": { + "onFileOpen": [ + { + "pathGlob": "{**/CMakeLists.txt}", + "important": true + } + ] + }, + "ms-azure-devops.azure-pipelines": { + "onFileOpen": [ + { + "pathGlob": "{**/azure-pipelines.yaml}", + "important": true + } + ] + }, + "msazurermtools.azurerm-vscode-tools": { + "onFileOpen": [ + { + "pathGlob": "{**/azuredeploy.json}", + "important": true + } + ] + }, + "ms-vscode-remote.remote-containers": { + "onFileOpen": [ + { + "pathGlob": "{**/devcontainer.json}", + "important": true + } + ] + }, + "ms-azuretools.vscode-bicep": { + "onFileOpen": [ + { + "pathGlob": "{**/*.bicep}", + "important": true + } + ] + }, + "svelte.svelte-vscode": { + "onFileOpen": [ + { + "pathGlob": "{**/*.svelte}", + "important": true + } + ] + }, + "ms-vscode.vscode-github-issue-notebooks": { + "onFileOpen": [ + { + "pathGlob": "{**/*.github-issues}", + "important": true + } + ] + }, + "ms-playwright.playwright": { + "onFileOpen": [ + { + "pathGlob": "{**/*playwright*.config.ts,**/*playwright*.config.js,**/*playwright*.config.mjs}", + "important": true + } + ] + }, + "vscjava.vscode-gradle": { + "onFileOpen": [ + { + "pathGlob": "{**/gradlew,**/gradlew.bat,**/build.gradle,**/build.gradle.kts,**/settings.gradle,**/settings.gradle.kts}", + "important": true + } + ] + }, + "REditorSupport.r": { + "onFileOpen": [ + { + "pathGlob": "{**/*.r}", + "important": true + }, + { + "languages": [ + "r" + ], + "important": true + } + ] + }, + "firefox-devtools.vscode-firefox-debug": { + "onFileOpen": [ + { + "pathGlob": "{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/.babelrc}" + } + ] + }, + "ms-edgedevtools.vscode-edge-devtools": { + "onFileOpen": [ + { + "pathGlob": "{**/*.ts,**/*.tsx,**/*.js,**/*.css,**/*.html}" + } + ] + }, + "Ionide.Ionide-fsharp": { + "onFileOpen": [ + { + "pathGlob": "{**/*.fsx,**/*.fsi,**/*.fs,**/*.ml,**/*.mli}" + } + ] + }, + "dbaeumer.vscode-eslint": { + "onFileOpen": [ + { + "pathGlob": "{**/*.js,**/*.jsx,**/*.es6,**/.eslintrc.*,**/.eslintrc,**/.babelrc,**/jsconfig.json}" + } + ] + }, + "ms-vscode.vscode-typescript-tslint-plugin": { + "onFileOpen": [ + { + "pathGlob": "{**/tslint.json}" + } + ] + }, + "bmewburn.vscode-intelephense-client": { + "onFileOpen": [ + { + "pathGlob": "{**/*.php,**/php.ini}" + } + ] + }, + "xdebug.php-debug": { + "onFileOpen": [ + { + "pathGlob": "{**/*.php,**/php.ini}" + } + ] + }, + "rust-lang.rust-analyzer": { + "onFileOpen": [ + { + "pathGlob": "{**/*.rs,**/*.rslib}" + } + ] + }, + "DavidAnson.vscode-markdownlint": { + "onFileOpen": [ + { + "pathGlob": "{**/*.md}" + } + ] + }, + "EditorConfig.EditorConfig": { + "onFileOpen": [ + { + "pathGlob": "{**/.editorconfig}" + } + ] + }, + "HookyQR.beautify": { + "onFileOpen": [ + { + "pathGlob": "{**/.jsbeautifyrc}" + } + ] + }, + "donjayamanne.githistory": { + "onFileOpen": [ + { + "pathGlob": "{**/.gitignore,**/.git}" + } + ] + }, + "felipecaputo.git-project-manager": { + "onFileOpen": [ + { + "pathGlob": "{**/.gitignore,**/.git}" + } + ] + }, + "eamodio.gitlens": { + "onFileOpen": [ + { + "pathGlob": "{**/.gitignore,**/.git}" + } + ] + }, + "Shopify.ruby-lsp": { + "onFileOpen": [ + { + "pathGlob": "{**/*.rb,**/*.erb,**/*.reek,**/.fasterer.yml,**/ruby-lint.yml,**/.rubocop.yml}" + } + ] + }, + "DotJoshJohnson.xml": { + "onFileOpen": [ + { + "pathGlob": "{**/*.xml}" + } + ] + }, + "stylelint.vscode-stylelint": { + "onFileOpen": [ + { + "pathGlob": "{**/.stylelintrc,**/stylelint.config.js}" + } + ] + }, + "ms-mssql.mssql": { + "onFileOpen": [ + { + "pathGlob": "{**/*.sql}" + } + ] + }, + "mtxr.sqltools": { + "onFileOpen": [ + { + "pathGlob": "{**/*.sql}" + } + ] + }, + "usqlextpublisher.usql-vscode-ext": { + "onFileOpen": [ + { + "pathGlob": "{**/*.usql}" + } + ] + }, + "ms-vscode.sublime-keybindings": { + "onFileOpen": [ + { + "pathGlob": "{**/.sublime-project,**/.sublime-workspace}" + } + ] + }, + "k--kato.intellij-idea-keybindings": { + "onFileOpen": [ + { + "pathGlob": "{**/.idea}" + } + ] + }, + "christian-kohler.npm-intellisense": { + "onFileOpen": [ + { + "pathGlob": "{**/package.json}" + } + ] + }, + "cake-build.cake-vscode": { + "onFileOpen": [ + { + "pathGlob": "{**/build.cake}" + } + ] + }, + "Angular.ng-template": { + "onFileOpen": [ + { + "pathGlob": "{**/.angular-cli.json,**/angular.json,**/*.ng.html,**/*.ng,**/*.ngml}" + } + ] + }, + "vscjava.vscode-maven": { + "onFileOpen": [ + { + "pathGlob": "**/pom.xml" + } + ] + }, + "ms-azuretools.vscode-azureterraform": { + "onFileOpen": [ + { + "pathGlob": "**/*.tf" + } + ] + }, + "HashiCorp.terraform": { + "onFileOpen": [ + { + "pathGlob": "**/*.tf" + } + ] + }, + "vsciot-vscode.vscode-arduino": { + "onFileOpen": [ + { + "pathGlob": "**/*.ino" + } + ] + }, + "ms-kubernetes-tools.vscode-kubernetes-tools": { + "onFileOpen": [ + { + "pathGlob": "{**/Chart.yaml}" + } + ] + }, + "GoogleCloudTools.cloudcode": { + "onFileOpen": [ + { + "pathGlob": "{**/skaffold.yaml}" + } + ] + }, + "Oracle.oracledevtools": { + "onFileOpen": [ + { + "pathGlob": "{**/*.sql}" + } + ] + }, + "betterthantomorrow.calva": { + "onFileOpen": [ + { + "pathGlob": "{**/*.clj,**/*.cljs}" + } + ] + }, + "Pivotal.vscode-boot-dev-pack": { + "onFileOpen": [ + { + "pathGlob": "{**/application.properties}" + } + ] + }, + "GitHub.copilot": { + "onFileOpen": [ + { + "pathGlob": "{**/*.ts,**/*.tsx,**/*.js,**/*.py,**/*.go,**/*.rb}" + } + ] + }, + "GitHub.vscode-github-actions": { + "onFileOpen": [ + { + "pathGlob": "{**/.github/workflows/*.yml}", + "important": true + } + ] + }, + "circleci.circleci": { + "onFileOpen": [ + { + "pathGlob": "{**/.circleci/config.yml}" + } + ] + } + }, + "keymapExtensionTips": [ + "vscodevim.vim", + "ms-vscode.sublime-keybindings", + "ms-vscode.atom-keybindings", + "ms-vscode.brackets-keybindings", + "ms-vscode.vs-keybindings", + "ms-vscode.notepadplusplus-keybindings", + "k--kato.intellij-idea-keybindings", + "lfs.vscode-emacs-friendly", + "alphabotsec.vscode-eclipse-keybindings", + "alefragnani.delphi-keybindings" + ], + "languageExtensionTips": [ + "ms-python.python", + "ms-vscode.cpptools-extension-pack", + "ms-dotnettools.csharp", + "ms-toolsai.jupyter", + "vscjava.vscode-java-pack", + "ecmel.vscode-html-css", + "vue.volar", + "bmewburn.vscode-intelephense-client", + "dsznajder.es7-react-js-snippets", + "golang.go", + "ms-vscode.powershell", + "dart-code.dart-code", + "rust-lang.rust-analyzer", + "Shopify.ruby-lsp", + "GitHub.copilot" + ], + "configBasedExtensionTips": { + "git": { + "configPath": ".git/config", + "configName": "Git", + "recommendations": { + "github.vscode-pull-request-github": { + "name": "GitHub Pull Request", + "contentPattern": "^\\s*url\\s*=\\s*https:\\/\\/github\\.com.*$" + }, + "eamodio.gitlens": { + "name": "GitLens" + } + } + }, + "devContainer": { + "configPath": ".devcontainer/devcontainer.json", + "configName": "Dev Container", + "recommendations": { + "ms-vscode-remote.remote-containers": { + "name": "Dev Containers", + "important": true + } + } + }, + "maven": { + "configPath": "pom.xml", + "configName": "Maven", + "recommendations": { + "vscjava.vscode-java-pack": { + "name": "Java", + "important": true, + "isExtensionPack": true, + "whenNotInstalled": [ + "ASF.apache-netbeans-java" + ] + }, + "Pivotal.vscode-boot-dev-pack": { + "name": "Spring Boot Extension Pack", + "isExtensionPack": true + } + } + }, + "gradle": { + "configPath": "build.gradle", + "configName": "Gradle", + "recommendations": { + "vscjava.vscode-java-pack": { + "name": "Java", + "important": true, + "isExtensionPack": true, + "whenNotInstalled": [ + "ASF.apache-netbeans-java" + ] + } + } + }, + "github-pull-request": { + "configPath": ".vscode/.github-pull-request.rec", + "configName": "GitHub", + "configScheme": "vscode-vfs", + "recommendations": { + "github.vscode-pull-request-github": { + "name": "GitHub Pull Request", + "important": true + } + } + }, + "pyproject-formatter": { + "configPath": "pyproject.toml", + "configName": "Python Formatter", + "recommendations": { + "ms-python.black-formatter": { + "name": "Black Formatter", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?black\"?\\s*[\\].])|(\"black\\s*[\"[(<=>!~;@])" + }, + "ms-python.autopep8": { + "name": "Autopep8", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?autopep8\"?\\s*[\\].])|(\"autopep8\\s*[\"[(<=>!~;@])" + } + } + }, + "pep8-formatter": { + "configPath": ".pep8", + "configName": "Python Formatter", + "recommendations": { + "ms-python.autopep8": { + "name": "Autopep8" + } + } + }, + "python-setup-cgf-formatter": { + "configPath": "setup.cfg", + "configName": "Python Formatter", + "recommendations": { + "ms-python.autopep8": { + "name": "Autopep8", + "contentPattern": "^\\[pep8\\]" + } + } + }, + "tox-ini-formatter": { + "configPath": "tox.ini", + "configName": "Python Formatter", + "recommendations": { + "ms-python.autopep8": { + "name": "Autopep8", + "contentPattern": "^\\[pep8\\]" + } + } + }, + "pyproject-linter": { + "configPath": "pyproject.toml", + "configName": "Python Linter", + "recommendations": { + "ms-python.pylint": { + "name": "Pylint", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?pylint\"?\\s*[\\].])|(\"pylint\\s*[\"[(<=>!~;@])" + }, + "charliermarsh.ruff": { + "name": "Ruff", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?ruff\"?\\s*[\\].])|(\"ruff\\s*[\"[(<=>!~;@])" + }, + "ms-python.mypy-type-checker": { + "name": "Mypy Type Checker", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?mypy\"?\\s*[\\].])|(\"mypy\\s*[\"[(<=>!~;@])" + }, + "ms-python.flake8": { + "name": "Flake8", + "contentPattern": "(^\\s*\\[\\[?\\s*\"?tool\"?\\s*\\.\\s*\"?flake8\"?\\s*[\\].])|(\"flake8\\s*[\"[(<=>!~;@])" + } + } + }, + ".pylintrc-linter": { + "configPath": ".pylintrc", + "configName": "Python Linter", + "recommendations": { + "ms-python.pylint": { + "name": "Pylint" + } + } + }, + "pylintrc-linter": { + "configPath": "pylintrc", + "configName": "Python Linter", + "recommendations": { + "ms-python.pylint": { + "name": "Pylint" + } + } + }, + "mypy-ini-linter": { + "configPath": ".mypy.ini", + "configName": "Python Linter", + "recommendations": { + "ms-python.mypy-type-checker": { + "name": "Mypy Type Checker" + } + } + }, + "tox-ini-linter": { + "configPath": "tox.ini", + "configName": "Python Linter", + "recommendations": { + "ms-python.flake8": { + "name": "Flake8", + "contentPattern": "^\\[flake8\\]" + } + } + }, + ".flake8-linter": { + "configPath": ".flake8", + "configName": "Python Linter", + "recommendations": { + "ms-python.flake8": { + "name": "Flake8" + } + } + }, + "python-setup-cgf-linter": { + "configPath": "setup.cfg", + "configName": "Python Linter", + "recommendations": { + "ms-python.flake8": { + "name": "Flake8", + "contentPattern": "^\\[flake8\\]" + } + } + } + }, + "webExtensionTips": [ + "tyriar.luna-paint", + "codespaces-contrib.codeswing", + "ms-vscode.vscode-github-issue-notebooks", + "esbenp.prettier-vscode", + "hediet.vscode-drawio" + ], + "virtualWorkspaceExtensionTips": { + "vscode-vfs": { + "friendlyName": "Remote Repositories", + "extensionId": "ms-vscode.remote-repositories", + "startEntry": { + "helpLink": "https://aka.ms/vscode-remote/remote-repositories", + "startConnectLabel": "Remote Repository", + "startCommand": "remoteHub.continueOn.openRepository", + "priority": 5 + } + } + }, + "remoteExtensionTips": { + "wsl": { + "friendlyName": "WSL", + "extensionId": "ms-vscode-remote.remote-wsl", + "supportedPlatforms": [ + "Windows", + "Web" + ], + "startEntry": { + "helpLink": "https://aka.ms/vscode-remote/wsl", + "startConnectLabel": "WSL", + "startCommand": "remote-wsl.connect", + "priority": 3 + } + }, + "ssh-remote": { + "friendlyName": "Remote - SSH", + "extensionId": "ms-vscode-remote.remote-ssh", + "supportedPlatforms": [ + "Windows", + "Linux", + "Mac" + ], + "startEntry": { + "helpLink": "https://aka.ms/vscode-remote/ssh", + "startConnectLabel": "SSH ", + "startCommand": "opensshremotes.openEmptyWindowInCurrentWindow", + "priority": 1 + } + }, + "dev-container": { + "friendlyName": "Dev Containers", + "extensionId": "ms-vscode-remote.remote-containers", + "supportedPlatforms": [ + "Windows", + "Linux", + "Mac" + ], + "startEntry": { + "helpLink": "https://aka.ms/vscode-remote/containers", + "startConnectLabel": "Dev Container", + "startCommand": "remote-containers.reopenInContainer", + "priority": 2 + } + }, + "attached-container": { + "friendlyName": "Dev Containers", + "extensionId": "ms-vscode-remote.remote-containers" + }, + "codespaces": { + "friendlyName": "GitHub Codespaces", + "extensionId": "github.codespaces", + "startEntry": { + "helpLink": "https://aka.ms/vscode-remote-codespaces", + "startConnectLabel": "GitHub Codespace ", + "startCommand": "github.codespaces.connect", + "priority": 4 + } + }, + "tunnel": { + "friendlyName": "Remote - Tunnels", + "extensionId": "ms-vscode.remote-server", + "startEntry": { + "helpLink": "https://aka.ms/remote-tunnels-doc", + "startConnectLabel": "Tunnel", + "startCommand": "remote-tunnels.connectCurrentWindowToTunnel", + "priority": 0 + } + } + }, + "extensionAllowedBadgeProviders": [ + "api.bintray.com", + "api.travis-ci.com", + "api.travis-ci.org", + "app.fossa.io", + "badge.buildkite.com", + "badge.fury.io", + "badge.waffle.io", + "badgen.net", + "badges.frapsoft.com", + "badges.gitter.im", + "badges.greenkeeper.io", + "cdn.travis-ci.com", + "cdn.travis-ci.org", + "ci.appveyor.com", + "circleci.com", + "cla.opensource.microsoft.com", + "codacy.com", + "codeclimate.com", + "codecov.io", + "coveralls.io", + "david-dm.org", + "deepscan.io", + "dev.azure.com", + "docs.rs", + "flat.badgen.net", + "gemnasium.com", + "githost.io", + "gitlab.com", + "godoc.org", + "goreportcard.com", + "img.shields.io", + "isitmaintained.com", + "marketplace.visualstudio.com", + "nodesecurity.io", + "opencollective.com", + "snyk.io", + "travis-ci.com", + "travis-ci.org", + "visualstudio.com", + "vsmarketplacebadge.apphb.com", + "www.bithound.io", + "www.versioneye.com" + ], + "extensionAllowedBadgeProvidersRegex": [ + "^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/(actions\\/)?workflows\\/.*badge\\.svg" + ], + "msftInternalDomains": [ + "redmond.corp.microsoft.com", + "northamerica.corp.microsoft.com", + "fareast.corp.microsoft.com", + "ntdev.corp.microsoft.com", + "wingroup.corp.microsoft.com", + "southpacific.corp.microsoft.com", + "wingroup.windeploy.ntdev.microsoft.com", + "ddnet.microsoft.com", + "europe.corp.microsoft.com" + ], + "linkProtectionTrustedDomains": [ + "https://*.visualstudio.com", + "https://*.microsoft.com", + "https://aka.ms", + "https://*.gallerycdn.vsassets.io", + "https://*.github.com", + "https://login.microsoftonline.com", + "https://*.vscode.dev", + "https://*.github.dev", + "https://gh.io", + "https://portal.azure.com" + ], + "featuredExtensions": [ + { + "id": "github.copilot", + "title": "GitHub Copilot", + "description": "Supercharge your coding experience for as little as $10/month with cutting edge AI code generation." + } + ] +} \ No newline at end of file diff --git a/repo/code-marketplace/patch.py b/repo/code-marketplace/patch.py new file mode 100755 index 0000000..8e0cb76 --- /dev/null +++ b/repo/code-marketplace/patch.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +import sys +import json +import os + +pkt_name = sys.argv[1] +operation = sys.argv[2] + +product_path = "/usr/lib/code/product.json" +patch_path = "/usr/share/%s/patch.json" % pkt_name +cache_path = "/usr/share/%s/cache.json" % pkt_name + +if not os.path.exists(cache_path): + with open(cache_path, 'w') as file: + file.write("{}") + +def patch(): + with open(product_path, "r") as product_file: + product_data = json.load(product_file) + with open(patch_path, "r") as patch_file: + patch_data = json.load(patch_file) + cache_data = {} + for key in patch_data.keys(): + if key in product_data: + cache_data[key] = product_data[key] + product_data[key] = patch_data[key] + with open(product_path, "w") as product_file: + json.dump(product_data, product_file, indent='\t') + with open(cache_path, "w") as cache_file: + json.dump(cache_data, cache_file, indent='\t') + +def restore(): + with open(product_path, "r") as product_file: + product_data = json.load(product_file) + with open(patch_path, "r") as patch_file: + patch_data = json.load(patch_file) + with open(cache_path, "r") as cache_file: + cache_data = json.load(cache_file) + for key in patch_data.keys(): + if key in product_data: + del product_data[key] + for key in cache_data.keys(): + product_data[key] = cache_data[key] + with open(product_path, "w") as product_file: + json.dump(product_data, product_file, indent='\t') + +if operation == "patch": + patch() +elif operation == "restore": + restore() diff --git a/repo/code-marketplace/patch.sh b/repo/code-marketplace/patch.sh deleted file mode 100755 index 75141c3..0000000 --- a/repo/code-marketplace/patch.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env sh - -product_json_path="/usr/lib/code/product.json" - -_patch() { - # Patch "extensionsGallery" - - # Remove original "extensionsGallery" key. - sed -i -z -e 's/\t"extensionsGallery.*item"\n\t},\n//' \ - "${1}" - - # Add new "extensionsGallery" key - # Use vim to open product.json in official release and visual select the lines of "extensionsGallery" - # Execute :'<,'>join - # Select joined line and execute :'<,'>s/\//\\\//g - sed -i -e '/^\t"quality/a\\t"extensionsGallery": { "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" },' \ - "${1}" - - - - # Patch "linkProtectionTrustedDomains" - - # Use vim to open product.json in official release and visual select the line of "linkProtectionTrustedDomains" - # Execute :'<,'>s/\//\\\//g - sed -i -e 's/^\t"linkProtectionTrustedDomains.*/\t"linkProtectionTrustedDomains": ["https:\/\/*.visualstudio.com", "https:\/\/*.microsoft.com", "https:\/\/aka.ms", "https:\/\/*.gallerycdn.vsassets.io", "https:\/\/*.github.com", "https:\/\/login.microsoftonline.com", "https:\/\/*.vscode.dev", "https:\/\/*.github.dev", "https:\/\/gh.io"],/' \ - "${1}" -} - -_restore() { - sed -i -e 's/^\t"extensionsGallery.*/\t"extensionsGallery": {\n\t\t"serviceUrl": "https:\/\/open-vsx.org\/vscode\/gallery",\n\t\t"itemUrl": "https:\/\/open-vsx.org\/vscode\/item"\n\t},/' \ - -e 's/^\t"linkProtectionTrustedDomains.*/\t"linkProtectionTrustedDomains": ["https:\/\/open-vsx.org"],/' \ - -e '/^\t"extensionTips/d' \ - "${1}" -} - -# Use grep -q to detect if product.json has already been patched. -if grep -q "open-vsx" "${product_json_path}" & [ "$1" = '' ]; then - _patch "${product_json_path}" -elif ! grep -q "open-vsx" "${product_json_path}" & [ "$1" = '-R' ]; then - _restore "${product_json_path}" -fi diff --git a/repo/code-marketplace/update.py b/repo/code-marketplace/update.py new file mode 100755 index 0000000..d5acce6 --- /dev/null +++ b/repo/code-marketplace/update.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +# This script can update the content of ./patch.json to the latest version +# Usage: ./update.py /path/to/extracted/produce.json +# Where /path/to/extracted/produce.json is extracted from the latest version of official vscode release + +import sys +import json + +key_list = [ + "extensionsGallery", + "extensionRecommendations", + "keymapExtensionTips", + "languageExtensionTips", + "configBasedExtensionTips", + "webExtensionTips", + "virtualWorkspaceExtensionTips", + "remoteExtensionTips", + "extensionAllowedBadgeProviders", + "extensionAllowedBadgeProvidersRegex", + "msftInternalDomains", + "linkProtectionTrustedDomains", + "featuredExtensions" +] + +product_path = sys.argv[1] +patch_path = "patch.json" + +with open(product_path, "r") as product_file: + product_data = json.load(product_file) + +patch_data = {} + +for key in key_list: + patch_data[key] = product_data[key] + +with open(patch_path, "w") as patch_file: + json.dump(patch_data, patch_file, indent='\t')