MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / uninstall_dedsec

Function uninstall_dedsec

Scripts/Settings.py:2825–2864  ·  view source on GitHub ↗

Restores config files from backup and instructs user on final folder removal.

()

Source from the content-addressed store, hash-verified

2823def ensure_github_connected_for_sponsors():
2824 """Uses the existing gh login flow before accessing Sponsors-Only content."""
2825 if not github_cli_available():
2826 print("[!] GitHub CLI (gh) could not be installed. Run manually: pkg install gh")
2827 return False
2828
2829 if github_auth_status():
2830 username = github_current_username()
2831 config = load_github_account_config()
2832 if username and (not config.get("connected") or config.get("username") != username):
2833 save_github_account_config({
2834 "connected": True,
2835 "username": username,
2836 "connected_at": config.get("connected_at", time.time()),
2837 "prompt_auto_username": config.get("prompt_auto_username", True),
2838 })
2839 return True
2840
2841 answer = input(_("GitHub is not connected yet. Connect GitHub now? (y/n): ")).strip().lower()
2842 if answer not in ("y", "yes"):
2843 print(_("GitHub connection is required for Sponsors-Only scripts."))
2844 return False
2845
2846 connect_github_account()
2847 return github_auth_status()
2848
2849
2850def github_token_for_sponsors():
2851 """Returns the active gh token without printing it."""
2852 token = github_auth_token()
2853 return (token or "").strip()
2854
2855
2856def _write_sponsors_git_askpass(token):
2857 """Creates a temporary GIT_ASKPASS helper so private git access avoids gh GraphQL."""
2858 askpass_path = os.path.join(HOME_DIR, f".dedsec_sponsors_askpass_{os.getpid()}.py")
2859 script = """#!/usr/bin/env python3
2860import os
2861import sys
2862prompt = " ".join(sys.argv[1:]).lower()
2863if "username" in prompt:
2864 print("x-access-token")
2865else:
2866 print(os.environ.get("DEDSEC_GITHUB_TOKEN", ""))
2867"""

Callers 1

mainFunction · 0.70

Calls 5

printFunction · 0.85
inputFunction · 0.85
_Function · 0.70
cleanup_bashrcFunction · 0.70
find_dedsecFunction · 0.70

Tested by

no test coverage detected