2024-04-13, update cityline

master
Your Name 2024-04-30 22:13:45 +08:00
parent da2a83ceac
commit f8672be766
28 changed files with 1126 additions and 139 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -6746,7 +6746,8 @@ def cityline_close_second_tab(driver):
def cityline_main(driver, url, config_dict):
# https://msg.cityline.com/ https://event.cityline.com/
if 'msg.cityline.com' in url or 'event.cityline.com' in url:
cityline_auto_retry_access(driver, config_dict)
#cityline_auto_retry_access(driver, config_dict)
pass
cityline_close_second_tab(driver)

View File

@ -24,7 +24,7 @@ import webbrowser
import util
CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc)
pass
CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -263,6 +263,7 @@ async def nodriver_goto_homepage(driver, config_dict):
# for like human.
try:
tab = await driver.get(homepage)
await tab.get_content()
time.sleep(5)
except Exception as e:
pass
@ -302,6 +303,7 @@ async def nodriver_goto_homepage(driver, config_dict):
try:
tab = await driver.get(homepage)
await tab.get_content()
time.sleep(3)
except Exception as e:
pass
@ -1657,55 +1659,9 @@ async def nodriver_ibon_main(tab, url, config_dict, ocr, Captcha_Browser):
async def nodriver_cityline_auto_retry_access(tab, url, config_dict):
cityline_event_url = "https://event.cityline.com/"
# from loc redirect.
if "?loc=" in url:
url = url.replace("%3Flang%3DTW%26lang%3DTW","%3Flang%3DTW")
loc = url.split("?loc=")[1]
if len(loc) > 0:
if "&" in loc:
loc = url.split("&")[0]
loc_decode = urllib.parse.unquote(loc)
if len(loc_decode) > 0:
if loc_decode[:1]=="/":
loc_decode = loc_decode[1:]
if loc_decode[:6] != "https:":
new_url = cityline_event_url + loc_decode
if not "&lang=" in new_url:
new_url = new_url + "&lang=TW"
new_url = new_url.replace("lang=TW&lang=TW","lang=TW")
if new_url != url:
try:
#print("old url:", url)
print("redirect to url:", new_url)
tab = await tab.get(new_url)
time.sleep(0.2)
pass
except Exception as e:
print(e)
pass
# https://event.cityline.com/utsvInternet/EVENT_NAME/home?lang=TW
if "lang=TW" in url:
url_array = url.split("lang=TW")
if len(url_array) > 2:
new_url = url_array[0] + "lang=TW"
if new_url != url:
try:
new_url = new_url.replace("lang=TW&lang=TW","lang=TW")
print("redirect to url:", new_url)
tab = await tab.get(new_url)
time.sleep(0.2)
except Exception as exc:
print(exc)
pass
try:
btn_retry = await tab.query_selector('button')
if btn_retry:
#print("found button to click.")
btn_retry.click()
time.sleep(0.2)
js = "goEvent();"
await tab.evaluate(js)
except Exception as exc:
print(exc)
pass
@ -1894,7 +1850,8 @@ async def nodriver_cityline_main(tab, url, config_dict):
except Exception as exc:
pass
if is_dom_ready:
await nodriver_cityline_auto_retry_access(tab, url, config_dict)
#await nodriver_cityline_auto_retry_access(tab, url, config_dict)
pass
if 'cityline.com/Login.html' in url:
cityline_account = config_dict["advanced"]["cityline_account"]

View File

@ -76,7 +76,7 @@
"auto_guess_options": true,
"user_guess_string": "",
"remote_url": "\"http://127.0.0.1:16888/\"",
"auto_reload_page_interval": 0.2,
"auto_reload_page_interval": 0.1,
"reset_browser_interval": 0,
"kktix_status_api": false,
"max_dwell_time": 60,

View File

