diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index ad7db3f..722da36 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -99,6 +99,18 @@ def t_or_f(arg): ret = True return ret +def format_config_keyword_for_json(user_input): + if len(user_input) > 0: + if not ('\"' in user_input): + user_input = '"' + user_input + '"' + if user_input[:1]=="{" and user_input[-1:]=="}" + user_input=user_input[1:] + user_input=user_input[:-] + if user_input[:1]=="[" and user_input[-1:]=="]" + user_input=user_input[1:] + user_input=user_input[:-] + return user_input + def sx(s1): key=18 return ''.join(chr(ord(a) ^ key) for a in s1) @@ -2333,6 +2345,7 @@ def tixcraft_verify(driver, config_dict, answer_index): presale_code = text_file.readline() if len(presale_code) > 0: + presale_code = format_config_keyword_for_json(presale_code) answer_list = json.loads("["+ presale_code +"]") if len(answer_list) > 0: if answer_index < len(answer_list)-1: @@ -3818,12 +3831,16 @@ def kktix_reg_captcha(driver, config_dict, answer_index, is_finish_checkbox_clic user_guess_string = "" if len(config_dict["advanced"]["user_guess_string"]) > 0: user_guess_string = config_dict["advanced"]["user_guess_string"] + + # load from internet. if len(user_guess_string) == 0: if len(config_dict["advanced"]["online_dictionary_url"]) > 0: if os.path.exists(CONST_MAXBOT_ANSWER_ONLINE_FILE): with open(CONST_MAXBOT_ANSWER_ONLINE_FILE, "r") as text_file: user_guess_string = text_file.readline() + if len(user_guess_string) > 0: + user_guess_string = format_config_keyword_for_json(user_guess_string) answer_list = json.loads("["+ user_guess_string +"]") if len(answer_list) == 1: inferred_answer_string = answer_list[0] diff --git a/pip-req.txt b/pip-req.txt index 2495deb..e3fe151 100644 --- a/pip-req.txt +++ b/pip-req.txt @@ -10,3 +10,4 @@ pyperclip ddddocr urllib3>=1.21.1 numpy +tornado diff --git a/settings.py b/settings.py index 081b194..54862f9 100644 --- a/settings.py +++ b/settings.py @@ -467,6 +467,18 @@ def load_translate(): translate['ja_jp']=ja_jp return translate +def format_config_keyword_for_json(user_input): + if len(user_input) > 0: + if not ('\"' in user_input): + user_input = '"' + user_input + '"' + if user_input[:1]=="{" and user_input[-1:]=="}" + user_input=user_input[1:] + user_input=user_input[:-] + if user_input[:1]=="[" and user_input[-1:]=="]" + user_input=user_input[1:] + user_input=user_input[:-] + return user_input + def sx(s1): key=18 return ''.join(chr(ord(a) ^ key) for a in s1) @@ -747,17 +759,13 @@ def btn_save_act(language_code, slience_mode=False): config_dict["tixcraft"]["auto_reload_coming_soon_page"] = bool(chk_state_auto_reload_coming_soon_page.get()) area_keyword = txt_area_keyword.get("1.0",END).strip() - if len(area_keyword) > 0: - if not ('\"' in area_keyword): - area_keyword = '"' + area_keyword + '"' + area_keyword = format_config_keyword_for_json(area_keyword) + area_keyword_exclude = txt_area_keyword_exclude.get("1.0",END).strip() - if len(area_keyword_exclude) > 0: - if not ('\"' in area_keyword_exclude): - area_keyword_exclude = '"' + area_keyword_exclude + '"' + area_keyword_exclude = format_config_keyword_for_json(area_keyword_exclude) + user_guess_string = txt_user_guess_string.get("1.0",END).strip() - if len(user_guess_string) > 0: - if not ('\"' in user_guess_string): - user_guess_string = '"' + user_guess_string + '"' + user_guess_string = format_config_keyword_for_json(user_guess_string) config_dict["area_auto_select"]["enable"] = bool(chk_state_area_auto_select.get()) config_dict["area_auto_select"]["mode"] = combo_area_auto_select_mode.get().strip() diff --git a/text_server.py b/text_server.py index 5141c83..b0008b8 100644 --- a/text_server.py +++ b/text_server.py @@ -25,7 +25,8 @@ import asyncio import tornado from tornado.web import Application -CONST_APP_VERSION = "MaxBot (2023.6.14)" +CONST_APP_VERSION = "MaxBot (2023.6.15)" + CONST_SERVER_PORT = 8888 def get_ip_address():