2024-01-13, split maxbot plus extension to maxblock plus.

master
CHUN YU YAO 2024-01-19 01:35:42 +08:00
parent a6d8d6677e
commit e9eb8b72b1
49 changed files with 29848 additions and 29821 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.12)" CONST_APP_VERSION = "MaxBot (2024.01.13)"
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"
@ -49,6 +49,7 @@ CONST_MAXBOT_EXTENSION_NAME = "Maxbotplus_1.0.0"
CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt" CONST_MAXBOT_INT28_FILE = "MAXBOT_INT28_IDLE.txt"
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt" CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
CONST_MAXBLOCK_EXTENSION_NAME = "Maxblockplus_1.0.0"
CONST_CHROME_VERSION_NOT_MATCH_EN="Please download the WebDriver version to match your browser version." CONST_CHROME_VERSION_NOT_MATCH_EN="Please download the WebDriver version to match your browser version."
CONST_CHROME_VERSION_NOT_MATCH_TW="請下載與您瀏覽器相同版本的WebDriver版本或更新您的瀏覽器版本。" CONST_CHROME_VERSION_NOT_MATCH_TW="請下載與您瀏覽器相同版本的WebDriver版本或更新您的瀏覽器版本。"
@ -369,6 +370,7 @@ def get_favoriate_extension_path(webdriver_path, config_dict):
#print("webdriver_path:", webdriver_path) #print("webdriver_path:", webdriver_path)
extension_list = [] extension_list = []
extension_list.append(os.path.join(webdriver_path, CONST_MAXBOT_EXTENSION_NAME + ".crx")) extension_list.append(os.path.join(webdriver_path, CONST_MAXBOT_EXTENSION_NAME + ".crx"))
extension_list.append(os.path.join(webdriver_path, CONST_MAXBLOCK_EXTENSION_NAME + ".crx"))
return extension_list return extension_list
def get_chromedriver_path(webdriver_path): def get_chromedriver_path(webdriver_path):
@ -611,26 +613,6 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
with open(target_path, 'w') as outfile: with open(target_path, 'w') as outfile:
outfile.write(json_str) outfile.write(json_str)
# show advanced rows in extension.
target_path = ext
target_path = os.path.join(target_path, "options.html")
if os.path.isfile(target_path):
file_options = open(target_path, 'r')
html_lines = file_options.readlines()
file_options.close()
new_html_array = []
my_target_row = ['remote_url_row','ocr_captcha_enable_row']
for line in html_lines:
for row in my_target_row:
if row in line:
line = line.replace('display: none;','')
new_html_array.append(line)
if len(new_html_array) > 0:
#print("output new options.html")
with open(target_path, 'w') as outfile:
outfile.write("".join(new_html_array))
def get_uc_options(uc, config_dict, webdriver_path): def get_uc_options(uc, config_dict, webdriver_path):
options = uc.ChromeOptions() options = uc.ChromeOptions()
options.page_load_strategy = 'eager' options.page_load_strategy = 'eager'

View File

@ -22,7 +22,7 @@ import sys
import threading import threading
import webbrowser import webbrowser
CONST_APP_VERSION = "MaxBot (2024.01.12)" CONST_APP_VERSION = "MaxBot (2024.01.13)"
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

@ -39,7 +39,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.01.12)" CONST_APP_VERSION = "MaxBot (2024.01.13)"
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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,31 @@
{
"author": "Max Yao",
"name": "MaxBlock Plus",
"description": "Helps you hide ads, avoid tracking, load pages faster.",
"icons": {
"16": "icons/maxblock-16.png",
"32": "icons/maxblock-32.png",
"48": "icons/maxblock-48.png",
"64": "icons/maxblock-64.png",
"128": "icons/maxblock-128.png"
},
"manifest_version": 3,
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}
]
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback"
],
"action": {
"default_icon": "icons/maxblock-128.png",
"default_title": "MaxBlock"
},
"version": "1.0.0"
}

View File

@ -14,21 +14,13 @@
"service_worker": "background.js", "service_worker": "background.js",
"type": "module" "type": "module"
}, },
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}
]
},
"permissions": [ "permissions": [
"storage", "storage",
"declarativeNetRequest", "declarativeNetRequest",
"declarativeNetRequestFeedback" "declarativeNetRequestFeedback"
], ],
"host_permissions": [ "host_permissions": [
"http://maxbot.dropboxlike.com:16888/*",
"http://127.0.0.1:16888/*" "http://127.0.0.1:16888/*"
], ],
"web_accessible_resources": [ "web_accessible_resources": [

View File

@ -95,7 +95,7 @@
</div> </div>
</div> </div>
<div class="col-12" id="ocr_captcha_enable_row" style=""> <div class="col-12">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="ocr_captcha_enable"> <input class="form-check-input" type="checkbox" id="ocr_captcha_enable">
<label class="form-check-label" for="ocr_captcha_enable"> <label class="form-check-label" for="ocr_captcha_enable">
@ -104,10 +104,20 @@
</div> </div>
</div> </div>
<div class="col-12" id="remote_url_row" style=""> <div class="col-12">
<label for="remote_url" class="form-label">OCR Server URL</label> <label for="remote_url" class="form-label">OCR Server URL</label>
<input class="form-control" id="remote_url" value="" /> <input class="form-control" id="remote_url" value="" />
</div> </div>
<div class="col-12">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="ocr_captcha_use_public_server">
<label class="form-check-label" for="ocr_captcha_use_public_server">
Use MaxBot Pulic OCR Server
</label>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -10,13 +10,17 @@ const keyword_exclude = document.querySelector('#keyword_exclude');
const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval'); const auto_reload_page_interval = document.querySelector('#auto_reload_page_interval');
const disable_adjacent_seat = document.querySelector('#disable_adjacent_seat'); const disable_adjacent_seat = document.querySelector('#disable_adjacent_seat');
const ocr_captcha_enable = document.querySelector('#ocr_captcha_enable'); 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 remote_url = document.querySelector('#remote_url');
const PUBLIC_SERVER_URL = "http://maxbot.dropboxlike.com:16888/";
var settings = null; var settings = null;
loadChanges(); loadChanges();
submitButton.addEventListener('click', saveChanges); submitButton.addEventListener('click', saveChanges);
ocr_captcha_use_public_server.addEventListener('change', checkUsePublicServer);
async function saveChanges() async function saveChanges()
{ {
@ -114,6 +118,14 @@ function loadChanges()
); );
} }
async function checkUsePublicServer()
{
if(ocr_captcha_enable.checked) {
remote_url.value = PUBLIC_SERVER_URL;
} else {
}
}
let messageClearTimer; let messageClearTimer;
function message(msg) function message(msg)