@ -34,7 +34,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_APP_VERSION = "MaxBot (2024.04.13)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -2745,7 +2745,7 @@ def check_maxbot_config_unsaved(config_dict):
def settgins_gui_timer():
while True:
btn_preview_text_clicked()
#btn_preview_text_clicked()
preview_question_text_file()
update_maxbot_runtime_status()
change_maxbot_status_by_keyword()

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_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "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.0, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]}
{"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_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "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, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}, "domain_filter": ["*.doubleclick.net/*", "*.googlesyndication.com/*", "*.ssp.hinet.net/*", "*a.amnet.tw/*", "*adx.c.appier.net/*", "*cdn.cookielaw.org/*", "*cdnjs.cloudflare.com/ajax/libs/clipboard.js/*", "*clarity.ms/*", "*cloudfront.com/*", "*cms.analytics.yahoo.com/*", "*e2elog.fetnet.net/*", "*fundingchoicesmessages.google.com/*", "*ghtinc.com/*", "*google-analytics.com/*", "*googletagmanager.com/*", "*googletagservices.com/*", "*img.uniicreative.com/*", "*lndata.com/*", "*match.adsrvr.org/*", "*onead.onevision.com.tw/*", "*play.google.com/log?*", "*popin.cc/*", "*rollbar.com/*", "*sb.scorecardresearch.com/*", "*tagtoo.co/*", "*ticketmaster.sg/js/adblock*", "*ticketmaster.sg/js/adblock.js*", "*tixcraft.com/js/analytics.js*", "*tixcraft.com/js/common.js*", "*tixcraft.com/js/custom.js*", "*treasuredata.com/*", "*www.youtube.com/youtubei/v1/player/heartbeat*"]}

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_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "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.0, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}
{"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_sound": {"ticket": true, "order": 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": "", "facebook_password_plaintext": "", "kktix_password_plaintext": "", "fami_password_plaintext": "", "urbtix_password_plaintext": "", "cityline_password_plaintext": "", "hkticketing_password_plaintext": "", "kham_password_plaintext": "", "ticket_password_plaintext": "", "udn_password_plaintext": "", "ticketplus_password_plaintext": "", "chrome_extension": true, "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, "reset_browser_interval": 0, "kktix_status_api": false, "max_dwell_time": 60, "proxy_server_port": "", "window_size": "480,1024,0", "idle_keyword": "", "resume_keyword": "", "idle_keyword_second": "", "resume_keyword_second": ""}}

View File

@ -9,47 +9,12 @@ function begin()
$("#settings").remove();
$("#status").remove();
let auto_reload_page_interval = 0.0;
if(settings) {
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
}
// too short to cause error.
if(auto_reload_page_interval < 0.1) {
auto_reload_page_interval = 0.1;
}
if(status=='ON') {
let target_interval = auto_reload_page_interval * 1000;
setInterval(() => {
$(".eventposter").off();
$(".btn_cta").prop('disabled', false);
if(location.href.indexOf('?loc=') > -1) {
if(location.href.indexOf('%2F') > -1) {
const myArray = url.split("lang=TW");
if(myArray.length >=3) {
if(myArray[1]=="utsvInternet") {
let new_url = "https://event.cityline.com/utsvInternet/"+myArray[1]+"/home?lang=TW";
location.href = new_url;
}
}
if (typeof remainTime !== "undefined") {
remainTime = 0;
}
if (typeof setRetryUrl !== "undefined") {
setRetryUrl(window.location.href);
}
if (typeof goEvent !== "undefined") {
let is_need_goEvent = false;
if(location.href.indexOf('home?') > -1) is_need_goEvent = true;
if(location.href.indexOf('?loc=') > -1) is_need_goEvent = true;
if(location.href.indexOf('lang=') > -1) is_need_goEvent = true;
if(is_need_goEvent) {
//goEvent();
remainTime = 0;
}
} else {
//$("#btn-retry-en-1").prop('disabled', false).trigger("click");
}
}, target_interval);
}, 3000);
}
}
@ -67,24 +32,3 @@ myInterval = setInterval(() => {
dom_ready();
}, 100);
function getHtmlDocName() {
var pathname = location.pathname;
var pathParts = pathname.split('/');
if(pathParts.length >= 3) return pathParts[2];
return null;
}
if(getHtmlDocName()==null) {
history.back();
}
if (typeof goEvent !== "undefined") {
let is_need_back = true;
if(location.href.indexOf('home?') > -1) is_need_back = false;
if(location.href.indexOf('?loc=') > -1) is_need_back = false;
if(location.href.indexOf('lang=') > -1) is_need_back = false;
if (is_need_back) {
history.back();
}
}

View File

@ -328,8 +328,9 @@
},
{
"matches": [
"https://msg.cityline.com/*.html*",
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
"https://msg.cityline.com/*",
"https://event.cityline.com/utsvInternet/*/home?*",
"https://event.cityline.com/utsvInternet/*/login?*",
"https://event.cityline.com/",
"https://event.cityline.com/queue?loc=*"
],
@ -341,8 +342,9 @@
},
{
"matches": [
"https://msg.cityline.com/*.html*",
"https://*.cityline.com/utsvInternet/*/home?lang=TW",
"https://msg.cityline.com/*",
"https://event.cityline.com/utsvInternet/*/home?*",
"https://event.cityline.com/utsvInternet/*/login?*",
"https://event.cityline.com/",
"https://event.cityline.com/queue?loc=*"
],
@ -465,5 +467,5 @@
]
}
],
"version": "1.0.25"
"version": "1.0.26"
}

View File

