2024-01-08, bugs fix.

master
Your Name 2024-01-16 14:24:21 +08:00
parent 322ef1093b
commit 600433be1f
6 changed files with 96 additions and 15 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.07)" CONST_APP_VERSION = "MaxBot (2024.01.08)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -2971,10 +2971,9 @@ def get_answer_list_from_user_guess_string(config_dict):
# load from internet. # load from internet.
user_guess_string = "" user_guess_string = ""
if len(config_dict["advanced"]["online_dictionary_url"]) > 0: if os.path.exists(CONST_MAXBOT_ANSWER_ONLINE_FILE):
if os.path.exists(CONST_MAXBOT_ANSWER_ONLINE_FILE): with open(CONST_MAXBOT_ANSWER_ONLINE_FILE, "r") as text_file:
with open(CONST_MAXBOT_ANSWER_ONLINE_FILE, "r") as text_file: user_guess_string = text_file.readline()
user_guess_string = text_file.readline()
if len(user_guess_string) > 0: if len(user_guess_string) > 0:
user_guess_string = format_config_keyword_for_json(user_guess_string) user_guess_string = format_config_keyword_for_json(user_guess_string)
try: try:

View File

@ -22,7 +22,7 @@ import sys
import threading import threading
import webbrowser import webbrowser
CONST_APP_VERSION = "MaxBot (2024.01.07)" CONST_APP_VERSION = "MaxBot (2024.01.08)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -1 +1,70 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "proxy_server_port": ""}} {
"homepage": "https://tixcraft.com",
"browser": "chrome",
"language": "\u7e41\u9ad4\u4e2d\u6587",
"ticket_number": 2,
"ocr_captcha": {
"enable": true,
"beta": true,
"force_submit": true,
"image_source": "canvas"
},
"webdriver_type": "undetected_chromedriver",
"date_auto_select": {
"enable": true,
"date_keyword": "",
"mode": "random"
},
"area_auto_select": {
"enable": true,
"mode": "random",
"area_keyword": ""
},
"keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"",
"kktix": {
"auto_press_next_step_button": true,
"auto_fill_ticket_number": true
},
"tixcraft": {
"pass_date_is_sold_out": true,
"auto_reload_coming_soon_page": true
},
"advanced": {
"play_captcha_sound": {
"enable": true,
"filename": "ding-dong.wav"
},
"tixcraft_sid": "",
"ibonqware": "",
"facebook_account": "",
"kktix_account": "",
"fami_account": "",
"cityline_account": "",
"urbtix_account": "",
"hkticketing_account": "",
"kham_account": "",
"ticket_account": "",
"udn_account": "",
"ticketplus_account": "",
"facebook_password": "",
"kktix_password": "",
"fami_password": "",
"urbtix_password": "",
"cityline_password": "",
"hkticketing_password": "",
"kham_password": "",
"ticket_password": "",
"udn_password": "",
"ticketplus_password": "",
"disable_adjacent_seat": false,
"hide_some_image": true,
"block_facebook_network": false,
"headless": false,
"verbose": false,
"auto_guess_options": true,
"user_guess_string": "",
"remote_url": "\"http://127.0.0.1:16888/\"",
"auto_reload_page_interval": 0.1,
"proxy_server_port": ""
}
}

View File

@ -38,7 +38,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.07)" CONST_APP_VERSION = "MaxBot (2024.01.08)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -994,16 +994,18 @@ def btn_save_act(language_code, slience_mode=False):
if not file_to_save is None: if not file_to_save is None:
if len(file_to_save) > 0: if len(file_to_save) > 0:
print("save as to:", file_to_save) print("save as to:", file_to_save)
with open(file_to_save, 'w') as outfile: save_json(config_dict, file_to_save)
json.dump(config_dict, outfile)
else: else:
# slience # slience
with open(config_filepath, 'w') as outfile: save_json(config_dict, config_filepath)
json.dump(config_dict, outfile)
return is_all_data_correct return is_all_data_correct
def save_json(config_dict, target_path):
json_str = json.dumps(config_dict, indent=4)
with open(target_path, 'w') as outfile:
outfile.write(json_str)
def btn_run_clicked(language_code): def btn_run_clicked(language_code):
print('run button pressed.') print('run button pressed.')
Root_Dir = "" Root_Dir = ""

View File

@ -1 +1 @@
{"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "disable_adjacent_seat": false, "hide_some_image": false, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "proxy_server_port": ""}} {"homepage": "https://tixcraft.com", "browser": "chrome", "language": "\u7e41\u9ad4\u4e2d\u6587", "ticket_number": 2, "ocr_captcha": {"enable": true, "beta": true, "force_submit": true, "image_source": "canvas"}, "webdriver_type": "undetected_chromedriver", "date_auto_select": {"enable": true, "date_keyword": "", "mode": "random"}, "area_auto_select": {"enable": true, "mode": "random", "area_keyword": ""}, "keyword_exclude": "\"\u8f2a\u6905\",\"\u8eab\u969c\",\"\u8eab\u5fc3 \u969c\u7919\",\"Restricted View\",\"\u71c8\u67f1\u906e\u853d\",\"\u8996\u7dda\u4e0d\u5b8c\u6574\"", "kktix": {"auto_press_next_step_button": true, "auto_fill_ticket_number": true}, "tixcraft": {"pass_date_is_sold_out": true, "auto_reload_coming_soon_page": true}, "advanced": {"play_captcha_sound": {"enable": true, "filename": "ding-dong.wav"}, "tixcraft_sid": "", "ibonqware": "", "facebook_account": "", "kktix_account": "", "fami_account": "", "cityline_account": "", "urbtix_account": "", "hkticketing_account": "", "kham_account": "", "ticket_account": "", "udn_account": "", "ticketplus_account": "", "facebook_password": "", "kktix_password": "", "fami_password": "", "urbtix_password": "", "cityline_password": "", "hkticketing_password": "", "kham_password": "", "ticket_password": "", "udn_password": "", "ticketplus_password": "", "disable_adjacent_seat": false, "hide_some_image": true, "block_facebook_network": false, "headless": false, "verbose": false, "auto_guess_options": true, "user_guess_string": "", "remote_url": "\"http://127.0.0.1:16888/\"", "auto_reload_page_interval": 0.1, "proxy_server_port": ""}}

View File

@ -139,9 +139,20 @@ function get_ocr_image()
return image_data; return image_data;
} }
var last_captcha_answer="";
chrome.runtime.onMessage.addListener((message) => { chrome.runtime.onMessage.addListener((message) => {
//console.log('sent from background', message); //console.log('sent from background', message);
tixcraft_set_ocr_answer(message.answer); if(message.answer.length==4) {
tixcraft_set_ocr_answer(message.answer);
last_captcha_answer=message.answer;
} else {
// renew captcha.
if(last_captcha_answer!=message.answer) {
last_captcha_answer=message.answer;
console.log("renew captcha");
$('#TicketForm_verifyCode').click();
}
}
}); });
function tixcraft_set_ocr_answer(answer) function tixcraft_set_ocr_answer(answer)