diff --git a/OlivOS/bootAPI.py b/OlivOS/bootAPI.py index d2ad28e6..ae2b66e0 100644 --- a/OlivOS/bootAPI.py +++ b/OlivOS/bootAPI.py @@ -241,6 +241,11 @@ def start(self): bot_info_dict=plugin_bot_info_dict, logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], ) + if platform.system() == 'Windows': + OlivOS.libEXEModelAPI.accountFix( + bot_info_dict=plugin_bot_info_dict, + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + ) plugin_bot_info_dict = OlivOS.accountAPI.accountFix( basic_conf_models=basic_conf_models, bot_info_dict=plugin_bot_info_dict, @@ -511,6 +516,9 @@ def start(self): 'gocqhttp', 'gocqhttp_hide', 'gocqhttp_show', + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad', 'gocqhttp_show_old' ]: tmp_Proc_name = basic_conf_models_this['name'] + '=' + bot_info_key diff --git a/OlivOS/infoAPI.py b/OlivOS/infoAPI.py index d251ebb1..78b18384 100644 --- a/OlivOS/infoAPI.py +++ b/OlivOS/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.0' -OlivOS_SVN = 120 +OlivOS_Version = '0.11.1' +OlivOS_SVN = 121 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libEXEModelAPI.py b/OlivOS/libEXEModelAPI.py index 2efc13bc..ec9a5532 100644 --- a/OlivOS/libEXEModelAPI.py +++ b/OlivOS/libEXEModelAPI.py @@ -20,6 +20,7 @@ import time import os import traceback +import json import OlivOS @@ -47,7 +48,10 @@ def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=Non def run(self): flag_run = True if self.Proc_data['bot_info_dict'].platform['model'] in [ - 'gocqhttp_show' + 'gocqhttp_show', + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad' ]: self.send_init_event() while flag_run: @@ -78,7 +82,10 @@ def run(self): self.log(2, 'OlivOS libEXEModel server [' + self.Proc_name + '] exited') elif self.Proc_data['bot_info_dict'].platform['model'] in [ 'gocqhttp', - 'gocqhttp_show' + 'gocqhttp_show', + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad' ]: self.log(2, 'OlivOS libEXEModel server [' + self.Proc_name + '] will run under visiable mode') self.clear_gocqhttp() @@ -328,6 +335,38 @@ def setConfig(self): with open('./conf/gocqhttp/' + self.bot_info_dict.hash + '/config.yml', 'w+', encoding='utf-8') as tmp: tmp.write(self.config_file_str) +def accountFix(bot_info_dict, logger_proc): + releaseDir('./conf') + releaseDir('./conf/gocqhttp') + for bot_info_dict_this in bot_info_dict: + bot_hash = bot_info_dict_this + if bot_info_dict[bot_hash].platform['sdk'] == 'onebot' \ + and bot_info_dict[bot_hash].platform['platform'] == 'qq' \ + and bot_info_dict[bot_hash].platform['model'] in [ + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad', + ]: + releaseDir('./conf/gocqhttp/' + bot_hash) + file_path = './conf/gocqhttp/' + bot_hash + '/device.json' + device_info = {} + try: + with open(file_path, 'r', encoding = 'utf-8') as f: + device_info = json.loads(f.read()) + except: + device_info = {} + if bot_info_dict[bot_hash].platform['model'] == 'gocqhttp_show_Android_Phone': + device_info['protocol'] = 1 + elif bot_info_dict[bot_hash].platform['model'] == 'gocqhttp_show_Android_Watch': + device_info['protocol'] = 2 + elif bot_info_dict[bot_hash].platform['model'] == 'gocqhttp_show_iPad': + device_info['protocol'] = 5 + try: + with open(file_path, 'w', encoding = 'utf-8') as f: + f.write(json.dumps(device_info, ensure_ascii = False)) + except: + pass + def releaseDir(dir_path): if not os.path.exists(dir_path): diff --git a/OlivOS/multiLoginUIAPI.py b/OlivOS/multiLoginUIAPI.py index 56db49b7..925b88f0 100644 --- a/OlivOS/multiLoginUIAPI.py +++ b/OlivOS/multiLoginUIAPI.py @@ -255,7 +255,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'edit_root_Combobox_Account_type_StringVar': tkinter.StringVar(), 'edit_root_Combobox_dict': { 'type_list': [ - '传统QQ', + '传统QQ - 默认', + '传统QQ - 安卓手机', + '传统QQ - 安卓手表', + '传统QQ - iPad', '传统QQ - 旧', 'Discord', 'Telegram', @@ -275,11 +278,32 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non # 各类账号组合的匹配与注册表 # type: [platform, sdk, model, server_auto, server_type, {data_dict}] 'type_note_list': { - '传统QQ': '密码留空即尝试使用扫码登录', + '传统QQ - 默认': '密码留空即尝试使用扫码登录', + '传统QQ - 安卓手机': '密码留空即尝试使用扫码登录', + '传统QQ - 安卓手表': '密码留空即尝试使用扫码登录', + '传统QQ - iPad': '密码留空即尝试使用扫码登录', '传统QQ - 旧': '密码留空即尝试使用扫码登录' }, 'type_mapping_list': { - '传统QQ': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { + '传统QQ - 默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + # 推荐使用扫码登录时,可以隐藏密码栏 + } + ], + '传统QQ - 安卓手机': ['qq', 'onebot', 'gocqhttp_show_Android_Phone', 'True', 'post', { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + # 推荐使用扫码登录时,可以隐藏密码栏 + } + ], + '传统QQ - 安卓手表': ['qq', 'onebot', 'gocqhttp_show_Android_Watch', 'True', 'post', { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + # 推荐使用扫码登录时,可以隐藏密码栏 + } + ], + '传统QQ - iPad': ['qq', 'onebot', 'gocqhttp_show_iPad', 'True', 'post', { '账号': 'edit_root_Entry_ID', '密码': 'edit_root_Entry_Password', # 推荐使用扫码登录时,可以隐藏密码栏 @@ -411,6 +435,9 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non # 'gocqhttp', # 'gocqhttp_hide', 'gocqhttp_show', + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad', 'gocqhttp_show_old', 'default' ]