diff options
author | Sainnhe Park | 2022-08-06 12:50:03 +0800 |
---|---|---|
committer | Sainnhe Park | 2022-08-06 12:50:03 +0800 |
commit | 2771302fe543c5aefca65f96a5f75d57f806b215 (patch) | |
tree | cf6d8c03faad7b2eee52ea9a72cd6783eed0753f | |
parent | 6f5283f9c4d7c9830fbaa9d9b1c93261c170de43 (diff) | |
download | aur-2771302fe543c5aefca65f96a5f75d57f806b215.tar.gz |
Update to 1.70.0
The patch.sh has been completely rewritten, with more clear explanation in comment, detection for if product.json has already been patched and more keys in "extensionsGallery".
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rwxr-xr-x | patch.sh | 55 |
3 files changed, 43 insertions, 23 deletions
@@ -1,6 +1,6 @@ pkgbase = code-marketplace pkgdesc = Enable vscode marketplace in Code OSS - pkgver = 1.66.0 + pkgver = 1.70.0 pkgrel = 1 url = https://marketplace.visualstudio.com/vscode install = code-marketplace.install @@ -8,10 +8,11 @@ pkgbase = code-marketplace license = unknown depends = code depends = sed + depends = grep optdepends = code-features: unblock some extensions specific to the official build source = code-marketplace.hook source = patch.sh md5sums = 2f5ebcc1795bb5eac95162059a9a496e - md5sums = 9bd7d0737d86c05900ee32f6821e681a + md5sums = 0cc8e76358594ef567cf90a62a8c7d82 pkgname = code-marketplace @@ -1,18 +1,18 @@ # Maintainer: Sainnhe Park <sainnhe@gmail.com> pkgname=code-marketplace -pkgver=1.66.0 +pkgver=1.70.0 pkgrel=1 pkgdesc='Enable vscode marketplace in Code OSS' arch=('any') url='https://marketplace.visualstudio.com/vscode' license=('unknown') -depends=('code' 'sed') +depends=('code' 'sed' 'grep') optdepends=('code-features: unblock some extensions specific to the official build') install="${pkgname}.install" source=('code-marketplace.hook' 'patch.sh') md5sums=('2f5ebcc1795bb5eac95162059a9a496e' - '9bd7d0737d86c05900ee32f6821e681a') + '0cc8e76358594ef567cf90a62a8c7d82') package() { install -Dm 644 "${srcdir}"/code-marketplace.hook "${pkgdir}"/usr/share/libalpm/hooks/code-marketplace.hook @@ -1,21 +1,40 @@ #!/usr/bin/env sh -if [ "${1}" = "-R" ]; then - sed -i -e 's/^[[:blank:]]*"serviceUrl":.*/\t\t"serviceUrl": "https:\/\/open-vsx.org\/vscode\/gallery",/' \ - -e '/^[[:blank:]]*"cacheUrl/d' \ - -e 's/^[[:blank:]]*"itemUrl":.*/\t\t"itemUrl": "https:\/\/open-vsx.org\/vscode\/item"/' \ - -e '/^[[:blank:]]*"resourceUrlTemplate/d' \ - -e '/^[[:blank:]]*"controlUrl/d' \ - -e '/^[[:blank:]]*"linkProtectionTrustedDomains/d' \ - -e '/^[[:blank:]]*"documentationUrl/i\\t"linkProtectionTrustedDomains": ["https:\/\/open-vsx.org"],' \ - /usr/lib/code/product.json -else - sed -i -e 's/^[[:blank:]]*"serviceUrl":.*/\t\t"serviceUrl": "https:\/\/marketplace.visualstudio.com\/_apis\/public\/gallery",/' \ - -e '/^[[:blank:]]*"cacheUrl/d' \ - -e '/^[[:blank:]]*"serviceUrl/a\\t\t"cacheUrl": "https:\/\/vscode.blob.core.windows.net\/gallery\/index",' \ - -e 's/^[[:blank:]]*"itemUrl":.*/\t\t"itemUrl": "https:\/\/marketplace.visualstudio.com\/items",/' \ - -e '/^[[:blank:]]*"itemUrl/a\\t\t"resourceUrlTemplate": "https:\/\/{publisher}.vscode-unpkg.net\/{publisher}\/{name}\/{version}\/{path}",\n\t\t"controlUrl": "https:\/\/az764295.vo.msecnd.net\/extensions\/marketplace.json"' \ - -e '/^[[:blank:]]*"linkProtectionTrustedDomains/d' \ - -e '/^[[:blank:]]*"documentationUrl/i\\t"linkProtectionTrustedDomains": ["https:\/\/*.visualstudio.com", "https:\/\/*.microsoft.com", "https:\/\/aka.ms", "https:\/\/vscode-auth.github.com", "https:\/\/client-auth-staging-14a768b.herokuapp.com", "https:\/\/*.gallerycdn.vsassets.io", "https:\/\/github.com\/microsoft\/", "https:\/\/github.com\/MicrosoftDocs\/", "https:\/\/login.microsoftonline.com"],' \ - /usr/lib/code/product.json +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", "recommendationsUrl": "https:\/\/az764295.vo.msecnd.net\/extensions\/workspaceRecommendations.json.gz" },' \ + "${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\/microsoft\/", "https:\/\/github.com\/MicrosoftDocs\/", "https:\/\/login.microsoftonline.com"],/' \ + "${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"],/' \ + "${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 |