feat: Add JavaScript trial reset code and update PR description

This commit is contained in:
Nigel1992
2025-03-15 23:52:39 +01:00
parent 808b1ba3dc
commit 975647765d
2 changed files with 82 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ import configparser
from new_signup import get_user_documents_path
import traceback
from config import get_config
from github_trial_reset import reset_trial as github_reset_trial
# Initialize colorama
init()
@@ -691,19 +692,30 @@ class MachineIDResetter:
return False
def run(translator=None):
config = get_config(translator)
if not config:
"""Main function to run the reset process"""
try:
print(f"\n{Fore.CYAN}{EMOJI['RESET']} {translator.get('reset.starting_reset') if translator else 'Starting reset process...'}{Style.RESET_ALL}")
# First, try GitHub trial reset
print(f"\n{Fore.CYAN}{EMOJI['INFO']} Attempting GitHub trial reset...{Style.RESET_ALL}")
if github_reset_trial(translator):
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} GitHub trial reset completed successfully!{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}{EMOJI['INFO']} GitHub trial reset failed, falling back to manual reset...{Style.RESET_ALL}")
# Then proceed with manual reset
resetter = MachineIDResetter(translator)
if resetter.reset():
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {translator.get('reset.completed_successfully') if translator else 'Reset completed successfully!'}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.failed') if translator else 'Reset failed!'}{Style.RESET_ALL}")
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {translator.get('reset.error_occurred', error=str(e)) if translator else f'An error occurred: {str(e)}'}{Style.RESET_ALL}")
print(f"{Fore.YELLOW}{EMOJI['INFO']} {translator.get('reset.stack_trace')}: {traceback.format_exc()}{Style.RESET_ALL}")
return False
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
print(f"{Fore.CYAN}{EMOJI['RESET']} {translator.get('reset.title')}{Style.RESET_ALL}")
print(f"{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
resetter = MachineIDResetter(translator) # Correctly pass translator
resetter.reset_machine_ids()
print(f"\n{Fore.CYAN}{'='*50}{Style.RESET_ALL}")
input(f"{EMOJI['INFO']} {translator.get('reset.press_enter')}...")
return True
if __name__ == "__main__":
from main import translator as main_translator
run(main_translator)
run()