diff --git a/platformio/app.py b/platformio/app.py index 374f4014..6c152c17 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -253,29 +253,14 @@ def is_disabled_progressbar(): def get_cid(): - # pylint: disable=import-outside-toplevel - from platformio.clients.http import fetch_remote_content - cid = get_state_item("cid") if cid: return cid uid = None - if os.getenv("C9_UID"): - uid = os.getenv("C9_UID") + if os.getenv("GITHUB_USER"): + uid = os.getenv("GITHUB_USER") elif os.getenv("GITPOD_GIT_USER_NAME"): uid = os.getenv("GITPOD_GIT_USER_NAME") - elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")): - try: - uid = json.loads( - fetch_remote_content( - "{api}/user?token={token}".format( - api=os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")), - token=os.getenv("USER_TOKEN"), - ) - ) - ).get("id") - except: # pylint: disable=bare-except - pass if not uid: uid = uuid.getnode() cid = uuid.UUID(bytes=hashlib.md5(hashlib_encode_data(uid)).digest()) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index ba370032..82aa4a0f 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -35,7 +35,6 @@ from platformio.package.manager.tool import ToolPackageManager from platformio.package.meta import PackageSpec from platformio.package.version import pepver_to_semver from platformio.platform.factory import PlatformFactory -from platformio.proc import is_container def on_platformio_start(ctx, force, caller): @@ -78,17 +77,12 @@ def set_caller(caller=None): caller = caller or os.getenv("PLATFORMIO_CALLER") if caller: return app.set_session_var("caller_id", caller) - if os.getenv("VSCODE_PID") or os.getenv("VSCODE_NLS_CONFIG"): + if os.getenv("CODESPACES"): + caller = "codespaces" + elif os.getenv("VSCODE_PID") or os.getenv("VSCODE_NLS_CONFIG"): caller = "vscode" - elif os.getenv("GITPOD_INSTANCE_ID") or os.getenv("GITPOD_WORKSPACE_URL"): + elif os.getenv("GITPOD_WORKSPACE_ID") or os.getenv("GITPOD_WORKSPACE_URL"): caller = "gitpod" - elif is_container(): - if os.getenv("C9_UID"): - caller = "C9" - elif os.getenv("USER") == "cabox": - caller = "CA" - elif os.getenv("CHE_API", os.getenv("CHE_API_ENDPOINT")): - caller = "Che" return app.set_session_var("caller_id", caller)