dotfiles/patch-codium.sh

16 lines
982 B
Bash
Executable file

#!/usr/bin/env bash
SERVICE_URL='https://marketplace.visualstudio.com/_apis/public/gallery'
CACHE_URL='https://vscode.blob.core.windows.net/gallery/index'
ITEM_URL='https://marketplace.visualstudio.com/items'
gum style --border rounded --margin '1 1' --padding '1 1' --align center --foreground '#5BCEFA' --border-foreground '#F5A9B8' 'Select the product.json file of vs-codium to patch it'
PRODUCT_JSON=$(sudo find /usr -name 'product.json' | gum choose)
JSON_STRING=$(cat $PRODUCT_JSON)
JSON_STRING=$(echo "$JSON_STRING" | jq '.extensionsGallery.serviceUrl = $newVal' --arg newVal "$SERVICE_URL")
JSON_STRING=$(echo "$JSON_STRING" | jq '.extensionsGallery.cacheUrl = $newVal' --arg newVal "$CACHE_URL")
JSON_STRING=$(echo "$JSON_STRING" | jq '.extensionsGallery.itemUrl = $newVal' --arg newVal "$ITEM_URL")
JSON_STRING=$(echo "$JSON_STRING" | jq 'del(.linkProtectionTrustedDomains)')
sudo cp $PRODUCT_JSON $PRODUCT_JSON.bkup
echo "$JSON_STRING" | jq . | sudo tee $PRODUCT_JSON