dotfiles/patch-codium.sh
2023-11-21 16:17:54 +01:00

14 lines
945 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)')
echo "$JSON_STRING" | jq '.linkProtectionTrustedDomains'