summarylogtreecommitdiffstats
path: root/patch.py
blob: 3676e90d96e69928746962cfa1ba4976d0011427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env python
from sys import argv
from json import load, dump, JSONDecodeError
from requests import get

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:
        result = get('https://github.com/microsoft/vscode/raw/main/product.json')
        if result.ok:
            product = result.json()
        else:
            print(
                "error: couldn't parse local product.json or fetch a new one from the web")
            exit(1)
    if '-R' in argv:
        product["nameLong"] = "VSCodium"
        product.pop("auth", None)
        product.pop("configurationSync.store", None)
        product.pop("editSessions.store", None)
        product.pop("extensionEnabledApiProposals", None)
    else:
        product["nameLong"] = "Visual Studio Code"
        product["auth"] = {
            "loginUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
            "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token",
            "redirectUrl": "https://vscode-redirect.azurewebsites.net/",
            "clientId": "aebc6443-996d-45c2-90f0-388ff96faa56"
        }
        product["configurationSync.store"] = {
            "url": "https://vscode-sync.trafficmanager.net/",
            "stableUrl": "https://vscode-sync.trafficmanager.net/",
            "insidersUrl": "https://vscode-sync-insiders.trafficmanager.net/",
            "canSwitch": False,
            "authenticationProviders": {
                "microsoft": {
                    "scopes": ["openid", "profile", "email", "offline_access"]
                },
                "github": {
                    "scopes": ["user:email"]
                }
            }
        }
        product["editSessions.store"] = {
            "url": "https://vscode-sync.trafficmanager.net/",
            "authenticationProviders": {
                "microsoft": {
                    "scopes": ["openid", "profile", "email", "offline_access"]
                },
                "github": {
                    "scopes": ["user:email"]
                }
            }
        }
        product["extensionEnabledApiProposals"] = {
            "ms-vscode.vscode-selfhost-test-provider": ["testObserver"],
            "VisualStudioExptTeam.vscodeintellicode-completions": ["inlineCompletionsAdditions"],
            "ms-vsliveshare.vsliveshare": [
                "contribMenuBarHome", "diffCommand",
                "documentFiltersExclusive", "fileSearchProvider",
                "findTextInFiles", "notebookCellExecutionState",
                "notebookLiveShare", "terminalDimensions",
                "terminalDataWriteEvent", "textSearchProvider"
            ],
            "ms-vscode.js-debug": [
                "portsAttributes", "findTextInFiles", "workspaceTrust",
                "tunnels"
            ],
            "ms-toolsai.vscode-ai-remote": ["resolvers"],
            "ms-python.python": ["quickPickSortByLabel", "testObserver", "telemetryLogger"],
            "ms-dotnettools.dotnet-interactive-vscode": ["notebookMessaging"],
            "GitHub.codespaces": [
                "contribEditSessions", "contribMenuBarHome",
                "contribRemoteHelp", "contribViewsRemote", "resolvers",
                "tunnels", "terminalDataWriteEvent", "treeViewReveal",
                "notebookKernelSource"
            ],
            "ms-vscode.azure-repos": [
                "extensionRuntime", "fileSearchProvider", "telemetryLogger",
                "textSearchProvider"
            ],
            "ms-vscode.remote-repositories": [
                "contribEditSessions", "contribRemoteHelp",
                "contribMenuBarHome", "contribViewsRemote",
                "contribViewsWelcome", "contribShareMenu",
                "documentFiltersExclusive", "editSessionIdentityProvider",
                "extensionRuntime", "fileSearchProvider",
                "quickPickSortByLabel", "workspaceTrust", "scmActionButton",
                "scmSelectedProvider", "scmValidation", "telemetryLogger",
                "textSearchProvider", "timeline"
            ],
            "ms-vscode-remote.remote-wsl": ["resolvers", "contribViewsRemote", "telemetry"],
            "ms-vscode-remote.remote-ssh": [
                "resolvers", "tunnels", "terminalDataWriteEvent",
                "contribViewsRemote", "telemetry"
            ],
            "ms-vscode.remote-server": ["resolvers"],
            "ms-vscode.remote-explorer": ["contribViewsRemote", "extensionsAny"],
            "ms-vscode-remote.remote-containers": [
                "contribEditSessions", "resolvers", "tunnels",
                "workspaceTrust", "terminalDimensions", "contribViewsRemote"
            ],
            "ms-vscode.js-debug-nightly": [
                "portsAttributes", "findTextInFiles", "workspaceTrust",
                "tunnels"
            ],
            "ms-vscode.lsif-browser": ["documentFiltersExclusive"],
            "GitHub.vscode-pull-request-github": [
                "contribCommentThreadAdditionalMenu", "tokenInformation",
                "commentsResolvedState", "contribShareMenu",
                "contribCommentPeekContext", "treeItemCheckbox",
                "codiconDecoration", "diffCommand"
            ],
            "GitHub.copilot": ["inlineCompletionsAdditions"],
            "GitHub.copilot-nightly": ["inlineCompletionsAdditions"],
            "GitHub.remotehub": [
                "contribRemoteHelp", "contribMenuBarHome",
                "contribViewsRemote", "contribViewsWelcome",
                "documentFiltersExclusive", "extensionRuntime",
                "fileSearchProvider", "quickPickSortByLabel", "workspaceTrust",
                "scmSelectedProvider", "scmValidation", "textSearchProvider",
                "timeline", "telemetryLogger"
            ],
            "ms-python.gather": ["notebookCellExecutionState"],
            "ms-python.vscode-pylance": ["notebookCellExecutionState"],
            "ms-toolsai.jupyter-renderers": ["contribNotebookStaticPreloads"],
            "ms-toolsai.jupyter": [
                "notebookControllerKind", "notebookDeprecated",
                "notebookMessaging", "notebookMime",
                "notebookCellExecutionState", "portsAttributes",
                "quickPickSortByLabel", "notebookKernelSource",
                "interactiveWindow", "notebookControllerAffinityHidden",
                "contribNotebookStaticPreloads"
            ],
            "dbaeumer.vscode-eslint": ["notebookCellExecutionState"],
            "ms-vscode.azure-sphere-tools-ui": ["tunnels"],
            "ms-azuretools.vscode-azureappservice": ["terminalDataWriteEvent"],
            "ms-vscode.anycode": ["extensionsAny"],
            "ms-vscode.cpptools": ["terminalDataWriteEvent"],
            "redhat.java": ["documentPaste"]
        }
    with open(PRODUCT_JSON_LOCATION, mode='w') as file:
        dump(product, file, indent=4)