diff options
Diffstat (limited to 'patch.py')
-rwxr-xr-x | patch.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/patch.py b/patch.py new file mode 100755 index 000000000000..6aef3d7f2218 --- /dev/null +++ b/patch.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +from sys import argv +from json import load, dump, JSONDecodeError + +PRODUCT_JSON_LOCATION = "/opt/vscodium-bin/resources/app/product.json" + + +if __name__ == "__main__": + try: + with open(PRODUCT_JSON_LOCATION) as file: + product = load(file) + except JSONDecodeError: + print( + "error: couldn't parse local product.json or fetch a new one from the web") + exit(1) + if '-R' in argv: + product["extensionsGallery"] = { + "serviceUrl": "https://open-vsx.org/vscode/gallery", + "itemUrl": "https://open-vsx.org/vscode/item", + } + product["linkProtectionTrustedDomains"] = ["https://open-vsx.org"] + else: + product["extensionsGallery"] = { + "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", + "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", + "itemUrl": "https://marketplace.visualstudio.com/items" + } + product.pop("linkProtectionTrustedDomains", None) + + with open(PRODUCT_JSON_LOCATION, mode='w') as file: + dump(product, file, indent=2) |