@ -13,24 +13,24 @@
<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>
<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">偏好設定</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>
<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">進階設定</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>
<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">驗證問題</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>
<label for="ticket_number" class="col-sm-2 col-form-label">張數</label>
<div class="col-sm-10">
<select id="ticket_number" class="form-select" aria-label="Default select">
<option selected="selected">
Ticket Number
張數
</option>
<option value="1">
1
@ -66,7 +66,7 @@
</div>
</div>
<div class="row mb-3">
<label for="date_select_mode" class="col-sm-2 col-form-label">Date Select Order</label>
<label for="date_select_mode" class="col-sm-2 col-form-label">日期排序方式</label>
<div class="col-sm-10">
<select id="date_select_mode" class="form-select" aria-label="Default select">
<option value="from top to bottom">
@ -85,13 +85,13 @@
</div>
</div>
<div class="row mb-3">
<label for="date_keyword" class="col-sm-2 col-form-label">Date Keywords</label>
<label for="date_keyword" class="col-sm-2 col-form-label">日期關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="date_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="area_select_mode" class="col-sm-2 col-form-label">Area Select Order</label>
<label for="area_select_mode" class="col-sm-2 col-form-label">區域排序方式</label>
<div class="col-sm-10">
<select id="area_select_mode" class="form-select" aria-label="Default select">
<option value="from top to bottom">
@ -110,13 +110,13 @@
</div>
</div>
<div class="row mb-3">
<label for="area_keyword" class="col-sm-2 col-form-label">Area Keywords</label>
<label for="area_keyword" class="col-sm-2 col-form-label">區域關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="area_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="keyword_exclude" class="col-sm-2 col-form-label">Exclude Keywords</label>
<label for="keyword_exclude" class="col-sm-2 col-form-label">排除關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="keyword_exclude" rows="3"></textarea>
</div>
@ -125,32 +125,32 @@
<!-- 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>
<label for="auto_reload_page_interval" class="col-sm-2 col-form-label">自動刷新頁面間隔(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="auto_reload_page_interval" value="" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="auto_press_next_step_button">KKTIX Press Next Step Button</label>
<label class="col-sm-2 col-form-label form-check-label" for="auto_press_next_step_button">KKTIX點選下一步按鈕</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="auto_press_next_step_button" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="kktix_status_api">KKTIX Status API</label>
<label class="col-sm-2 col-form-label form-check-label" for="kktix_status_api">KKTIX購票狀態API</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="kktix_status_api" />
</div>
</div>
<div class="row mb-3">
<label for="max_dwell_time" class="col-sm-2 col-form-label">KKTIX dwell time(sec.)</label>
<label for="max_dwell_time" class="col-sm-2 col-form-label">KKTIX購票最長停留(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="max_dwell_time" value="" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="disable_adjacent_seat">Disable Adjacent Seat</label>
<label class="col-sm-2 col-form-label form-check-label" for="disable_adjacent_seat">允許不連續座位</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="disable_adjacent_seat" />
</div>
@ -177,7 +177,7 @@
<!-- 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>
<label for="user_guess_string" class="col-sm-2 col-form-label">使用者自定字典</label>
<div class="col-sm-10">
<textarea class="form-control" id="user_guess_string" rows="3"></textarea>
</div>
@ -185,7 +185,7 @@
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" id="save_btn">Save</button>
<button class="btn btn-primary" id="save_btn">存檔</button>
</div>
</div>
<script src="options.js"></script>

BIN
www/.DS_Store vendored Normal file

Binary file not shown.

17
www/css/settings.css Normal file
View File

@ -0,0 +1,17 @@
body {
margin: 36px;
}
textarea {
font-family: monospace;
}
.message {
height: 20px;
background: #eee;
padding: 5px;
}
.disappear {
display: none;
}

BIN
www/dist/bootstrap/.DS_Store vendored Normal file

Binary file not shown.

6
www/dist/bootstrap/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
www/dist/bootstrap/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

30
www/dist/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
www/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
www/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
www/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
www/icons/maxbot-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
www/icons/maxbot-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

BIN
www/icons/maxbot-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
www/icons/maxbot-48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
www/icons/maxbot-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

598
www/settings.html Normal file
View File

@ -0,0 +1,598 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MaxBot Settings</title>
<meta charset="UTF-8" />
<link href="dist/bootstrap/bootstrap.min.css" rel="stylesheet" />
<script src="dist/bootstrap/bootstrap.min.js"></script>
<script src="dist/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/settings.css" />
<link rel="icon" href="/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="icon" href="/favicon.ico">
</head>
<body>
<div id="message"></div>
<h2>Max蛋黃酥上車機器人 - 設定介面</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="readme-tab" data-bs-toggle="tab" data-bs-target="#readme-tab-pane" type="button" role="tab" aria-controls="readme-tab-pane" aria-selected="true">使用需知</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="false">偏好設定</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">進階設定</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">驗證問題</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="autofill-tab" data-bs-toggle="tab" data-bs-target="#autofill-tab-pane" type="button" role="tab" aria-controls="autofill-tab-pane" aria-selected="false">自動填表單</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="runtime-tab" data-bs-toggle="tab" data-bs-target="#runtime-tab-pane" type="button" role="tab" aria-controls="runtime-tab-pane" aria-selected="false">執行階段</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<!-- tab 1 -->
<div class="tab-pane fade show active" id="readme-tab-pane" role="tabpanel" aria-labelledby="readme-tab" tabindex="0">
<p>MaxBot是一個免費、開放原始碼的蛋黃酥/公車訂位機器人。祝您搶購成功。</p>
<p>搶票機制,就是在比誰的網路快、電腦配備好、手速快,或是在比誰的機器人跑的快。</p>
<p>售票系統完全無法阻擋機器人進行搶票,也無法透過驗證碼確定為真人,因此售票系統的「驗證碼」機制只是讓一般民眾更難公平地購買到預期的門票。</p>
<p>目前售票系統還有另一個問題,就是可以透過「人海戰術」來提升買到票的機率,因此建議大家可以麻煩親朋好友去註冊售票系統的帳號。注意,在借用他人帳號前,一定要告知當事人用途,並徵詢同意與授權。</p>
<p>MaxBot 的出發點是讓一般民眾與代購黃牛或懂得寫程式的人有類似的基準點或類似的起跑線上,用魔法對抗魔法,當某一天大家都是透過機器人來搶票時,當機器人數量已多到影響一般民眾購票的權利時,售票業者才比較有可能會對未來熱門演唱會改採「實名制」+「抽籤制」,讓更多民眾可以公平地購買到門票,就可以跟「人海戰術」與「搶票機器人」說 bye-bye 。</p>
<p>台灣藝文活動的文創法第十條中的「不正方式」由於沒有明確定義,代表的是所有軟體都涉嫌違反。故在此呼籲大家,勿以身試法。</p>
<p>以下文章出現的「搶票」指的是「非台灣的藝文活動或車票」。</p>
<hr/>
<h2>法律聲明</h2>
<p>作者沒有意圖要他人購得的票券進行加價轉售或是使用在違法的事情上,他人的行為並不在作者的意識支配範圍之內,作者不對他人的非法行為負責。</p>
<p>使用此儲存庫或與之相關的任何程式碼,即表示您同意<a href="https://github.com/max32002/tixcraft_bot/blob/master/LEGAL_NOTICE.md" target="_blank">法律聲明</a>。作者不對該儲存庫的使用負責與背書,也不對其他使用者所做的任何副本、分叉、重新上傳或與 MaxBot 相關的任何其他內容負責。 這是作者唯一的帳戶和儲存庫。 為了防止假冒或不負責任的行為,請遵守此儲存庫使用的 GNU GPL 授權。</p>
</div>
<!-- tab 2 -->
<div class="tab-pane fade" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">
<div class="row mb-3">
<label for="homepage" class="col-sm-2 col-form-label">網址</label>
<div class="col-sm-10">
<input class="form-control" id="homepage" value="" />
</div>
</div>
<div class="row mb-3">
<label for="ticket_number" class="col-sm-2 col-form-label">張數</label>
<div class="col-sm-10">
<select id="ticket_number" class="form-select" aria-label="Default select">
<option selected="selected">
張數
</option>
<option value="1">
1
</option>
<option value="2">
2
</option>
<option value="3">
3
</option>
<option value="4">
4
</option>
<option value="5">
5
</option>
<option value="6">
6
</option>
<option value="7">
7
</option>
<option value="8">
8
</option>
<option value="9">
9
</option>
<option value="10">
10
</option>
</select>
</div>
</div>
<div class="row mb-3">
<label for="date_select_mode" class="col-sm-2 col-form-label">日期排序方式</label>
<div class="col-sm-10">
<select id="date_select_mode" class="form-select" aria-label="Default select">
<option value="from top to bottom">
from top to bottom
</option>
<option value="from bottom to top">
from bottom to top
</option>
<option value="center">
center
</option>
<option value="random">
random
</option>
</select>
</div>
</div>
<div class="row mb-3">
<label for="date_keyword" class="col-sm-2 col-form-label">日期關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="date_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="area_select_mode" class="col-sm-2 col-form-label">區域排序方式</label>
<div class="col-sm-10">
<select id="area_select_mode" class="form-select" aria-label="Default select">
<option value="from top to bottom">
from top to bottom
</option>
<option value="from bottom to top">
from bottom to top
</option>
<option value="center">
center
</option>
<option value="random">
random
</option>
</select>
</div>
</div>
<div class="row mb-3">
<label for="area_keyword" class="col-sm-2 col-form-label">區域關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="area_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="keyword_exclude" class="col-sm-2 col-form-label">排除關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="keyword_exclude" rows="3"></textarea>
<p>
每組關鍵字需要用「雙引號」包起來, 用「逗號」分隔, 在關鍵字中使用「空格」為 AND 邏輯。完全不輸入或是加入 「,""」 代表符合所有關鍵字
</p>
</div>
</div>
</div>
<!-- tab 3 -->
<div class="tab-pane fade" id="advanced-tab-pane" role="tabpanel" aria-labelledby="advanced-tab" tabindex="1">
<div class="row mb-3">
<label for="browser" class="col-sm-2 col-form-label">瀏覽器</label>
<div class="col-sm-10">
<select id="browser" class="form-select" aria-label="Default select">
<option value="chrome">Chrome</option>
<option value="edge">Edge</option>
<option value="brave">Brave</option>
<option value="firefox">Firefox</option>
<option value="safari">Safari</option>
</select>
</div>
</div>
<div class="row mb-3">
<label for="webdriver_type" class="col-sm-2 col-form-label">WebDriver類別</label>
<div class="col-sm-10">
<select id="webdriver_type" class="form-select" aria-label="Default select">
<option value="selenium">selenium</option>
<option value="undetected_chromedriver">undetected chromedriver</option>
<option value="nodriver">NODRIVER</option>
<!-- option value="DrissionPage">DrissionPage</option -->
</select>
</div>
</div>
<div class="row mb-3">
<label for="area_select_mode" class="col-sm-2 col-form-label">區域排序方式</label>
<div class="col-sm-10">
<select id="area_select_mode" class="form-select" aria-label="Default select">
<option value="from top to bottom">
from top to bottom
</option>
<option value="from bottom to top">
from bottom to top
</option>
<option value="center">
center
</option>
<option value="random">
random
</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="play_ticket_sound">有票時播放音效</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="play_ticket_sound" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="play_order_sound">訂購時播放音效</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="play_order_sound" />
</div>
</div>
<div class="row mb-3">
<label for="play_sound_filename" class="col-sm-2 col-form-label">音效檔</label>
<div class="col-sm-10">
<input class="form-control" id="play_sound_filename" value="" />
</div>
</div>
<div class="row mb-3">
<label for="auto_reload_page_interval" class="col-sm-2 col-form-label">自動刷新頁面間隔(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="auto_reload_page_interval" value="" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="auto_press_next_step_button">KKTIX點選下一步按鈕</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="auto_press_next_step_button" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="kktix_status_api">KKTIX購票狀態API</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="kktix_status_api" />
</div>
</div>
<div class="row mb-3">
<label for="max_dwell_time" class="col-sm-2 col-form-label">KKTIX購票最長停留(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="max_dwell_time" value="" />
</div>
</div>
<div class="row mb-3">
<label for="reset_browser_interval" class="col-sm-2 col-form-label">重新啟動瀏覽器間隔(秒)</label>
<div class="col-sm-10">
<input class="form-control" id="reset_browser_interval" value="" />
</div>
</div>
<div class="row mb-3">
<label for="proxy_server_port" class="col-sm-2 col-form-label">Proxy IP:PORT</label>
<div class="col-sm-10">
<input class="form-control" id="proxy_server_port" value="" />
</div>
</div>
<div class="row mb-3">
<label for="window_size" class="col-sm-2 col-form-label">瀏覽器視窗大小</label>
<div class="col-sm-10">
<input class="form-control" id="window_size" value="" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="chrome_extension">Chrome 瀏覽器擴充功能</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="chrome_extension" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="disable_adjacent_seat">允許不連續座位</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="disable_adjacent_seat" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="hide_some_image">隱藏部份圖片</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="hide_some_image" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="block_facebook_network">擋掉 Facebook 連線</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="block_facebook_network" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="headless">無圖形界面模式</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="headless" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="verbose">輸出除錯訊息</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="verbose" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="ocr_captcha_enable">OCR</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="ocr_captcha_enable" />
</div>
</div>
<div class="row mb-3">
<label for="ocr_captcha_image_source" class="col-sm-2 col-form-label">OCR圖片取得方式</label>
<div class="col-sm-10">
<select id="ocr_captcha_image_source" class="form-select" aria-label="Default select">
<option value="canvas">canvas</option>
<option value="NonBrowser">NonBrowser</option>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="ocr_captcha_force_submit">掛機模式</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="ocr_captcha_force_submit" />
</div>
</div>
<div class="row mb-3">
<label for="remote_url" class="col-sm-2 col-form-label">OCR Server URL</label>
<div class="col-sm-10">
<input class="form-control" id="remote_url" value="" />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label form-check-label" for="ocr_captcha_use_public_server">MaxBot Public OCR Server</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" id="ocr_captcha_use_public_server" />
</div>
</div>
</div>
<!-- tab 4 -->
<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">使用者自定字典</label>
<div class="col-sm-10">
<textarea class="form-control" id="user_guess_string" rows="3"></textarea>
</div>
</div>
</div>
<!-- tab 5 -->
<div class="tab-pane fade" id="autofill-tab-pane" role="tabpanel" aria-labelledby="autofill-tab" tabindex="2">
<div class="row mb-3">
<label for="tixcraft_sid" class="col-sm-2 col-form-label">拓元家族 cookie SID</label>
<div class="col-sm-10">
<input class="form-control" id="tixcraft_sid" value="" />
</div>
</div>
<div class="row mb-3">
<label for="ibonqware" class="col-sm-2 col-form-label">ibon cookie ibonqware</label>
<div class="col-sm-10">
<input class="form-control" id="ibonqware" value="" />
</div>
</div>
<div class="row mb-3">
<label for="facebook_account" class="col-sm-2 col-form-label">Facebook</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="facebook_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="facebook_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="kktix_account" class="col-sm-2 col-form-label">KKTIX</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="kktix_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="kktix_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="fami_account" class="col-sm-2 col-form-label">FamiTicket</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="fami_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="fami_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="kham_account" class="col-sm-2 col-form-label">寬宏</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="kham_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="kham_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="ticket_account" class="col-sm-2 col-form-label">年代</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="ticket_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="ticket_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="udn_account" class="col-sm-2 col-form-label">UDN</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="udn_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="udn_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="ticketplus_account" class="col-sm-2 col-form-label">遠大</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="ticketplus_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="ticketplus_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="cityline_account" class="col-sm-2 col-form-label">cityline</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="cityline_account" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="urbtix_account" class="col-sm-2 col-form-label">URBTIX</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="urbtix_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="urbtix_password" value="" class="form-control">
</div>
</div>
</div>
<div class="row mb-3">
<label for="hkticketing_account" class="col-sm-2 col-form-label">HKTICKETING</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-text" id="inputGroup-sizing-default">帳號</span>
<input type="text" id="hkticketing_account" value="" class="form-control">
<span class="input-group-text" id="inputGroup-sizing-default">密碼</span>
<input type="text" id="hkticketing_password" value="" class="form-control">
</div>
</div>
</div>
</div>
<!-- tab 6 -->
<div class="tab-pane fade" id="runtime-tab-pane" role="tabpanel" aria-labelledby="runtime-tab" tabindex="2">
<div class="row mb-3">
<label for="maxbot_status" class="col-sm-2 col-form-label">執行狀態</label>
<div class="col-sm-10">
<span id="maxbot_status"></span>
<button class="btn btn-primary" id="pause_btn">暫停搶票</button>
<button class="btn btn-primary" id="resume_btn">接繼搶票</button>
</div>
</div>
<div class="row mb-3">
<label for="last_url" class="col-sm-2 col-form-label">執行網址</label>
<div class="col-sm-10">
<input class="form-control" id="last_url" value="" />
</div>
</div>
<div class="row mb-3">
<label for="maxbot_status" class="col-sm-2 col-form-label">系統時間</label>
<div class="col-sm-10">
<span id="system_time"></span>
</div>
</div>
<div class="row mb-3">
<label for="idle_keyword" class="col-sm-2 col-form-label">系統時間 - 暫停關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="idle_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="resume_keyword" class="col-sm-2 col-form-label">系統時間 - 接繼關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="resume_keyword" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="idle_keyword_second" class="col-sm-2 col-form-label">秒數 - 暫停關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="idle_keyword_second" rows="3"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="resume_keyword_second" class="col-sm-2 col-form-label">秒數 - 接繼關鍵字</label>
<div class="col-sm-10">
<textarea class="form-control" id="resume_keyword_second" rows="3"></textarea>
</div>
</div>
</div>
</div>
<div class="col-12">
<button class="btn btn-primary" id="run_btn">搶票</button>
<button class="btn btn-primary" id="save_btn">存檔</button>
<button class="btn btn-primary" id="exit_btn">結束</button>
</div>
</div>
<div class="modal" id="saveModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">MaxBot 存檔</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>存檔完成</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
</div>
</div>
</div>
</div>
<script src="settings.js"></script>
</body>
</html>

423
www/settings.js Normal file
View File

@ -0,0 +1,423 @@
//const storage = chrome.storage.local;
const run_button = document.querySelector('#run_btn');
const save_button = document.querySelector('#save_btn');
const exit_button = document.querySelector('#exit_btn');
const pause_button = document.querySelector('#pause_btn');
const resume_button = document.querySelector('#resume_btn');
const homepage = document.querySelector('#homepage');
const ticket_number = document.querySelector('#ticket_number');
const date_select_mode = document.querySelector('#date_select_mode');
const date_keyword = document.querySelector('#date_keyword');
const area_select_mode = document.querySelector('#area_select_mode');
const area_keyword = document.querySelector('#area_keyword');
const keyword_exclude = document.querySelector('#keyword_exclude');
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
const auto_press_next_step_button = document.querySelector('#auto_press_next_step_button');
const kktix_status_api = document.querySelector('#kktix_status_api');
const max_dwell_time = document.querySelector('#max_dwell_time');
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/";
const tixcraft_sid = document.querySelector('#tixcraft_sid');
const ibonqware = document.querySelector('#ibonqware');
const facebook_account = document.querySelector('#facebook_account');
const kktix_account = document.querySelector('#kktix_account');
const fami_account = document.querySelector('#fami_account');
const kham_account = document.querySelector('#kham_account');
const ticket_account = document.querySelector('#ticket_account');
const udn_account = document.querySelector('#udn_account');
const ticketplus_account = document.querySelector('#ticketplus_account');
const cityline_account = document.querySelector('#cityline_account');
const urbtix_account = document.querySelector('#urbtix_account');
const hkticketing_account = document.querySelector('#hkticketing_account');
const facebook_password = document.querySelector('#facebook_password');
const kktix_password = document.querySelector('#kktix_password');
const fami_password = document.querySelector('#fami_password');
const kham_password = document.querySelector('#kham_password');
const ticket_password = document.querySelector('#ticket_password');
const udn_password = document.querySelector('#udn_password');
const ticketplus_password = document.querySelector('#ticketplus_password');
const urbtix_password = document.querySelector('#urbtix_password');
const hkticketing_password = document.querySelector('#hkticketing_password');
const idle_keyword = document.querySelector('#idle_keyword');
const resume_keyword = document.querySelector('#resume_keyword');
const idle_keyword_second = document.querySelector('#idle_keyword_second');
const resume_keyword_second = document.querySelector('#resume_keyword_second');
var settings = null;
load_changes();
run_button.addEventListener('click', maxbot_launch);
save_button.addEventListener('click', maxbot_save);
exit_button.addEventListener('click', maxbot_shutdown);
pause_button.addEventListener('click', maxbot_pause_api);
resume_button.addEventListener('click', maxbot_resume_api);
ocr_captcha_use_public_server.addEventListener('change', checkUsePublicServer);
function load_changes()
{
let api_url = "http://127.0.0.1:16888/load";
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
//console.log(data);
settings = data;
if (settings)
{
//console.log("ticket_number:"+ settings.ticket_number);
homepage.value = settings.homepage;
ticket_number.value = settings.ticket_number;
date_select_mode.value = settings.date_auto_select.mode;
date_keyword.value = settings.date_auto_select.date_keyword;
if(date_keyword.value=='""') {
date_keyword.value='';
}
area_select_mode.value = settings.area_auto_select.mode;
area_keyword.value = settings.area_auto_select.area_keyword;
if(area_keyword.value=='""') {
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;
auto_press_next_step_button.checked = settings.kktix.auto_press_next_step_button;
kktix_status_api.checked = settings.advanced.kktix_status_api;
max_dwell_time.value = settings.advanced.max_dwell_time;
disable_adjacent_seat.checked = settings.advanced.disable_adjacent_seat;
ocr_captcha_enable.checked = settings.ocr_captcha.enable;
let remote_url_string = "";
let remote_url_array = [];
if(settings.advanced.remote_url.length > 0) {
remote_url_array = JSON.parse('[' + settings.advanced.remote_url +']');
}
if(remote_url_array.length) {
remote_url_string = remote_url_array[0];
}
remote_url.value = remote_url_string;
tixcraft_sid.value = settings.advanced.tixcraft_sid;
ibonqware.value = settings.advanced.ibonqware;
facebook_account.value = settings.advanced.facebook_account;
kktix_account.value = settings.advanced.kktix_account;
fami_account.value = settings.advanced.fami_account;
kham_account.value = settings.advanced.kham_account;
ticket_account.value = settings.advanced.ticket_account;
udn_account.value = settings.advanced.udn_account;
ticketplus_account.value = settings.advanced.ticketplus_account;
cityline_account.value = settings.advanced.cityline_account;
urbtix_account.value = settings.advanced.urbtix_account;
hkticketing_account.value = settings.advanced.hkticketing_account;
facebook_password.value = settings.advanced.facebook_password;
kktix_password.value = settings.advanced.kktix_password;
fami_password.value = settings.advanced.fami_password;
kham_password.value = settings.advanced.kham_password;
ticket_password.value = settings.advanced.ticket_password;
udn_password.value = settings.advanced.udn_password;
ticketplus_password.value = settings.advanced.ticketplus_password;
urbtix_password.value = settings.advanced.urbtix_password;
hkticketing_password.value = settings.advanced.hkticketing_password;
idle_keyword.value = settings.advanced.idle_keyword;
if(idle_keyword.value=='""') {
idle_keyword.value='';
}
resume_keyword.value = settings.advanced.resume_keyword;
if(resume_keyword.value=='""') {
resume_keyword.value='';
}
idle_keyword_second.value = settings.advanced.idle_keyword_second;
if(idle_keyword_second.value=='""') {
idle_keyword_second.value='';
}
resume_keyword_second.value = settings.advanced.resume_keyword_second;
if(resume_keyword_second.value=='""') {
resume_keyword_second.value='';
}
//message('Loaded saved settings.');
} else {
console.log('no settings found');
}
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
async function checkUsePublicServer()
{
if(ocr_captcha_enable.checked) {
remote_url.value = PUBLIC_SERVER_URL;
} else {
}
}
let messageClearTimer;
function message(msg)
{
clearTimeout(messageClearTimer);
const message = document.querySelector('#message');
message.innerText = msg;
messageClearTimer = setTimeout(function ()
{
message.innerText = '';
}, 3000);
}
function maxbot_launch()
{
let api_url = "http://127.0.0.1:16888/run";
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
function maxbot_shutdown()
{
let api_url = "http://127.0.0.1:16888/shutdown";
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
window.close();
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
function save_changes_to_dict()
{
const ticket_number_value = ticket_number.value;
//console.log(ticket_number_value);
if (!ticket_number_value)
{
message('Error: No ticket_number specified');
} else {
if(settings) {
settings.homepage = homepage.value;
settings.ticket_number = ticket_number_value;
settings.date_auto_select.mode = date_select_mode.value;
let date_keyword_string = date_keyword.value;
if(date_keyword_string.indexOf('"')==-1) {
date_keyword_string = '"' + date_keyword_string + '"';
}
settings.date_auto_select.date_keyword = date_keyword_string;
settings.area_auto_select.mode = area_select_mode.value;
let area_keyword_string = area_keyword.value;
if(area_keyword_string.indexOf('"')==-1) {
area_keyword_string = '"' + area_keyword_string + '"';
}
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;
settings.kktix.auto_press_next_step_button = auto_press_next_step_button.checked;
settings.advanced.kktix_status_api = kktix_status_api.checked;
settings.advanced.max_dwell_time = max_dwell_time.value;
settings.advanced.disable_adjacent_seat = disable_adjacent_seat.checked;
settings.ocr_captcha.enable = ocr_captcha_enable.checked;
let remote_url_array = [];
remote_url_array.push(remote_url.value);
let remote_url_string = JSON.stringify(remote_url_array);
remote_url_string = remote_url_string.substring(0,remote_url_string.length-1);
remote_url_string = remote_url_string.substring(1);
//console.log("final remote_url_string:"+remote_url_string);
settings.advanced.remote_url = remote_url_string;
settings.tixcraft_sid = tixcraft_sid.value;
settings.ibonqware = ibonqware.value;
settings.facebook_account = facebook_account.value;
settings.kktix_account = kktix_account.value;
settings.fami_account = fami_account.value;
settings.kham_account = kham_account.value;
settings.ticket_account = ticket_account.value;
settings.udn_account = udn_account.value;
settings.ticketplus_account = ticketplus_account.value;
settings.cityline_account = cityline_account.value;
settings.urbtix_account = urbtix_account.value;
settings.hkticketing_account = hkticketing_account.value;
settings.facebook_password = facebook_password.value;
settings.kktix_password = kktix_password.value;
settings.fami_password = fami_password.value;
settings.kham_password = kham_password.value;
settings.ticket_password = ticket_password.value;
settings.udn_password = udn_password.value;
settings.ticketplus_password = ticketplus_password.value;
settings.urbtix_password = urbtix_password.value;
settings.hkticketing_password = hkticketing_password.value;
settings.advanced.idle_keyword = idle_keyword.value;
settings.advanced.resume_keyword = resume_keyword.value;
settings.advanced.idle_keyword_second = idle_keyword_second.value;
settings.advanced.resume_keyword_second = resume_keyword_second.value;
}
message('Settings saved');
}
}
function maxbot_save_api()
{
let api_url = "http://127.0.0.1:16888/save";
if(settings) {
$.post( api_url, JSON.stringify(settings), function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
}
function maxbot_pause_api()
{
let api_url = "http://127.0.0.1:16888/pause";
if(settings) {
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
}
function maxbot_resume_api()
{
let api_url = "http://127.0.0.1:16888/resume";
if(settings) {
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
}
function maxbot_save()
{
//$('#saveModal').modal('show')
save_changes_to_dict();
maxbot_save_api();
}
function maxbot_status_api()
{
let api_url = "http://127.0.0.1:16888/status";
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
let status_text = "已暫停";
let status_class = "badge text-bg-danger";
if(data.status) {
status_text="已啟動";
status_class = "badge text-bg-success";
$("#pause_btn").removeClass("disappear");
$("#resume_btn").addClass("disappear");
} else {
$("#pause_btn").addClass("disappear");
$("#resume_btn").removeClass("disappear");
}
$("#last_url").html(data.last_url);
$("#maxbot_status").html(status_text).prop( "class", status_class);
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
function update_system_time()
{
var currentdate = new Date();
var datetime = currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
$("#system_time").html(datetime);
}
var status_interval= setInterval(() => {
maxbot_status_api();
update_system_time();
}, 200);