summarylogtreecommitdiffstats
path: root/patch.py
diff options
context:
space:
mode:
authorIcelk2023-03-18 22:20:11 +0100
committerIcelk2023-03-18 22:20:11 +0100
commit52d65c741c48c4db5c2f275c2453137e06786a18 (patch)
treead7f3c9001aa4542ce83935a5a6229e162d519b2 /patch.py
parent333a97a1618cbe4c2fdf0b613b9c35ae27450142 (diff)
downloadaur-vscodium-bin-marketplace.tar.gz
Use python to change product.json instead of sed.
Diffstat (limited to 'patch.py')
-rwxr-xr-xpatch.py31
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)