2024-01-17, fix for ibon verification, maxbot plus extension add new tab to access local dictionary.

master
Your Name 2024-02-06 17:09:46 +08:00
parent f16e5f62d9
commit d79bd8dfa3
8 changed files with 122 additions and 105 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.01.16)"
CONST_APP_VERSION = "MaxBot (2024.01.17)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -2951,24 +2951,29 @@ def fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_li
# PS: sometime may send key twice...
form_input_1.clear()
form_input_1.send_keys(inferred_answer_string)
is_button_clicked = False
if is_do_press_next_button:
if submit_by_enter:
form_input_1.send_keys(Keys.ENTER)
is_button_clicked = True
if len(next_step_button_css) > 0:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css)
if is_button_clicked:
is_answer_sent = True
fail_list.append(inferred_answer_string)
if show_debug_message:
print("sent password by bot:", inferred_answer_string, " at #", len(fail_list))
except Exception as exc:
if show_debug_message:
print(exc)
pass
is_button_clicked = False
try:
if is_do_press_next_button:
if submit_by_enter:
form_input_1.send_keys(Keys.ENTER)
is_button_clicked = True
if len(next_step_button_css) > 0:
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css)
except Exception as exc:
if show_debug_message:
print(exc)
pass
if is_button_clicked:
is_answer_sent = True
fail_list.append(inferred_answer_string)
if show_debug_message:
print("sent password by bot:", inferred_answer_string, " at #", len(fail_list))
if is_answer_sent:
for i in range(3):
time.sleep(0.1)
@ -8475,17 +8480,18 @@ def cityline_main(driver, url, config_dict):
cityline_shows_goto_cta(driver)
def get_ibon_question_text(driver):
form_select = None
question_div = None
try:
form_select = driver.find_element(By.CSS_SELECTOR, 'div.editor-box > div > div.form-group > label')
content_div = driver.find_element(By.CSS_SELECTOR, '#content')
question_div = content_div.find_element(By.CSS_SELECTOR, 'label')
except Exception as exc:
print("find verify textbox fail")
pass
question_text = ""
if not form_select is None:
if not question_div is None:
try:
question_text = form_select.text
question_text = question_div.text
except Exception as exc:
print("get text fail")

View File

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

View File

@ -40,7 +40,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.01.16)"
CONST_APP_VERSION = "MaxBot (2024.01.17)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -1,84 +1,6 @@
var myInterval = null;
//console.log("assign appear");
function kktix_area_keyword(settings, register_info)
{
let area_keyword_array = [];
if(settings.area_auto_select.area_keyword.length > 0) {
area_keyword_array = JSON.parse('[' + settings.area_auto_select.area_keyword +']');
}
// console.log(area_keyword_array);
let target_area = [];
if(area_keyword_array.length) {
for (let i = 0; i < area_keyword_array.length; i++) {
let matched_block=[];
$("div.ticket-unit").each(function ()
{
let html_text=$(this).text();
if(html_text.indexOf(area_keyword_array[i])>-1) {
matched_block.push($(this));
}
target_area = get_target_area_with_order(settings, matched_block);
});
if (matched_block.length) {
console.log("match keyword:" + area_keyword_array[i]);
break;
}
}
} else {
let query_string = "div.ticket-unit";
let matched_block=$(query_string);
target_area = get_target_area_with_order(settings, matched_block);
}
if (target_area.length) {
let first_node = target_area.find(":first-child");
let link_id = first_node.attr("id");
//console.log("link_id: " + link_id);
if(link_id) {
$('input[type=checkbox]').each(function() {
//$(this).prop('checked', true);
if(!$(this).is(':checked')) {
$(this).click();
}
});
let seat_inventory_key=link_id.split("_")[1];
let seat_inventory_number=register_info.inventory.seatInventory[seat_inventory_key];
let ticket_number = settings.ticket_number;
if(seat_inventory_number<ticket_number) {
ticket_number=seat_inventory_number;
}
if(ticket_number>0) {
/*
let target_input = target_area.find("input");
target_input.click();
target_input.prop("value", ticket_number);
let down = $.Event('keydown');
down.key=""+ticket_number;
target_input.trigger(down);
let up = $.Event('keyup');
up.key=""+ticket_number;
target_input.trigger(up);
*/
let add_button = target_area.find('button[ng-click="quantityBtnClick(1)"]');
for(let i=0; i<ticket_number; i++) {
add_button.click();
}
let $next_btn = $('div.register-new-next-button-area > button');
$next_btn.click();
}
}
} else {
console.log("not target_area found.")
}
}
function begin()
{
console.log("begin to next");

View File

@ -0,0 +1,48 @@
const storage = chrome.storage.local;
var settings = null;
function ibon_verification_main() {
let user_guess_string_array = [];
if(settings) {
if(settings.advanced.user_guess_string.length > 0) {
if(settings.advanced.user_guess_string!='""') {
user_guess_string_array = JSON.parse('[' + settings.advanced.user_guess_string +']');
}
}
}
let target_row=null;
let all_row = $("div.editor-box > div > div.form-group > input[type='text']");
if (all_row.length > 0 && user_guess_string_array.length > 0)
{
//console.log("input count:" + all_row.length);
let travel_index=0;
all_row.each(function ()
{
let current_index = all_row.index(this);
//console.log("current_index:" + current_index);
if(current_index+1 <= user_guess_string_array.length) {
//console.log("input data:" + user_guess_string_array[current_index]);
$(this).val(user_guess_string_array[current_index]);
}
});
}
}
storage.get('settings', function (items)
{
if (items.settings)
{
settings = items.settings;
}
});
storage.get('status', function (items)
{
if (items.status && items.status=='ON')
{
ibon_verification_main();
} else {
console.log('no status found');
}
});

View File

@ -262,6 +262,17 @@
"js/ibon_ticket_next.js"
]
},
{
"matches": [
"https://orders.ibon.com.tw/application/UTK02/UTK0201_0.aspx?*PERFORMANCE_ID=*PRODUCT_ID=*",
"https://orders.ibon.com.tw/application/UTK02/UTK0201_0.aspx?*PRODUCT_ID=*PERFORMANCE_ID=*"
],
"run_at": "document_end",
"js": [
"jquery.min.js",
"js/ibon_verification.js"
]
},
{
"matches": [
"https://queue.hkticketing.com/hotshow.html",
@ -380,5 +391,5 @@
]
}
],
"version": "1.0.8"
"version": "1.0.9"
}

