2023-11-21 15:16:47 +00:00
|
|
|
#!/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)')
|
2023-11-23 09:53:57 +00:00
|
|
|
sudo cp $PRODUCT_JSON $PRODUCT_JSON.bkup
|
2023-11-23 09:58:42 +00:00
|
|
|
echo "$JSON_STRING" | jq . | sudo tee $PRODUCT_JSON > /dev/null
|
2023-11-23 09:53:57 +00:00
|
|
|
|