diff --git a/OlivOS/adapter/onebotV11/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py index 84e63457..021e0ab5 100644 --- a/OlivOS/adapter/onebotV11/flaskServerAPI.py +++ b/OlivOS/adapter/onebotV11/flaskServerAPI.py @@ -40,6 +40,7 @@ 'napcat', 'napcat_hide', 'napcat_show', + 'napcat_show_new', 'napcat_show_old' ] diff --git a/OlivOS/core/core/messageAPI.py b/OlivOS/core/core/messageAPI.py index f481fc0e..d7960359 100644 --- a/OlivOS/core/core/messageAPI.py +++ b/OlivOS/core/core/messageAPI.py @@ -58,6 +58,7 @@ 'napcat': 'old_string', 'napcat_hide': 'old_string', 'napcat_show': 'old_string', + 'napcat_show_new': 'old_string', 'napcat_show_old': 'old_string' } }, diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index efa7988c..05533086 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -39,6 +39,7 @@ 'napcat', 'napcat_hide', 'napcat_show', + 'napcat_show_new', 'napcat_show_old' ] @@ -62,11 +63,19 @@ def startNapCatLibExeModel( OlivOS.updateAPI.checkResouceFile( logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], resouce_api=resourceUrlPath, - resouce_name='NapCat-QQ-Win-9.9.11-24568', # resouce_name='NapCat-QQ-Win-9.9.12-26000', + resouce_name='NapCat-QQ-Win-9.9.11-24568', filePath='./lib/NapCat.zip', filePathUpdate='./lib/NapCat.zip.tmp', filePathFORCESKIP='./lib/FORCESKIP' ) + OlivOS.updateAPI.checkResouceFile( + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + resouce_api=resourceUrlPath, + resouce_name='NapCat-QQ-Win-9.9.12-26000', + filePath='./lib/NapCatNew.zip', + filePathUpdate='./lib/NapCat.zip.tmp', + filePathFORCESKIP='./lib/FORCESKIP' + ) for bot_info_key in plugin_bot_info_dict: if plugin_bot_info_dict[bot_info_key].platform['model'] in gCheckList: tmp_Proc_name = basic_conf_models_this['name'] + '=' + bot_info_key @@ -126,10 +135,16 @@ def run(self): releaseDir('./conf/napcat') releaseDir(f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}") releaseDir(f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}/config") - unzip('./lib/NapCat.zip', f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}") + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'napcat_show_new' + ]: + unzip('./lib/NapCatNew.zip', f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}") + else: + unzip('./lib/NapCat.zip', f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}") napcatTypeConfig(self.Proc_data['bot_info_dict'], self.Proc_config['target_proc']).setConfig() if self.Proc_data['bot_info_dict'].platform['model'] in [ 'napcat', + 'napcat_show_new', 'napcat_show' ]: self.log(2, OlivOS.L10NAPI.getTrans( @@ -147,31 +162,43 @@ def run(self): args=(), daemon=self.deamon ).start() - tmp_env = dict(os.environ) - model_Proc = subprocess.Popen( - f".\\napcat-utf8.bat -q {self.Proc_data['bot_info_dict'].id}", - cwd=f".\\conf\\napcat\\{self.Proc_data['bot_info_dict'].hash}", - shell=True, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - creationflags=subprocess.CREATE_NEW_CONSOLE, - env=tmp_env - ) - self.Proc_data['model_Proc'] = model_Proc - threading.Thread( - target=self.check_stdin, - args=(model_Proc,), - daemon=self.deamon - ).start() - self.get_model_stdout(model_Proc) - # model_Proc.communicate(timeout = None) - self.log(3, OlivOS.L10NAPI.getTrans( - 'OlivOS libNapCatEXEModel server [{0}] will retry in 10s...', - [self.Proc_name], modelName - )) - self.Proc_data['model_Proc'] = None - time.sleep(8) + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'napcat_show_new' + ]: + tmp_env = dict(os.environ) + subprocess.call( + 'start powershell .\\BootWay05.ps1', + shell=True, + cwd='.\\conf\\napcat\\' + self.Proc_data['bot_info_dict'].hash, + env=tmp_env + ) + self.flag_run = False + else: + tmp_env = dict(os.environ) + model_Proc = subprocess.Popen( + f".\\napcat-utf8.bat -q {self.Proc_data['bot_info_dict'].id}", + cwd=f".\\conf\\napcat\\{self.Proc_data['bot_info_dict'].hash}", + shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + creationflags=subprocess.CREATE_NEW_CONSOLE, + env=tmp_env + ) + self.Proc_data['model_Proc'] = model_Proc + threading.Thread( + target=self.check_stdin, + args=(model_Proc,), + daemon=self.deamon + ).start() + self.get_model_stdout(model_Proc) + # model_Proc.communicate(timeout = None) + self.log(3, OlivOS.L10NAPI.getTrans( + 'OlivOS libNapCatEXEModel server [{0}] will retry in 10s...', + [self.Proc_name], modelName + )) + self.Proc_data['model_Proc'] = None + time.sleep(8) elif self.Proc_data['bot_info_dict'].platform['model'] in [ 'napcat_show_old' ]: diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 636a744d..4ddd3aeb 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -365,6 +365,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'edit_root_Combobox_dict': { 'type_list': [ 'QQ/NapCat/默认', + 'QQ/NapCat/9.9.11', 'QQ/OPQ/默认', 'QQ/GoCq/安卓平板', 'QQ/GoCq/安卓手机', @@ -429,7 +430,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/OPQ/默认': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', 'QQ/OPQ/指定端口': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', 'QQ/OPQ/指定端口/旧': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', - 'QQ/NapCat/默认': '使用本方法需要已经安装较新版本QQ', + 'QQ/NapCat/默认': '需要已经安装不低于9.9.12版本QQ', + 'QQ/NapCat/9.9.11': '需要已经安装不高于9.9.11版本QQ', 'QQ/NapCat/旧': '使用本方法需要已经安装较新版本QQ' }, 'type_clear_note_list': { @@ -448,6 +450,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/OPQ/指定端口': './conf/OPQBot/{bothash}', 'QQ/OPQ/指定端口/旧': './conf/OPQBot/{bothash}', 'QQ/NapCat/默认': './conf/napcat/{bothash}', + 'QQ/NapCat/9.9.11': './conf/napcat/{bothash}', 'QQ/NapCat/旧': './conf/napcat/{bothash}' }, 'type_extend_note_list': { @@ -542,7 +545,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'TOKEN': 'edit_root_Entry_Server_access_token', } ], - 'QQ/NapCat/默认': ['qq', 'onebot', 'napcat_show', 'True', 'post', { + 'QQ/NapCat/默认': ['qq', 'onebot', 'napcat_show_new', 'True', 'post', { + 'QQ号': 'edit_root_Entry_ID', + } + ], + 'QQ/NapCat/9.9.11': ['qq', 'onebot', 'napcat_show', 'True', 'post', { 'QQ号': 'edit_root_Entry_ID', } ], @@ -889,6 +896,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'napcat', #'napcat_hide', 'napcat_show', + 'napcat_show_new', 'napcat_show_old' ] },