View File

@ -12,10 +12,18 @@
<h2>MaxBot Settings</h2>
<div class="row g-3">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation"><button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Perference</button></li>
<li class="nav-item" role="presentation"><button class="nav-link" id="advanced-tab" data-bs-toggle="tab" data-bs-target="#advanced-tab-pane" type="button" role="tab" aria-controls="advanced-tab-pane" aria-selected="false">Advanced</button></li>
<li class="nav-item" role="presentation">
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Perference</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="advanced-tab" data-bs-toggle="tab" data-bs-target="#advanced-tab-pane" type="button" role="tab" aria-controls="advanced-tab-pane" aria-selected="false">Advanced</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="verification-tab" data-bs-toggle="tab" data-bs-target="#verification-tab-pane" type="button" role="tab" aria-controls="verification-tab-pane" aria-selected="false">Verification</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<!-- tab 1 -->
<div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">
<div class="row mb-3">
<label for="ticket_number" class="col-sm-2 col-form-label">Ticket Number</label>
@ -114,7 +122,8 @@
</div>
</div>
</div>
<div class="tab-pane fade" id="advanced-tab-pane" role="tabpanel" aria-labelledby="advanced-tab" tabindex="0">
<!-- tab 2 -->
<div class="tab-pane fade" id="advanced-tab-pane" role="tabpanel" aria-labelledby="advanced-tab" tabindex="1">
<div class="row mb-3">
<label for="auto_reload_page_interval" class="col-sm-2 col-form-label">Reload page interval(sec.)</label>
<div class="col-sm-10">
@ -146,6 +155,15 @@
</div>
</div>
</div>
<!-- tab 3 -->
<div class="tab-pane fade" id="verification-tab-pane" role="tabpanel" aria-labelledby="verification-tab" tabindex="2">
<div class="row mb-3">
<label for="user_guess_string" class="col-sm-2 col-form-label">Local Dictionary</label>
<div class="col-sm-10">
<textarea class="form-control" id="user_guess_string" rows="3"></textarea>
</div>
</div>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" id="save_btn">Save</button>

View File

@ -12,6 +12,7 @@ const disable_adjacent_seat = document.querySelector('#disable_adjacent_seat');
const ocr_captcha_enable = document.querySelector('#ocr_captcha_enable');
const ocr_captcha_use_public_server = document.querySelector('#ocr_captcha_use_public_server');
const remote_url = document.querySelector('#remote_url');
const user_guess_string = document.querySelector('#user_guess_string');
const PUBLIC_SERVER_URL = "http://maxbot.dropboxlike.com:16888/";
@ -25,7 +26,7 @@ ocr_captcha_use_public_server.addEventListener('change', checkUsePublicServer);
async function saveChanges()
{
const ticket_number_value = ticket_number.value;
console.log(ticket_number_value);
//console.log(ticket_number_value);
if (!ticket_number_value)
{
message('Error: No ticket_number specified');
@ -48,6 +49,12 @@ async function saveChanges()
}
settings.area_auto_select.area_keyword = area_keyword_string;
let user_guess_string_string = user_guess_string.value;
if(user_guess_string_string.indexOf('"')==-1) {
user_guess_string_string = '"' + user_guess_string_string + '"';
}
settings.advanced.user_guess_string = user_guess_string_string;
settings.keyword_exclude = keyword_exclude.value;
settings.advanced.auto_reload_page_interval = auto_reload_page_interval.value;
@ -94,6 +101,11 @@ function loadChanges()
area_keyword.value='';
}
user_guess_string.value = settings.advanced.user_guess_string;
if(user_guess_string.value=='""') {
user_guess_string.value='';
}
keyword_exclude.value = settings.keyword_exclude;
auto_reload_page_interval.value = settings.advanced.auto_reload_page_interval;
disable_adjacent_seat.checked = settings.advanced.disable_adjacent_seat;