2024-03-26, change verion code.
parent
949d192b36
commit
017a88334d
|
@ -44,7 +44,7 @@ except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.03.25)"
|
CONST_APP_VERSION = "MaxBot (2024.03.26)"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -115,6 +115,21 @@ CONST_WEBDRIVER_TYPE_DP = "DrissionPage"
|
||||||
CONST_WEBDRIVER_TYPE_NODRIVER = "nodriver"
|
CONST_WEBDRIVER_TYPE_NODRIVER = "nodriver"
|
||||||
CONST_CHROME_FAMILY = ["chrome","edge","brave"]
|
CONST_CHROME_FAMILY = ["chrome","edge","brave"]
|
||||||
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
|
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
|
||||||
|
CONST_PREFS_DICT = {
|
||||||
|
"credentials_enable_service": False,
|
||||||
|
"in_product_help.snoozed_feature.IPH_LiveCaption.is_dismissed": True,
|
||||||
|
"in_product_help.snoozed_feature.IPH_LiveCaption.last_dismissed_by": 4,
|
||||||
|
"media_router.show_cast_sessions_started_by_other_devices.enabled": False,
|
||||||
|
"net.network_prediction_options": 3,
|
||||||
|
"privacy_guide.viewed": True,
|
||||||
|
"profile.default_content_setting_values.notifications": 2,
|
||||||
|
"profile.default_content_setting_values.sound": 2,
|
||||||
|
"profile.name": CONST_APP_VERSION,
|
||||||
|
"profile.password_manager_enabled": False,
|
||||||
|
"safebrowsing.enabled":False,
|
||||||
|
"safebrowsing.enhanced":False,
|
||||||
|
"sync.autofill_wallet_import_enabled_migrated":False,
|
||||||
|
"translate":{"enabled": False}}
|
||||||
|
|
||||||
warnings.simplefilter('ignore',InsecureRequestWarning)
|
warnings.simplefilter('ignore',InsecureRequestWarning)
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
@ -292,7 +307,7 @@ def get_chrome_options(webdriver_path, config_dict):
|
||||||
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
|
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])
|
||||||
# Deprecated chrome option is ignored: useAutomationExtension
|
# Deprecated chrome option is ignored: useAutomationExtension
|
||||||
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
||||||
chrome_options.add_experimental_option("prefs", {"credentials_enable_service": False, "profile.password_manager_enabled": False, "profile.name": CONST_APP_VERSION, "translate":{"enabled": False}})
|
chrome_options.add_experimental_option("prefs", CONST_PREFS_DICT)
|
||||||
|
|
||||||
if len(config_dict["advanced"]["proxy_server_port"]) > 2:
|
if len(config_dict["advanced"]["proxy_server_port"]) > 2:
|
||||||
chrome_options.add_argument('--proxy-server=%s' % config_dict["advanced"]["proxy_server_port"])
|
chrome_options.add_argument('--proxy-server=%s' % config_dict["advanced"]["proxy_server_port"])
|
||||||
|
@ -455,7 +470,7 @@ def get_uc_options(uc, config_dict, webdriver_path):
|
||||||
options.add_argument("--no-sandbox")
|
options.add_argument("--no-sandbox")
|
||||||
options.add_argument("--no-service-autorun")
|
options.add_argument("--no-service-autorun")
|
||||||
options.add_argument("--password-store=basic")
|
options.add_argument("--password-store=basic")
|
||||||
options.add_experimental_option("prefs", {"credentials_enable_service": False, "profile.password_manager_enabled": False, "profile.name": CONST_APP_VERSION, "translate":{"enabled": False}})
|
options.add_experimental_option("prefs", CONST_PREFS_DICT)
|
||||||
|
|
||||||
if len(config_dict["advanced"]["proxy_server_port"]) > 2:
|
if len(config_dict["advanced"]["proxy_server_port"]) > 2:
|
||||||
options.add_argument('--proxy-server=%s' % config_dict["advanced"]["proxy_server_port"])
|
options.add_argument('--proxy-server=%s' % config_dict["advanced"]["proxy_server_port"])
|
||||||
|
|
|
@ -24,7 +24,7 @@ import webbrowser
|
||||||
|
|
||||||
import util
|
import util
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.03.25)"
|
CONST_APP_VERSION = "MaxBot (2024.03.26)"
|
||||||
|
|
||||||
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"
|
||||||
|
|
|
@ -29,7 +29,7 @@ from datetime import datetime
|
||||||
|
|
||||||
import util
|
import util
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.03.25)"
|
CONST_APP_VERSION = "MaxBot (2024.03.26)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
|
CONST_MAXBOT_KKTIX_CONFIG_FILE = "kktix.json"
|
||||||
|
|
|
@ -32,7 +32,7 @@ except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.03.25)"
|
CONST_APP_VERSION = "MaxBot (2024.03.26)"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -1392,12 +1392,33 @@ def get_maxbot_plus_extension_path():
|
||||||
|
|
||||||
return config_filepath
|
return config_filepath
|
||||||
|
|
||||||
|
def get_maxbot_block_extension_path():
|
||||||
|
extension_path = "webdriver/Maxblockplus_1.0.0/"
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
extension_path = extension_path.replace("/","\\")
|
||||||
|
|
||||||
|
app_root = util.get_app_root()
|
||||||
|
config_filepath = os.path.join(app_root, extension_path)
|
||||||
|
#print("config_filepath:", config_filepath)
|
||||||
|
|
||||||
|
# check extesion mainfest
|
||||||
|
path = pathlib.Path(config_filepath)
|
||||||
|
if path.exists():
|
||||||
|
if path.is_dir():
|
||||||
|
#print("found extension dir")
|
||||||
|
for item in path.rglob("manifest.*"):
|
||||||
|
path = item.parent
|
||||||
|
#print("final path:", path)
|
||||||
|
|
||||||
|
return config_filepath
|
||||||
|
|
||||||
def get_extension_config(config_dict):
|
def get_extension_config(config_dict):
|
||||||
default_lang = "zh-TW"
|
default_lang = "zh-TW"
|
||||||
no_sandbox=True
|
no_sandbox=True
|
||||||
conf = Config(browser_args=get_nodriver_browser_args(), lang=default_lang, no_sandbox=no_sandbox, headless=config_dict["advanced"]["headless"])
|
conf = Config(browser_args=get_nodriver_browser_args(), lang=default_lang, no_sandbox=no_sandbox, headless=config_dict["advanced"]["headless"])
|
||||||
if config_dict["advanced"]["chrome_extension"]:
|
if config_dict["advanced"]["chrome_extension"]:
|
||||||
conf.add_extension(get_maxbot_plus_extension_path())
|
conf.add_extension(get_maxbot_plus_extension_path())
|
||||||
|
conf.add_extension(get_maxbot_block_extension_path())
|
||||||
return conf
|
return conf
|
||||||
|
|
||||||
async def nodrver_block_urls(tab, config_dict):
|
async def nodrver_block_urls(tab, config_dict):
|
||||||
|
@ -1504,9 +1525,33 @@ def nodriver_overwrite_prefs(conf, prefs_dict={}):
|
||||||
if not os.path.exists(prefs_filepath):
|
if not os.path.exists(prefs_filepath):
|
||||||
os.mkdir(prefs_filepath)
|
os.mkdir(prefs_filepath)
|
||||||
prefs_filepath = os.path.join(prefs_filepath,"Preferences")
|
prefs_filepath = os.path.join(prefs_filepath,"Preferences")
|
||||||
|
prefs_dict["in_product_help"]={}
|
||||||
|
prefs_dict["in_product_help"]["snoozed_feature"]={}
|
||||||
|
prefs_dict["in_product_help"]["snoozed_feature"]["IPH_LiveCaption"]={}
|
||||||
|
prefs_dict["in_product_help"]["snoozed_feature"]["IPH_LiveCaption"]["is_dismissed"]=True
|
||||||
|
prefs_dict["in_product_help"]["snoozed_feature"]["IPH_LiveCaption"]["last_dismissed_by"]=4
|
||||||
|
prefs_dict["media_router"]={}
|
||||||
|
prefs_dict["media_router"]["show_cast_sessions_started_by_other_devices"]={}
|
||||||
|
prefs_dict["media_router"]["show_cast_sessions_started_by_other_devices"]["enabled"]=False
|
||||||
|
prefs_dict["net"]={}
|
||||||
|
prefs_dict["net"]["network_prediction_options"]=3
|
||||||
|
prefs_dict["privacy_guide"]={}
|
||||||
|
prefs_dict["privacy_guide"]["viewed"]=True
|
||||||
|
prefs_dict["privacy_sandbox"]={}
|
||||||
|
prefs_dict["privacy_sandbox"]["first_party_sets_enabled"]=False
|
||||||
prefs_dict["profile"]={}
|
prefs_dict["profile"]={}
|
||||||
|
prefs_dict["profile"]["cookie_controls_mode"]=1
|
||||||
|
prefs_dict["profile"]["default_content_setting_values"]={}
|
||||||
|
prefs_dict["profile"]["default_content_setting_values"]["notifications"]=2
|
||||||
|
prefs_dict["profile"]["default_content_setting_values"]["sound"]=2
|
||||||
prefs_dict["profile"]["name"]=CONST_APP_VERSION
|
prefs_dict["profile"]["name"]=CONST_APP_VERSION
|
||||||
prefs_dict["profile"]["password_manager_enabled"]=False
|
prefs_dict["profile"]["password_manager_enabled"]=False
|
||||||
|
prefs_dict["safebrowsing"]={}
|
||||||
|
prefs_dict["safebrowsing"]["enabled"]=False
|
||||||
|
prefs_dict["safebrowsing"]["enhanced"]=False
|
||||||
|
prefs_dict["sync"]={}
|
||||||
|
prefs_dict["sync"]["autofill_wallet_import_enabled_migrated"]=False
|
||||||
|
|
||||||
json_str = json.dumps(prefs_dict)
|
json_str = json.dumps(prefs_dict)
|
||||||
with open(prefs_filepath, 'w') as outfile:
|
with open(prefs_filepath, 'w') as outfile:
|
||||||
outfile.write(json_str)
|
outfile.write(json_str)
|
||||||
|
@ -1521,6 +1566,8 @@ def nodriver_overwrite_prefs(conf, prefs_dict={}):
|
||||||
"memory-saver-multi-state-mode@1",
|
"memory-saver-multi-state-mode@1",
|
||||||
"modal-memory-saver@1"
|
"modal-memory-saver@1"
|
||||||
]
|
]
|
||||||
|
state_dict["dns_over_https"]={}
|
||||||
|
state_dict["dns_over_https"]["mode"]="off"
|
||||||
json_str = json.dumps(state_dict)
|
json_str = json.dumps(state_dict)
|
||||||
with open(state_filepath, 'w') as outfile:
|
with open(state_filepath, 'w') as outfile:
|
||||||
outfile.write(json_str)
|
outfile.write(json_str)
|
||||||
|
@ -1729,7 +1776,6 @@ async def main(args):
|
||||||
if len(facebook_account) > 4:
|
if len(facebook_account) > 4:
|
||||||
await nodriver_facebook_login(tab, facebook_account, facebook_password)
|
await nodriver_facebook_login(tab, facebook_account, facebook_password)
|
||||||
|
|
||||||
|
|
||||||
def cli():
|
def cli():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="MaxBot Aggument Parser")
|
description="MaxBot Aggument Parser")
|
||||||
|
|
|
@ -41,7 +41,7 @@ try:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2024.03.25)"
|
CONST_APP_VERSION = "MaxBot (2024.03.26)"
|
||||||
|
|
||||||
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"
|
||||||
|
|
2
util.py
2
util.py
|
@ -6,9 +6,9 @@ import platform
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import subprocess
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
Loading…
Reference in New Issue