2023-12-23

master
CHUN YU YAO 2024-01-04 01:28:12 +08:00
parent a11441e3e9
commit 0c2e863b6d
7 changed files with 124 additions and 16 deletions

View File

@ -54,7 +54,7 @@ import webbrowser
import chromedriver_autoinstaller
CONST_APP_VERSION = "MaxBot (2023.12.20)"
CONST_APP_VERSION = "MaxBot (2023.12.21)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
@ -11440,6 +11440,7 @@ def ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict)
show_debug_message = True
next_step_button = None
# PS: only button disabled = True to continue.
is_button_disabled = False
current_layout_style = 0
try:
@ -11999,7 +12000,9 @@ def ticketplus_main(driver, url, config_dict, ocr, Captcha_Browser, ticketplus_d
is_button_pressed = ticketplus_accept_realname_card(driver)
is_button_pressed = ticketplus_accept_order_fail(driver)
is_reloading = ticketplus_order_auto_reload_coming_soon(driver)
is_reloading = False
# move below code to extension.
#is_reloading = ticketplus_order_auto_reload_coming_soon(driver)
if not is_reloading:
is_captcha_sent, ticketplus_dict = ticketplus_order(driver, config_dict, ocr, Captcha_Browser, ticketplus_dict)

View File

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

View File

@ -34,7 +34,7 @@ import ssl
ssl._create_default_https_context = ssl._create_unverified_context
CONST_APP_VERSION = "MaxBot (2023.12.20)"
CONST_APP_VERSION = "MaxBot (2023.12.21)"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"

View File

@ -27,7 +27,7 @@ import pyperclip
import tornado
from tornado.web import Application
CONST_APP_VERSION = "MaxBot (2023.12.20)"
CONST_APP_VERSION = "MaxBot (2023.12.21)"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"

View File

@ -1,8 +1,4 @@
'use strict';
import { decrypt } from "./vendor/crypto";
console.log('hello');
setTimeout(function () {
$("#banner").remove();
$("footer").remove();

View File

@ -1,3 +1,4 @@
'use strict';
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';
@ -26344,9 +26345,7 @@ function config (name) {
(function (Buffer){(function (){
var crypto = require('crypto-browserify');
window.crypto_decrypt = function decrypt(text) {
let KEY = 'ILOVEFETIXFETIX!';
const IV = '!@#$FETIXEVENTiv';
window.crypto_decrypt = function decrypt(text, KEY, IV) {
let encryptedText = new Buffer.from(text, 'hex');
let decipher = crypto.createDecipheriv('aes-128-cbc', KEY, IV);
let decrypted = decipher.update(encryptedText);
@ -26358,5 +26357,108 @@ window.crypto_decrypt = function decrypt(text) {
},{"buffer":48,"crypto-browserify":56}]},{},[158]);
//let text="";
//console.log(window.crypto_decrypt(text));
const storage = chrome.storage.local;
let KEY = 'ILOVEFETIXFETIX!';
const IV = '!@#$FETIXEVENTiv';
const currentUrl = window.location.href;
const event_id = currentUrl.split('/')[4];
const session_id = currentUrl.split('/')[5];
//console.log(event_id);
//console.log(session_id);
var retry_count =0;
console.log("retry_count:"+retry_count);
function get_event_status(real_event_id, real_session_id) {
console.log("get_event_status")
console.log("retry_count:"+retry_count);
storage.get('status', function (items)
{
if (items.status && items.status=='ON')
{
get_event_status_core(real_event_id, real_session_id);
} else {
console.log('no status found');
}
});
}
function get_event_status_core(real_event_id, real_session_id) {
let timestamp = new Date().getTime();
timestamp = (timestamp/1000).toFixed()*1000;
//console.log(timestamp);
let api_url = "https://apis.ticketplus.com.tw/config/api/v1/get?eventId="+ real_event_id +"&sessionId="+real_session_id+"&_="+timestamp;
$.get( api_url, function() {
//alert( "success" );
})
.done(function(data) {
//alert( "second success" );
let reload=false;
//console.log(data);
//console.log(data.result.session[0].status);
//console.log(reload);
//if(reload) {location.reload();}
let last_status = "";
storage.get('ticketplus_last_status', function (items)
{
if (items.ticketplus_last_status)
{
last_status = items.ticketplus_last_status;
} else {
console.log('no status found');
}
});
if(data.result.session[0].status=="pending" || data.result.session[0].status=="soldout") {
retry_count +=1;
chrome.storage.local.set({'ticketplus_last_status': real_session_id + "-FAIL" });
location.reload();
}
console.log("retry_count:"+retry_count);
if(data.result.session[0].status=="onsale") {
chrome.storage.local.set({'ticketplus_last_status': real_session_id + "-OK" });
if(last_status==real_session_id + "-FAIL") {
location.reload();
}
}
})
.fail(function() {
//alert( "error" );
})
.always(function() {
//alert( "finished" );
});
}
function decrypt_text() {
let real_event_id = window.crypto_decrypt(event_id,KEY,IV);
//console.log(real_event_id);
let real_session_id = window.crypto_decrypt(session_id,KEY,IV);
//console.log(real_session_id);
get_event_status(real_event_id, real_session_id);
}
function wait_function_ready() {
if(session_id){
if (typeof window.crypto_decrypt === 'function') {
decrypt_text()
} else {
setTimeout(function () {
wait_function_ready();
}, 500);
}
}
}
storage.get('status', function (items)
{
if (items.status && items.status=='ON')
{
wait_function_ready();
} else {
console.log('no status found');
}
});

View File

@ -91,14 +91,21 @@
"https://*.cityline.com/utsvlnternet/*/login?lang=TW"
],
"run_at": "document_end",
"js" : [ "jquery.min.js", "js/cityline_event_common.js","js/cityline_event_detail.js" ]
"js" : [ "jquery.min.js", "js/cityline_event_common.js"]
},
{
"matches" : [
"https://ticketplus.com.tw/activity/*"
],
"run_at": "document_end",
"js" : [ "jquery.min.js", "js/ticketplus_activity.js", "/js/vendor/crypto.js" ]
"js" : ["jquery.min.js", "js/ticketplus_activity.js"]
},
{
"matches" : [
"https://ticketplus.com.tw/order/*"
],
"run_at": "document_end",
"js" : [ "jquery.min.js", "js/ticketplus_order.js"]
},
{
"matches" : [