reduce a thread, show running on PORT debug message.

master
Your Name 2024-01-16 17:21:20 +08:00
parent 600433be1f
commit 66d62cef21
3 changed files with 22 additions and 23 deletions

View File

@ -41,7 +41,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.01.08)"
CONST_APP_VERSION = "MaxBot (2024.01.09)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -618,13 +618,11 @@ def dump_settins_to_maxbot_plus_extension(ext, config_dict):
line = line.replace('display: none;','')
new_html_array.append(line)
if len(new_html_array) > 0:
print("output new options.html")
#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):
options = uc.ChromeOptions()
options.page_load_strategy = 'eager'

View File

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

View File

@ -38,7 +38,7 @@ try:
except Exception as exc:
pass
CONST_APP_VERSION = "MaxBot (2024.01.08)"
CONST_APP_VERSION = "MaxBot (2024.01.09)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -100,6 +100,8 @@ URL_CHROME_DRIVER = 'https://chromedriver.chromium.org/'
URL_FIREFOX_DRIVER = 'https://github.com/mozilla/geckodriver/releases'
URL_EDGE_DRIVER = 'https://developer.microsoft.com/zh-tw/microsoft-edge/tools/webdriver/'
GLOBAL_SERVER_SHUTDOWN = False
def load_translate():
translate = {}
en_us={}
@ -2422,12 +2424,10 @@ def resetful_api_timer():
while True:
btn_preview_text_clicked()
preview_question_text_file()
time.sleep(0.2)
def settings_timer():
while True:
update_maxbot_runtime_status()
time.sleep(0.6)
time.sleep(0.3)
if GLOBAL_SERVER_SHUTDOWN:
break
def clean_extension_status():
Root_Dir = get_app_root()
@ -2765,9 +2765,9 @@ def main():
root.call('wm', 'iconphoto', root._w, logo)
os.remove(icon_filepath)
threading.Thread(target=settings_timer, daemon=True).start()
root.mainloop()
print("exit settings")
GLOBAL_SERVER_SHUTDOWN=True
clean_extension_status()
def force_remove_file(filepath):
@ -2918,6 +2918,7 @@ async def main_server():
app.version = CONST_APP_VERSION;
app.listen(CONST_SERVER_PORT)
print("server running on port:", CONST_SERVER_PORT)
await asyncio.Event().wait()
def web_server():