From 247ad3309a57078f1632ae0bb3477991075ce7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 6 Dec 2023 17:14:53 +0800 Subject: [PATCH 01/76] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + OlivOS/__init__.py | 112 +++++++++--------- .../biliLive}/biliLiveLinkServerAPI.py | 0 OlivOS/{ => adapter/biliLive}/biliLiveSDK.py | 0 .../dingtalk}/dingtalkLinkServerAPI.py | 0 OlivOS/{ => adapter/dingtalk}/dingtalkSDK.py | 0 .../discord}/discordLinkServerAPI.py | 0 OlivOS/{ => adapter/discord}/discordSDK.py | 0 OlivOS/{ => adapter/dodo}/dodoLinkSDK.py | 0 .../{ => adapter/dodo}/dodoLinkServerAPI.py | 0 .../{ => adapter/dodo}/dodoPollServerAPI.py | 0 OlivOS/{ => adapter/dodo}/dodoSDK.py | 0 OlivOS/{ => adapter/dodo}/dodobotEASDK.py | 0 .../{ => adapter/dodo}/dodobotEAServerAPI.py | 0 OlivOS/{ => adapter/dodo}/dodobotEATXAPI.py | 0 .../fanbook}/fanbookPollServerAPI.py | 0 OlivOS/{ => adapter/fanbook}/fanbookSDK.py | 0 .../hackChat}/hackChatLinkServerAPI.py | 2 - OlivOS/{ => adapter/hackChat}/hackChatSDK.py | 0 .../kaiheila}/kaiheilaLinkServerAPI.py | 0 OlivOS/{ => adapter/kaiheila}/kaiheilaSDK.py | 0 .../mhyVila}/mhyVilaLinkServerAPI.py | 0 OlivOS/{ => adapter/mhyVila}/mhyVilaSDK.py | 0 .../{ => adapter/onebotV11}/flaskServerAPI.py | 0 OlivOS/{ => adapter/onebotV11}/onebotSDK.py | 0 .../onebotV12}/onebotV12LinkServerAPI.py | 0 .../{ => adapter/onebotV12}/onebotV12SDK.py | 0 .../qqGuild}/qqGuildLinkServerAPI.py | 0 OlivOS/{ => adapter/qqGuild}/qqGuildSDK.py | 0 .../qqGuild}/qqGuildv2LinkServerAPI.py | 0 OlivOS/{ => adapter/qqGuild}/qqGuildv2SDK.py | 0 .../{ => adapter/red}/qqRedLinkServerAPI.py | 0 OlivOS/{ => adapter/red}/qqRedSDK.py | 0 .../telegram}/telegramPollServerAPI.py | 0 OlivOS/{ => adapter/telegram}/telegramSDK.py | 0 .../virtualTerminalLinkServerAPI.py | 0 .../virtualTerminal}/virtualTerminalSDK.py | 0 OlivOS/{ => core/L10N}/L10NAPI.py | 0 OlivOS/{ => core/L10N}/L10NDataAPI.py | 0 OlivOS/{ => core/boot}/bootAPI.py | 0 OlivOS/{ => core/boot}/bootDataAPI.py | 0 OlivOS/{ => core/core}/API.py | 0 OlivOS/{ => core/core}/accountAPI.py | 0 OlivOS/{ => core/core}/contentAPI.py | 0 OlivOS/{ => core/core}/diagnoseAPI.py | 0 OlivOS/{ => core/core}/messageAPI.py | 0 OlivOS/{ => core/core}/metadataAPI.py | 0 OlivOS/{ => core/core}/pluginAPI.py | 0 OlivOS/{ => core/info}/infoAPI.py | 4 +- OlivOS/{ => core/inlineData}/data.py | 0 OlivOS/{ => core/web}/updateAPI.py | 0 OlivOS/{ => core/web}/webTool.py | 0 OlivOS/{ => libBooter}/libCWCBEXEModelAPI.py | 0 OlivOS/{ => libBooter}/libEXEModelAPI.py | 0 OlivOS/{ => libBooter}/libWQEXEModelAPI.py | 0 OlivOS/{ => nativeGUI}/multiLoginUIAPI.py | 0 OlivOS/{ => nativeGUI}/nativeWinUIAPI.py | 0 OlivOS/{ => nativeGUI}/webviewUIAPI.py | 0 58 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 .gitignore rename OlivOS/{ => adapter/biliLive}/biliLiveLinkServerAPI.py (100%) rename OlivOS/{ => adapter/biliLive}/biliLiveSDK.py (100%) rename OlivOS/{ => adapter/dingtalk}/dingtalkLinkServerAPI.py (100%) rename OlivOS/{ => adapter/dingtalk}/dingtalkSDK.py (100%) rename OlivOS/{ => adapter/discord}/discordLinkServerAPI.py (100%) rename OlivOS/{ => adapter/discord}/discordSDK.py (100%) rename OlivOS/{ => adapter/dodo}/dodoLinkSDK.py (100%) rename OlivOS/{ => adapter/dodo}/dodoLinkServerAPI.py (100%) rename OlivOS/{ => adapter/dodo}/dodoPollServerAPI.py (100%) rename OlivOS/{ => adapter/dodo}/dodoSDK.py (100%) rename OlivOS/{ => adapter/dodo}/dodobotEASDK.py (100%) rename OlivOS/{ => adapter/dodo}/dodobotEAServerAPI.py (100%) rename OlivOS/{ => adapter/dodo}/dodobotEATXAPI.py (100%) rename OlivOS/{ => adapter/fanbook}/fanbookPollServerAPI.py (100%) rename OlivOS/{ => adapter/fanbook}/fanbookSDK.py (100%) rename OlivOS/{ => adapter/hackChat}/hackChatLinkServerAPI.py (98%) rename OlivOS/{ => adapter/hackChat}/hackChatSDK.py (100%) rename OlivOS/{ => adapter/kaiheila}/kaiheilaLinkServerAPI.py (100%) rename OlivOS/{ => adapter/kaiheila}/kaiheilaSDK.py (100%) rename OlivOS/{ => adapter/mhyVila}/mhyVilaLinkServerAPI.py (100%) rename OlivOS/{ => adapter/mhyVila}/mhyVilaSDK.py (100%) rename OlivOS/{ => adapter/onebotV11}/flaskServerAPI.py (100%) rename OlivOS/{ => adapter/onebotV11}/onebotSDK.py (100%) rename OlivOS/{ => adapter/onebotV12}/onebotV12LinkServerAPI.py (100%) rename OlivOS/{ => adapter/onebotV12}/onebotV12SDK.py (100%) rename OlivOS/{ => adapter/qqGuild}/qqGuildLinkServerAPI.py (100%) rename OlivOS/{ => adapter/qqGuild}/qqGuildSDK.py (100%) rename OlivOS/{ => adapter/qqGuild}/qqGuildv2LinkServerAPI.py (100%) rename OlivOS/{ => adapter/qqGuild}/qqGuildv2SDK.py (100%) rename OlivOS/{ => adapter/red}/qqRedLinkServerAPI.py (100%) rename OlivOS/{ => adapter/red}/qqRedSDK.py (100%) rename OlivOS/{ => adapter/telegram}/telegramPollServerAPI.py (100%) rename OlivOS/{ => adapter/telegram}/telegramSDK.py (100%) rename OlivOS/{ => adapter/virtualTerminal}/virtualTerminalLinkServerAPI.py (100%) rename OlivOS/{ => adapter/virtualTerminal}/virtualTerminalSDK.py (100%) rename OlivOS/{ => core/L10N}/L10NAPI.py (100%) rename OlivOS/{ => core/L10N}/L10NDataAPI.py (100%) rename OlivOS/{ => core/boot}/bootAPI.py (100%) rename OlivOS/{ => core/boot}/bootDataAPI.py (100%) rename OlivOS/{ => core/core}/API.py (100%) rename OlivOS/{ => core/core}/accountAPI.py (100%) rename OlivOS/{ => core/core}/contentAPI.py (100%) rename OlivOS/{ => core/core}/diagnoseAPI.py (100%) rename OlivOS/{ => core/core}/messageAPI.py (100%) rename OlivOS/{ => core/core}/metadataAPI.py (100%) rename OlivOS/{ => core/core}/pluginAPI.py (100%) rename OlivOS/{ => core/info}/infoAPI.py (96%) rename OlivOS/{ => core/inlineData}/data.py (100%) rename OlivOS/{ => core/web}/updateAPI.py (100%) rename OlivOS/{ => core/web}/webTool.py (100%) rename OlivOS/{ => libBooter}/libCWCBEXEModelAPI.py (100%) rename OlivOS/{ => libBooter}/libEXEModelAPI.py (100%) rename OlivOS/{ => libBooter}/libWQEXEModelAPI.py (100%) rename OlivOS/{ => nativeGUI}/multiLoginUIAPI.py (100%) rename OlivOS/{ => nativeGUI}/nativeWinUIAPI.py (100%) rename OlivOS/{ => nativeGUI}/webviewUIAPI.py (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0041fb85 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index 86b36715..05141349 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -18,63 +18,63 @@ import platform -from . import infoAPI -from . import L10NAPI -from . import L10NDataAPI -from . import bootAPI -from . import bootDataAPI -from . import data +from .core.info import infoAPI +from .core.L10N import L10NAPI +from .core.L10N import L10NDataAPI +from .core.boot import bootAPI +from .core.boot import bootDataAPI +from .core.inlineData import data from . import hook -from . import contentAPI -from . import messageAPI -from . import metadataAPI -from . import API +from .core.core import contentAPI +from .core.core import messageAPI +from .core.core import metadataAPI +from .core.core import API from . import thirdPartyModule -from . import accountAPI -from . import diagnoseAPI -from . import flaskServerAPI -from . import onebotV12SDK -from . import onebotV12LinkServerAPI -from . import pluginAPI -from . import onebotSDK -from . import virtualTerminalSDK -from . import virtualTerminalLinkServerAPI -from . import qqGuildSDK -from . import qqGuildLinkServerAPI -from . import qqGuildv2SDK -from . import qqGuildv2LinkServerAPI -from . import qqRedSDK -from . import qqRedLinkServerAPI -from . import telegramSDK -from . import telegramPollServerAPI -from . import discordSDK -from . import discordLinkServerAPI -from . import hackChatSDK -from . import hackChatLinkServerAPI -from . import dodobotEAServerAPI -from . import dodobotEATXAPI -from . import dodobotEASDK -from . import dodoSDK -from . import dodoPollServerAPI -from . import dodoLinkSDK -from . import dodoLinkServerAPI -from . import dingtalkSDK -from . import dingtalkLinkServerAPI -from . import fanbookSDK -from . import fanbookPollServerAPI -from . import kaiheilaSDK -from . import kaiheilaLinkServerAPI -from . import mhyVilaSDK -from . import mhyVilaLinkServerAPI -from . import biliLiveSDK -from . import biliLiveLinkServerAPI -from . import updateAPI -from . import webTool +from .core.core import accountAPI +from .core.core import diagnoseAPI +from .adapter.onebotV11 import flaskServerAPI +from .adapter.onebotV12 import onebotV12SDK +from .adapter.onebotV12 import onebotV12LinkServerAPI +from .core.core import pluginAPI +from .adapter.onebotV11 import onebotSDK +from .adapter.virtualTerminal import virtualTerminalSDK +from .adapter.virtualTerminal import virtualTerminalLinkServerAPI +from .adapter.qqGuild import qqGuildSDK +from .adapter.qqGuild import qqGuildLinkServerAPI +from .adapter.qqGuild import qqGuildv2SDK +from .adapter.qqGuild import qqGuildv2LinkServerAPI +from .adapter.red import qqRedSDK +from .adapter.red import qqRedLinkServerAPI +from .adapter.telegram import telegramSDK +from .adapter.telegram import telegramPollServerAPI +from .adapter.discord import discordSDK +from .adapter.discord import discordLinkServerAPI +from .adapter.hackChat import hackChatSDK +from .adapter.hackChat import hackChatLinkServerAPI +from .adapter.dodo import dodobotEAServerAPI +from .adapter.dodo import dodobotEATXAPI +from .adapter.dodo import dodobotEASDK +from .adapter.dodo import dodoSDK +from .adapter.dodo import dodoPollServerAPI +from .adapter.dodo import dodoLinkSDK +from .adapter.dodo import dodoLinkServerAPI +from .adapter.dingtalk import dingtalkSDK +from .adapter.dingtalk import dingtalkLinkServerAPI +from .adapter.fanbook import fanbookSDK +from .adapter.fanbook import fanbookPollServerAPI +from .adapter.kaiheila import kaiheilaSDK +from .adapter.kaiheila import kaiheilaLinkServerAPI +from .adapter.mhyVila import mhyVilaSDK +from .adapter.mhyVila import mhyVilaLinkServerAPI +from .adapter.biliLive import biliLiveSDK +from .adapter.biliLive import biliLiveLinkServerAPI +from .core.web import updateAPI +from .core.web import webTool if platform.system() == 'Windows': - from . import multiLoginUIAPI - from . import libEXEModelAPI - from . import libWQEXEModelAPI - from . import libCWCBEXEModelAPI - from . import nativeWinUIAPI - from . import webviewUIAPI + from .nativeGUI import multiLoginUIAPI + from .libBooter import libEXEModelAPI + from .libBooter import libWQEXEModelAPI + from .libBooter import libCWCBEXEModelAPI + from .nativeGUI import nativeWinUIAPI + from .nativeGUI import webviewUIAPI from . import userModule diff --git a/OlivOS/biliLiveLinkServerAPI.py b/OlivOS/adapter/biliLive/biliLiveLinkServerAPI.py similarity index 100% rename from OlivOS/biliLiveLinkServerAPI.py rename to OlivOS/adapter/biliLive/biliLiveLinkServerAPI.py diff --git a/OlivOS/biliLiveSDK.py b/OlivOS/adapter/biliLive/biliLiveSDK.py similarity index 100% rename from OlivOS/biliLiveSDK.py rename to OlivOS/adapter/biliLive/biliLiveSDK.py diff --git a/OlivOS/dingtalkLinkServerAPI.py b/OlivOS/adapter/dingtalk/dingtalkLinkServerAPI.py similarity index 100% rename from OlivOS/dingtalkLinkServerAPI.py rename to OlivOS/adapter/dingtalk/dingtalkLinkServerAPI.py diff --git a/OlivOS/dingtalkSDK.py b/OlivOS/adapter/dingtalk/dingtalkSDK.py similarity index 100% rename from OlivOS/dingtalkSDK.py rename to OlivOS/adapter/dingtalk/dingtalkSDK.py diff --git a/OlivOS/discordLinkServerAPI.py b/OlivOS/adapter/discord/discordLinkServerAPI.py similarity index 100% rename from OlivOS/discordLinkServerAPI.py rename to OlivOS/adapter/discord/discordLinkServerAPI.py diff --git a/OlivOS/discordSDK.py b/OlivOS/adapter/discord/discordSDK.py similarity index 100% rename from OlivOS/discordSDK.py rename to OlivOS/adapter/discord/discordSDK.py diff --git a/OlivOS/dodoLinkSDK.py b/OlivOS/adapter/dodo/dodoLinkSDK.py similarity index 100% rename from OlivOS/dodoLinkSDK.py rename to OlivOS/adapter/dodo/dodoLinkSDK.py diff --git a/OlivOS/dodoLinkServerAPI.py b/OlivOS/adapter/dodo/dodoLinkServerAPI.py similarity index 100% rename from OlivOS/dodoLinkServerAPI.py rename to OlivOS/adapter/dodo/dodoLinkServerAPI.py diff --git a/OlivOS/dodoPollServerAPI.py b/OlivOS/adapter/dodo/dodoPollServerAPI.py similarity index 100% rename from OlivOS/dodoPollServerAPI.py rename to OlivOS/adapter/dodo/dodoPollServerAPI.py diff --git a/OlivOS/dodoSDK.py b/OlivOS/adapter/dodo/dodoSDK.py similarity index 100% rename from OlivOS/dodoSDK.py rename to OlivOS/adapter/dodo/dodoSDK.py diff --git a/OlivOS/dodobotEASDK.py b/OlivOS/adapter/dodo/dodobotEASDK.py similarity index 100% rename from OlivOS/dodobotEASDK.py rename to OlivOS/adapter/dodo/dodobotEASDK.py diff --git a/OlivOS/dodobotEAServerAPI.py b/OlivOS/adapter/dodo/dodobotEAServerAPI.py similarity index 100% rename from OlivOS/dodobotEAServerAPI.py rename to OlivOS/adapter/dodo/dodobotEAServerAPI.py diff --git a/OlivOS/dodobotEATXAPI.py b/OlivOS/adapter/dodo/dodobotEATXAPI.py similarity index 100% rename from OlivOS/dodobotEATXAPI.py rename to OlivOS/adapter/dodo/dodobotEATXAPI.py diff --git a/OlivOS/fanbookPollServerAPI.py b/OlivOS/adapter/fanbook/fanbookPollServerAPI.py similarity index 100% rename from OlivOS/fanbookPollServerAPI.py rename to OlivOS/adapter/fanbook/fanbookPollServerAPI.py diff --git a/OlivOS/fanbookSDK.py b/OlivOS/adapter/fanbook/fanbookSDK.py similarity index 100% rename from OlivOS/fanbookSDK.py rename to OlivOS/adapter/fanbook/fanbookSDK.py diff --git a/OlivOS/hackChatLinkServerAPI.py b/OlivOS/adapter/hackChat/hackChatLinkServerAPI.py similarity index 98% rename from OlivOS/hackChatLinkServerAPI.py rename to OlivOS/adapter/hackChat/hackChatLinkServerAPI.py index 945542a6..a75d1352 100644 --- a/OlivOS/hackChatLinkServerAPI.py +++ b/OlivOS/adapter/hackChat/hackChatLinkServerAPI.py @@ -21,8 +21,6 @@ import threading import OlivOS -from OlivOS import hackChatSDK -from OlivOS.qqGuildSDK import PAYLOAD modelName = 'hackChatLinkServerAPI' diff --git a/OlivOS/hackChatSDK.py b/OlivOS/adapter/hackChat/hackChatSDK.py similarity index 100% rename from OlivOS/hackChatSDK.py rename to OlivOS/adapter/hackChat/hackChatSDK.py diff --git a/OlivOS/kaiheilaLinkServerAPI.py b/OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py similarity index 100% rename from OlivOS/kaiheilaLinkServerAPI.py rename to OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py diff --git a/OlivOS/kaiheilaSDK.py b/OlivOS/adapter/kaiheila/kaiheilaSDK.py similarity index 100% rename from OlivOS/kaiheilaSDK.py rename to OlivOS/adapter/kaiheila/kaiheilaSDK.py diff --git a/OlivOS/mhyVilaLinkServerAPI.py b/OlivOS/adapter/mhyVila/mhyVilaLinkServerAPI.py similarity index 100% rename from OlivOS/mhyVilaLinkServerAPI.py rename to OlivOS/adapter/mhyVila/mhyVilaLinkServerAPI.py diff --git a/OlivOS/mhyVilaSDK.py b/OlivOS/adapter/mhyVila/mhyVilaSDK.py similarity index 100% rename from OlivOS/mhyVilaSDK.py rename to OlivOS/adapter/mhyVila/mhyVilaSDK.py diff --git a/OlivOS/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py similarity index 100% rename from OlivOS/flaskServerAPI.py rename to OlivOS/adapter/onebotV11/flaskServerAPI.py diff --git a/OlivOS/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py similarity index 100% rename from OlivOS/onebotSDK.py rename to OlivOS/adapter/onebotV11/onebotSDK.py diff --git a/OlivOS/onebotV12LinkServerAPI.py b/OlivOS/adapter/onebotV12/onebotV12LinkServerAPI.py similarity index 100% rename from OlivOS/onebotV12LinkServerAPI.py rename to OlivOS/adapter/onebotV12/onebotV12LinkServerAPI.py diff --git a/OlivOS/onebotV12SDK.py b/OlivOS/adapter/onebotV12/onebotV12SDK.py similarity index 100% rename from OlivOS/onebotV12SDK.py rename to OlivOS/adapter/onebotV12/onebotV12SDK.py diff --git a/OlivOS/qqGuildLinkServerAPI.py b/OlivOS/adapter/qqGuild/qqGuildLinkServerAPI.py similarity index 100% rename from OlivOS/qqGuildLinkServerAPI.py rename to OlivOS/adapter/qqGuild/qqGuildLinkServerAPI.py diff --git a/OlivOS/qqGuildSDK.py b/OlivOS/adapter/qqGuild/qqGuildSDK.py similarity index 100% rename from OlivOS/qqGuildSDK.py rename to OlivOS/adapter/qqGuild/qqGuildSDK.py diff --git a/OlivOS/qqGuildv2LinkServerAPI.py b/OlivOS/adapter/qqGuild/qqGuildv2LinkServerAPI.py similarity index 100% rename from OlivOS/qqGuildv2LinkServerAPI.py rename to OlivOS/adapter/qqGuild/qqGuildv2LinkServerAPI.py diff --git a/OlivOS/qqGuildv2SDK.py b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py similarity index 100% rename from OlivOS/qqGuildv2SDK.py rename to OlivOS/adapter/qqGuild/qqGuildv2SDK.py diff --git a/OlivOS/qqRedLinkServerAPI.py b/OlivOS/adapter/red/qqRedLinkServerAPI.py similarity index 100% rename from OlivOS/qqRedLinkServerAPI.py rename to OlivOS/adapter/red/qqRedLinkServerAPI.py diff --git a/OlivOS/qqRedSDK.py b/OlivOS/adapter/red/qqRedSDK.py similarity index 100% rename from OlivOS/qqRedSDK.py rename to OlivOS/adapter/red/qqRedSDK.py diff --git a/OlivOS/telegramPollServerAPI.py b/OlivOS/adapter/telegram/telegramPollServerAPI.py similarity index 100% rename from OlivOS/telegramPollServerAPI.py rename to OlivOS/adapter/telegram/telegramPollServerAPI.py diff --git a/OlivOS/telegramSDK.py b/OlivOS/adapter/telegram/telegramSDK.py similarity index 100% rename from OlivOS/telegramSDK.py rename to OlivOS/adapter/telegram/telegramSDK.py diff --git a/OlivOS/virtualTerminalLinkServerAPI.py b/OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py similarity index 100% rename from OlivOS/virtualTerminalLinkServerAPI.py rename to OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py diff --git a/OlivOS/virtualTerminalSDK.py b/OlivOS/adapter/virtualTerminal/virtualTerminalSDK.py similarity index 100% rename from OlivOS/virtualTerminalSDK.py rename to OlivOS/adapter/virtualTerminal/virtualTerminalSDK.py diff --git a/OlivOS/L10NAPI.py b/OlivOS/core/L10N/L10NAPI.py similarity index 100% rename from OlivOS/L10NAPI.py rename to OlivOS/core/L10N/L10NAPI.py diff --git a/OlivOS/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py similarity index 100% rename from OlivOS/L10NDataAPI.py rename to OlivOS/core/L10N/L10NDataAPI.py diff --git a/OlivOS/bootAPI.py b/OlivOS/core/boot/bootAPI.py similarity index 100% rename from OlivOS/bootAPI.py rename to OlivOS/core/boot/bootAPI.py diff --git a/OlivOS/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py similarity index 100% rename from OlivOS/bootDataAPI.py rename to OlivOS/core/boot/bootDataAPI.py diff --git a/OlivOS/API.py b/OlivOS/core/core/API.py similarity index 100% rename from OlivOS/API.py rename to OlivOS/core/core/API.py diff --git a/OlivOS/accountAPI.py b/OlivOS/core/core/accountAPI.py similarity index 100% rename from OlivOS/accountAPI.py rename to OlivOS/core/core/accountAPI.py diff --git a/OlivOS/contentAPI.py b/OlivOS/core/core/contentAPI.py similarity index 100% rename from OlivOS/contentAPI.py rename to OlivOS/core/core/contentAPI.py diff --git a/OlivOS/diagnoseAPI.py b/OlivOS/core/core/diagnoseAPI.py similarity index 100% rename from OlivOS/diagnoseAPI.py rename to OlivOS/core/core/diagnoseAPI.py diff --git a/OlivOS/messageAPI.py b/OlivOS/core/core/messageAPI.py similarity index 100% rename from OlivOS/messageAPI.py rename to OlivOS/core/core/messageAPI.py diff --git a/OlivOS/metadataAPI.py b/OlivOS/core/core/metadataAPI.py similarity index 100% rename from OlivOS/metadataAPI.py rename to OlivOS/core/core/metadataAPI.py diff --git a/OlivOS/pluginAPI.py b/OlivOS/core/core/pluginAPI.py similarity index 100% rename from OlivOS/pluginAPI.py rename to OlivOS/core/core/pluginAPI.py diff --git a/OlivOS/infoAPI.py b/OlivOS/core/info/infoAPI.py similarity index 96% rename from OlivOS/infoAPI.py rename to OlivOS/core/info/infoAPI.py index e7f4dace..3d629f86 100644 --- a/OlivOS/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.25' -OlivOS_SVN = 145 +OlivOS_Version = '0.11.26' +OlivOS_SVN = 146 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/data.py b/OlivOS/core/inlineData/data.py similarity index 100% rename from OlivOS/data.py rename to OlivOS/core/inlineData/data.py diff --git a/OlivOS/updateAPI.py b/OlivOS/core/web/updateAPI.py similarity index 100% rename from OlivOS/updateAPI.py rename to OlivOS/core/web/updateAPI.py diff --git a/OlivOS/webTool.py b/OlivOS/core/web/webTool.py similarity index 100% rename from OlivOS/webTool.py rename to OlivOS/core/web/webTool.py diff --git a/OlivOS/libCWCBEXEModelAPI.py b/OlivOS/libBooter/libCWCBEXEModelAPI.py similarity index 100% rename from OlivOS/libCWCBEXEModelAPI.py rename to OlivOS/libBooter/libCWCBEXEModelAPI.py diff --git a/OlivOS/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py similarity index 100% rename from OlivOS/libEXEModelAPI.py rename to OlivOS/libBooter/libEXEModelAPI.py diff --git a/OlivOS/libWQEXEModelAPI.py b/OlivOS/libBooter/libWQEXEModelAPI.py similarity index 100% rename from OlivOS/libWQEXEModelAPI.py rename to OlivOS/libBooter/libWQEXEModelAPI.py diff --git a/OlivOS/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py similarity index 100% rename from OlivOS/multiLoginUIAPI.py rename to OlivOS/nativeGUI/multiLoginUIAPI.py diff --git a/OlivOS/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py similarity index 100% rename from OlivOS/nativeWinUIAPI.py rename to OlivOS/nativeGUI/nativeWinUIAPI.py diff --git a/OlivOS/webviewUIAPI.py b/OlivOS/nativeGUI/webviewUIAPI.py similarity index 100% rename from OlivOS/webviewUIAPI.py rename to OlivOS/nativeGUI/webviewUIAPI.py From a21fdce9f4265b3d7b4c24024dcb0e76212a24a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 8 Dec 2023 14:59:34 +0800 Subject: [PATCH 02/76] Create Codecov --- .github/workflows/Codecov | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/Codecov diff --git a/.github/workflows/Codecov b/.github/workflows/Codecov new file mode 100644 index 00000000..e3f102ab --- /dev/null +++ b/.github/workflows/Codecov @@ -0,0 +1,12 @@ +name: Codecov +on: + push: + branches: [ main, dev ] +jobs: + Codecov: + runs-on: ubuntu-latest + steps: + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From a48f55d65269e23a4347eb8b5b04647c6ff566ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 8 Dec 2023 14:59:52 +0800 Subject: [PATCH 03/76] Rename Codecov to Codecov.yml --- .github/workflows/{Codecov => Codecov.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{Codecov => Codecov.yml} (100%) diff --git a/.github/workflows/Codecov b/.github/workflows/Codecov.yml similarity index 100% rename from .github/workflows/Codecov rename to .github/workflows/Codecov.yml From 2c2237cefa33aba6aab832fa9eb87bf79c0ee6f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 8 Dec 2023 15:05:18 +0800 Subject: [PATCH 04/76] Delete Codecov.yml --- .github/workflows/Codecov.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/workflows/Codecov.yml diff --git a/.github/workflows/Codecov.yml b/.github/workflows/Codecov.yml deleted file mode 100644 index e3f102ab..00000000 --- a/.github/workflows/Codecov.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Codecov -on: - push: - branches: [ main, dev ] -jobs: - Codecov: - runs-on: ubuntu-latest - steps: - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From eb7a53d759ac39443e8eacaa6eb42dfc5f4ff06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 13 Dec 2023 17:05:06 +0800 Subject: [PATCH 05/76] =?UTF-8?q?=E6=96=B0=E5=A2=9EOPQBot=E5=88=9D?= =?UTF-8?q?=E6=AD=A5=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/__init__.py | 2 + OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py | 137 ++++++++ OlivOS/adapter/OPQBot/OPQBotSDK.py | 316 +++++++++++++++++++ OlivOS/core/L10N/L10NDataAPI.py | 12 + OlivOS/core/boot/bootAPI.py | 28 +- OlivOS/core/boot/bootDataAPI.py | 15 + OlivOS/core/core/API.py | 7 + OlivOS/core/core/messageAPI.py | 3 +- OlivOS/nativeGUI/multiLoginUIAPI.py | 18 +- README.md | 1 + 10 files changed, 535 insertions(+), 4 deletions(-) create mode 100644 OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py create mode 100644 OlivOS/adapter/OPQBot/OPQBotSDK.py diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index 05141349..9be29d8a 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -45,6 +45,8 @@ from .adapter.qqGuild import qqGuildv2LinkServerAPI from .adapter.red import qqRedSDK from .adapter.red import qqRedLinkServerAPI +from .adapter.OPQBot import OPQBotSDK +from .adapter.OPQBot import OPQBotLinkServerAPI from .adapter.telegram import telegramSDK from .adapter.telegram import telegramPollServerAPI from .adapter.discord import discordSDK diff --git a/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py b/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py new file mode 100644 index 00000000..a40c0b40 --- /dev/null +++ b/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py @@ -0,0 +1,137 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/OPQBotLinkServerAPI.py +@Author : lunzhiPenxil仑质 +@Contact : lunzhipenxil@gmail.com +@License : AGPL +@Copyright : (C) 2020-2023, OlivOS-Team +@Desc : None +''' + +import time +import json +import websocket +import uuid +import threading + +import OlivOS + +gCheckList = [ + 'opqbot_default' +] + +modelName = 'OPQBotLinkServerAPI' + +class server(OlivOS.API.Proc_templet): + def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=None, tx_queue=None, logger_proc=None, + debug_mode=False, bot_info_dict=None): + OlivOS.API.Proc_templet.__init__( + self, + Proc_name=Proc_name, + Proc_type='OPQBot_link', + scan_interval=scan_interval, + dead_interval=dead_interval, + rx_queue=rx_queue, + tx_queue=tx_queue, + logger_proc=logger_proc + ) + self.Proc_config['debug_mode'] = debug_mode + self.Proc_data['bot_info_dict'] = bot_info_dict + self.Proc_data['extend_data'] = { + 'websocket_url': None, + 'ws_obj': None, + 'ws_item': None + } + self.Proc_data['platform_bot_info_dict'] = None + + def run(self): + wsPath = f"ws://{self.Proc_data['bot_info_dict'].post_info.host}:{self.Proc_data['bot_info_dict'].post_info.port}/ws" + self.log(2, OlivOS.L10NAPI.getTrans('OlivOS OPQBot link server [{0}] is running on [{1}]', [self.Proc_name, wsPath], modelName)) + threading.Thread( + target=self.message_router, + args=() + ).start() + while True: + try: + self.Proc_data['extend_data']['websocket_url'] = wsPath + except: + self.Proc_data['extend_data']['websocket_url'] = None + if self.Proc_data['extend_data']['websocket_url'] is not None: + self.run_websocket_rx_connect_start() + time.sleep(self.Proc_info.scan_interval) + + def on_message(self, ws, message): + try: + #print(message) + rx_data = json.loads(message) + rx_obj = OlivOS.OPQBotSDK.PAYLOAD.rxPacket(data=rx_data) + if rx_obj.active: + sdk_event = OlivOS.OPQBotSDK.event(rx_obj, self.Proc_data['bot_info_dict']) + tx_packet_data = OlivOS.pluginAPI.shallow.rx_packet(sdk_event) + self.Proc_info.tx_queue.put(tx_packet_data, block=False) + except: + pass + + def on_error(self, ws, error): + self.log(0, OlivOS.L10NAPI.getTrans( + 'OlivOS OPQBot link server [{0}] websocket link error', + [self.Proc_name], + modelName + )) + + def on_close(self, ws, close_status_code, close_msg): + self.log(0, OlivOS.L10NAPI.getTrans( + 'OlivOS OPQBot link server [{0}] websocket link close', + [self.Proc_name], + modelName + )) + + def on_open(self, ws: websocket.WebSocketApp): + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS OPQBot link server [{0}] websocket link start', + [self.Proc_name], + modelName + )) + + def run_websocket_rx_connect_start(self): + websocket.enableTrace(False) + ws = websocket.WebSocketApp( + self.Proc_data['extend_data']['websocket_url'], + on_open=self.on_open, + on_message=self.on_message, + on_error=self.on_error, + on_close=self.on_close + ) + self.Proc_data['extend_data']['ws_obj'] = ws + self.Proc_data['extend_data']['ws_item'] = uuid.uuid4() + proxy_set = OlivOS.webTool.get_system_proxy_tuple('http') + ws.run_forever(http_proxy_host=proxy_set[0], http_proxy_port=proxy_set[1], proxy_type=proxy_set[2]) + self.Proc_data['extend_data']['ws_obj'] = None + self.Proc_data['extend_data']['ws_item'] = None + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS OPQBot link server [{0}] websocket link lost', + [self.Proc_name], + modelName + )) + + def message_router(self): + while True: + if self.Proc_data['extend_data']['ws_obj'] is None or self.Proc_info.rx_queue.empty(): + time.sleep(self.Proc_info.scan_interval) + else: + try: + rx_packet_data = self.Proc_info.rx_queue.get(block=False) + except: + rx_packet_data = None + if rx_packet_data is not None: + if 'data' in rx_packet_data.key and 'action' in rx_packet_data.key['data']: + if 'send' == rx_packet_data.key['data']['action']: + if 'data' in rx_packet_data.key['data']: + #print(rx_packet_data.key['data']['data']) + self.Proc_data['extend_data']['ws_obj'].send(rx_packet_data.key['data']['data']) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py new file mode 100644 index 00000000..1b8b8c01 --- /dev/null +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -0,0 +1,316 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/OPQBotSDK.py +@Author : lunzhiPenxil仑质 +@Contact : lunzhipenxil@gmail.com +@License : AGPL +@Copyright : (C) 2020-2023, OlivOS-Team +@Desc : None +''' + +import time +import json +import uuid +import hashlib + +import OlivOS + +gBotIdDict = {} + +class bot_info_T(object): + def __init__(self, id=-1): + self.id = id + self.debug_mode = False + self.debug_logger = None + + +def get_SDK_bot_info_from_Plugin_bot_info(plugin_bot_info): + res = bot_info_T(id=plugin_bot_info.id) + return res + + +def get_SDK_bot_info_from_Event(target_event): + res = get_SDK_bot_info_from_Plugin_bot_info(target_event.bot_info) + return res + + +class event(object): + def __init__(self, payload_data=None, bot_info=None): + self.payload = payload_data + self.platform = {'sdk': 'onebot', 'platform': 'qq', 'model': 'opqbot_default'} + if type(bot_info.platform) is dict: + self.platform.update(bot_info.platform) + self.active = False + if self.payload is not None: + self.active = True + self.base_info = {} + if self.active: + self.base_info['time'] = int(time.time()) + self.base_info['self_id'] = self.payload.CurrentQQ + self.base_info['post_type'] = None + +def get_message(Content:str, AtUinLists:list): + res_msg = Content + if type(AtUinLists) is list: + for AtUin in AtUinLists: + res_msg = res_msg.replace(f'@{AtUin["Nick"]}', f'[OP:at,id={AtUin["Uin"]}]') + return res_msg + +def get_Event_from_SDK(target_event): + global sdkSubSelfInfo + target_event.base_info['time'] = target_event.sdk_event.base_info['time'] + target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) + target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] + target_event.platform['sdk'] = target_event.sdk_event.platform['sdk'] + target_event.platform['platform'] = target_event.sdk_event.platform['platform'] + target_event.platform['model'] = target_event.sdk_event.platform['model'] + target_event.plugin_info['message_mode_rx'] = 'olivos_string' + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + if target_event.sdk_event.payload.active: + if target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_NEW_MSG': + if type(target_event.sdk_event.payload.EventData) is dict \ + and 'MsgHead' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ + and 'FromUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) is int \ + and 'ToUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['ToUin']) is int \ + and 'SenderUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['SenderUin']) is int \ + and 'SenderNick' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['SenderNick']) is str \ + and 'MsgBody' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgBody']) is dict \ + and 'Content' in target_event.sdk_event.payload.EventData['MsgBody'] \ + and type(target_event.sdk_event.payload.EventData['MsgBody']['Content']) is str: + target_event.active = True + message_obj = OlivOS.messageAPI.Message_templet( + 'olivos_string', + get_message( + Content = target_event.sdk_event.payload.EventData['MsgBody']['Content'], + AtUinLists = target_event.sdk_event.payload.EventData['MsgBody'].get('AtUinLists', []) + ) + ) + if str(target_event.sdk_event.payload.EventData['MsgHead']['SenderUin']) == str(target_event.base_info['self_id']): + target_event.plugin_info['func_type'] = 'group_message_sent' + target_event.data = target_event.group_message_sent( + str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']), + str(target_event.sdk_event.payload.EventData['MsgHead']['SenderUin']), + message_obj, + 'group' + ) + else: + target_event.plugin_info['func_type'] = 'group_message' + target_event.data = target_event.group_message( + str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']), + str(target_event.sdk_event.payload.EventData['MsgHead']['SenderUin']), + message_obj, + 'group' + ) + target_event.data.message_sdk = message_obj + target_event.data.message_id = str(-1) + target_event.data.raw_message = message_obj + target_event.data.raw_message_sdk = message_obj + target_event.data.font = None + target_event.data.sender['user_id'] = str(target_event.sdk_event.payload.EventData['MsgHead']['SenderUin']) + target_event.data.sender['nickname'] = target_event.sdk_event.payload.EventData['MsgHead']['SenderNick'] + target_event.data.sender['id'] = target_event.data.sender['user_id'] + target_event.data.sender['name'] = target_event.data.sender['nickname'] + target_event.data.sender['sex'] = 'unknown' + target_event.data.sender['age'] = 0 + target_event.data.sender['role'] = 'member' + target_event.data.host_id = None + elif target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': + if type(target_event.sdk_event.payload.EventData) is dict \ + and 'MsgHead' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ + and 'FromUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) is int \ + and 'ToUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['ToUin']) is int \ + and 'MsgBody' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgBody']) is dict \ + and 'Content' in target_event.sdk_event.payload.EventData['MsgBody'] \ + and type(target_event.sdk_event.payload.EventData['MsgBody']['Content']) is str: + target_event.active = True + message_obj = OlivOS.messageAPI.Message_templet( + 'olivos_string', + get_message( + Content = target_event.sdk_event.payload.EventData['MsgBody']['Content'], + AtUinLists = target_event.sdk_event.payload.EventData['MsgBody'].get('AtUinLists', []) + ) + ) + target_event.plugin_info['func_type'] = 'private_message' + target_event.data = target_event.private_message( + str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']), + message_obj, + 'private' + ) + target_event.data.message_sdk = message_obj + target_event.data.message_id = str(-1) + target_event.data.raw_message = message_obj + target_event.data.raw_message_sdk = message_obj + target_event.data.font = None + target_event.data.sender['user_id'] = str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) + target_event.data.sender['nickname'] = '用户' + target_event.data.sender['id'] = target_event.data.sender['user_id'] + target_event.data.sender['name'] = target_event.data.sender['nickname'] + target_event.data.sender['sex'] = 'unknown' + target_event.data.sender['age'] = 0 + target_event.data.sender['role'] = 'member' + target_event.data.host_id = None + + +''' +对于WEBSOCKET接口的PAYLOAD实现 +''' + + +class payload_template(object): + def __init__(self, data=None, is_rx=False): + self.active = True + self.data = None + self.EventName = None + self.EventData = None + self.CurrentQQ = None + self.ReqId = int(getHash(str(uuid.uuid4())), 16) % 1000000000000 + self.CgiCmd = None + self.load(data, is_rx) + + def dump(self): + res = json.dumps(obj=self.data) + return res + + def dump_CurrentPacket(self): + res = json.dumps( + obj = { + 'CurrentPacket': { + 'EventData': self.EventData, + 'EventName': self.EventName + }, + 'CurrentQQ': int(self.CurrentQQ) + } + ) + return res + + def load(self, data, is_rx: bool): + self.active = False + if is_rx \ + and type(data) is dict \ + and 'CurrentQQ' in data \ + and type(data['CurrentQQ']) in [int, str] \ + and 'CurrentPacket' in data \ + and type(data['CurrentPacket']) is dict \ + and 'EventName' in data['CurrentPacket'] \ + and type(data['CurrentPacket']['EventName']) is str \ + and 'EventData' in data['CurrentPacket'] \ + and type(data['CurrentPacket']['EventData']) is dict: + self.active = True + self.data = data + self.EventName = data['CurrentPacket']['EventName'] + self.EventData = data['CurrentPacket']['EventData'] + self.CurrentQQ = data['CurrentQQ'] + return self + + +def getHash(key): + hash_tmp = hashlib.new('md5') + hash_tmp.update(str(key).encode(encoding='UTF-8')) + return hash_tmp.hexdigest() + +def getIdBackport(id): + res = id + try: + res = int(id) + except: + res = id + return res + +class PAYLOAD(object): + class rxPacket(payload_template): + def __init__(self, data): + payload_template.__init__(self, data, True) + + class MessageSvc_PbSendMsg(payload_template): + def __init__(self, ToUin:'int|str', ToType:int, Content:str, CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "MessageSvc.PbSendMsg" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + "ToUin": getIdBackport(ToUin), + "ToType": ToType, + "Content": Content + } + } + + +# 支持OlivOS API调用的方法实现 +class event_action(object): + def send_msg(target_event, target_type, target_id, message, control_queue): + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + message_new = '' + message_obj = OlivOS.messageAPI.Message_templet( + 'olivos_string', + message + ) + if message_obj.active: + for data_this in message_obj.data: + if data_this.type == 'text': + message_new += data_this.data['text'] + if len(message_new) > 0: + send_ws_event( + plugin_event_bot_hash, + PAYLOAD.MessageSvc_PbSendMsg( + ToUin = target_id, + ToType = 2 if 'group' == target_type else 1, + Content = message_new, + CurrentQQ = target_event.base_info['self_id'] + ).dump(), + control_queue + ) + + +def sendControlEventSend(action, data, control_queue): + if control_queue is not None: + control_queue.put( + OlivOS.API.Control.packet( + action, + data + ), + block=False + ) + + +def send_ws_event(hash, data, control_queue): + sendControlEventSend('send', { + 'target': { + 'type': 'OPQBot_link', + 'hash': hash + }, + 'data': { + 'action': 'send', + 'data': data + } + }, + control_queue + ) diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index 47f8c10c..f422cdb9 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -56,6 +56,12 @@ 'hackChatLinkServerAPI_0004': 'OlivOS hackChat link server [{0}] websocket link close', 'hackChatLinkServerAPI_0005': 'OlivOS hackChat link server [{0}] websocket link start', 'hackChatLinkServerAPI_0006': 'OlivOS hackChat link server [{0}] websocket link lost', + 'OPQBotLinkServerAPI_0001': 'OlivOS OPQBot link server [{0}] is running on [{1}]', + 'OPQBotLinkServerAPI_0002': 'OlivOS OPQBot link server [{0}] websocket link will retry in {1}s', + 'OPQBotLinkServerAPI_0003': 'OlivOS OPQBot link server [{0}] websocket link error', + 'OPQBotLinkServerAPI_0004': 'OlivOS OPQBot link server [{0}] websocket link close', + 'OPQBotLinkServerAPI_0005': 'OlivOS OPQBot link server [{0}] websocket link start', + 'OPQBotLinkServerAPI_0006': 'OlivOS OPQBot link server [{0}] websocket link lost', 'updateAPI_0001': 'will check {0} lib after {1}s ...', 'updateAPI_0002': 'check {0} lib patch target md5: [{1}]', 'updateAPI_0003': 'check {0} lib patch [{1}] md5: [{2}]', @@ -136,6 +142,12 @@ 'hackChatLinkServerAPI_0004': 'OlivOS hackChat 连接服务组件 [{0}] WebSocket 连接 已经关闭', 'hackChatLinkServerAPI_0005': 'OlivOS hackChat 连接服务组件 [{0}] WebSocket 连接 已经启动', 'hackChatLinkServerAPI_0006': 'OlivOS hackChat 连接服务组件 [{0}] WebSocket 连接 已经丢失', + 'OPQBotLinkServerAPI_0001': 'OlivOS OPQBot 连接服务组件 [{0}] 正在运作, 采用WS服务器 [{1}]', + 'OPQBotLinkServerAPI_0002': 'OlivOS OPQBot 连接服务组件 [{0}] WebSocket 连接 将在{1}秒内重试', + 'OPQBotLinkServerAPI_0003': 'OlivOS OPQBot 连接服务组件 [{0}] WebSocket 连接 发生错误', + 'OPQBotLinkServerAPI_0004': 'OlivOS OPQBot 连接服务组件 [{0}] WebSocket 连接 已经关闭', + 'OPQBotLinkServerAPI_0005': 'OlivOS OPQBot 连接服务组件 [{0}] WebSocket 连接 已经启动', + 'OPQBotLinkServerAPI_0006': 'OlivOS OPQBot 连接服务组件 [{0}] WebSocket 连接 已经丢失', 'updateAPI_0001': '将在 {1}秒后 检查 {0} 依赖库 ...', 'updateAPI_0002': '检查 {0} 依赖库补丁 目标 MD5文件摘要: [{1}]', 'updateAPI_0003': '检查 {0} 依赖库补丁 [{1}] MD5文件摘要: [{2}]', diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index 44863cbf..f665f22a 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -519,8 +519,32 @@ def start(self): bot_info_dict=plugin_bot_info_dict[bot_info_key], debug_mode=False ) - Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity( - tmp_proc_mode) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) + elif basic_conf_models_this['type'] == 'OPQBot_link': + flag_need_enable = False + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['sdk'] == 'onebot': + if plugin_bot_info_dict[bot_info_key].platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + flag_need_enable = True + if not flag_need_enable: + continue + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['sdk'] == 'onebot': + if plugin_bot_info_dict[bot_info_key].platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + tmp_Proc_name = basic_conf_models_this['name'] + '=' + bot_info_key + tmp_queue_name = basic_conf_models_this['rx_queue'] + '=' + bot_info_key + multiprocessing_dict[tmp_queue_name] = multiprocessing.Queue() + Proc_dict[tmp_Proc_name] = OlivOS.OPQBotLinkServerAPI.server( + Proc_name=tmp_Proc_name, + scan_interval=basic_conf_models_this['interval'], + dead_interval=basic_conf_models_this['dead_interval'], + rx_queue=multiprocessing_dict[tmp_queue_name], + tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + bot_info_dict=plugin_bot_info_dict[bot_info_key], + debug_mode=False + ) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) elif basic_conf_models_this['type'] == 'telegram_poll': flag_need_enable = False for bot_info_key in plugin_bot_info_dict: diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index 8fbece2b..f5d7f9f6 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -33,6 +33,7 @@ "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", "OlivOS_hackChat_link", + "OlivOS_OPQBot_link", "OlivOS_qqRed_link", "OlivOS_dingtalk_link", "OlivOS_plugin", @@ -76,6 +77,7 @@ "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", "OlivOS_hackChat_link", + "OlivOS_OPQBot_link", "OlivOS_qqRed_link", "OlivOS_dingtalk_link", "OlivOS_virtual_terminal_link", @@ -98,6 +100,7 @@ "walleq_lib_exe_model", "cwcb_lib_exe_model", "hackChat_link", + "OPQBot_link", "qqRed_link", "dingtalk_link", "terminal_link", @@ -129,6 +132,7 @@ "OlivOS_cwcb_lib_rx_queue", "OlivOS_virtual_terminal_queue", "OlivOS_hackChat_queue", + "OlivOS_OPQBot_queue", "OlivOS_biliLive_queue", "OlivOS_onebotv12_queue", "OlivOS_qqRed_queue", @@ -329,6 +333,17 @@ "logger_proc": "OlivOS_logger", "debug": False }, + "OlivOS_OPQBot_link": { + "enable": True, + "name": "OlivOS_OPQBot_link", + "type": "OPQBot_link", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_OPQBot_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": False + }, "OlivOS_qqRed_link": { "enable": True, "name": "OlivOS_qqRed_link", diff --git a/OlivOS/core/core/API.py b/OlivOS/core/core/API.py index 920c41af..a1db5680 100644 --- a/OlivOS/core/core/API.py +++ b/OlivOS/core/core/API.py @@ -203,6 +203,8 @@ def get_Event_from_SDK(self): OlivOS.qqRedSDK.get_Event_from_SDK(self) elif self.sdk_event_type is OlivOS.hackChatSDK.event: OlivOS.hackChatSDK.get_Event_from_SDK(self) + elif self.sdk_event_type is OlivOS.OPQBotSDK.event: + OlivOS.OPQBotSDK.get_Event_from_SDK(self) elif self.sdk_event_type is OlivOS.dingtalkSDK.event: OlivOS.dingtalkSDK.get_Event_from_SDK(self) elif self.sdk_event_type is OlivOS.biliLiveSDK.event: @@ -822,6 +824,11 @@ def __send(self, send_type, target_id, message, host_id=None, flag_log=True): OlivOS.qqRedSDK.event_action.send_msg(self, 1, target_id, tmp_message, self.plugin_info['control_queue']) elif flag_type == 'group': OlivOS.qqRedSDK.event_action.send_msg(self, 2, target_id, tmp_message, self.plugin_info['control_queue']) + elif self.platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + if flag_type == 'private': + OlivOS.OPQBotSDK.event_action.send_msg(self, 'private', target_id, tmp_message, self.plugin_info['control_queue']) + elif flag_type == 'group': + OlivOS.OPQBotSDK.event_action.send_msg(self, 'group', target_id, tmp_message, self.plugin_info['control_queue']) elif self.platform['sdk'] == 'qqGuild_link': if flag_type == 'group': if hasattr(self.data, 'extend') \ diff --git a/OlivOS/core/core/messageAPI.py b/OlivOS/core/core/messageAPI.py index 598bd5b4..fe53a1ae 100644 --- a/OlivOS/core/core/messageAPI.py +++ b/OlivOS/core/core/messageAPI.py @@ -50,7 +50,8 @@ 'walleq_show_Android_Watch': 'obv12_para', 'walleq_show_iPad': 'obv12_para', 'walleq_show_iMac': 'obv12_para', - 'walleq_show_old': 'obv12_para' + 'walleq_show_old': 'obv12_para', + 'opqbot_default': 'olivos_string' } }, 'qqGuild': { diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 2e5f0c96..7a1a1efb 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -379,6 +379,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'onebotV12/正向WS', 'onebotV11/Http', 'RED协议', + 'OPQBot/正向WS', 'B站直播间/游客', 'B站直播间/登录', 'FF14终端', @@ -477,6 +478,12 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'TOKEN': 'edit_root_Entry_Server_access_token', } ], + 'OPQBot/正向WS': ['qq', 'onebot', 'opqbot_default', 'False', 'websocket', { + 'QQ号': 'edit_root_Entry_ID', + '服务地址': 'edit_root_Entry_Server_host', + '服务端口': 'edit_root_Entry_Server_port', + } + ], 'QQ/GoCq/默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { '账号': 'edit_root_Entry_ID', '密码': 'edit_root_Entry_Password', @@ -771,7 +778,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'walleq_show_Android_Watch', 'walleq_show_iPad', 'walleq_show_iMac', - 'walleq_show_old' + 'walleq_show_old', + 'opqbot_default' ] }, 'qqGuild': { @@ -902,6 +910,14 @@ def tree_edit_commit(self): tmp_port = '58001' if tmp_access_token == '': tmp_access_token = 'NONEED' + if tmp_platform_platform == 'qq' \ + and tmp_platform_sdk == 'onebot' \ + and tmp_platform_model in OlivOS.OPQBotLinkServerAPI.gCheckList \ + and tmp_server_auto == 'False': + if tmp_host == '': + tmp_host = '127.0.0.1' + if tmp_access_token == '': + tmp_access_token = 'NONEED' if tmp_platform_platform == 'qqGuild' \ and tmp_platform_sdk == 'qqGuild_link': if tmp_password == '': diff --git a/README.md b/README.md index 2a3c22b9..c8a092f9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ [![OnebotV11](https://img.shields.io/badge/-OnebotV11-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![OnebotV12](https://img.shields.io/badge/-OnebotV12-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![RED](https://img.shields.io/badge/-RED-111111?style=flat-square&logoColor=white)](https://chrononeko.github.io/QQNTRedProtocol/) +[![OPQBot](https://img.shields.io/badge/-OPQBot-111111?style=flat-square&logoColor=white)](https://opqbot.com/) [![QQ全域](https://img.shields.io/badge/-QQ%E5%85%A8%E5%9F%9F-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![QQ频道](https://img.shields.io/badge/-QQ%E9%A2%91%E9%81%93-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![DingTalk](https://img.shields.io/badge/-%E9%92%89%E9%92%89-007FFF?style=flat-square&logo=alibabadotcom&logoColor=white)](https://open.dingtalk.com/) From 3903c7514e8d1d65bd7996e7fc5fb69d4cb533b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 14 Dec 2023 16:42:15 +0800 Subject: [PATCH 06/76] =?UTF-8?q?=E5=B5=8C=E5=85=A5OPQBot=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/__init__.py | 1 + OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py | 5 +- OlivOS/core/L10N/L10NDataAPI.py | 8 + OlivOS/core/boot/bootAPI.py | 14 + OlivOS/core/boot/bootDataAPI.py | 17 + OlivOS/libBooter/libOPQBotEXEModelAPI.py | 367 ++++++++++++++++++ OlivOS/nativeGUI/multiLoginUIAPI.py | 41 +- OlivOS/nativeGUI/nativeWinUIAPI.py | 375 +++++++++++++++++-- 8 files changed, 796 insertions(+), 32 deletions(-) create mode 100644 OlivOS/libBooter/libOPQBotEXEModelAPI.py diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index 9be29d8a..d0733efc 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -77,6 +77,7 @@ from .libBooter import libEXEModelAPI from .libBooter import libWQEXEModelAPI from .libBooter import libCWCBEXEModelAPI + from .libBooter import libOPQBotEXEModelAPI from .nativeGUI import nativeWinUIAPI from .nativeGUI import webviewUIAPI from . import userModule diff --git a/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py b/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py index a40c0b40..57ff194f 100644 --- a/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py +++ b/OlivOS/adapter/OPQBot/OPQBotLinkServerAPI.py @@ -23,7 +23,10 @@ import OlivOS gCheckList = [ - 'opqbot_default' + 'opqbot_default', + 'opqbot_auto', + 'opqbot_port', + 'opqbot_port_old', ] modelName = 'OPQBotLinkServerAPI' diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index f422cdb9..67d8d74d 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -86,6 +86,10 @@ 'libWQEXEModelAPI_0002': 'OlivOS libWQEXEModel server [{0}] will run under visiable mode', 'libWQEXEModelAPI_0003': 'OlivOS libWQEXEModel server [{0}] will retry in 10s...', 'libWQEXEModelAPI_0004': 'OlivOS libWQEXEModel failed: {0}\n{1}', + 'libOPQBotEXEModelAPI_0001': 'OlivOS libOPQBotEXEModel server [{0}] can`t found target lib', + 'libOPQBotEXEModelAPI_0002': 'OlivOS libOPQBotEXEModel server [{0}] will run under visiable mode', + 'libOPQBotEXEModelAPI_0003': 'OlivOS libOPQBotEXEModel server [{0}] will retry in 10s...', + 'libOPQBotEXEModelAPI_0004': 'OlivOS libOPQBotEXEModel failed: {0}\n{1}', 'libEXEModelAPI_0001': 'OlivOS libEXEModel server [{0}] can`t found target lib', 'libEXEModelAPI_0002': 'OlivOS libEXEModel server [{0}] will run under visiable mode', 'libEXEModelAPI_0003': 'OlivOS libEXEModel server [{0}] will retry in 10s...', @@ -172,6 +176,10 @@ 'libWQEXEModelAPI_0002': 'OlivOS WQ进程托管服务组件 [{0}] 将在前台模式下运行', 'libWQEXEModelAPI_0003': 'OlivOS WQ进程托管服务组件 [{0}] 将在10秒后重试...', 'libWQEXEModelAPI_0004': 'OlivOS WQ进程托管服务组件 错误: {0}\n{1}', + 'libOPQBotEXEModelAPI_0001': 'OlivOS OPQBot进程托管服务组件 [{0}] 无法找到库文件', + 'libOPQBotEXEModelAPI_0002': 'OlivOS OPQBot进程托管服务组件 [{0}] 将在前台模式下运行', + 'libOPQBotEXEModelAPI_0003': 'OlivOS OPQBot进程托管服务组件 [{0}] 将在10秒后重试...', + 'libOPQBotEXEModelAPI_0004': 'OlivOS OPQBot进程托管服务组件 错误: {0}\n{1}', 'libEXEModelAPI_0001': 'OlivOS GoCq进程托管服务组件 [{0}] 无法找到库文件', 'libEXEModelAPI_0002': 'OlivOS GoCq进程托管服务组件 [{0}] 将在前台模式下运行', 'libEXEModelAPI_0003': 'OlivOS GoCq进程托管服务组件 [{0}] 将在10秒后重试...', diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index f665f22a..4b9e3aae 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -748,6 +748,20 @@ def start(self): 'tmp_proc_mode': tmp_proc_mode } ).start() + elif basic_conf_models_this['type'] == 'opqbot_lib_exe_model': + if platform.system() == 'Windows': + threading.Thread( + target = OlivOS.libOPQBotEXEModelAPI.startOPQBotLibExeModel, + kwargs = { + 'plugin_bot_info_dict': plugin_bot_info_dict, + 'basic_conf_models_this': basic_conf_models_this, + 'multiprocessing_dict': multiprocessing_dict, + 'Proc_dict': Proc_dict, + 'Proc_Proc_dict': Proc_Proc_dict, + 'basic_conf_models': basic_conf_models, + 'tmp_proc_mode': tmp_proc_mode + } + ).start() elif basic_conf_models_this['type'] == 'update_get': threading.Thread(target=update_get_func, args=(Proc_dict, basic_conf_models, basic_conf_models_this)).start() diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index f5d7f9f6..55b5163e 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -32,6 +32,7 @@ "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", + "OlivOS_opqbot_lib_exe_model", "OlivOS_hackChat_link", "OlivOS_OPQBot_link", "OlivOS_qqRed_link", @@ -76,6 +77,7 @@ "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", + "OlivOS_opqbot_lib_exe_model", "OlivOS_hackChat_link", "OlivOS_OPQBot_link", "OlivOS_qqRed_link", @@ -99,6 +101,7 @@ "gocqhttp_lib_exe_model", "walleq_lib_exe_model", "cwcb_lib_exe_model", + "opqbot_lib_exe_model", "hackChat_link", "OPQBot_link", "qqRed_link", @@ -130,6 +133,7 @@ "OlivOS_gocqhttp_lib_rx_queue", "OlivOS_walleq_lib_rx_queue", "OlivOS_cwcb_lib_rx_queue", + "OlivOS_opqbot_lib_rx_queue", "OlivOS_virtual_terminal_queue", "OlivOS_hackChat_queue", "OlivOS_OPQBot_queue", @@ -499,6 +503,19 @@ "control_queue": "OlivOS_control_queue", "debug": False }, + "OlivOS_opqbot_lib_exe_model": { + "enable": True, + "name": "OlivOS_opqbot_lib_exe_model", + "type": "opqbot_lib_exe_model", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_opqbot_lib_rx_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "target_proc": None, + "control_queue": "OlivOS_control_queue", + "debug": False + }, "OlivOS_webview_page": { "enable": True, "name": "OlivOS_webview_page", diff --git a/OlivOS/libBooter/libOPQBotEXEModelAPI.py b/OlivOS/libBooter/libOPQBotEXEModelAPI.py new file mode 100644 index 00000000..cc8be638 --- /dev/null +++ b/OlivOS/libBooter/libOPQBotEXEModelAPI.py @@ -0,0 +1,367 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/libOPQBotEXEModelAPI.py +@Author : lunzhiPenxil仑质 +@Contact : lunzhipenxil@gmail.com +@License : AGPL +@Copyright : (C) 2020-2023, OlivOS-Team +@Desc : None +''' + +import multiprocessing +import subprocess +import threading +import time +import os +import traceback +import json +import copy +import random +import uuid +import hashlib +import re +import platform +import shutil + +import OlivOS + +modelName = 'libOPQBotEXEModelAPI' + +resourceUrlPath = OlivOS.infoAPI.resourceUrlPath + +gCheckList = [ + 'opqbot_auto', + 'opqbot_port', + 'opqbot_port_old' +] + + +def startOPQBotLibExeModel( + plugin_bot_info_dict, + basic_conf_models_this, + multiprocessing_dict, + Proc_dict, + Proc_Proc_dict, + basic_conf_models, + tmp_proc_mode +): + if platform.system() == 'Windows': + flagActive = False + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['model'] in gCheckList: + flagActive = True + if flagActive: + releaseDir('./lib') + OlivOS.updateAPI.checkResouceFile( + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + resouce_api=resourceUrlPath, + resouce_name='OPQBot', + filePath='./lib/OPQBot.exe', + filePathUpdate='./lib/OPQBot.exe.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 + tmp_queue_name = basic_conf_models_this['rx_queue'] + '=' + bot_info_key + multiprocessing_dict[tmp_queue_name] = multiprocessing.Queue() + Proc_dict[tmp_Proc_name] = OlivOS.libOPQBotEXEModelAPI.server( + Proc_name=tmp_Proc_name, + scan_interval=basic_conf_models_this['interval'], + dead_interval=basic_conf_models_this['dead_interval'], + rx_queue=multiprocessing_dict[tmp_queue_name], + tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], + control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + bot_info_dict=plugin_bot_info_dict[bot_info_key], + target_proc=None, + debug_mode=False + ) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) + +class server(OlivOS.API.Proc_templet): + def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=None, tx_queue=None, + control_queue=None, logger_proc=None, target_proc=None, debug_mode=False, bot_info_dict=None): + OlivOS.API.Proc_templet.__init__( + self, + Proc_name=Proc_name, + Proc_type='opqbot_lib_exe_model', + scan_interval=scan_interval, + dead_interval=dead_interval, + rx_queue=rx_queue, + tx_queue=tx_queue, + control_queue=control_queue, + logger_proc=logger_proc + ) + self.Proc_config['debug_mode'] = debug_mode + self.Proc_data['bot_info_dict'] = bot_info_dict + self.Proc_config['target_proc'] = target_proc + self.Proc_data['check_qrcode_flag'] = False + self.Proc_data['check_stdin'] = False + self.Proc_data['model_Proc'] = None + self.Proc_data['qrcode_flag'] = True + self.Proc_data['stdout_start_ts'] = None + self.flag_run = True + + def run(self): + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'opqbot_auto', + 'opqbot_port', + 'opqbot_port_old' + ]: + self.send_init_event() + while self.flag_run: + releaseDir('./lib') + if not os.path.exists('./lib/OPQBot.exe'): + self.log(3, OlivOS.L10NAPI.getTrans( + 'OlivOS libOPQBotEXEModel server [{0}] can`t found target lib', + [self.Proc_name], modelName + )) + break + releaseDir('./conf') + releaseDir('./conf/OPQBot') + releaseDir('./conf/OPQBot/' + self.Proc_data['bot_info_dict'].hash) + copyFile( + src='./lib/OPQBot.exe', + dst='./conf/OPQBot/' + self.Proc_data['bot_info_dict'].hash + '/OPQBot.exe' + ) + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'opqbot_auto', + 'opqbot_port', + ]: + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS libOPQBotEXEModel server [{0}] will run under visiable mode', + [self.Proc_name], modelName + )) + self.clear_OPQBot() + self.Proc_data['check_qrcode_flag'] = False + self.Proc_data['check_stdin'] = False + time.sleep(2) + self.Proc_data['check_qrcode_flag'] = True + self.Proc_data['check_stdin'] = True + threading.Thread( + target=self.check_qrcode, + args=(), + daemon=self.deamon + ).start() + tmp_env = dict(os.environ) + model_Proc = subprocess.Popen( + f'.\\OPQBot.exe' + f' -port {self.Proc_data["bot_info_dict"].post_info.port}' + f' -token {self.Proc_data["bot_info_dict"].post_info.access_token}', + cwd='.\\conf\\OPQBot\\' + 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() + threading.Thread( + target=self.check_model_flag, + args=(), + daemon=self.deamon + ).start() + self.get_model_stdout(model_Proc) + # model_Proc.communicate(timeout = None) + self.log(3, OlivOS.L10NAPI.getTrans( + 'OlivOS libOPQBotEXEModel 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 [ + 'opqbot_port_old' + ]: + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS libOPQBotEXEModel server [{0}] will run under visiable mode', + [self.Proc_name], modelName + )) + tmp_env = dict(os.environ) + subprocess.call( + 'start cmd /K "title OPQBot For OlivOS|.\\OPQBot.exe -port %s -token %s"' % ( + str(self.Proc_data['bot_info_dict'].post_info.port), + str(self.Proc_data['bot_info_dict'].post_info.access_token) + ), + shell=True, + cwd='.\\conf\\OPQBot\\' + self.Proc_data['bot_info_dict'].hash, + env=tmp_env + ) + self.flag_run = False + pass + + def on_terminate(self): + self.flag_run = False + if 'model_Proc' in self.Proc_data \ + and self.Proc_data['model_Proc'] is not None: + OlivOS.bootAPI.killByPid(self.Proc_data['model_Proc'].pid) + + def getBotIDStr(self): + tmp_self_data = self.Proc_data['bot_info_dict'].platform['platform'] + if self.Proc_data['bot_info_dict'].id is not None: + tmp_self_data = '%s|%s' % ( + self.Proc_data['bot_info_dict'].platform['platform'], + str(self.Proc_data['bot_info_dict'].id) + ) + return tmp_self_data + + def check_stdin(self, model_Proc: subprocess.Popen): + while self.Proc_data['check_stdin']: + if self.Proc_info.rx_queue.empty(): + time.sleep(0.02) + else: + try: + rx_packet_data = self.Proc_info.rx_queue.get(block=False) + except: + rx_packet_data = None + if 'data' in rx_packet_data.key and 'action' in rx_packet_data.key['data']: + if 'input' == rx_packet_data.key['data']['action']: + if 'data' in rx_packet_data.key['data']: + input_raw = str(rx_packet_data.key['data']['data']) + input_data = ('%s\r\n' % input_raw).encode('utf-8') + model_Proc.stdin.write(input_data) + model_Proc.stdin.flush() + log_data = ('%s' % input_raw) + self.send_log_event(log_data) + self.log(2, log_data, [ + (self.getBotIDStr(), 'default'), + ('OPQBot', 'default'), + ('stdin_send', 'default') + ]) + + def get_model_stdout(self, model_Proc: subprocess.Popen): + for line in iter(model_Proc.stdout.readline, b''): + try: + log_data = ('%s' % line.decode('utf-8', errors='replace')).rstrip('\n') + self.send_log_event(log_data) + self.log(1, log_data, [ + (self.getBotIDStr(), 'default'), + ('OPQBot', 'default'), + ('onebot', 'default') + ]) + self.check_model_stdout(log_data) + except Exception as e: + self.log(4, OlivOS.L10NAPI.getTrans('OlivOS libOPQBotEXEModel failed: %s\n%s' % [ + str(e), + traceback.format_exc() + ], + modelName + )) + + def check_model_stdout(self, line_data:str): + if self.Proc_data['qrcode_flag']: + try: + matchRes = re.match( + r'^\d{4}\/\d{2}\/\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}\s\[C\]\s{2}User\s\d+\s登录成功,即将刷新相关数据$', + line_data + ) + if matchRes != None: + self.Proc_data['qrcode_flag'] = False + except: + pass + + def check_model_flag(self): + self.Proc_data['stdout_start_ts'] = time.time() + while time.time() - self.Proc_data['stdout_start_ts'] < 5: + if not self.Proc_data['qrcode_flag']: + break + time.sleep(0.2) + #print("self.Proc_data['qrcode_flag'] = " + str(self.Proc_data['qrcode_flag'])) + if self.Proc_data['qrcode_flag']: + self.send_QRCode_event( + f'http://' + f'{self.Proc_data["bot_info_dict"].post_info.host}:' + f'{self.Proc_data["bot_info_dict"].post_info.port}/v1/login/getqrcode' + ) + + def send_init_event(self): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'opqbot', + 'event': 'init', + 'hash': self.Proc_data['bot_info_dict'].hash + } + } + ) + + def clear_OPQBot(self): + file_path = './conf/OPQBot/' + self.Proc_data['bot_info_dict'].hash + '/qrcode.png' + if os.path.exists(file_path): + os.remove(file_path) + + def check_qrcode(self): + count = 2 * 60 + file_path = './conf/OPQBot/' + self.Proc_data['bot_info_dict'].hash + '/qrcode.png' + while count > 0 and self.Proc_data['check_qrcode_flag']: + if os.path.exists(file_path): + self.send_QRCode_event(file_path) + count = 0 + count -= 1 + time.sleep(1) + self.Proc_data['check_qrcode_flag'] = False + + def send_QRCode_event(self, path: str): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'opqbot', + 'event': 'qrcode', + 'hash': self.Proc_data['bot_info_dict'].hash, + 'path': path + } + } + ) + + def send_log_event(self, data): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'opqbot', + 'event': 'log', + 'hash': self.Proc_data['bot_info_dict'].hash, + 'data': data + } + } + ) + + def sendControlEventSend(self, action, data): + if self.Proc_info.control_queue is not None: + self.Proc_info.control_queue.put( + OlivOS.API.Control.packet( + action, + data + ), + block=False + ) + +def releaseDir(dir_path): + if not os.path.exists(dir_path): + os.makedirs(dir_path) + +def copyFile(src, dst): + try: + shutil.copyfile(src = src, dst = dst) + except: + pass diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 7a1a1efb..33bbe8dc 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -361,6 +361,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'type_list': [ 'KOOK', 'KOOK/消息兼容', + 'QQ/OPQ/默认', + 'QQ/OPQ/指定端口', '钉钉', '渡渡语音/Dodo/V2', '渡渡语音/Dodo/V1', @@ -395,6 +397,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/Wq/安卓手机', 'QQ/Wq/安卓平板', '微信/ComWeChat', + 'QQ/OPQ/指定端口/旧', 'QQ/GoCq/旧', 'QQ/Wq/旧', '自定义' @@ -421,7 +424,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/Wq/安卓手表': './conf/walleq/{bothash}', 'QQ/Wq/安卓手机': './conf/walleq/{bothash}', 'QQ/Wq/安卓平板': './conf/walleq/{bothash}', - 'QQ/Wq/旧': './conf/walleq/{bothash}' + 'QQ/Wq/旧': './conf/walleq/{bothash}', + 'QQ/OPQ/默认': './conf/OPQBot/{bothash}', + 'QQ/OPQ/指定端口': './conf/OPQBot/{bothash}', + 'QQ/OPQ/指定端口/旧': './conf/OPQBot/{bothash}' }, 'type_extend_note_list': { #'QQ/GoCq/默认': ['签名服务器', 'sign-server'], @@ -484,6 +490,23 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non '服务端口': 'edit_root_Entry_Server_port', } ], + 'QQ/OPQ/默认': ['qq', 'onebot', 'opqbot_auto', 'True', 'websocket', { + 'QQ号': 'edit_root_Entry_ID', + 'TOKEN': 'edit_root_Entry_Server_access_token', + } + ], + 'QQ/OPQ/指定端口': ['qq', 'onebot', 'opqbot_port', 'True', 'websocket', { + 'QQ号': 'edit_root_Entry_ID', + '服务端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', + } + ], + 'QQ/OPQ/指定端口/旧': ['qq', 'onebot', 'opqbot_port_old', 'True', 'websocket', { + 'QQ号': 'edit_root_Entry_ID', + '服务端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', + } + ], 'QQ/GoCq/默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { '账号': 'edit_root_Entry_ID', '密码': 'edit_root_Entry_Password', @@ -779,7 +802,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'walleq_show_iPad', 'walleq_show_iMac', 'walleq_show_old', - 'opqbot_default' + 'opqbot_default', + 'opqbot_auto', + 'opqbot_port', + 'opqbot_port_old' ] }, 'qqGuild': { @@ -918,6 +944,17 @@ def tree_edit_commit(self): tmp_host = '127.0.0.1' if tmp_access_token == '': tmp_access_token = 'NONEED' + if tmp_platform_platform == 'qq' \ + and tmp_platform_sdk == 'onebot' \ + and tmp_platform_model in OlivOS.OPQBotLinkServerAPI.gCheckList \ + and tmp_server_auto == 'True': + if tmp_host == '': + tmp_host = '127.0.0.1' + if tmp_platform_model in [ + 'opqbot_auto' + ]: + if tmp_port == '': + tmp_port = '8086' if tmp_platform_platform == 'qqGuild' \ and tmp_platform_sdk == 'qqGuild_link': if tmp_password == '': diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index 8b8fc527..41ebf964 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -85,6 +85,9 @@ def __init__( self.UIObject['root_cwcb_terminal'] = {} self.UIObject['root_cwcb_terminal_data'] = {} self.UIObject['root_cwcb_terminal_data_max'] = 500 + self.UIObject['root_opqbot_terminal'] = {} + self.UIObject['root_opqbot_terminal_data'] = {} + self.UIObject['root_opqbot_terminal_data_max'] = 500 self.UIObject['root_virtual_terminal_terminal'] = {} self.UIObject['root_virtual_terminal_terminal_data'] = {} self.UIObject['root_virtual_terminal_terminal_data_max'] = 150 @@ -99,6 +102,7 @@ def __init__( self.UIData['shallow_gocqhttp_menu_list'] = None self.UIData['shallow_walleq_menu_list'] = None self.UIData['shallow_cwcb_menu_list'] = None + self.UIData['shallow_opqbot_menu_list'] = None self.UIData['shallow_virtual_terminal_menu_list'] = None self.UIData['shallow_plugin_data_dict'] = None self.updateShallowMenuList() @@ -122,6 +126,7 @@ def on_control_rx(self, packet): if 'data' in packet.key['data'] \ and type(packet.key['data']['data']) is dict: self.bot_info = packet.key['data']['data'] + self.UIData['shallow_opqbot_menu_list'] = None self.UIData['shallow_gocqhttp_menu_list'] = None self.UIData['shallow_walleq_menu_list'] = None self.UIData['shallow_cwcb_menu_list'] = None @@ -190,8 +195,7 @@ def mainrun(self): if 'hash' in rx_packet_data.key['data']: if rx_packet_data.key['data']['hash'] in self.bot_info: tmp_title = '%s' % ( - str(self.bot_info[ - rx_packet_data.key['data']['hash']].id) + str(self.bot_info[rx_packet_data.key['data']['hash']].id) ) self.UIData['shallow_gocqhttp_menu_list'].append( [ @@ -249,8 +253,7 @@ def mainrun(self): if 'hash' in rx_packet_data.key['data']: if rx_packet_data.key['data']['hash'] in self.bot_info: tmp_title = '%s' % ( - str(self.bot_info[ - rx_packet_data.key['data']['hash']].id) + str(self.bot_info[rx_packet_data.key['data']['hash']].id) ) self.UIData['shallow_walleq_menu_list'].append( [ @@ -308,8 +311,7 @@ def mainrun(self): if 'hash' in rx_packet_data.key['data']: if rx_packet_data.key['data']['hash'] in self.bot_info: tmp_title = '%s' % ( - str(self.bot_info[ - rx_packet_data.key['data']['hash']].id) + str(self.bot_info[rx_packet_data.key['data']['hash']].id) ) self.UIData['shallow_cwcb_menu_list'].append( [ @@ -340,6 +342,52 @@ def mainrun(self): elif 'cwcb_terminal_on' == rx_packet_data.key['data']['event']: if 'hash' in rx_packet_data.key['data']: self.startCWCBTerminalUI(rx_packet_data.key['data']['hash']) + elif 'opqbot' == rx_packet_data.key['data']['action']: + if 'event' in rx_packet_data.key['data']: + if 'init' == rx_packet_data.key['data']['event']: + if self.UIData['shallow_opqbot_menu_list'] is None: + self.UIData['shallow_opqbot_menu_list'] = [] + if 'hash' in rx_packet_data.key['data']: + if rx_packet_data.key['data']['hash'] in self.bot_info: + tmp_title = '%s' % ( + str(self.bot_info[rx_packet_data.key['data']['hash']].id) + ) + self.UIData['shallow_opqbot_menu_list'].append( + [ + tmp_title, + rx_packet_data.key['data']['hash'], + '', + 'opqbot' + ] + ) + self.updateShallowMenuList() + if self.UIObject['root_shallow'] is not None: + self.updateShallow() + self.startOPQBotTerminalUISend(rx_packet_data.key['data']['hash']) + elif 'log' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data'] and 'data' in \ + rx_packet_data.key['data']: + hash = rx_packet_data.key['data']['hash'] + if hash not in self.UIObject['root_opqbot_terminal_data']: + self.UIObject['root_opqbot_terminal_data'][hash] = [] + self.UIObject['root_opqbot_terminal_data'][hash].append( + rx_packet_data.key['data']['data']) + if len(self.UIObject['root_opqbot_terminal_data'][hash]) > \ + self.UIObject['root_opqbot_terminal_data_max']: + self.UIObject['root_opqbot_terminal_data'][hash].pop(0) + if hash in self.UIObject['root_opqbot_terminal']: + self.UIObject['root_opqbot_terminal'][hash].tree_add_line( + rx_packet_data.key['data']['data']) + elif 'qrcode' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data'] \ + and 'path' in rx_packet_data.key['data']: + hash = rx_packet_data.key['data']['hash'] + path = rx_packet_data.key['data']['path'] + #print(rx_packet_data.key['data']) + self.sendOpenQRcodeUrl(hash, path) + elif 'opqbot_terminal_on' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data']: + self.startOPQBotTerminalUI(rx_packet_data.key['data']['hash']) elif 'virtual_terminal' == rx_packet_data.key['data']['action']: if 'event' in rx_packet_data.key['data']: if 'init' == rx_packet_data.key['data']['event']: @@ -348,8 +396,7 @@ def mainrun(self): if 'hash' in rx_packet_data.key['data']: if rx_packet_data.key['data']['hash'] in self.bot_info: tmp_title = '%s' % ( - str(self.bot_info[ - rx_packet_data.key['data']['hash']].id) + str(self.bot_info[rx_packet_data.key['data']['hash']].id) ) self.UIData['shallow_virtual_terminal_menu_list'].append( [ @@ -402,7 +449,8 @@ def updateShallowMenuList(self): self.UIData['shallow_menu_list'] = [ ['打开终端', self.startOlivOSTerminalUISend], #['账号管理', self.startAccountEditSendFunc()], - ['账号管理', None], + #['账号管理', None], + ['OPQBot管理', self.UIData['shallow_opqbot_menu_list']], ['gocqhttp管理', self.UIData['shallow_gocqhttp_menu_list']], ['walleq管理', self.UIData['shallow_walleq_menu_list']], ['ComWeChat管理', self.UIData['shallow_cwcb_menu_list']], @@ -415,7 +463,7 @@ def updateShallowMenuList(self): ['退出OlivOS', self.setOlivOSExit] ] for data_this in self.UIData['shallow_menu_list']: - if data_this[0] in ['gocqhttp管理', 'walleq管理', 'ComWeChat管理', '虚拟终端']: + if data_this[0] in ['OPQBot管理', 'gocqhttp管理', 'walleq管理', 'ComWeChat管理', '虚拟终端']: if data_this[1] is not None: tmp_new.append(data_this) elif data_this[0] in ['更新OlivOS']: @@ -456,6 +504,11 @@ def resFunc(): self.startCWCBTerminalUISend(hash) return resFunc + def startOPQBotTerminalUISendFunc(self, hash): + def resFunc(): + self.startOPQBotTerminalUISend(hash) + return resFunc + def startGoCqhttpTerminalUISend(self, hash): self.sendRxEvent( 'send', { @@ -498,6 +551,20 @@ def startCWCBTerminalUISend(self, hash): } ) + def startOPQBotTerminalUISend(self, hash): + self.sendRxEvent( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'opqbot', + 'event': 'opqbot_terminal_on', + 'hash': hash, + } + } + ) + def startGoCqhttpTerminalUI(self, hash): if hash in self.bot_info: if hash in self.UIObject['root_gocqhttp_terminal']: @@ -546,6 +613,22 @@ def startCWCBTerminalUI(self, hash): ) self.UIObject['root_cwcb_terminal'][hash].start() + def startOPQBotTerminalUI(self, hash): + if hash in self.bot_info: + if hash in self.UIObject['root_opqbot_terminal']: + try: + self.UIObject['root_opqbot_terminal'][hash].stop() + except: + pass + self.UIObject['root_opqbot_terminal'][hash] = opqbotTerminalUI( + Model_name='opqbot_terminal', + logger_proc=self.Proc_info.logger_proc.log, + root=self, + root_tk=None, + bot=self.bot_info[hash] + ) + self.UIObject['root_opqbot_terminal'][hash].start() + def startVirtualTerminalUISendFunc(self, hash): def resFunc(): self.startVirtualTerminalUISend(hash) @@ -635,7 +718,20 @@ def setWalleQModelSend(self, hash, data): def setCWCBModelSend(self, hash, data): self.sendControlEventSend('send', { 'target': { - 'type': 'walleq_lib_exe_model', + 'type': 'cwcb_lib_exe_model', + 'hash': hash + }, + 'data': { + 'action': 'input', + 'data': data + } + } + ) + + def setOPQBotModelSend(self, hash, data): + self.sendControlEventSend('send', { + 'target': { + 'type': 'opqbot_lib_exe_model', 'hash': hash }, 'data': { @@ -775,6 +871,18 @@ def sendOpenForum(self): ) self.sendOpenWebviewEvent('forum_page', 'OlivOS论坛', 'https://forum.olivos.run/') + def sendOpenQRcodeUrl(self, hash, url): + if type(self.bot_info) is dict \ + and hash in self.bot_info: + try: + res = tkinter.messagebox.askquestion(f'请使用账号 {self.bot_info[hash].id} 扫码', "是否使用内置浏览器?") + if res == 'yes': + self.sendOpenWebviewEvent(f'qrcode_page={hash}', f'请使用账号 {self.bot_info[hash].id} 扫码', url) + else: + webbrowser.open(url) + except webbrowser.Error as error_info: + tkinter.messagebox.showerror("webbrowser.Error", error_info) + def sendOpenWebviewEvent( self, name:str, @@ -1543,14 +1651,6 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he # height = height # ) - def show_url_webbrowser(self, url): - res = tkinter.messagebox.askquestion("请完成验证", "是否通过浏览器访问 \"" + url + "\" ?") - try: - if res == 'yes': - webbrowser.open(url) - except webbrowser.Error as error_info: - tkinter.messagebox.showerror("webbrowser.Error", error_info) - def tree_init_line(self): if self.bot.hash in self.root.UIObject['root_cwcb_terminal_data']: for line in self.root.UIObject['root_cwcb_terminal_data'][self.bot.hash]: @@ -1577,17 +1677,224 @@ def tree_add_line(self, data, flagInit = False): except: pass - if not flagInit and platform.system() == 'Windows': + def stop(self): + self.exit() + self.UIObject['root'].destroy() + + def exit(self): + self.root.UIObject['root_cwcb_terminal'].pop(self.bot.hash) + + + +class opqbotTerminalUI(object): + def __init__(self, Model_name, logger_proc=None, root=None, root_tk=None, bot=None): + self.Model_name = Model_name + self.root = root + self.root_tk = root_tk + self.bot = bot + self.UIObject = {} + self.UIData = {} + self.UIConfig = {} + self.logger_proc = logger_proc + self.UIConfig.update(dictColorContext) + + def start(self): + self.UIObject['root'] = tkinter.Toplevel() + self.UIObject['root'].title('OPQBot 终端 - %s' % str(self.bot.id)) + self.UIObject['root'].geometry('800x600') + self.UIObject['root'].minsize(800, 600) + self.UIObject['root'].grid_rowconfigure(0, weight=15) + self.UIObject['root'].grid_rowconfigure(1, weight=0) + self.UIObject['root'].grid_columnconfigure(0, weight=0) + self.UIObject['root'].grid_columnconfigure(1, weight=2) + self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].resizable( + width=True, + height=True + ) + self.UIObject['root'].configure(bg=self.UIConfig['color_001']) + + self.UIObject['style'] = ttk.Style() + fix_Treeview_color(self.UIObject['style']) + + self.UIObject['tree'] = ttk.Treeview(self.UIObject['root']) + self.UIObject['tree']['show'] = 'headings' + self.UIObject['tree']['columns'] = ('DATA') + self.UIObject['tree'].column('DATA', width=800 - 15 * 2 - 18 - 5) + self.UIObject['tree'].heading('DATA', text='日志') + self.UIObject['tree']['selectmode'] = 'browse' + self.UIObject['tree_rightkey_menu'] = tkinter.Menu(self.UIObject['root'], tearoff=False) + self.UIObject['tree'].bind('', lambda x: self.tree_rightKey(x)) + # self.tree_load() + # self.UIObject['tree'].place(x = 15, y = 15, width = 800 - 15 * 2 - 18 , height = 600 - 15 * 2 - 24 - 8) + self.UIObject['tree'].grid( + row=0, + column=0, + sticky="nsew", + rowspan=1, + columnspan=2, + padx=(15, 0), + pady=(15, 0), + ipadx=0, + ipady=0 + ) + self.UIObject['tree_yscroll'] = ttk.Scrollbar( + self.UIObject['root'], + orient="vertical", + command=self.UIObject['tree'].yview + ) + # self.UIObject['tree_yscroll'].place( + # x = 800 - 15 - 18, + # y = 15, + # width = 18, + # height = 600 - 15 * 2 - 24 - 8 + # ) + self.UIObject['tree_yscroll'].grid( + row=0, + column=2, + sticky="nsw", + rowspan=1, + columnspan=1, + padx=(0, 15), + pady=(15, 0), + ipadx=0, + ipady=0 + ) + self.UIObject['tree'].configure( + yscrollcommand=self.UIObject['tree_yscroll'].set + ) + + self.root_Entry_init( + obj_root='root', + obj_name='root_input', + str_name='root_input_StringVar', + x=15, + y=600 - 15 * 1 - 24, + width_t=0, + width=800 - 15 * 2, + height=24, + action=None, + title='输入' + ) + self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) + self.UIObject['root_input'].grid( + row=1, + column=1, + sticky="s", + rowspan=1, + columnspan=3, + padx=(15, 15), + pady=(8, 15), + ipadx=0, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') + self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) + + self.tree_init_line() + + self.UIObject['root'].mainloop() + + self.exit() + + def tree_rightKey(self, event): + # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 + # iid = self.UIObject['tree'].identify_row(event.y) + # self.UIObject['tree'].selection_set(iid) + # self.UIObject['tree'].update() + self.UIObject['tree_rightkey_menu'].delete(0, tkinter.END) + self.UIObject['tree_rightkey_menu'].add_command(label='查看', command=lambda: self.rightKey_action('show')) + self.UIObject['tree_rightkey_menu'].add_command(label='复制', command=lambda: self.rightKey_action('copy')) + self.UIObject['tree_rightkey_menu'].post(event.x_root, event.y_root) + + def rightKey_action(self, action: str): + if action == 'show': + msg = get_tree_force(self.UIObject['tree'])['text'] + if len(msg) > 0: + tkinter.messagebox.showinfo('日志内容', msg) + elif action == 'copy': + msg = get_tree_force(self.UIObject['tree'])['text'] + if len(msg) > 0: + self.UIObject['root'].clipboard_clear() + self.UIObject['root'].clipboard_append(msg) + self.UIObject['root'].update() + + def root_Entry_enter_Func(self, name): + def resFunc(event): + self.root_Entry_enter(name, event) + + return resFunc + + def root_Entry_enter(self, name, event): + if name == 'root_input': + input = self.UIData['root_input_StringVar'].get() + if len(input) >= 0 and len(input) < 1000: + self.root.setOPQBotModelSend(self.bot.hash, input) + self.UIData['root_input_StringVar'].set('') + + def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, height, action, title='', + mode='NONE'): + self.UIObject[obj_name + '=Label'] = tkinter.Label( + self.UIObject[obj_root], + text=title + ) + self.UIObject[obj_name + '=Label'].configure( + bg=self.UIConfig['color_001'], + fg=self.UIConfig['color_004'] + ) + # self.UIObject[obj_name + '=Label'].place( + # x = x - width_t, + # y = y, + # width = width_t, + # height = height + # ) + self.UIData[str_name] = tkinter.StringVar() + self.UIObject[obj_name] = tkinter.Entry( + self.UIObject[obj_root], + textvariable=self.UIData[str_name] + ) + self.UIObject[obj_name].configure( + bg=self.UIConfig['color_004'], + fg=self.UIConfig['color_005'], + bd=0 + ) + if mode == 'SAFE': + self.UIObject[obj_name].configure( + show='●' + ) + self.UIObject[obj_name].configure( + width=width + ) + # self.UIObject[obj_name].place( + # x = x, + # y = y, + # width = width, + # height = height + # ) + + def tree_init_line(self): + if self.bot.hash in self.root.UIObject['root_opqbot_terminal_data']: + for line in self.root.UIObject['root_opqbot_terminal_data'][self.bot.hash]: + self.tree_add_line(line, flagInit = True) + + def tree_add_line(self, data, flagInit = False): + res_data = re.sub(r'\033\[[\d;]*m?', '', data) + res_data_raw = res_data + res_data = res_data.encode(encoding='gb2312', errors='replace').decode(encoding='gb2312', errors='replace') + res_data_1 = res_data + res_data = res_data.replace(' ', '\ ') + if len(res_data.replace('\ ', '')) > 0: try: - matchRes = re.match( - r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s请前往该地址验证\s+->\s+(http[s]{0,1}://captcha\.go-cqhttp\.org/captcha\?[^\s]+).*$', - res_data_raw + iid = self.UIObject['tree'].insert( + '', + tkinter.END, + text=res_data_1, + values=( + res_data + ) ) - if matchRes != None: - matchResList = list(matchRes.groups()) - if len(matchResList) == 1: - matchResUrl = matchResList[0] - self.show_url_webbrowser(matchResUrl) + self.UIObject['tree'].see(iid) + self.UIObject['tree'].update() except: pass @@ -1596,7 +1903,8 @@ def stop(self): self.UIObject['root'].destroy() def exit(self): - self.root.UIObject['root_cwcb_terminal'].pop(self.bot.hash) + self.root.UIObject['root_opqbot_terminal'].pop(self.bot.hash) + @@ -2580,6 +2888,15 @@ def getMenu(self, data): ) ) ) + elif item_this[3] == 'opqbot': + list_new.append( + pystray.MenuItem( + item_this[0], + self.root.startOPQBotTerminalUISendFunc( + item_this[1] + ) + ) + ) elif item_this[3] == 'virtual_terminal': list_new.append( pystray.MenuItem( From 48ad1525d88da14770c0ca6b4eb95bc4acf839cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 14 Dec 2023 17:08:13 +0800 Subject: [PATCH 07/76] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=86=E9=85=8DOPQBo?= =?UTF-8?q?t=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/core/accountAPI.py | 5 +++++ OlivOS/libBooter/libOPQBotEXEModelAPI.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/OlivOS/core/core/accountAPI.py b/OlivOS/core/core/accountAPI.py index dfcb0f1a..1f8baaf2 100644 --- a/OlivOS/core/core/accountAPI.py +++ b/OlivOS/core/core/accountAPI.py @@ -131,6 +131,11 @@ def accountFix(basic_conf_models, bot_info_dict, logger_proc): Account_data_this.post_info.host = 'ws://127.0.0.1' Account_data_this.post_info.port = g.get_free_port() Account_data_this.post_info.access_token = bot_info_dict_this + if Account_data_this.platform['model'] in OlivOS.libOPQBotEXEModelAPI.gAutoCheckList: + if Account_data_this.post_info.auto == True: + Account_data_this.post_info.type = 'websocket' + Account_data_this.post_info.host = '127.0.0.1' + Account_data_this.post_info.port = g.get_free_port() res[bot_info_dict_this] = Account_data_this return res diff --git a/OlivOS/libBooter/libOPQBotEXEModelAPI.py b/OlivOS/libBooter/libOPQBotEXEModelAPI.py index cc8be638..4e22fbbc 100644 --- a/OlivOS/libBooter/libOPQBotEXEModelAPI.py +++ b/OlivOS/libBooter/libOPQBotEXEModelAPI.py @@ -41,6 +41,10 @@ 'opqbot_port_old' ] +gAutoCheckList = [ + 'opqbot_auto' +] + def startOPQBotLibExeModel( plugin_bot_info_dict, From 48204c1ba0ec2d2ef6b9cd319f8eab0028c2e2e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 15 Dec 2023 09:44:51 +0800 Subject: [PATCH 08/76] =?UTF-8?q?hook=20email=E7=9B=B8=E5=85=B3=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/hook_pack.py | 2 ++ OlivOS/hook_pack_debug.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/OlivOS/hook_pack.py b/OlivOS/hook_pack.py index 44f1683b..cc4e9b8f 100644 --- a/OlivOS/hook_pack.py +++ b/OlivOS/hook_pack.py @@ -50,6 +50,8 @@ import prompt_toolkit import regex import rich +import smtplib +import email import sys diff --git a/OlivOS/hook_pack_debug.py b/OlivOS/hook_pack_debug.py index 5d4c21b9..638b7ea5 100644 --- a/OlivOS/hook_pack_debug.py +++ b/OlivOS/hook_pack_debug.py @@ -50,5 +50,7 @@ import prompt_toolkit import regex import rich +import smtplib +import email import sys From 5f68a1d4df8ba36a1413bfb1b9a7eac2be91f4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 15 Dec 2023 09:55:24 +0800 Subject: [PATCH 09/76] Create hook-email.py --- hook/hook-email.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hook/hook-email.py diff --git a/hook/hook-email.py b/hook/hook-email.py new file mode 100644 index 00000000..2427ea56 --- /dev/null +++ b/hook/hook-email.py @@ -0,0 +1,9 @@ +from PyInstaller.utils.hooks import collect_all + +def hook(hook_api): + packages = ['email'] + for package in packages: + datas, binaries, hiddenimports = collect_all(package) + #hook_api.add_datas(datas) + #hook_api.add_binaries(binaries) + hook_api.add_imports(*hiddenimports) From b90a47e86cf2f35e97a6b37add57adc78cbbc42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 15 Dec 2023 17:47:35 +0800 Subject: [PATCH 10/76] =?UTF-8?q?=E9=80=82=E9=85=8DOPQ=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + 退出群接口 + 获取群列表接口 + 发送图片消息 --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 365 ++++++++++++++++++++++++++++- OlivOS/core/core/API.py | 5 + 2 files changed, 363 insertions(+), 7 deletions(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index 1b8b8c01..c9cd078d 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -18,11 +18,18 @@ import json import uuid import hashlib +import copy +import base64 +import requests as req +from urllib import parse +import traceback import OlivOS gBotIdDict = {} +gResReg = {} + class bot_info_T(object): def __init__(self, id=-1): self.id = id @@ -78,7 +85,16 @@ def get_Event_from_SDK(target_event): platform_model=target_event.platform['model'] ) if target_event.sdk_event.payload.active: - if target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_NEW_MSG': + if target_event.sdk_event.payload.EventName == 'CgiBaseResponse': + if type(target_event.sdk_event.payload.ReqId) is int \ + and type(target_event.sdk_event.payload.ResponseData) is dict \ + and type(target_event.sdk_event.payload.Ret) is int: + target_event.active = False + waitForResSet( + str(target_event.sdk_event.payload.ReqId), + target_event.sdk_event.payload.data + ) + elif target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_NEW_MSG': if type(target_event.sdk_event.payload.EventData) is dict \ and 'MsgHead' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ @@ -186,6 +202,9 @@ def __init__(self, data=None, is_rx=False): self.CurrentQQ = None self.ReqId = int(getHash(str(uuid.uuid4())), 16) % 1000000000000 self.CgiCmd = None + self.ResponseData = None + self.CgiBaseResponse = None + self.Ret = None self.load(data, is_rx) def dump(self): @@ -221,6 +240,23 @@ def load(self, data, is_rx: bool): self.EventName = data['CurrentPacket']['EventName'] self.EventData = data['CurrentPacket']['EventData'] self.CurrentQQ = data['CurrentQQ'] + elif is_rx \ + and type(data) is dict \ + and 'CgiBaseResponse' in data \ + and type(data['CgiBaseResponse']) is dict \ + and 'Ret' in data['CgiBaseResponse'] \ + and type(data['CgiBaseResponse']['Ret']) is int \ + and 'ReqId' in data \ + and type(data['ReqId']) is int \ + and 'ResponseData' in data \ + and type(data['ResponseData']) is dict: + self.active = True + self.data = data + self.ReqId = data['ReqId'] + self.ResponseData = data['ResponseData'] + self.CgiBaseResponse = data['CgiBaseResponse'] + self.Ret = data['CgiBaseResponse']['Ret'] + self.EventName = 'CgiBaseResponse' return self @@ -258,9 +294,117 @@ def __init__(self, ToUin:'int|str', ToType:int, Content:str, CurrentQQ:'int|str' } } + class MessageSvc_PbSendMsg_all(payload_template): + def __init__(self, ToUin:'int|str', ToType:int, dataPatch:dict, CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "MessageSvc.PbSendMsg" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + "ToUin": getIdBackport(ToUin), + "ToType": ToType + } + } + self.data['CgiRequest'].update(dataPatch) + + class exitGroup(payload_template): + def __init__(self, Uin:'int|str', CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "SsoGroup.Op" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + "OpCode": 4247, + "Uin": getIdBackport(Uin) + } + } + + class GetGroupLists(payload_template): + def __init__(self, CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "GetGroupLists" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": {} + } + + class PicUp_DataUp(payload_template): + def __init__( + self, + CommandId:int, + CurrentQQ:'int|str', + FilePath:'str|None' = None, + FileUrl:'str|None' = None, + Base64Buf:'str|None' = None, + ): + payload_template.__init__(self) + self.CgiCmd = "PicUp.DataUp" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": {} + } + self.data['CgiRequest']['CommandId'] = CommandId + if FilePath is not None: + self.data['CgiRequest']['FilePath'] = FilePath + if FileUrl is not None: + self.data['CgiRequest']['FileUrl'] = FileUrl + if Base64Buf is not None: + self.data['CgiRequest']['Base64Buf'] = Base64Buf + # 支持OlivOS API调用的方法实现 class event_action(object): + def send_solo_msg(target_event, target_type, target_id, message, control_queue): + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + if len(message) > 0: + send_ws_event( + plugin_event_bot_hash, + PAYLOAD.MessageSvc_PbSendMsg( + ToUin = target_id, + ToType = 2 if 'group' == target_type else 1, + Content = message, + CurrentQQ = target_event.base_info['self_id'] + ).dump(), + control_queue + ) + + def send_solo_all_msg(target_event, target_type, target_id, dataPatch, control_queue): + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + if type(dataPatch) is dict: + send_ws_event( + plugin_event_bot_hash, + PAYLOAD.MessageSvc_PbSendMsg_all( + ToUin = target_id, + ToType = 2 if 'group' == target_type else 1, + dataPatch = dataPatch, + CurrentQQ = target_event.base_info['self_id'] + ).dump(), + control_queue + ) + + def send_msg(target_event, target_type, target_id, message, control_queue): plugin_event_bot_hash = OlivOS.API.getBotHash( bot_id=target_event.base_info['self_id'], @@ -273,22 +417,171 @@ def send_msg(target_event, target_type, target_id, message, control_queue): 'olivos_string', message ) + count_data = 0 + size_data = len(message_obj.data) + flag_now_type = 'string' + flag_now_type_last = flag_now_type if message_obj.active: for data_this in message_obj.data: - if data_this.type == 'text': + res = None + count_data += 1 + flag_now_type_last = flag_now_type + if type(data_this) is OlivOS.messageAPI.PARA.text: message_new += data_this.data['text'] - if len(message_new) > 0: + flag_now_type = 'string' + elif type(data_this) is OlivOS.messageAPI.PARA.image: + res = event_action.setResourceUploadFast( + target_event = target_event, + control_queue = control_queue, + url = data_this.data['file'], + type_path = 'images', + type_chat = 2 if 'group' == target_type else 1 + ) + flag_now_type = 'image' + if size_data == count_data\ + or (flag_now_type_last != flag_now_type \ + and flag_now_type_last == 'string' \ + and len(message_new) > 0): + event_action.send_solo_msg( + target_event = target_event, + target_type = target_type, + target_id = target_id, + message = message_new, + control_queue = control_queue + ) + message_new = '' + time.sleep(1) + if flag_now_type == 'image': + if res is not None: + event_action.send_solo_all_msg( + target_event = target_event, + target_type = target_type, + target_id = target_id, + dataPatch = { + 'Images': [ + { + "FileId": res[2], + "FileMd5": res[0], + "FileSize": res[1], + "Height": 1920, + "Width": 1080 + } + ] + }, + control_queue = control_queue + ) + time.sleep(1) + + # 现场上传的就地实现 + def setResourceUploadFast(target_event, control_queue, url: str, type_path: str = 'images', type_chat: int = 2): + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + res = [None, None, None] + data_obj = None + try: + pic_file = None + if url.startswith("base64://"): + data_obj = PAYLOAD.PicUp_DataUp( + CommandId = type_chat, + Base64Buf = url, + CurrentQQ = target_event.base_info['self_id'] + ) + else: + url_parsed = parse.urlparse(url) + if url_parsed.scheme in ["http", "https"]: + data_obj = PAYLOAD.PicUp_DataUp( + CommandId = type_chat, + FileUrl = url, + CurrentQQ = target_event.base_info['self_id'] + ) + else: + file_path = url_parsed.path + file_path = OlivOS.contentAPI.resourcePathTransform(type_path, file_path) + data_obj = PAYLOAD.PicUp_DataUp( + CommandId = type_chat, + FilePath = file_path, + CurrentQQ = target_event.base_info['self_id'] + ) + + if data_obj is not None: + waitForResReady(str(data_obj.ReqId)) + send_ws_event( + plugin_event_bot_hash, + data_obj.dump(), + control_queue + ) + res_raw = waitForRes(str(data_obj.ReqId)) + raw_obj = init_api_json(res_raw) + if raw_obj is not None: + if type(raw_obj) is dict \ + and 'FileMd5' in raw_obj \ + and type(raw_obj['FileMd5']) is str \ + and 'FileSize' in raw_obj \ + and type(raw_obj['FileSize']) is int \ + and 'FileId' in raw_obj \ + and type(raw_obj['FileId']) is int: + res = [raw_obj['FileMd5'], raw_obj['FileSize'], raw_obj['FileId']] + except Exception as e: + traceback.print_exc() + res = [None, None, None] + return res + + def set_group_leave(target_event, group_id, control_queue): + if target_event.bot_info != None: + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) send_ws_event( plugin_event_bot_hash, - PAYLOAD.MessageSvc_PbSendMsg( - ToUin = target_id, - ToType = 2 if 'group' == target_type else 1, - Content = message_new, + PAYLOAD.exitGroup( + Uin = group_id, CurrentQQ = target_event.base_info['self_id'] ).dump(), control_queue ) + def get_group_list(target_event:OlivOS.API.Event, control_queue): + res_data = OlivOS.contentAPI.api_result_data_template.get_group_list() + if target_event.bot_info != None: + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + this_msg = PAYLOAD.GetGroupLists( + CurrentQQ = target_event.base_info['self_id'] + ) + waitForResReady(str(this_msg.ReqId)) + send_ws_event( + plugin_event_bot_hash, + this_msg.dump(), + control_queue + ) + res_raw = waitForRes(str(this_msg.ReqId)) + raw_obj = init_api_json(res_raw) + if raw_obj is not None: + if type(raw_obj) is dict \ + and 'GroupLists' in raw_obj \ + and type(raw_obj['GroupLists']) is list: + res_data['active'] = True + for raw_obj_this in raw_obj['GroupLists']: + tmp_res_data_this = OlivOS.contentAPI.api_result_data_template.get_user_info_strip() + tmp_res_data_this['name'] = init_api_do_mapping_for_dict(raw_obj_this, ['GroupName'], str) + tmp_res_data_this['id'] = init_api_do_mapping_for_dict(raw_obj_this, ['GroupCode'], int) + tmp_res_data_this['memo'] = '' + tmp_res_data_this['member_count'] = init_api_do_mapping_for_dict(raw_obj_this, ['MemberCnt'], int) + tmp_res_data_this['max_member_count'] = init_api_do_mapping_for_dict(raw_obj_this, ['GroupCnt'], int) + res_data['data'].append(tmp_res_data_this) + return res_data + def sendControlEventSend(action, data, control_queue): if control_queue is not None: @@ -314,3 +607,61 @@ def send_ws_event(hash, data, control_queue): }, control_queue ) + +def init_api_json(raw:dict): + res_data = None + if type(raw) is dict \ + and 'CgiBaseResponse' in raw \ + and type(raw['CgiBaseResponse']) is dict \ + and 'Ret' in raw['CgiBaseResponse'] \ + and type(raw['CgiBaseResponse']['Ret']) is int \ + and raw['CgiBaseResponse']['Ret'] == 0 \ + and 'ReqId' in raw \ + and type(raw['ReqId']) is int \ + and 'ResponseData' in raw \ + and type(raw['ResponseData']) is dict: + res_data = copy.deepcopy(raw['ResponseData']) + return res_data + +def init_api_do_mapping(src_type, src_data): + if type(src_data) == src_type: + return src_data + +def init_api_do_mapping_for_dict(src_data, path_list, src_type): + res_data = None + flag_active = True + tmp_src_data = src_data + for path_list_this in path_list: + if type(tmp_src_data) == dict: + if path_list_this in tmp_src_data: + tmp_src_data = tmp_src_data[path_list_this] + else: + return None + else: + return None + res_data = init_api_do_mapping(src_type, tmp_src_data) + return res_data + +def waitForResSet(echo:str, data): + global gResReg + if echo in gResReg: + gResReg[echo] = data + +def waitForResReady(echo:str): + global gResReg + gResReg[echo] = None + +def waitForRes(echo:str): + global gResReg + res = None + interval = 0.1 + limit = 30 + index_limit = int(limit / interval) + for i in range(index_limit): + time.sleep(interval) + if echo in gResReg \ + and gResReg[echo] is not None: + res = gResReg[echo] + gResReg.pop(echo) + break + return res diff --git a/OlivOS/core/core/API.py b/OlivOS/core/core/API.py index a1db5680..06ab58ae 100644 --- a/OlivOS/core/core/API.py +++ b/OlivOS/core/core/API.py @@ -1187,6 +1187,9 @@ def __set_group_leave(self, group_id, host_id, is_dismiss, flag_log=True): elif self.platform['model'] in OlivOS.flaskServerAPI.gCheckList: if host_id is None: OlivOS.onebotSDK.event_action.set_group_leave(self, group_id, is_dismiss) + elif self.platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + if host_id is None: + OlivOS.OPQBotSDK.event_action.set_group_leave(self, group_id, self.plugin_info['control_queue']) elif self.platform['sdk'] == 'telegram_poll': OlivOS.telegramSDK.event_action.set_chat_leave(self, group_id, is_dismiss) @@ -1378,6 +1381,8 @@ def __get_group_list(self, flag_log=True): res_data = OlivOS.onebotV12SDK.event_action.get_group_list(self) elif self.platform['model'] in OlivOS.flaskServerAPI.gCheckList: res_data = OlivOS.onebotSDK.event_action.get_group_list(self) + elif self.platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + res_data = OlivOS.OPQBotSDK.event_action.get_group_list(self, self.plugin_info['control_queue']) elif self.platform['sdk'] == 'telegram_poll': pass return res_data From e321101720515c9f829dacaf31e1062b910c332a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 18 Dec 2023 11:09:58 +0800 Subject: [PATCH 11/76] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closed #108 --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 112 +++++++++++++++++++++++++++- OlivOS/nativeGUI/multiLoginUIAPI.py | 13 ++-- README.md | 1 - 3 files changed, 119 insertions(+), 7 deletions(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index c9cd078d..103b38d7 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -30,6 +30,8 @@ gResReg = {} +gUinfoReg = {} + class bot_info_T(object): def __init__(self, id=-1): self.id = id @@ -186,6 +188,54 @@ def get_Event_from_SDK(target_event): target_event.data.sender['age'] = 0 target_event.data.sender['role'] = 'member' target_event.data.host_id = None + elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': + if type(target_event.sdk_event.payload.EventData) is dict \ + and 'ReqUid' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['ReqUid']) is str \ + and 'Status' in target_event.sdk_event.payload.EventData \ + and target_event.sdk_event.payload.EventData['Status'] == 7 \ + and 'MsgAdditional' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgAdditional']) is str: + target_event.active = True + target_event.plugin_info['func_type'] = 'friend_add_request' + uin = str(target_event.sdk_event.payload.EventData['ReqUid']) + if OlivOS.pluginAPI.gProc is not None: + uin = event_action.getUinfo( + target_event = target_event, + Uid = target_event.sdk_event.payload.EventData['ReqUid'], + control_queue = OlivOS.pluginAPI.gProc.Proc_info.control_queue + ) + target_event.data = target_event.friend_add_request( + str(uin), + target_event.sdk_event.payload.EventData['MsgAdditional'] + ) + target_event.data.flag = str(target_event.sdk_event.payload.EventData['ReqUid']) + elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_SYSTEM_MSG_NOTIFY': + if type(target_event.sdk_event.payload.EventData) is dict \ + and 'GroupCode' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['GroupCode']) is int \ + and 'ReqUid' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['ReqUid']) is str \ + and 'Status' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['Status']) is int \ + and target_event.sdk_event.payload.EventData['Status'] in [1, 2] \ + and 'MsgAdditional' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgAdditional']) is str: + target_event.active = True + target_event.plugin_info['func_type'] = 'friend_add_request' + uin = str(target_event.sdk_event.payload.EventData['ReqUid']) + if OlivOS.pluginAPI.gProc is not None: + uin = event_action.getUinfo( + target_event = target_event, + Uid = target_event.sdk_event.payload.EventData['ReqUid'], + control_queue = OlivOS.pluginAPI.gProc.Proc_info.control_queue + ) + target_event.data = target_event.group_add_request( + str(target_event.sdk_event.payload.EventData['GroupCode']), + str(uin), + target_event.sdk_event.payload.EventData['MsgAdditional'] + ) + target_event.data.flag = str(target_event.sdk_event.payload.EventData['ReqUid']) ''' @@ -363,9 +413,69 @@ def __init__( if Base64Buf is not None: self.data['CgiRequest']['Base64Buf'] = Base64Buf + class QueryUinByUid(payload_template): + def __init__(self, UidQuery:'list[str]', CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "QueryUinByUid" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + 'Uids': UidQuery + } + } + # 支持OlivOS API调用的方法实现 class event_action(object): + def getUinfo(target_event, Uid, control_queue): + global gUinfoReg + res = Uid + if Uid in gUinfoReg: + res = gUinfoReg[Uid] + else: + res_list = event_action.getUinfoCache( + target_event = target_event, + UidQuery = [Uid], + control_queue = control_queue + ) + if len(res_list) == 1: + res = res_list[0] + return res + + def getUinfoCache(target_event, UidQuery, control_queue): + global gUinfoReg + res_tmp = {} + res = [] + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + this_msg = PAYLOAD.QueryUinByUid( + UidQuery = UidQuery, + CurrentQQ = target_event.base_info['self_id'] + ) + waitForResReady(str(this_msg.ReqId)) + send_ws_event( + plugin_event_bot_hash, + this_msg.dump(), + control_queue + ) + res_raw = waitForRes(str(this_msg.ReqId)) + raw_obj = init_api_json(res_raw) + if raw_obj is not None: + if type(raw_obj) is list: + for raw_obj_this in raw_obj: + res_tmp[str(raw_obj_this['Uid'])] = raw_obj_this['Uin'] + gUinfoReg.update(res_tmp) + for UidQuery_this in UidQuery: + res.append(res_tmp.get(UidQuery_this, None)) + return res + def send_solo_msg(target_event, target_type, target_id, message, control_queue): plugin_event_bot_hash = OlivOS.API.getBotHash( bot_id=target_event.base_info['self_id'], @@ -619,7 +729,7 @@ def init_api_json(raw:dict): and 'ReqId' in raw \ and type(raw['ReqId']) is int \ and 'ResponseData' in raw \ - and type(raw['ResponseData']) is dict: + and type(raw['ResponseData']) in [dict, list]: res_data = copy.deepcopy(raw['ResponseData']) return res_data diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 33bbe8dc..3c82481b 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -361,8 +361,6 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'type_list': [ 'KOOK', 'KOOK/消息兼容', - 'QQ/OPQ/默认', - 'QQ/OPQ/指定端口', '钉钉', '渡渡语音/Dodo/V2', '渡渡语音/Dodo/V1', @@ -387,6 +385,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'FF14终端', '虚拟终端', '接口终端', + 'QQ/OPQ/默认', + 'QQ/OPQ/指定端口', 'QQ/GoCq/安卓手表', 'QQ/GoCq/安卓手机', 'QQ/GoCq/安卓平板', @@ -411,7 +411,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/Wq/旧': '密码留空即尝试使用扫码登录', '微信/ComWeChat': '启动后需要再运行特定版本微信', 'Hack.Chat': '密码可以留空', - 'RED协议': 'HTTP可以不填,反正也没实现' + 'RED协议': 'HTTP可以不填,反正也没实现', + 'QQ/OPQ/默认': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', + 'QQ/OPQ/指定端口': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', + 'QQ/OPQ/指定端口/旧': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责' }, 'type_clear_note_list': { 'QQ/GoCq/默认': './conf/gocqhttp/{bothash}', @@ -1537,9 +1540,9 @@ def tree_edit_UI_Combobox_update(self, action, con_action): self.tree_edit_UI_Label_init( obj_root='edit_root', obj_name='edit_root_Label_type_note', - x=100, + x=15, y=40 + count * (24 + 6), - width=200, + width=400 - 15 * 2, height=24, title=self.UIData['edit_root_Combobox_dict']['type_note_list'][tmp_type] ) diff --git a/README.md b/README.md index c8a092f9..2a3c22b9 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ [![OnebotV11](https://img.shields.io/badge/-OnebotV11-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![OnebotV12](https://img.shields.io/badge/-OnebotV12-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![RED](https://img.shields.io/badge/-RED-111111?style=flat-square&logoColor=white)](https://chrononeko.github.io/QQNTRedProtocol/) -[![OPQBot](https://img.shields.io/badge/-OPQBot-111111?style=flat-square&logoColor=white)](https://opqbot.com/) [![QQ全域](https://img.shields.io/badge/-QQ%E5%85%A8%E5%9F%9F-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![QQ频道](https://img.shields.io/badge/-QQ%E9%A2%91%E9%81%93-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![DingTalk](https://img.shields.io/badge/-%E9%92%89%E9%92%89-007FFF?style=flat-square&logo=alibabadotcom&logoColor=white)](https://open.dingtalk.com/) From 8e4c60b0d055eac49b2687af8ee2cb9a2fa11855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 18 Dec 2023 16:50:16 +0800 Subject: [PATCH 12/76] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a3c22b9..bd021b81 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ if __name__ == '__main__': ### **OlivOS 的形象图及项目图标都拥有著作权保护。** **在未经过允许的情况下,任何人都不可以使用形象图和图标,或本文初的有关 OlivOS 名称来历的介绍原文,用于商业用途或是放置在项目首页,或其他未许可的行为。** -### 衍生软件需声明引用 +### 衍生软件需声明引用(此声明参考[Mirai](https://github.com/mamoe/mirai)) - 若引用 OlivOS 发布的软件包而不修改 OlivOS,则衍生项目需在描述的任意部位提及使用 OlivOS。 - 若修改 OlivOS 源代码再发布,**或参考 OlivOS 内部实现发布另一个项目**,则衍生项目必须在**文章首部**或 'OlivOS' 相关内容**首次出现**的位置**明确声明**来源于本仓库 (`https://github.com/OlivOS-Team/OlivOS`)。不得扭曲或隐藏免费且开源的事实。 From e33982a7b507cbc7c42e21c68c45389c4f62e942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 18 Dec 2023 16:51:42 +0800 Subject: [PATCH 13/76] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd021b81..3eae0fc7 100644 --- a/README.md +++ b/README.md @@ -125,14 +125,14 @@ if __name__ == '__main__': You should have received a copy of the GNU Affero General Public License along with this program. If not, see . -`OlivOS` 采用 `AGPLv3` 协议开源。为了整个社区的良性发展,我们**强烈建议**您做到以下几点: +`OlivOS` 采用 `AGPLv3` 协议开源。为了整个社区的良性发展,我们**强烈建议**您做到以下几点(此声明继承自[Mirai](https://github.com/mamoe/mirai)): - **间接接触(包括但不限于使用 `Http API` 或 跨进程技术)到 `OlivOS` 的软件使用 `AGPLv3` 开源** ### **OlivOS 的形象图及项目图标都拥有著作权保护。** **在未经过允许的情况下,任何人都不可以使用形象图和图标,或本文初的有关 OlivOS 名称来历的介绍原文,用于商业用途或是放置在项目首页,或其他未许可的行为。** -### 衍生软件需声明引用(此声明参考[Mirai](https://github.com/mamoe/mirai)) +### 衍生软件需声明引用 - 若引用 OlivOS 发布的软件包而不修改 OlivOS,则衍生项目需在描述的任意部位提及使用 OlivOS。 - 若修改 OlivOS 源代码再发布,**或参考 OlivOS 内部实现发布另一个项目**,则衍生项目必须在**文章首部**或 'OlivOS' 相关内容**首次出现**的位置**明确声明**来源于本仓库 (`https://github.com/OlivOS-Team/OlivOS`)。不得扭曲或隐藏免费且开源的事实。 From 3b9cc87afb7d2899024c0f8e801beeb7e4a56fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 19 Dec 2023 19:59:24 +0800 Subject: [PATCH 14/76] =?UTF-8?q?=E6=96=B0=E5=A2=9EShamrock=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #109 --- OlivOS/adapter/onebotV11/flaskServerAPI.py | 2 + OlivOS/adapter/onebotV11/onebotSDK.py | 81 +++++++++++++++++----- OlivOS/core/info/infoAPI.py | 4 +- OlivOS/nativeGUI/multiLoginUIAPI.py | 17 +++++ 4 files changed, 83 insertions(+), 21 deletions(-) diff --git a/OlivOS/adapter/onebotV11/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py index 5e43b557..cbbeb7e7 100644 --- a/OlivOS/adapter/onebotV11/flaskServerAPI.py +++ b/OlivOS/adapter/onebotV11/flaskServerAPI.py @@ -26,6 +26,8 @@ gCheckList = [ 'default', + 'shamrock_default', + 'para_default', 'gocqhttp', 'gocqhttp_hide', 'gocqhttp_show', diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 87f83a5e..2e08e7f3 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -19,8 +19,15 @@ import requests as req from urllib import parse import os +import time +import traceback + import OlivOS +paraMsgMap = [ + 'shamrock_default', + 'para_default' +] class bot_info_T(object): def __init__(self, id=-1, host='', port=-1, access_token=None): @@ -53,24 +60,31 @@ def send_onebot_post_json(self): if type(self.bot_info) is not bot_info_T or self.bot_info.host == '' or self.bot_info.port == -1 or self.obj is None or self.node_ext == '': return None else: - json_str_tmp = json.dumps(obj=self.obj.__dict__) - send_url = self.bot_info.host + ':' + str( - self.bot_info.port) + '/' + self.node_ext + '?access_token=' + self.bot_info.access_token + try: + json_str_tmp = json.dumps(obj=self.obj.__dict__, ensure_ascii=False) + tmp_host = self.bot_info.host + if tmp_host.startswith('http://') or tmp_host.startswith('https://'): + pass + else: + tmp_host = 'http://' + tmp_host + send_url = f'{self.bot_info.host}:{self.bot_info.port}/{self.node_ext}?access_token={self.bot_info.access_token}' - if self.bot_info.debug_mode: - if self.bot_info.debug_logger is not None: - self.bot_info.debug_logger.log(0, self.node_ext + ': ' + json_str_tmp) + if self.bot_info.debug_mode: + if self.bot_info.debug_logger is not None: + self.bot_info.debug_logger.log(0, self.node_ext + ': ' + json_str_tmp) - headers = { - 'Content-Type': 'application/json' - } - msg_res = req.request("POST", send_url, headers=headers, data=json_str_tmp) + headers = { + 'Content-Type': 'application/json' + } + msg_res = req.request("POST", send_url, headers=headers, data=json_str_tmp.encode('utf-8')) - if self.bot_info.debug_mode: - if self.bot_info.debug_logger is not None: - self.bot_info.debug_logger.log(0, self.node_ext + ' - sendding succeed: ' + msg_res.text) + if self.bot_info.debug_mode: + if self.bot_info.debug_logger is not None: + self.bot_info.debug_logger.log(0, self.node_ext + ' - sendding succeed: ' + msg_res.text) - return msg_res + return msg_res + except: + traceback.print_exc() class api_templet(object): @@ -138,7 +152,7 @@ def event_load(self, raw): # 支持OlivOS API事件生成的映射实现 def get_Event_from_SDK(target_event): - target_event.base_info['time'] = target_event.sdk_event.base_info['time'] + target_event.base_info['time'] = target_event.sdk_event.base_info.get('time', int(time.time())) target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] target_event.platform['sdk'] = target_event.sdk_event.platform['sdk'] @@ -432,7 +446,7 @@ def get_Event_from_SDK(target_event): target_event.sdk_event.json['interval'] ) -def formatMessage(data:str): +def formatMessage(data:str, msgType:str = 'para'): res = data data_obj = OlivOS.messageAPI.Message_templet( mode_rx = 'old_string', @@ -452,7 +466,28 @@ def formatMessage(data:str): file_path = OlivOS.contentAPI.resourcePathTransform('images', file_path) if os.path.exists(file_path): data_obj_this.data['file'] = 'file:///%s' % file_path - res = data_obj.get('old_string') + if msgType == 'para': + res = paraMapper(paraList = data_obj.data, msgType = 'para') + else: + res = data_obj.get('old_string') + return res + + +def paraMapper(paraList, msgType='para'): + res = [] + if 'para' == msgType: + for para in paraList: + tmp_para = para.__dict__ + if para.type == 'at': + tmp_para = {} + tmp_para['type'] = 'at' + tmp_para['data'] = {} + tmp_para['data']['qq'] = para.data['id'] + res.append(tmp_para) + elif 'msg' == msgType: + res = '' + for para in paraList: + res += para.CQ() return res # 支持OlivOS API调用的方法实现 @@ -472,17 +507,25 @@ def reply_group_msg(target_event, message): ) def send_private_msg(target_event, user_id, message): + global paraMsgMap + msgType = 'msg' this_msg = api.send_msg(get_SDK_bot_info_from_Event(target_event)) this_msg.data.message_type = 'private' this_msg.data.user_id = str(user_id) - this_msg.data.message = formatMessage(message) + if target_event.bot_info.platform['model'] in paraMsgMap: + msgType = 'para' + this_msg.data.message = formatMessage(data = message, msgType = msgType) this_msg.do_api() def send_group_msg(target_event, group_id, message): + global paraMsgMap + msgType = 'msg' this_msg = api.send_msg(get_SDK_bot_info_from_Event(target_event)) this_msg.data.message_type = 'group' this_msg.data.group_id = str(group_id) - this_msg.data.message = formatMessage(message) + if target_event.bot_info.platform['model'] in paraMsgMap: + msgType = 'para' + this_msg.data.message = formatMessage(data = message, msgType = msgType) this_msg.do_api() def delete_msg(target_event, message_id): diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 3d629f86..e74409de 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.26' -OlivOS_SVN = 146 +OlivOS_Version = '0.11.27' +OlivOS_SVN = 147 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 3c82481b..74d12279 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -378,6 +378,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'Hack.Chat/私有', 'onebotV12/正向WS', 'onebotV11/Http', + 'onebotV11/Http/Shamrock', 'RED协议', 'OPQBot/正向WS', 'B站直播间/游客', @@ -473,6 +474,20 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'TOKEN': 'edit_root_Entry_Server_access_token', } ], + 'onebotV11/Http/Shamrock': ['qq', 'onebot', 'shamrock_default', 'False', 'post', { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', + } + ], + 'onebotV11/Http/消息段': ['qq', 'onebot', 'array_default', 'False', 'post', { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', + } + ], 'onebotV12/正向WS': ['qq', 'onebot', 'onebotV12', 'False', 'websocket', { '账号': 'edit_root_Entry_ID', '地址': 'edit_root_Entry_Server_host', @@ -787,6 +802,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non # 'gocqhttp', # 'gocqhttp_hide', 'default', + 'shamrock_default', + 'para_default', 'onebotV12', 'red', 'gocqhttp_show', From 400236a311a3e067d52a080e5583c99a22cca026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 21 Dec 2023 10:08:49 +0800 Subject: [PATCH 15/76] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8C=87=E5=AE=9Ainten?= =?UTF-8?q?ts=E7=9A=84qq=E5=BC=80=E6=94=BE=E5=B9=B3=E5=8F=B0=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/qqGuild/qqGuildv2SDK.py | 17 ++++++++----- OlivOS/nativeGUI/multiLoginUIAPI.py | 33 +++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py index 210ea446..6206e5bd 100644 --- a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py +++ b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py @@ -75,22 +75,23 @@ class intents_T(IntEnum): class bot_info_T(object): - def __init__(self, id=-1, access_token=None, model='private'): + def __init__(self, id=-1, access_token=None, model='private', intents=0): self.id = id self.access_token = access_token self.model = model + self.intents = intents self.debug_mode = False self.debug_logger = None def get_SDK_bot_info_from_Plugin_bot_info(plugin_bot_info): res = bot_info_T( - plugin_bot_info.id, - plugin_bot_info.post_info.access_token + id = plugin_bot_info.id, + access_token = plugin_bot_info.post_info.access_token, + model = plugin_bot_info.platform.get('model', 'private'), + intents = plugin_bot_info.post_info.port ) res.debug_mode = plugin_bot_info.debug_mode - if plugin_bot_info.platform['model'] == 'public': - res.model = 'public' return res @@ -175,7 +176,7 @@ def __init__(self, data): payload_template.__init__(self, data, True) class sendIdentify(payload_template): - def __init__(self, bot_info, intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE))): + def __init__(self, bot_info:bot_info_T, intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE))): tmp_intents = intents if bot_info.model == 'private': tmp_intents |= int(intents_T.GUILD_MESSAGES) @@ -183,6 +184,10 @@ def __init__(self, bot_info, intents=(int(intents_T.GUILDS) | int(intents_T.DIRE elif bot_info.model == 'public': tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) tmp_intents |= int(intents_T.PUBLIC_QQ_MESSAGES) + elif bot_info.model == 'public_guild_only': + tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) + elif bot_info.model in ['private_intents', 'public_intents']: + tmp_intents = bot_info.intents payload_template.__init__(self) self.data.op = 2 try: diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 74d12279..7f104e03 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -365,7 +365,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non '渡渡语音/Dodo/V2', '渡渡语音/Dodo/V1', 'QQ官方/公域/V2', + 'QQ官方/公域/V2/纯频道', + 'QQ官方/公域/V2/指定intents', 'QQ官方/私域/V2', + 'QQ官方/私域/V2/指定intents', 'QQ官方/公域/V1', 'QQ官方/私域/V1', '米游社/大别野/公域', @@ -663,11 +666,28 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'AppSecret': 'edit_root_Entry_Server_access_token' } ], + 'QQ官方/公域/V2/纯频道': ['qqGuild', 'qqGuildv2_link', 'public_guild_only', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + } + ], + 'QQ官方/公域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'public_intents', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + } + ], 'QQ官方/私域/V2': ['qqGuild', 'qqGuildv2_link', 'private', 'True', 'websocket', { 'AppID': 'edit_root_Entry_ID', 'AppSecret': 'edit_root_Entry_Server_access_token' } ], + 'QQ官方/私域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'private_intents', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + } + ], 'Telegram': ['telegram', 'telegram_poll', 'default', 'True', 'post', { 'TOKEN': 'edit_root_Entry_Server_access_token' } @@ -835,8 +855,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'default' ], 'qqGuildv2_link': [ - 'private', 'public', + 'public_guild_only', + 'public_intents', + 'private', + 'private_intents', 'default' ] }, @@ -989,8 +1012,12 @@ def tree_edit_commit(self): tmp_password = 'NONEED' if tmp_host == '': tmp_host = 'NONEED' - if tmp_port == '': - tmp_port = '0' + if tmp_platform_model not in [ + 'public_intents', + 'private_intents' + ]: + if tmp_port == '': + tmp_port = '0' if tmp_platform_platform == 'mhyVila' \ and tmp_platform_sdk == 'mhyVila_link': tmp_id = tmp_id.strip('\n') From f5a3c98a96e58b883ef59b7a94030cb523fab543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 27 Dec 2023 01:12:42 +0800 Subject: [PATCH 16/76] Update basic_default.json --- conf/basic_default.json | 91 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/conf/basic_default.json b/conf/basic_default.json index 7d4f964e..dd4011fd 100644 --- a/conf/basic_default.json +++ b/conf/basic_default.json @@ -12,16 +12,22 @@ "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", + "OlivOS_opqbot_lib_exe_model", "OlivOS_hackChat_link", + "OlivOS_OPQBot_link", + "OlivOS_qqRed_link", + "OlivOS_dingtalk_link", "OlivOS_plugin", "OlivOS_virtual_terminal_link", "OlivOS_flask_post_rx", "OlivOS_onebotV12_link", "OlivOS_qqGuild_link", + "OlivOS_qqGuildv2_link", "OlivOS_discord_link", "OlivOS_telegram_poll", "OlivOS_fanbook_poll", "OlivOS_kaiheila_link", + "OlivOS_mhyVila_link", "OlivOS_dodo_link", "OlivOS_biliLive_link", "OlivOS_update_check" @@ -51,15 +57,21 @@ "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", + "OlivOS_opqbot_lib_exe_model", "OlivOS_hackChat_link", + "OlivOS_OPQBot_link", + "OlivOS_qqRed_link", + "OlivOS_dingtalk_link", "OlivOS_virtual_terminal_link", "OlivOS_flask_post_rx", "OlivOS_onebotV12_link", "OlivOS_qqGuild_link", + "OlivOS_qqGuildv2_link", "OlivOS_discord_link", "OlivOS_telegram_poll", "OlivOS_fanbook_poll", "OlivOS_kaiheila_link", + "OlivOS_mhyVila_link", "OlivOS_dodo_link", "OlivOS_biliLive_link" ] @@ -69,15 +81,21 @@ "gocqhttp_lib_exe_model", "walleq_lib_exe_model", "cwcb_lib_exe_model", + "opqbot_lib_exe_model", "hackChat_link", + "OPQBot_link", + "qqRed_link", + "dingtalk_link", "terminal_link", "flask_post_rx", "onebotV12_link", "qqGuild_link", + "qqGuildv2_link", "discord_link", "telegram_poll", "fanbook_poll", "kaiheila_link", + "mhyVila_link", "dodo_link", "biliLive_link" ] @@ -95,10 +113,14 @@ "OlivOS_gocqhttp_lib_rx_queue", "OlivOS_walleq_lib_rx_queue", "OlivOS_cwcb_lib_rx_queue", + "OlivOS_opqbot_lib_rx_queue", "OlivOS_virtual_terminal_queue", "OlivOS_hackChat_queue", + "OlivOS_OPQBot_queue", "OlivOS_biliLive_queue", - "OlivOS_onebotv12_queue" + "OlivOS_onebotv12_queue", + "OlivOS_qqRed_queue", + "OlivOS_dingtalk_queue" ], "models": { "OlivOS_sleep": { @@ -262,6 +284,17 @@ "logger_proc": "OlivOS_logger", "debug": false }, + "OlivOS_qqGuildv2_link": { + "enable": true, + "name": "OlivOS_qqGuildv2_link", + "type": "qqGuildv2_link", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": null, + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": false + }, "OlivOS_discord_link": { "enable": true, "name": "OlivOS_discord_link", @@ -284,6 +317,28 @@ "logger_proc": "OlivOS_logger", "debug": false }, + "OlivOS_OPQBot_link": { + "enable": true, + "name": "OlivOS_OPQBot_link", + "type": "OPQBot_link", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_OPQBot_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": false + }, + "OlivOS_qqRed_link": { + "enable": true, + "name": "OlivOS_qqRed_link", + "type": "qqRed_link", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_qqRed_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": false + }, "OlivOS_biliLive_link": { "enable": true, "name": "OlivOS_biliLive_link", @@ -306,6 +361,16 @@ "logger_proc": "OlivOS_logger", "debug": false }, + "OlivOS_mhyVila_link": { + "enable": true, + "name": "OlivOS_mhyVila_link", + "type": "mhyVila_link", + "interval": 0.2, + "dead_interval": 1, + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": false + }, "OlivOS_telegram_poll": { "enable": true, "name": "OlivOS_telegram_poll", @@ -368,6 +433,17 @@ "logger_proc": "OlivOS_logger", "debug": false }, + "OlivOS_dingtalk_link": { + "enable": true, + "name": "OlivOS_dingtalk_link", + "type": "dingtalk_link", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_dingtalk_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "debug": false + }, "OlivOS_gocqhttp_lib_exe_model": { "enable": true, "name": "OlivOS_gocqhttp_lib_exe_model", @@ -407,6 +483,19 @@ "control_queue": "OlivOS_control_queue", "debug": false }, + "OlivOS_opqbot_lib_exe_model": { + "enable": true, + "name": "OlivOS_opqbot_lib_exe_model", + "type": "opqbot_lib_exe_model", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_opqbot_lib_rx_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "target_proc": null, + "control_queue": "OlivOS_control_queue", + "debug": false + }, "OlivOS_webview_page": { "enable": true, "name": "OlivOS_webview_page", From eaea94ce5503bf56d10d26d911756d3334cb7f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 27 Dec 2023 09:20:12 +0800 Subject: [PATCH 17/76] =?UTF-8?q?=E6=94=AF=E6=8C=81header=20token=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/onebotV11/onebotSDK.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 2e08e7f3..815fa518 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -67,7 +67,12 @@ def send_onebot_post_json(self): pass else: tmp_host = 'http://' + tmp_host - send_url = f'{self.bot_info.host}:{self.bot_info.port}/{self.node_ext}?access_token={self.bot_info.access_token}' + token_str = '' + token_dict = {} + if len(self.bot_info.access_token) > 0: + token_str = f'?access_token={self.bot_info.access_token}' + token_dict = {'Authorization': f'Bearer {self.bot_info.access_token}'} + send_url = f'{self.bot_info.host}:{self.bot_info.port}/{self.node_ext}{token_str}' if self.bot_info.debug_mode: if self.bot_info.debug_logger is not None: @@ -76,6 +81,7 @@ def send_onebot_post_json(self): headers = { 'Content-Type': 'application/json' } + headers.update(token_dict) msg_res = req.request("POST", send_url, headers=headers, data=json_str_tmp.encode('utf-8')) if self.bot_info.debug_mode: From e2902138c857e888659781c1303dd26dc9d24051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 28 Dec 2023 01:34:37 +0800 Subject: [PATCH 18/76] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/hook.py | 3 +++ OlivOS/hook_pack.py | 3 +++ OlivOS/hook_pack_debug.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/OlivOS/hook.py b/OlivOS/hook.py index c7e11e7c..680bc587 100644 --- a/OlivOS/hook.py +++ b/OlivOS/hook.py @@ -22,6 +22,9 @@ # sqlite import sqlite3 +# pyjson5 +import pyjson5 + # win if platform.system() == 'Windows': import win32com.client diff --git a/OlivOS/hook_pack.py b/OlivOS/hook_pack.py index cc4e9b8f..b3cd03a9 100644 --- a/OlivOS/hook_pack.py +++ b/OlivOS/hook_pack.py @@ -35,6 +35,9 @@ # yaml import yaml +# pyjson5 +import pyjson5 + # openpyxl import openpyxl diff --git a/OlivOS/hook_pack_debug.py b/OlivOS/hook_pack_debug.py index 638b7ea5..35982c24 100644 --- a/OlivOS/hook_pack_debug.py +++ b/OlivOS/hook_pack_debug.py @@ -35,6 +35,9 @@ # yaml import yaml +# pyjson5 +import pyjson5 + # openpyxl import openpyxl From 03ff73de621fc6115b2a023c85dc248d61627ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 29 Dec 2023 16:06:26 +0800 Subject: [PATCH 19/76] =?UTF-8?q?=E6=96=B0=E5=A2=9Eflask=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E7=AB=AF=E5=8F=A3=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/onebotV11/flaskServerAPI.py | 5 +++-- OlivOS/core/L10N/L10NDataAPI.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OlivOS/adapter/onebotV11/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py index cbbeb7e7..1248b6ec 100644 --- a/OlivOS/adapter/onebotV11/flaskServerAPI.py +++ b/OlivOS/adapter/onebotV11/flaskServerAPI.py @@ -83,8 +83,9 @@ def run(self): self.app() self.set_config() self.Proc_config['Flask_app'].config.from_object(self.Proc_config['config']) - self.log(2, OlivOS.L10NAPI.getTrans('OlivOS flask server [{0}] is running', [ - self.Proc_config['Flask_name'] + self.log(2, OlivOS.L10NAPI.getTrans('OlivOS flask server [{0}] is running on port [{1}]', [ + self.Proc_config['Flask_name'], + str(self.Proc_config['Flask_server_port']) ], modelName )) if self.Proc_config['config'].debug_mode: diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index 67d8d74d..3b928fcd 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -96,7 +96,7 @@ 'libEXEModelAPI_0004': 'OlivOS libEXEModel failed: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS libEXEModel server [{0}] is running', 'libEXEModelAPI_0006': 'OlivOS libEXEModel server [{0}] exited', - 'flaskServerAPI_0001': 'OlivOS flask server [{0}] is running', + 'flaskServerAPI_0001': 'OlivOS flask server [{0}] is running on port [{1}]', 'libCWCBEXEModelAPI_0001': 'OlivOS libCWCBEXEModel server [{0}] can`t found target lib', 'libCWCBEXEModelAPI_0002': 'OlivOS libCWCBEXEModel server [{0}] will run under visiable mode', 'libCWCBEXEModelAPI_0003': 'OlivOS libCWCBEXEModel server [{0}] will retry in 10s...', @@ -186,7 +186,7 @@ 'libEXEModelAPI_0004': 'OlivOS GoCq进程托管服务组件 错误: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS GoCq进程托管服务组件 [{0}] 正在运作', 'libEXEModelAPI_0006': 'OlivOS GoCq进程托管服务组件 [{0}] 已经存在', - 'flaskServerAPI_0001': 'OlivOS onebotV11 flask POST服务组件 [{0}] 正在运作', + 'flaskServerAPI_0001': 'OlivOS onebotV11 flask POST服务组件 [{0}] 正在运作于端口 [{1}]', 'libCWCBEXEModelAPI_0001': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 无法找到库文件', 'libCWCBEXEModelAPI_0002': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 将在前台模式下运行', 'libCWCBEXEModelAPI_0003': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 将在10秒后重试...', From b98e2054f2e0dc5e54ce225d52bc32c17e474925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 2 Jan 2024 11:20:41 +0800 Subject: [PATCH 20/76] =?UTF-8?q?0.11.28=20Discord=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8C=87=E5=AE=9Aintents=E8=B4=A6=E5=8F=B7=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/discord/discordSDK.py | 13 ++++++++++--- OlivOS/core/info/infoAPI.py | 4 ++-- OlivOS/nativeGUI/multiLoginUIAPI.py | 16 +++++++++++++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/OlivOS/adapter/discord/discordSDK.py b/OlivOS/adapter/discord/discordSDK.py index e6834a29..b27cf7e6 100644 --- a/OlivOS/adapter/discord/discordSDK.py +++ b/OlivOS/adapter/discord/discordSDK.py @@ -78,8 +78,9 @@ class intents_T(IntEnum): class bot_info_T(object): - def __init__(self, id=-1, access_token=None, model='private'): + def __init__(self, id=-1, port=-1, access_token=None, model='private'): self.id = id + self.intents = port self.access_token = access_token self.model = model self.debug_mode = False @@ -89,6 +90,7 @@ def __init__(self, id=-1, access_token=None, model='private'): def get_SDK_bot_info_from_Plugin_bot_info(plugin_bot_info): res = bot_info_T( plugin_bot_info.id, + plugin_bot_info.post_info.port, plugin_bot_info.post_info.access_token ) res.debug_mode = plugin_bot_info.debug_mode @@ -178,9 +180,14 @@ def __init__(self, data): payload_template.__init__(self, data, True) class sendIdentify(payload_template): - def __init__(self, bot_info, - intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE | intents_T.GUILD_MESSAGES))): + def __init__( + self, + bot_info:bot_info_T, + intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE | intents_T.GUILD_MESSAGES)) + ): tmp_intents = intents + if bot_info.model == 'intents': + tmp_intents = bot_info.intents payload_template.__init__(self) self.data.op = 2 try: diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index e74409de..b0c7c27a 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.27' -OlivOS_SVN = 147 +OlivOS_Version = '0.11.28' +OlivOS_SVN = 148 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 7f104e03..dc4544a6 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -375,6 +375,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non '米游社/大别野/私域', '米游社/大别野/沙盒', 'Discord', + 'Discord/指定intents', 'Telegram', 'Fanbook', 'Hack.Chat', @@ -696,6 +697,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'TOKEN': 'edit_root_Entry_Server_access_token' } ], + 'Discord/指定intents': ['discord', 'discord_link', 'intents', 'True', 'websocket', { + 'TOKEN': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + } + ], '渡渡语音/Dodo/V2': ['dodo', 'dodo_link', 'default', 'True', 'websocket', { 'BotID': 'edit_root_Entry_ID', 'Bot私钥': 'edit_root_Entry_Server_access_token' @@ -885,7 +891,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non }, 'discord': { 'discord_link': [ - 'default' + 'default', + 'intents' ] }, 'dodo': { @@ -1055,8 +1062,11 @@ def tree_edit_commit(self): tmp_password = 'NONEED' if tmp_host == '': tmp_host = 'NONEED' - if tmp_port == '': - tmp_port = '0' + if tmp_platform_model not in [ + 'intents' + ]: + if tmp_port == '': + tmp_port = '0' if tmp_platform_platform == 'kaiheila' \ and tmp_platform_sdk == 'kaiheila_link': if tmp_id == '': From 245116a1df646d2eee8bd9721514e9c2923c2680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 2 Jan 2024 11:33:13 +0800 Subject: [PATCH 21/76] Update discordSDK.py --- OlivOS/adapter/discord/discordSDK.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/OlivOS/adapter/discord/discordSDK.py b/OlivOS/adapter/discord/discordSDK.py index b27cf7e6..cc7b9103 100644 --- a/OlivOS/adapter/discord/discordSDK.py +++ b/OlivOS/adapter/discord/discordSDK.py @@ -253,14 +253,20 @@ def do_api(self, req_type='POST', proxy=None): msg_res = None if req_type == 'POST': - msg_res = req.request("POST", send_url, headers=headers, data=payload, - proxies=OlivOS.webTool.get_system_proxy()) + msg_res = req.request( + "POST", + send_url, + headers=headers, + data=payload, + proxies=OlivOS.webTool.get_system_proxy() + ) elif req_type == 'GET': - msg_res = req.request("GET", send_url, headers=headers, proxies=OlivOS.webTool.get_system_proxy()) - - if self.bot_info.debug_mode: - if self.bot_info.debug_logger is not None: - self.bot_info.debug_logger.log(0, self.node_ext + ' - sendding succeed: ' + msg_res.text) + msg_res = req.request( + "GET", + send_url, + headers=headers, + proxies=OlivOS.webTool.get_system_proxy() + ) self.res = msg_res.text return msg_res.text From 2be56195602158deade181d389d0a98f8054a5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 2 Jan 2024 16:37:53 +0800 Subject: [PATCH 22/76] =?UTF-8?q?KOOK=20=E6=96=B0=E5=A2=9E=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=82=B9=E5=87=BB=E5=93=8D=E5=BA=94=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E5=88=B0=E6=B6=88=E6=81=AF=E4=BA=8B=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/kaiheila/kaiheilaLinkServerAPI.py | 1 + OlivOS/adapter/kaiheila/kaiheilaSDK.py | 101 +++++++++++++++++- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py b/OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py index 6bd01c78..36292c59 100644 --- a/OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py +++ b/OlivOS/adapter/kaiheila/kaiheilaLinkServerAPI.py @@ -76,6 +76,7 @@ def on_message(self, ws, message): tmp_data_rx_obj = OlivOS.kaiheilaSDK.PAYLOAD.rxPacket( data=json.loads(message) ) + # print(json.dumps(json.loads(message), indent=4, ensure_ascii=False)) if tmp_data_rx_obj.data.s == 0: self.Proc_data['extend_data']['last_s'] = tmp_data_rx_obj.data.sn sdk_event = OlivOS.kaiheilaSDK.event(tmp_data_rx_obj, self.Proc_data['bot_info_dict']) diff --git a/OlivOS/adapter/kaiheila/kaiheilaSDK.py b/OlivOS/adapter/kaiheila/kaiheilaSDK.py index 73ecaf1e..835097be 100644 --- a/OlivOS/adapter/kaiheila/kaiheilaSDK.py +++ b/OlivOS/adapter/kaiheila/kaiheilaSDK.py @@ -567,7 +567,106 @@ def get_Event_from_SDK(target_event): except Exception as e: traceback.print_exc() target_event.active = False - + else: + if 'type' in target_event.sdk_event.payload.data.d \ + and target_event.sdk_event.payload.data.d['type'] == 255 \ + and 'extra' in target_event.sdk_event.payload.data.d \ + and type(target_event.sdk_event.payload.data.d['extra']) is dict: + if 'body' in target_event.sdk_event.payload.data.d['extra'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']) is dict \ + and 'type' in target_event.sdk_event.payload.data.d['extra'] \ + and target_event.sdk_event.payload.data.d['extra']['type'] == 'message_btn_click': + if 'channel_type' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and target_event.sdk_event.payload.data.d['extra']['body']['channel_type'] == 'PERSON' \ + and 'target_id' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['target_id']) is str \ + and 'user_id' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_id']) is str \ + and 'value' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['value']) is str \ + and 'user_info' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']) is dict \ + and 'id' in target_event.sdk_event.payload.data.d['extra']['body']['user_info'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']['id']) is str \ + and 'username' in target_event.sdk_event.payload.data.d['extra']['body']['user_info'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']['username']) is str: + target_event.active = True + target_event.plugin_info['func_type'] = 'private_message' + msg = target_event.sdk_event.payload.data.d['extra']['body']['value'] + user_id = target_event.sdk_event.payload.data.d['extra']['body']['user_info']['id'] + user_name = target_event.sdk_event.payload.data.d['extra']['body']['user_info']['username'] + message_obj = OlivOS.messageAPI.Message_templet( + 'olivos_para', + [OlivOS.messageAPI.PARA.text(text=msg)] + ) + target_event.data = target_event.private_message( + user_id, + message_obj, + 'friend' + ) + target_event.data.message_sdk = message_obj + target_event.data.message_id = str(-1) + target_event.data.raw_message = message_obj + target_event.data.raw_message_sdk = message_obj + target_event.data.font = None + target_event.data.sender['user_id'] = user_id + target_event.data.sender['nickname'] = user_name + target_event.data.sender['id'] = user_id + target_event.data.sender['name'] = user_name + target_event.data.sender['sex'] = 'unknown' + target_event.data.sender['age'] = 0 + target_event.data.extend['flag_from_direct'] = True + if plugin_event_bot_hash in sdkSubSelfInfo: + target_event.data.extend['sub_self_id'] = str(sdkSubSelfInfo[plugin_event_bot_hash]) + elif 'channel_type' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and target_event.sdk_event.payload.data.d['extra']['body']['channel_type'] == 'GROUP' \ + and 'target_id' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['target_id']) is str \ + and 'guild_id' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['guild_id']) is str \ + and 'user_id' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_id']) is str \ + and 'value' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['value']) is str \ + and 'user_info' in target_event.sdk_event.payload.data.d['extra']['body'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']) is dict \ + and 'id' in target_event.sdk_event.payload.data.d['extra']['body']['user_info'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']['id']) is str \ + and 'username' in target_event.sdk_event.payload.data.d['extra']['body']['user_info'] \ + and type(target_event.sdk_event.payload.data.d['extra']['body']['user_info']['username']) is str: + target_event.active = True + target_event.plugin_info['func_type'] = 'group_message' + msg = target_event.sdk_event.payload.data.d['extra']['body']['value'] + host_id = target_event.sdk_event.payload.data.d['extra']['body']['guild_id'] + group_id = target_event.sdk_event.payload.data.d['extra']['body']['target_id'] + user_id = target_event.sdk_event.payload.data.d['extra']['body']['user_info']['id'] + user_name = target_event.sdk_event.payload.data.d['extra']['body']['user_info']['username'] + message_obj = OlivOS.messageAPI.Message_templet( + 'olivos_para', + [OlivOS.messageAPI.PARA.text(text=msg)] + ) + target_event.data = target_event.group_message( + group_id, + user_id, + message_obj, + 'group' + ) + target_event.data.message_sdk = message_obj + target_event.data.message_id = str(-1) + target_event.data.raw_message = message_obj + target_event.data.raw_message_sdk = message_obj + target_event.data.font = None + target_event.data.sender['user_id'] = user_id + target_event.data.sender['nickname'] = user_name + target_event.data.sender['id'] = user_id + target_event.data.sender['name'] = user_name + target_event.data.sender['sex'] = 'unknown' + target_event.data.sender['age'] = 0 + target_event.data.sender['role'] = 'member' + target_event.data.host_id = host_id + target_event.data.extend['flag_from_direct'] = False + if plugin_event_bot_hash in sdkSubSelfInfo: + target_event.data.extend['sub_self_id'] = str(sdkSubSelfInfo[plugin_event_bot_hash]) # 支持OlivOS API调用的方法实现 class event_action(object): From 972a4010ab5adf141e6cebee4d2c676da11565b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 4 Jan 2024 19:54:28 +0800 Subject: [PATCH 23/76] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3eae0fc7..79b1be2d 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,10 @@ ## 方针 技术路线上,基于Python、采用模块化框架、进程分离、消息队列通信、前后端分离、响应式布局、渐进式渲染的基本思路,实现一个高并发性、高可靠性、高适应性的整体方案。 +## 欢迎点击Star,这对我们将带来很大的支持! +[![Star History Chart](https://api.star-history.com/svg?repos=OlivOS-Team/OlivOS&type=Date)](https://star-history.com/#OlivOS-Team/OlivOS&Date) + + ## 开始使用 ### 发布版本 #### Windows From 0108bf7035ae874389bd4b6d2ac18af2140a5c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 5 Jan 2024 11:26:52 +0800 Subject: [PATCH 24/76] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=B1=B3=E6=B8=B8?= =?UTF-8?q?=E7=A4=BE=E5=8F=91=E9=80=81=E5=8D=A1=E7=89=87=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/mhyVila/mhyVilaSDK.py | 63 ++++++++++++++++++++++++++++ OlivOS/core/core/API.py | 4 +- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/mhyVila/mhyVilaSDK.py b/OlivOS/adapter/mhyVila/mhyVilaSDK.py index 57becc9a..a377489e 100644 --- a/OlivOS/adapter/mhyVila/mhyVilaSDK.py +++ b/OlivOS/adapter/mhyVila/mhyVilaSDK.py @@ -497,3 +497,66 @@ def send_group_msg(target_event, chat_id, message, host_id = None): api_obj.data.object_name = 'MHY:Text' api_obj.do_api('POST') return None + + def create_panel_message(target_event, chat_id, object_name, content:dict, host_id = None): + res_data = OlivOS.contentAPI.api_result_data_template.universal_result() + res_data['active'] = True + if host_id is None: + try: + host_id = target_event.data.host_id + except: + pass + sdk_bot_info = get_SDK_bot_info_from_Event(target_event) + api_obj = API.sendMessage(sdk_bot_info) + api_obj.headdata.vila_id = host_id + api_obj.data.room_id = chat_id + api_obj.data.msg_content = json.dumps(content) + api_obj.data.object_name = object_name + api_obj.do_api('POST') + res_data['data'] = {} + res_data['data']['chat_type'] = 'private' if False else 'group' + res_data['data']['chat_id'] = str(chat_id) + res_data['data']['object_name'] = str(object_name) + res_data['data']['content'] = str(json.dumps(content, ensure_ascii = False)) + return res_data + + +class inde_interface(OlivOS.API.inde_interface_T): + @OlivOS.API.Event.callbackLogger('mhyVila:create_message', ['chat_type', 'chat_id', 'object_name', 'content']) + def __create_message(target_event, chat_type:str, chat_id:str, object_name:str, content:dict, host_id=None, flag_log:bool=True): + res_data = None + if chat_type == 'group': + res_data = OlivOS.mhyVilaSDK.event_action.create_panel_message( + target_event = target_event, + chat_id = chat_id, + object_name = object_name, + content = content, + host_id = host_id + ) + return res_data + + def create_message( + self, + chat_type:str, + chat_id:str, + object_name:str, + content:dict, + host_id:'str|None' = None, + flag_log: bool = True, + remote: bool = False + ): + res_data = None + if remote: + pass + else: + res_data = inde_interface.__create_message( + self.event, + chat_type = chat_type, + chat_id = chat_id, + object_name = object_name, + content = content, + host_id = host_id, + flag_log = True + ) + return res_data + diff --git a/OlivOS/core/core/API.py b/OlivOS/core/core/API.py index 06ab58ae..8635e8e7 100644 --- a/OlivOS/core/core/API.py +++ b/OlivOS/core/core/API.py @@ -169,6 +169,8 @@ def __init_inde_interface(self): self.indeAPI = inde_interface_T(self, self.platform['platform']) if self.platform['sdk'] == 'kaiheila_link': self.indeAPI = OlivOS.kaiheilaSDK.inde_interface(self, self.platform['platform']) + if self.platform['sdk'] == 'mhyVila_link': + self.indeAPI = OlivOS.mhyVilaSDK.inde_interface(self, self.platform['platform']) def get_Event_from_SDK(self): if self.sdk_event_type is OlivOS.virtualTerminalSDK.event: @@ -600,7 +602,7 @@ def funcWarpped(*args, **kwargs): callback_msg_list.append( '%s(%s)' % ( val_list_this, - warppedRes['data'][val_list_this] + str(warppedRes['data'][val_list_this]) ) ) callback_msg = ' '.join(callback_msg_list) From 3fd822436a5eab29a107d3f6a36ecf0d158f5526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 7 Feb 2024 15:55:35 +0800 Subject: [PATCH 25/76] =?UTF-8?q?=E5=B0=86OPQBot=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=BE=A4=E7=94=A8=E6=88=B7=E8=AE=BE=E7=BD=AE=E4=B8=BA=E4=B8=8D?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E7=BE=A4=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index 103b38d7..a8455eb7 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -147,7 +147,8 @@ def get_Event_from_SDK(target_event): target_event.data.sender['name'] = target_event.data.sender['nickname'] target_event.data.sender['sex'] = 'unknown' target_event.data.sender['age'] = 0 - target_event.data.sender['role'] = 'member' + if 'role' in target_event.data.sender: + target_event.data.sender.pop('role') target_event.data.host_id = None elif target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': if type(target_event.sdk_event.payload.EventData) is dict \ @@ -186,7 +187,6 @@ def get_Event_from_SDK(target_event): target_event.data.sender['name'] = target_event.data.sender['nickname'] target_event.data.sender['sex'] = 'unknown' target_event.data.sender['age'] = 0 - target_event.data.sender['role'] = 'member' target_event.data.host_id = None elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': if type(target_event.sdk_event.payload.EventData) is dict \ From 433a466dad2d9db8d93762245bd6cabf641cf654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 22 Feb 2024 15:56:58 +0800 Subject: [PATCH 26/76] =?UTF-8?q?=E8=BF=9B=E8=A1=8CLiteLoaderQQNT-OneBotAp?= =?UTF-8?q?i=E5=88=9D=E6=AD=A5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #115 --- OlivOS/adapter/onebotV11/onebotSDK.py | 86 +++++++++++++++------------ 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 815fa518..f5ede9df 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -156,10 +156,33 @@ def event_load(self, raw): return res +def format_cq_code_msg(msg): + res = msg + if type(msg) is str: + res = msg + elif type(msg) is list: + res = '' + for msg_this in msg: + if type(msg_this) is dict \ + and 'type' in msg_this \ + and 'data' in msg_this \ + and type(msg_this['data']) is dict: + if msg_this['type'] == 'text': + if 'text' in msg_this['data']: + res += msg_this['data']['text'] + elif msg_this['type'] == 'at': + if 'qq' in msg_this['data']: + res += f"[CQ:at,qq={msg_this['data']['qq']}]" + else: + res += '[' + ','.join([f"CQ:{msg_this['type']}"] + [f"{key_this}={msg_this['data'][key_this]}" for key_this in msg_this['data']]) + ']' + return res + + # 支持OlivOS API事件生成的映射实现 def get_Event_from_SDK(target_event): target_event.base_info['time'] = target_event.sdk_event.base_info.get('time', int(time.time())) target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) + print(target_event.base_info['self_id']) target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] target_event.platform['sdk'] = target_event.sdk_event.platform['sdk'] target_event.platform['platform'] = target_event.sdk_event.platform['platform'] @@ -172,18 +195,16 @@ def get_Event_from_SDK(target_event): if target_event.sdk_event.json['message_type'] == 'private': target_event.active = True target_event.plugin_info['func_type'] = 'private_message_sent' + new_msg = format_cq_code_msg(target_event.sdk_event.json['message']) target_event.data = target_event.private_message_sent( str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['message'], + new_msg, target_event.sdk_event.json['sub_type'] ) - target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json['message']) + target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.message_id = str(target_event.sdk_event.json['message_id']) - target_event.data.raw_message = target_event.sdk_event.json['raw_message'] - target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'raw_message']) + target_event.data.raw_message = new_msg + target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.font = target_event.sdk_event.json['font'] target_event.data.sender.update(target_event.sdk_event.json['sender']) if 'user_id' in target_event.sdk_event.json['sender']: @@ -194,20 +215,17 @@ def get_Event_from_SDK(target_event): if target_event.sdk_event.json['sub_type'] == 'normal': target_event.active = True target_event.plugin_info['func_type'] = 'group_message_sent' + new_msg = format_cq_code_msg(target_event.sdk_event.json['message']) target_event.data = target_event.group_message_sent( str(target_event.sdk_event.json['group_id']), str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['message'], + new_msg, target_event.sdk_event.json['sub_type'] ) - target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'message']) + target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.message_id = str(target_event.sdk_event.json['message_id']) - target_event.data.raw_message = target_event.sdk_event.json['raw_message'] - target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'raw_message']) + target_event.data.raw_message = new_msg + target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.font = target_event.sdk_event.json['font'] target_event.data.sender.update(target_event.sdk_event.json['sender']) if 'user_id' in target_event.sdk_event.json['sender']: @@ -218,18 +236,16 @@ def get_Event_from_SDK(target_event): if target_event.sdk_event.json['message_type'] == 'private': target_event.active = True target_event.plugin_info['func_type'] = 'private_message' + new_msg = format_cq_code_msg(target_event.sdk_event.json['message']) target_event.data = target_event.private_message( str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['message'], + new_msg, target_event.sdk_event.json['sub_type'] ) - target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json['message']) + target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.message_id = str(target_event.sdk_event.json['message_id']) - target_event.data.raw_message = target_event.sdk_event.json['raw_message'] - target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'raw_message']) + target_event.data.raw_message = new_msg + target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.font = target_event.sdk_event.json['font'] target_event.data.sender.update(target_event.sdk_event.json['sender']) if 'user_id' in target_event.sdk_event.json['sender']: @@ -240,20 +256,17 @@ def get_Event_from_SDK(target_event): if target_event.sdk_event.json['sub_type'] == 'normal': target_event.active = True target_event.plugin_info['func_type'] = 'group_message' + new_msg = format_cq_code_msg(target_event.sdk_event.json['message']) target_event.data = target_event.group_message( str(target_event.sdk_event.json['group_id']), str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['message'], + new_msg, target_event.sdk_event.json['sub_type'] ) - target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'message']) + target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.message_id = str(target_event.sdk_event.json['message_id']) - target_event.data.raw_message = target_event.sdk_event.json['raw_message'] - target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'raw_message']) + target_event.data.raw_message = new_msg + target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.font = target_event.sdk_event.json['font'] target_event.data.sender.update(target_event.sdk_event.json['sender']) if 'user_id' in target_event.sdk_event.json['sender']: @@ -264,20 +277,17 @@ def get_Event_from_SDK(target_event): if target_event.sdk_event.json['sub_type'] == 'channel': target_event.active = True target_event.plugin_info['func_type'] = 'group_message' + new_msg = format_cq_code_msg(target_event.sdk_event.json['message']) target_event.data = target_event.group_message( str(target_event.sdk_event.json['channel_id']), str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['message'], + new_msg, target_event.sdk_event.json['sub_type'] ) - target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'message']) + target_event.data.message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.message_id = str(target_event.sdk_event.json['message_id']) - target_event.data.raw_message = target_event.sdk_event.json['message'] - target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', - target_event.sdk_event.json[ - 'message']) + target_event.data.raw_message = new_msg + target_event.data.raw_message_sdk = OlivOS.messageAPI.Message_templet('old_string', new_msg) target_event.data.font = None target_event.data.sender.update(target_event.sdk_event.json['sender']) if 'user_id' in target_event.sdk_event.json['sender']: From fc7cd0a14d5e1689614f0c2b20ea634257e3356c Mon Sep 17 00:00:00 2001 From: willkyu <87601487+willkyu@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:52:53 +0800 Subject: [PATCH 27/76] Update onebotSDK.py --- OlivOS/adapter/onebotV11/onebotSDK.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index f5ede9df..628d566f 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -61,7 +61,8 @@ def send_onebot_post_json(self): return None else: try: - json_str_tmp = json.dumps(obj=self.obj.__dict__, ensure_ascii=False) + clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host if tmp_host.startswith('http://') or tmp_host.startswith('https://'): pass From d4105862a877e92a7e4dad18e879ac37a91f1f16 Mon Sep 17 00:00:00 2001 From: willkyu <87601487+willkyu@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:04:09 +0800 Subject: [PATCH 28/76] Update onebotSDK.py --- OlivOS/adapter/onebotV11/onebotSDK.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 628d566f..17dc03c9 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -61,7 +61,10 @@ def send_onebot_post_json(self): return None else: try: - clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + # clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + clear_dict = self.obj.__dict__ + if clear_dict['message_type']=='private': + clear_dict.pop('group_id','No "group_id"') json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host if tmp_host.startswith('http://') or tmp_host.startswith('https://'): From 4cbddbcf37a2969bc3221d49d48bd61d3e233a53 Mon Sep 17 00:00:00 2001 From: willkyu <87601487+willkyu@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:17:16 +0800 Subject: [PATCH 29/76] Update onebotSDK.py --- OlivOS/adapter/onebotV11/onebotSDK.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 17dc03c9..bee91c75 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -63,7 +63,7 @@ def send_onebot_post_json(self): try: # clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} clear_dict = self.obj.__dict__ - if clear_dict['message_type']=='private': + if clear_dict.get('message_type')=='private': clear_dict.pop('group_id','No "group_id"') json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host From 97acb901af1ff26046617c69d2a00b809de5db3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 11:53:46 +0800 Subject: [PATCH 30/76] =?UTF-8?q?OPQ=EF=BC=9A=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=BE=A4=E9=82=80=E8=AF=B7=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 110 +++++++++++++++++++++----- OlivOS/adapter/onebotV11/onebotSDK.py | 8 +- OlivOS/core/core/API.py | 2 + 3 files changed, 99 insertions(+), 21 deletions(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index a8455eb7..11df06f4 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -32,6 +32,8 @@ gUinfoReg = {} +gMsgSeqToGroupCodeReg = {} + class bot_info_T(object): def __init__(self, id=-1): self.id = id @@ -188,6 +190,26 @@ def get_Event_from_SDK(target_event): target_event.data.sender['sex'] = 'unknown' target_event.data.sender['age'] = 0 target_event.data.host_id = None + elif target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_INVITE': + if type(target_event.sdk_event.payload.EventData) is dict \ + and 'MsgHead' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ + and 'FromUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) is int \ + and 'Event' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['Event']) is dict \ + and 'Invitee' in target_event.sdk_event.payload.EventData['Event'] \ + and type(target_event.sdk_event.payload.EventData['Event']['Invitee']) in [str, int] \ + and 'Invitor' in target_event.sdk_event.payload.EventData['Event'] \ + and type(target_event.sdk_event.payload.EventData['Event']['Invitor']) in [str, int]: + target_event.active = True + target_event.plugin_info['func_type'] = 'group_member_increase' + target_event.data = target_event.group_member_increase( + str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']), + str(target_event.sdk_event.payload.EventData['Event']['Invitor']), + str(target_event.sdk_event.payload.EventData['Event']['Invitee']) + ) + target_event.data.action = 'approve' elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': if type(target_event.sdk_event.payload.EventData) is dict \ and 'ReqUid' in target_event.sdk_event.payload.EventData \ @@ -210,32 +232,31 @@ def get_Event_from_SDK(target_event): target_event.sdk_event.payload.EventData['MsgAdditional'] ) target_event.data.flag = str(target_event.sdk_event.payload.EventData['ReqUid']) - elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_SYSTEM_MSG_NOTIFY': + elif target_event.sdk_event.payload.EventName == 'ON_EVENT_GROUP_SYSTEM_MSG_NOTIFY': if type(target_event.sdk_event.payload.EventData) is dict \ + and 'MsgType' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgType']) is int \ and 'GroupCode' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['GroupCode']) is int \ - and 'ReqUid' in target_event.sdk_event.payload.EventData \ - and type(target_event.sdk_event.payload.EventData['ReqUid']) is str \ + and 'MsgSeq' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgSeq']) is int \ and 'Status' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['Status']) is int \ - and target_event.sdk_event.payload.EventData['Status'] in [1, 2] \ and 'MsgAdditional' in target_event.sdk_event.payload.EventData \ - and type(target_event.sdk_event.payload.EventData['MsgAdditional']) is str: - target_event.active = True - target_event.plugin_info['func_type'] = 'friend_add_request' - uin = str(target_event.sdk_event.payload.EventData['ReqUid']) - if OlivOS.pluginAPI.gProc is not None: - uin = event_action.getUinfo( - target_event = target_event, - Uid = target_event.sdk_event.payload.EventData['ReqUid'], - control_queue = OlivOS.pluginAPI.gProc.Proc_info.control_queue + and type(target_event.sdk_event.payload.EventData['MsgAdditional']) is str \ + and 'ActorUid' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['ActorUid']) in [str, int]: + if target_event.sdk_event.payload.EventData['MsgType'] == 2 \ + and target_event.sdk_event.payload.EventData['Status'] == 1: + target_event.active = True + target_event.plugin_info['func_type'] = 'group_invite_request' + target_event.data = target_event.group_invite_request( + str(target_event.sdk_event.payload.EventData['GroupCode']), + str(target_event.sdk_event.payload.EventData['ActorUid']), + target_event.sdk_event.payload.EventData['MsgAdditional'] ) - target_event.data = target_event.group_add_request( - str(target_event.sdk_event.payload.EventData['GroupCode']), - str(uin), - target_event.sdk_event.payload.EventData['MsgAdditional'] - ) - target_event.data.flag = str(target_event.sdk_event.payload.EventData['ReqUid']) + target_event.data.flag = str(target_event.sdk_event.payload.EventData['MsgSeq']) + gMsgSeqToGroupCodeReg[target_event.data.flag] = target_event.sdk_event.payload.EventData['GroupCode'] ''' @@ -427,6 +448,23 @@ def __init__(self, UidQuery:'list[str]', CurrentQQ:'int|str'): } } + class SystemMsgAction_Group(payload_template): + def __init__(self, MsgSeq:int, MsgType:int, GroupCode:int, OpCode:int, CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "SystemMsgAction.Group" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + "MsgSeq": MsgSeq, + "MsgType": MsgType, + "GroupCode": GroupCode, + "OpCode": OpCode + } + } + # 支持OlivOS API调用的方法实现 class event_action(object): @@ -657,6 +695,40 @@ def set_group_leave(target_event, group_id, control_queue): control_queue ) + def set_group_add_request(target_event, flag:str, sub_type:str, approve:bool, control_queue): + if target_event.bot_info != None: + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + sub_type_int = None + OpCode_int = None + GroupCode_this = None + if sub_type == 'invite': + sub_type_int = 1 + GroupCode_this = gMsgSeqToGroupCodeReg.get(str(flag), None) + if approve is True: + OpCode_int = 1 + else: + OpCode_int = 2 + elif sub_type == 'add': + pass + if sub_type_int is not None: + send_ws_event( + plugin_event_bot_hash, + PAYLOAD.SystemMsgAction_Group( + MsgSeq = int(flag), + MsgType = sub_type_int, + GroupCode = GroupCode_this, + OpCode = OpCode_int, + CurrentQQ = target_event.base_info['self_id'] + ).dump(), + control_queue + ) + + def get_group_list(target_event:OlivOS.API.Event, control_queue): res_data = OlivOS.contentAPI.api_result_data_template.get_group_list() if target_event.bot_info != None: diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index f5ede9df..03f29cb0 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -61,7 +61,11 @@ def send_onebot_post_json(self): return None else: try: - json_str_tmp = json.dumps(obj=self.obj.__dict__, ensure_ascii=False) + # clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + clear_dict = self.obj.__dict__ + if clear_dict.get('message_type')=='private': + clear_dict.pop('group_id','No "group_id"') + json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host if tmp_host.startswith('http://') or tmp_host.startswith('https://'): pass @@ -343,7 +347,7 @@ def get_Event_from_SDK(target_event): target_event.plugin_info['func_type'] = 'group_member_increase' target_event.data = target_event.group_member_increase( str(target_event.sdk_event.json['group_id']), - str(target_event.sdk_event.json['operator_id']), + str(target_event.sdk_event.json.get('operator_id', '-1')), str(target_event.sdk_event.json['user_id']) ) if target_event.sdk_event.json['sub_type'] == 'approve': diff --git a/OlivOS/core/core/API.py b/OlivOS/core/core/API.py index 8635e8e7..39c8cff4 100644 --- a/OlivOS/core/core/API.py +++ b/OlivOS/core/core/API.py @@ -1244,6 +1244,8 @@ def __set_group_add_request(self, flag, sub_type, approve, reason, flag_log=True OlivOS.onebotV12SDK.event_action.set_group_add_request(self, flag, sub_type, approve, reason) elif self.platform['model'] in OlivOS.flaskServerAPI.gCheckList: OlivOS.onebotSDK.event_action.set_group_add_request(self, flag, sub_type, approve, reason) + elif self.platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + OlivOS.OPQBotSDK.event_action.set_group_add_request(self, flag, sub_type, approve, self.plugin_info['control_queue']) elif self.platform['sdk'] == 'telegram_poll': pass From 4b2d55d7a7759de8b7e558d791329a07599ed125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 12:55:35 +0800 Subject: [PATCH 31/76] =?UTF-8?q?OPQ=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=BE=A4?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index 11df06f4..24bbbe95 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -707,7 +707,7 @@ def set_group_add_request(target_event, flag:str, sub_type:str, approve:bool, co OpCode_int = None GroupCode_this = None if sub_type == 'invite': - sub_type_int = 1 + sub_type_int = 2 GroupCode_this = gMsgSeqToGroupCodeReg.get(str(flag), None) if approve is True: OpCode_int = 1 From fd7a0fd8f1910b81cc6150f548c14a41dd3e0fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 13:25:53 +0800 Subject: [PATCH 32/76] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=B1=8F=E8=94=BDwin32?= =?UTF-8?q?=E7=89=88=E6=9C=ACdebug=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 80 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58a0a57d..e5d6c46c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,46 +126,46 @@ jobs: name: OlivOS-Win-32-old path: ./OlivOS-Win - build-win32-debug: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.7.5 - cache: pip - architecture: x86 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r ./requirements_win.txt - - name: Run packing - run: | - cp ./OlivOS/hook.py ./OlivOS/hook_bak.py - cp ./OlivOS/hook_pack_debug.py ./OlivOS/hook.py - pyinstaller ./main_debug.spec - - name: Run artifact - run: | - mkdir OlivOS-Win - cp ./dist/main.exe ./OlivOS-win/OlivOS_debug.exe - - name: Packing OlivOS-Win - uses: actions/upload-artifact@v3 - with: - name: OlivOS-Win-32-old-debug-origin - path: ./OlivOS-Win - - name: Ready for Packing - #run: | - # mkdir ./OlivOS-Win/lib - # curl -L https://github.com/Mrs4s/go-cqhttp/releases/latest/download/go-cqhttp_windows_386.exe -o ./OlivOS-Win/lib/go-cqhttp.exe - # curl -L https://github.com/onebot-walle/walle-q/releases/latest/download/walle-q-i686-windows-gnu.exe -o ./OlivOS-Win/lib/walle-q.exe - run: | - mkdir ./OlivOS-Win/lib - - name: Packing OlivOS-Win-with-lib - uses: actions/upload-artifact@v3 - with: - name: OlivOS-Win-32-old-debug - path: ./OlivOS-Win + #build-win32-debug: + # runs-on: windows-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: 3.7.5 + # cache: pip + # architecture: x86 + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # python -m pip install -r ./requirements_win.txt + # - name: Run packing + # run: | + # cp ./OlivOS/hook.py ./OlivOS/hook_bak.py + # cp ./OlivOS/hook_pack_debug.py ./OlivOS/hook.py + # pyinstaller ./main_debug.spec + # - name: Run artifact + # run: | + # mkdir OlivOS-Win + # cp ./dist/main.exe ./OlivOS-win/OlivOS_debug.exe + # - name: Packing OlivOS-Win + # uses: actions/upload-artifact@v3 + # with: + # name: OlivOS-Win-32-old-debug-origin + # path: ./OlivOS-Win + # - name: Ready for Packing + # #run: | + # # mkdir ./OlivOS-Win/lib + # # curl -L https://github.com/Mrs4s/go-cqhttp/releases/latest/download/go-cqhttp_windows_386.exe -o ./OlivOS-Win/lib/go-cqhttp.exe + # # curl -L https://github.com/onebot-walle/walle-q/releases/latest/download/walle-q-i686-windows-gnu.exe -o ./OlivOS-Win/lib/walle-q.exe + # run: | + # mkdir ./OlivOS-Win/lib + # - name: Packing OlivOS-Win-with-lib + # uses: actions/upload-artifact@v3 + # with: + # name: OlivOS-Win-32-old-debug + # path: ./OlivOS-Win build-linux-release: runs-on: ubuntu-20.04 From 966828bd269467fbcdddac89068cf333dc6abca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 13:42:23 +0800 Subject: [PATCH 33/76] =?UTF-8?q?Revert=20"=E6=9A=82=E6=97=B6=E5=B1=8F?= =?UTF-8?q?=E8=94=BDwin32=E7=89=88=E6=9C=ACdebug=E5=8C=85"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fd7a0fd8f1910b81cc6150f548c14a41dd3e0fd3. --- .github/workflows/build.yml | 80 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5d6c46c..58a0a57d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,46 +126,46 @@ jobs: name: OlivOS-Win-32-old path: ./OlivOS-Win - #build-win32-debug: - # runs-on: windows-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Setup Python - # uses: actions/setup-python@v4 - # with: - # python-version: 3.7.5 - # cache: pip - # architecture: x86 - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # python -m pip install -r ./requirements_win.txt - # - name: Run packing - # run: | - # cp ./OlivOS/hook.py ./OlivOS/hook_bak.py - # cp ./OlivOS/hook_pack_debug.py ./OlivOS/hook.py - # pyinstaller ./main_debug.spec - # - name: Run artifact - # run: | - # mkdir OlivOS-Win - # cp ./dist/main.exe ./OlivOS-win/OlivOS_debug.exe - # - name: Packing OlivOS-Win - # uses: actions/upload-artifact@v3 - # with: - # name: OlivOS-Win-32-old-debug-origin - # path: ./OlivOS-Win - # - name: Ready for Packing - # #run: | - # # mkdir ./OlivOS-Win/lib - # # curl -L https://github.com/Mrs4s/go-cqhttp/releases/latest/download/go-cqhttp_windows_386.exe -o ./OlivOS-Win/lib/go-cqhttp.exe - # # curl -L https://github.com/onebot-walle/walle-q/releases/latest/download/walle-q-i686-windows-gnu.exe -o ./OlivOS-Win/lib/walle-q.exe - # run: | - # mkdir ./OlivOS-Win/lib - # - name: Packing OlivOS-Win-with-lib - # uses: actions/upload-artifact@v3 - # with: - # name: OlivOS-Win-32-old-debug - # path: ./OlivOS-Win + build-win32-debug: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.7.5 + cache: pip + architecture: x86 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r ./requirements_win.txt + - name: Run packing + run: | + cp ./OlivOS/hook.py ./OlivOS/hook_bak.py + cp ./OlivOS/hook_pack_debug.py ./OlivOS/hook.py + pyinstaller ./main_debug.spec + - name: Run artifact + run: | + mkdir OlivOS-Win + cp ./dist/main.exe ./OlivOS-win/OlivOS_debug.exe + - name: Packing OlivOS-Win + uses: actions/upload-artifact@v3 + with: + name: OlivOS-Win-32-old-debug-origin + path: ./OlivOS-Win + - name: Ready for Packing + #run: | + # mkdir ./OlivOS-Win/lib + # curl -L https://github.com/Mrs4s/go-cqhttp/releases/latest/download/go-cqhttp_windows_386.exe -o ./OlivOS-Win/lib/go-cqhttp.exe + # curl -L https://github.com/onebot-walle/walle-q/releases/latest/download/walle-q-i686-windows-gnu.exe -o ./OlivOS-Win/lib/walle-q.exe + run: | + mkdir ./OlivOS-Win/lib + - name: Packing OlivOS-Win-with-lib + uses: actions/upload-artifact@v3 + with: + name: OlivOS-Win-32-old-debug + path: ./OlivOS-Win build-linux-release: runs-on: ubuntu-20.04 From 331d01e47461124f8d6df683f41d9d40932b1d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 13:58:39 +0800 Subject: [PATCH 34/76] =?UTF-8?q?OPQ=EF=BC=9A=E8=A7=A3=E5=86=B3=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E4=BA=8B=E4=BB=B6=E7=9A=84id=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index 24bbbe95..8caa6604 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -250,9 +250,18 @@ def get_Event_from_SDK(target_event): and target_event.sdk_event.payload.EventData['Status'] == 1: target_event.active = True target_event.plugin_info['func_type'] = 'group_invite_request' + uin = None + if False and OlivOS.pluginAPI.gProc is not None: + uin = event_action.getUinfo( + target_event = target_event, + Uid = target_event.sdk_event.payload.EventData['ActorUid'], + control_queue = OlivOS.pluginAPI.gProc.Proc_info.control_queue + ) + if uin is None: + uin = -1 target_event.data = target_event.group_invite_request( str(target_event.sdk_event.payload.EventData['GroupCode']), - str(target_event.sdk_event.payload.EventData['ActorUid']), + str(uin), target_event.sdk_event.payload.EventData['MsgAdditional'] ) target_event.data.flag = str(target_event.sdk_event.payload.EventData['MsgSeq']) From 349e44ee347f9275d2d1ae1af16bad69e64d7164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 15 May 2024 15:21:21 +0800 Subject: [PATCH 35/76] =?UTF-8?q?OPQ=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=A5=BD?= =?UTF-8?q?=E5=8F=8B=E8=AF=B7=E6=B1=82=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/OPQBot/OPQBotSDK.py | 73 ++++++++++++++++++++++++++++-- OlivOS/core/core/API.py | 2 + 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/OlivOS/adapter/OPQBot/OPQBotSDK.py b/OlivOS/adapter/OPQBot/OPQBotSDK.py index 8caa6604..bab19d3d 100644 --- a/OlivOS/adapter/OPQBot/OPQBotSDK.py +++ b/OlivOS/adapter/OPQBot/OPQBotSDK.py @@ -34,6 +34,8 @@ gMsgSeqToGroupCodeReg = {} +gFriendReqTsReg = {} + class bot_info_T(object): def __init__(self, id=-1): self.id = id @@ -74,7 +76,7 @@ def get_message(Content:str, AtUinLists:list): return res_msg def get_Event_from_SDK(target_event): - global sdkSubSelfInfo + global gFriendReqTsReg target_event.base_info['time'] = target_event.sdk_event.base_info['time'] target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] @@ -156,6 +158,31 @@ def get_Event_from_SDK(target_event): if type(target_event.sdk_event.payload.EventData) is dict \ and 'MsgHead' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ + and 'MsgType' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and target_event.sdk_event.payload.EventData['MsgHead']['MsgType'] == 528 \ + and 'C2cCmd' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and target_event.sdk_event.payload.EventData['MsgHead']['C2cCmd'] == 35 \ + and 'ToUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['ToUin']) is int \ + and 'FromUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) is int \ + and 'FromUid' in target_event.sdk_event.payload.EventData['MsgHead'] \ + and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUid']) is str: + tmp_ToUin = str(target_event.sdk_event.payload.EventData['MsgHead']['ToUin']) + tmp_FromUin = str(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) + if tmp_ToUin != tmp_FromUin: + if int(time.time()) - gFriendReqTsReg.get(tmp_FromUin, -1) >= 5: + gFriendReqTsReg[tmp_FromUin] = int(time.time()) + target_event.active = True + target_event.plugin_info['func_type'] = 'friend_add_request' + target_event.data = target_event.friend_add_request( + tmp_FromUin, + '' + ) + target_event.data.flag = str(target_event.sdk_event.payload.EventData['MsgHead']['FromUid']) + elif type(target_event.sdk_event.payload.EventData) is dict \ + and 'MsgHead' in target_event.sdk_event.payload.EventData \ + and type(target_event.sdk_event.payload.EventData['MsgHead']) is dict \ and 'FromUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ and type(target_event.sdk_event.payload.EventData['MsgHead']['FromUin']) is int \ and 'ToUin' in target_event.sdk_event.payload.EventData['MsgHead'] \ @@ -210,23 +237,25 @@ def get_Event_from_SDK(target_event): str(target_event.sdk_event.payload.EventData['Event']['Invitee']) ) target_event.data.action = 'approve' - elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_NEW_MSG': + elif False and target_event.sdk_event.payload.EventName == 'ON_EVENT_FRIEND_SYSTEM_MSG_NOTIFY': if type(target_event.sdk_event.payload.EventData) is dict \ and 'ReqUid' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['ReqUid']) is str \ and 'Status' in target_event.sdk_event.payload.EventData \ - and target_event.sdk_event.payload.EventData['Status'] == 7 \ + and type(target_event.sdk_event.payload.EventData['Status']) is int \ and 'MsgAdditional' in target_event.sdk_event.payload.EventData \ and type(target_event.sdk_event.payload.EventData['MsgAdditional']) is str: target_event.active = True target_event.plugin_info['func_type'] = 'friend_add_request' - uin = str(target_event.sdk_event.payload.EventData['ReqUid']) - if OlivOS.pluginAPI.gProc is not None: + uin = None + if False and OlivOS.pluginAPI.gProc is not None: uin = event_action.getUinfo( target_event = target_event, Uid = target_event.sdk_event.payload.EventData['ReqUid'], control_queue = OlivOS.pluginAPI.gProc.Proc_info.control_queue ) + if uin is None: + uin = -1 target_event.data = target_event.friend_add_request( str(uin), target_event.sdk_event.payload.EventData['MsgAdditional'] @@ -457,6 +486,21 @@ def __init__(self, UidQuery:'list[str]', CurrentQQ:'int|str'): } } + class SystemMsgAction_Friend(payload_template): + def __init__(self, ReqUid:int, OpCode:int, CurrentQQ:'int|str'): + payload_template.__init__(self) + self.CgiCmd = "SystemMsgAction.Friend" + self.CurrentQQ = str(CurrentQQ) + self.data = { + "ReqId": self.ReqId, + "BotUin": str(self.CurrentQQ), + "CgiCmd": self.CgiCmd, + "CgiRequest": { + "ReqUid": ReqUid, + "OpCode": OpCode + } + } + class SystemMsgAction_Group(payload_template): def __init__(self, MsgSeq:int, MsgType:int, GroupCode:int, OpCode:int, CurrentQQ:'int|str'): payload_template.__init__(self) @@ -704,6 +748,25 @@ def set_group_leave(target_event, group_id, control_queue): control_queue ) + def set_friend_add_request(target_event, flag:str, approve:bool, control_queue): + if target_event.bot_info != None: + plugin_event_bot_hash = OlivOS.API.getBotHash( + bot_id=target_event.base_info['self_id'], + platform_sdk=target_event.platform['sdk'], + platform_platform=target_event.platform['platform'], + platform_model=target_event.platform['model'] + ) + OpCode_int = 3 if approve is True else 5 + send_ws_event( + plugin_event_bot_hash, + PAYLOAD.SystemMsgAction_Friend( + ReqUid = flag, + OpCode = OpCode_int, + CurrentQQ = target_event.base_info['self_id'] + ).dump(), + control_queue + ) + def set_group_add_request(target_event, flag:str, sub_type:str, approve:bool, control_queue): if target_event.bot_info != None: plugin_event_bot_hash = OlivOS.API.getBotHash( diff --git a/OlivOS/core/core/API.py b/OlivOS/core/core/API.py index 39c8cff4..ccf34e87 100644 --- a/OlivOS/core/core/API.py +++ b/OlivOS/core/core/API.py @@ -1227,6 +1227,8 @@ def __set_friend_add_request(self, flag, approve, remark, flag_log=True): OlivOS.onebotV12SDK.event_action.set_friend_add_request(self, flag, approve, remark) elif self.platform['model'] in OlivOS.flaskServerAPI.gCheckList: OlivOS.onebotSDK.event_action.set_friend_add_request(self, flag, approve, remark) + elif self.platform['model'] in OlivOS.OPQBotLinkServerAPI.gCheckList: + OlivOS.OPQBotSDK.event_action.set_friend_add_request(self, flag, approve, self.plugin_info['control_queue']) elif self.platform['sdk'] == 'telegram_poll': pass From c7b72e9d4e6ecdcb9243903fecced4dfbff6ac99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Wed, 15 May 2024 08:54:57 +0000 Subject: [PATCH 36/76] =?UTF-8?q?telegram=EF=BC=9A=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=9B=BE=E6=96=87=E6=95=B0=E6=8D=AE=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/telegram/telegramSDK.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/OlivOS/adapter/telegram/telegramSDK.py b/OlivOS/adapter/telegram/telegramSDK.py index e8469660..e00417f4 100644 --- a/OlivOS/adapter/telegram/telegramSDK.py +++ b/OlivOS/adapter/telegram/telegramSDK.py @@ -7,7 +7,7 @@ \____/ /_____/___/ _____/ \____/ /____/ @File : OlivOS/telegramSDK.py -@Author : lunzhiPenxil仑质 +@Author : lunzhiPenxil仑质, MetaLeo元理 @Contact : lunzhipenxil@gmail.com @License : AGPL @Copyright : (C) 2020-2023, OlivOS-Team @@ -222,12 +222,20 @@ def get_message_obj_from_SDK(target_event): checkInDictSafe('photo', target_event.sdk_event.json, ['message']) ]): message_list = [] - if type(target_event.sdk_event.json['message']['photo']) == list: + if type(target_event.sdk_event.json['message']['photo']) is list: message_list.append( OlivOS.messageAPI.PARA.image( target_event.sdk_event.json['message']['photo'][0]['file_id'] ) ) + if checkByListAnd([ + checkInDictSafe('caption', target_event.sdk_event.json, ['message']) + ]): + message_list.append( + OlivOS.messageAPI.PARA.text( + text = str(target_event.sdk_event.json['message']['caption']) + ) + ) message_obj = OlivOS.messageAPI.Message_templet( 'olivos_para', message_list @@ -288,7 +296,7 @@ def get_Event_from_SDK(target_event): checkInDictSafe('message_id', target_event.sdk_event.json, ['message']), checkInDictSafe('from', target_event.sdk_event.json, ['message']), checkInDictSafe('first_name', target_event.sdk_event.json, ['message', 'from']), - checkInDictSafe('text', target_event.sdk_event.json, ['message']), + #checkInDictSafe('text', target_event.sdk_event.json, ['message']), checkEquelInDictSafe('private', target_event.sdk_event.json, ['message', 'chat', 'type']) ]): message_obj = None @@ -324,7 +332,7 @@ def get_Event_from_SDK(target_event): checkInDictSafe('from', target_event.sdk_event.json, ['message']), checkInDictSafe('id', target_event.sdk_event.json, ['message', 'from']), checkInDictSafe('first_name', target_event.sdk_event.json, ['message', 'from']), - checkInDictSafe('text', target_event.sdk_event.json, ['message']), + #checkInDictSafe('text', target_event.sdk_event.json, ['message']), checkEquelInDictSafe('group', target_event.sdk_event.json, ['message', 'chat', 'type']) ]): message_obj = None @@ -362,7 +370,7 @@ def get_Event_from_SDK(target_event): checkInDictSafe('from', target_event.sdk_event.json, ['message']), checkInDictSafe('id', target_event.sdk_event.json, ['message', 'from']), checkInDictSafe('first_name', target_event.sdk_event.json, ['message', 'from']), - checkInDictSafe('text', target_event.sdk_event.json, ['message']), + #checkInDictSafe('text', target_event.sdk_event.json, ['message']), checkEquelInDictSafe('supergroup', target_event.sdk_event.json, ['message', 'chat', 'type']) ]): message_obj = None From 2813f78b727a7e92148aee5fa28c15ece7bd9a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 28 May 2024 16:52:38 +0800 Subject: [PATCH 37/76] =?UTF-8?q?QQ=EF=BC=9A=E5=86=85=E7=BD=AENapCat?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/__init__.py | 1 + OlivOS/adapter/onebotV11/flaskServerAPI.py | 6 +- OlivOS/adapter/onebotV11/onebotSDK.py | 1 - OlivOS/core/boot/bootAPI.py | 14 + OlivOS/core/boot/bootDataAPI.py | 17 + OlivOS/libBooter/libNapCatEXEModelAPI.py | 388 +++++++++++++++++++++ OlivOS/nativeGUI/multiLoginUIAPI.py | 60 ++-- OlivOS/nativeGUI/nativeWinUIAPI.py | 343 +++++++++++++++++- 8 files changed, 806 insertions(+), 24 deletions(-) create mode 100644 OlivOS/libBooter/libNapCatEXEModelAPI.py diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index d0733efc..2e5fa8c4 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -78,6 +78,7 @@ from .libBooter import libWQEXEModelAPI from .libBooter import libCWCBEXEModelAPI from .libBooter import libOPQBotEXEModelAPI + from .libBooter import libNapCatEXEModelAPI from .nativeGUI import nativeWinUIAPI from .nativeGUI import webviewUIAPI from . import userModule diff --git a/OlivOS/adapter/onebotV11/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py index 1248b6ec..3e604824 100644 --- a/OlivOS/adapter/onebotV11/flaskServerAPI.py +++ b/OlivOS/adapter/onebotV11/flaskServerAPI.py @@ -36,7 +36,11 @@ 'gocqhttp_show_Android_Watch', 'gocqhttp_show_iPad', 'gocqhttp_show_iMac', - 'gocqhttp_show_old' + 'gocqhttp_show_old', + 'napcat', + 'napcat_hide', + 'napcat_show', + 'napcat_show_old' ] class server(OlivOS.API.Proc_templet): diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 03f29cb0..b2a30900 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -186,7 +186,6 @@ def format_cq_code_msg(msg): def get_Event_from_SDK(target_event): target_event.base_info['time'] = target_event.sdk_event.base_info.get('time', int(time.time())) target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) - print(target_event.base_info['self_id']) target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] target_event.platform['sdk'] = target_event.sdk_event.platform['sdk'] target_event.platform['platform'] = target_event.sdk_event.platform['platform'] diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index 4b9e3aae..89e37d01 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -762,6 +762,20 @@ def start(self): 'tmp_proc_mode': tmp_proc_mode } ).start() + elif basic_conf_models_this['type'] == 'napcat_lib_exe_model': + if platform.system() == 'Windows': + threading.Thread( + target = OlivOS.libNapCatEXEModelAPI.startNapCatLibExeModel, + kwargs = { + 'plugin_bot_info_dict': plugin_bot_info_dict, + 'basic_conf_models_this': basic_conf_models_this, + 'multiprocessing_dict': multiprocessing_dict, + 'Proc_dict': Proc_dict, + 'Proc_Proc_dict': Proc_Proc_dict, + 'basic_conf_models': basic_conf_models, + 'tmp_proc_mode': tmp_proc_mode + } + ).start() elif basic_conf_models_this['type'] == 'update_get': threading.Thread(target=update_get_func, args=(Proc_dict, basic_conf_models, basic_conf_models_this)).start() diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index 55b5163e..0103e701 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -33,6 +33,7 @@ "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", "OlivOS_opqbot_lib_exe_model", + "OlivOS_napcat_lib_exe_model", "OlivOS_hackChat_link", "OlivOS_OPQBot_link", "OlivOS_qqRed_link", @@ -78,6 +79,7 @@ "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", "OlivOS_opqbot_lib_exe_model", + "OlivOS_napcat_lib_exe_model", "OlivOS_hackChat_link", "OlivOS_OPQBot_link", "OlivOS_qqRed_link", @@ -102,6 +104,7 @@ "walleq_lib_exe_model", "cwcb_lib_exe_model", "opqbot_lib_exe_model", + "napcat_lib_exe_model", "hackChat_link", "OPQBot_link", "qqRed_link", @@ -134,6 +137,7 @@ "OlivOS_walleq_lib_rx_queue", "OlivOS_cwcb_lib_rx_queue", "OlivOS_opqbot_lib_rx_queue", + "OlivOS_napcat_lib_rx_queue", "OlivOS_virtual_terminal_queue", "OlivOS_hackChat_queue", "OlivOS_OPQBot_queue", @@ -516,6 +520,19 @@ "control_queue": "OlivOS_control_queue", "debug": False }, + "OlivOS_napcat_lib_exe_model": { + "enable": True, + "name": "OlivOS_napcat_lib_exe_model", + "type": "napcat_lib_exe_model", + "interval": 0.2, + "dead_interval": 1, + "rx_queue": "OlivOS_napcat_lib_rx_queue", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "target_proc": None, + "control_queue": "OlivOS_control_queue", + "debug": False + }, "OlivOS_webview_page": { "enable": True, "name": "OlivOS_webview_page", diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py new file mode 100644 index 00000000..deedc73e --- /dev/null +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -0,0 +1,388 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/libNapCatEXEModelAPI.py +@Author : lunzhiPenxil仑质 +@Contact : lunzhipenxil@gmail.com +@License : AGPL +@Copyright : (C) 2020-2023, OlivOS-Team +@Desc : None +''' + +import multiprocessing +import subprocess +import threading +import time +import os +import traceback +import json +import copy +import random +import uuid +import hashlib +import platform +import shutil +import zipfile + +import OlivOS + +modelName = 'libNapCatEXEModelAPI' + +resourceUrlPath = OlivOS.infoAPI.resourceUrlPath + +gCheckList = [ + 'napcat', + 'napcat_hide', + 'napcat_show', + 'napcat_show_old' +] + + +def startNapCatLibExeModel( + plugin_bot_info_dict, + basic_conf_models_this, + multiprocessing_dict, + Proc_dict, + Proc_Proc_dict, + basic_conf_models, + tmp_proc_mode +): + if platform.system() == 'Windows': + flagActive = False + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['model'] in gCheckList: + flagActive = True + if flagActive: + releaseDir('./lib') + #OlivOS.updateAPI.checkResouceFile( + # logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + # resouce_api=resourceUrlPath, + # resouce_name='NapCat', + # filePath='./lib/NapCat.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 + tmp_queue_name = basic_conf_models_this['rx_queue'] + '=' + bot_info_key + multiprocessing_dict[tmp_queue_name] = multiprocessing.Queue() + Proc_dict[tmp_Proc_name] = OlivOS.libNapCatEXEModelAPI.server( + Proc_name=tmp_Proc_name, + scan_interval=basic_conf_models_this['interval'], + dead_interval=basic_conf_models_this['dead_interval'], + rx_queue=multiprocessing_dict[tmp_queue_name], + tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], + control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + bot_info_dict=plugin_bot_info_dict[bot_info_key], + target_proc=None, + debug_mode=False + ) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) + +class server(OlivOS.API.Proc_templet): + def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=None, tx_queue=None, + control_queue=None, logger_proc=None, target_proc=None, debug_mode=False, bot_info_dict=None): + OlivOS.API.Proc_templet.__init__( + self, + Proc_name=Proc_name, + Proc_type='napcat_lib_exe_model', + scan_interval=scan_interval, + dead_interval=dead_interval, + rx_queue=rx_queue, + tx_queue=tx_queue, + control_queue=control_queue, + logger_proc=logger_proc + ) + self.Proc_config['debug_mode'] = debug_mode + self.Proc_data['bot_info_dict'] = bot_info_dict + self.Proc_config['target_proc'] = target_proc + self.Proc_data['check_qrcode_flag'] = False + self.Proc_data['check_stdin'] = False + self.Proc_data['model_Proc'] = None + self.flag_run = True + + def run(self): + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'napcat', + 'napcat_show' + ]: + self.send_init_event() + while self.flag_run: + releaseDir('./lib') + if not os.path.exists('./lib/NapCat.zip'): + self.log(3, OlivOS.L10NAPI.getTrans( + 'OlivOS libNapCatEXEModel server [{0}] can`t found target lib', + [self.Proc_name], modelName + )) + break + releaseDir('./conf') + 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}") + napcatTypeConfig(self.Proc_data['bot_info_dict']).setConfig() + if self.Proc_data['bot_info_dict'].platform['model'] in [ + 'napcat', + 'napcat_show' + ]: + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS libNapCatEXEModel server [{0}] will run under visiable mode', + [self.Proc_name], modelName + )) + self.clear_napcat() + self.Proc_data['check_qrcode_flag'] = False + self.Proc_data['check_stdin'] = False + time.sleep(2) + self.Proc_data['check_qrcode_flag'] = True + self.Proc_data['check_stdin'] = True + threading.Thread( + target=self.check_qrcode, + 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) + elif self.Proc_data['bot_info_dict'].platform['model'] in [ + 'napcat_show_old' + ]: + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS libNapCatEXEModel server [{0}] will run under visiable mode', + [self.Proc_name], modelName + )) + tmp_env = dict(os.environ) + subprocess.call( + 'start cmd /K "title NapCat For OlivOS| .\\napcat-utf8.bat -q ' + str(self.Proc_data['bot_info_dict'].id) + '"', + shell=True, + cwd='.\\conf\\napcat\\' + self.Proc_data['bot_info_dict'].hash, + env=tmp_env + ) + self.flag_run = False + + def on_terminate(self): + self.flag_run = False + if 'model_Proc' in self.Proc_data \ + and self.Proc_data['model_Proc'] is not None: + OlivOS.bootAPI.killByPid(self.Proc_data['model_Proc'].pid) + + def getBotIDStr(self): + tmp_self_data = self.Proc_data['bot_info_dict'].platform['platform'] + if self.Proc_data['bot_info_dict'].id is not None: + tmp_self_data = '%s|%s' % ( + self.Proc_data['bot_info_dict'].platform['platform'], + str(self.Proc_data['bot_info_dict'].id) + ) + return tmp_self_data + + def check_stdin(self, model_Proc: subprocess.Popen): + while self.Proc_data['check_stdin']: + if self.Proc_info.rx_queue.empty(): + time.sleep(0.02) + else: + try: + rx_packet_data = self.Proc_info.rx_queue.get(block=False) + except: + rx_packet_data = None + if 'data' in rx_packet_data.key and 'action' in rx_packet_data.key['data']: + if 'input' == rx_packet_data.key['data']['action']: + if 'data' in rx_packet_data.key['data']: + input_raw = str(rx_packet_data.key['data']['data']) + input_data = ('%s\r\n' % input_raw).encode('utf-8') + model_Proc.stdin.write(input_data) + model_Proc.stdin.flush() + log_data = ('%s' % input_raw) + self.send_log_event(log_data) + self.log(2, log_data, [ + (self.getBotIDStr(), 'default'), + ('napcat', 'default'), + ('onebot_send', 'default') + ]) + + def get_model_stdout(self, model_Proc: subprocess.Popen): + for line in iter(model_Proc.stdout.readline, b''): + try: + log_data = ('%s' % line.decode('utf-8', errors='replace')).rstrip('\n') + self.send_log_event(log_data) + self.log(1, log_data, [ + (self.getBotIDStr(), 'default'), + ('napcat', 'default'), + ('onebot', 'default') + ]) + except Exception as e: + self.log(4, OlivOS.L10NAPI.getTrans('OlivOS libNapCatEXEModel failed: %s\n%s' % [ + str(e), + traceback.format_exc() + ], + modelName + )) + + def send_init_event(self): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'napcat', + 'event': 'init', + 'hash': self.Proc_data['bot_info_dict'].hash + } + } + ) + + def clear_napcat(self): + file_path = f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}/qrcode.png" + if os.path.exists(file_path): + os.remove(file_path) + + def check_qrcode(self): + count = 2 * 60 + file_path = f"./conf/napcat/{self.Proc_data['bot_info_dict'].hash}/qrcode.png" + while count > 0 and self.Proc_data['check_qrcode_flag']: + if os.path.exists(file_path): + self.send_QRCode_event(file_path) + count = 0 + count -= 1 + time.sleep(1) + self.Proc_data['check_qrcode_flag'] = False + + def send_QRCode_event(self, path: str): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'napcat', + 'event': 'qrcode', + 'hash': self.Proc_data['bot_info_dict'].hash, + 'path': path + } + } + ) + + def send_log_event(self, data): + self.sendControlEventSend( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'napcat', + 'event': 'log', + 'hash': self.Proc_data['bot_info_dict'].hash, + 'data': data + } + } + ) + + def sendControlEventSend(self, action, data): + if self.Proc_info.control_queue is not None: + self.Proc_info.control_queue.put( + OlivOS.API.Control.packet( + action, + data + ), + block=False + ) + + +class napcatTypeConfig(object): + def __init__(self, bot_info_dict:OlivOS.API.bot_info_T): + self.bot_info_dict = bot_info_dict + self.config_file_str = '' + self.config_file_data = '' + self.config_file_format = {} + + def setConfig(self): + self.config_file_format['uin'] = str(self.bot_info_dict.id) + self.config_file_format['token'] = self.bot_info_dict.post_info.access_token + self.config_file_format['port'] = str(self.bot_info_dict.post_info.port) + self.config_file_format['postUrls'] = 'http://127.0.0.1:55001/OlivOSMsgApi/qq/onebot/default' + + self.config_file_data = { + "http": { + "enable": True, + "host": "", + "port": self.config_file_format['port'], + "secret": self.config_file_format['token'], + "enableHeart": False, + "enablePost": True, + "postUrls": [ + self.config_file_format['postUrls'] + ] + }, + "ws": { + "enable": False, + "host": "", + "port": 3001 + }, + "reverseWs": { + "enable": False, + "urls": [] + }, + "debug": False, + "heartInterval": 30000, + "messagePostFormat": "array", + "enableLocalFile2Url": True, + "musicSignUrl": "", + "reportSelfMessage": False, + "token": "" + } + + self.config_file_str = json.dumps(self.config_file_data, ensure_ascii = False, indent = 4) + + with open(f'./conf/napcat/{self.bot_info_dict.hash}/config/onebot11_{self.bot_info_dict.id}.json', 'w+', encoding='utf-8') as tmp: + tmp.write(self.config_file_str) + +def releaseDir(dir_path): + if not os.path.exists(dir_path): + os.makedirs(dir_path) + +def support_gbk(zip_file: zipfile.ZipFile): + name_to_info = zip_file.NameToInfo + # copy map first + for name, info in name_to_info.copy().items(): + try: + real_name = name.encode('cp437').decode('gbk') + except: + real_name = name + if real_name != name: + info.filename = real_name + del name_to_info[name] + name_to_info[real_name] = info + return zip_file + +def unzip(zip_file_path, target_dir): + with support_gbk(zipfile.ZipFile(zip_file_path, 'r', zipfile.ZIP_DEFLATED)) as zip_file: + zip_file = support_gbk(zip_file) + zip_file.extractall(target_dir) diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index dc4544a6..bf803229 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -359,11 +359,10 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'edit_root_Entry_qsign_num': 1, 'edit_root_Combobox_dict': { 'type_list': [ + 'QQ/NapCat/默认', + 'QQ/OPQ/默认', 'KOOK', 'KOOK/消息兼容', - '钉钉', - '渡渡语音/Dodo/V2', - '渡渡语音/Dodo/V1', 'QQ官方/公域/V2', 'QQ官方/公域/V2/纯频道', 'QQ官方/公域/V2/指定intents', @@ -371,26 +370,12 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ官方/私域/V2/指定intents', 'QQ官方/公域/V1', 'QQ官方/私域/V1', - '米游社/大别野/公域', - '米游社/大别野/私域', - '米游社/大别野/沙盒', 'Discord', 'Discord/指定intents', 'Telegram', 'Fanbook', 'Hack.Chat', 'Hack.Chat/私有', - 'onebotV12/正向WS', - 'onebotV11/Http', - 'onebotV11/Http/Shamrock', - 'RED协议', - 'OPQBot/正向WS', - 'B站直播间/游客', - 'B站直播间/登录', - 'FF14终端', - '虚拟终端', - '接口终端', - 'QQ/OPQ/默认', 'QQ/OPQ/指定端口', 'QQ/GoCq/安卓手表', 'QQ/GoCq/安卓手机', @@ -401,7 +386,24 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/Wq/安卓手表', 'QQ/Wq/安卓手机', 'QQ/Wq/安卓平板', + 'onebotV12/正向WS', + 'onebotV11/Http', + 'onebotV11/Http/Shamrock', + 'RED协议', + 'OPQBot/正向WS', '微信/ComWeChat', + '米游社/大别野/公域', + '米游社/大别野/私域', + '米游社/大别野/沙盒', + '渡渡语音/Dodo/V2', + '渡渡语音/Dodo/V1', + '钉钉', + 'B站直播间/游客', + 'B站直播间/登录', + 'FF14终端', + '虚拟终端', + '接口终端', + 'QQ/NapCat/旧', 'QQ/OPQ/指定端口/旧', 'QQ/GoCq/旧', 'QQ/Wq/旧', @@ -419,7 +421,9 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'RED协议': 'HTTP可以不填,反正也没实现', 'QQ/OPQ/默认': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', 'QQ/OPQ/指定端口': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', - 'QQ/OPQ/指定端口/旧': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责' + 'QQ/OPQ/指定端口/旧': '简单对接OPQ,使用闭源框架有账号安全风险,OlivOS不对此负责', + 'QQ/NapCat/默认': '使用本方法需要已经安装较新版本QQ', + 'QQ/NapCat/旧': '使用本方法需要已经安装较新版本QQ' }, 'type_clear_note_list': { 'QQ/GoCq/默认': './conf/gocqhttp/{bothash}', @@ -435,7 +439,9 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/Wq/旧': './conf/walleq/{bothash}', 'QQ/OPQ/默认': './conf/OPQBot/{bothash}', 'QQ/OPQ/指定端口': './conf/OPQBot/{bothash}', - 'QQ/OPQ/指定端口/旧': './conf/OPQBot/{bothash}' + 'QQ/OPQ/指定端口/旧': './conf/OPQBot/{bothash}', + 'QQ/NapCat/默认': './conf/napcat/{bothash}', + 'QQ/NapCat/旧': './conf/napcat/{bothash}' }, 'type_extend_note_list': { #'QQ/GoCq/默认': ['签名服务器', 'sign-server'], @@ -529,6 +535,16 @@ 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号': 'edit_root_Entry_ID', + } + ], + 'QQ/NapCat/旧': ['qq', 'onebot', 'napcat_show_old', 'True', 'post', { + 'QQ号': 'edit_root_Entry_ID', + 'TOKEN': 'edit_root_Entry_Server_access_token', + '服务端口': 'edit_root_Entry_Server_port', + } + ], 'QQ/GoCq/默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { '账号': 'edit_root_Entry_ID', '密码': 'edit_root_Entry_Password', @@ -851,7 +867,11 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'opqbot_default', 'opqbot_auto', 'opqbot_port', - 'opqbot_port_old' + 'opqbot_port_old', + 'napcat', + #'napcat_hide', + 'napcat_show', + 'napcat_show_old' ] }, 'qqGuild': { diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index 41ebf964..484d24e6 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -88,6 +88,9 @@ def __init__( self.UIObject['root_opqbot_terminal'] = {} self.UIObject['root_opqbot_terminal_data'] = {} self.UIObject['root_opqbot_terminal_data_max'] = 500 + self.UIObject['root_napcat_terminal'] = {} + self.UIObject['root_napcat_terminal_data'] = {} + self.UIObject['root_napcat_terminal_data_max'] = 500 self.UIObject['root_virtual_terminal_terminal'] = {} self.UIObject['root_virtual_terminal_terminal_data'] = {} self.UIObject['root_virtual_terminal_terminal_data_max'] = 150 @@ -103,6 +106,7 @@ def __init__( self.UIData['shallow_walleq_menu_list'] = None self.UIData['shallow_cwcb_menu_list'] = None self.UIData['shallow_opqbot_menu_list'] = None + self.UIData['shallow_napcat_menu_list'] = None self.UIData['shallow_virtual_terminal_menu_list'] = None self.UIData['shallow_plugin_data_dict'] = None self.updateShallowMenuList() @@ -126,6 +130,7 @@ def on_control_rx(self, packet): if 'data' in packet.key['data'] \ and type(packet.key['data']['data']) is dict: self.bot_info = packet.key['data']['data'] + self.UIData['shallow_napcat_menu_list'] = None self.UIData['shallow_opqbot_menu_list'] = None self.UIData['shallow_gocqhttp_menu_list'] = None self.UIData['shallow_walleq_menu_list'] = None @@ -187,6 +192,64 @@ def mainrun(self): if self.UIObject['root_OlivOS_terminal'] is not None: self.UIObject['root_OlivOS_terminal'].tree_add_line( rx_packet_data.key['data']['data']) + elif 'napcat' == rx_packet_data.key['data']['action']: + if 'event' in rx_packet_data.key['data']: + if 'init' == rx_packet_data.key['data']['event']: + if self.UIData['shallow_napcat_menu_list'] is None: + self.UIData['shallow_napcat_menu_list'] = [] + if 'hash' in rx_packet_data.key['data']: + if rx_packet_data.key['data']['hash'] in self.bot_info: + tmp_title = '%s' % ( + str(self.bot_info[rx_packet_data.key['data']['hash']].id) + ) + self.UIData['shallow_napcat_menu_list'].append( + [ + tmp_title, + rx_packet_data.key['data']['hash'], + '', + 'napcat' + ] + ) + self.updateShallowMenuList() + if self.UIObject['root_shallow'] is not None: + self.updateShallow() + self.startNapCatTerminalUISend(rx_packet_data.key['data']['hash']) + elif 'log' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data'] and 'data' in \ + rx_packet_data.key['data']: + hash = rx_packet_data.key['data']['hash'] + if hash not in self.UIObject['root_napcat_terminal_data']: + self.UIObject['root_napcat_terminal_data'][hash] = [] + self.UIObject['root_napcat_terminal_data'][hash].append( + rx_packet_data.key['data']['data']) + if len(self.UIObject['root_napcat_terminal_data'][hash]) > \ + self.UIObject['root_napcat_terminal_data_max']: + self.UIObject['root_napcat_terminal_data'][hash].pop(0) + if hash in self.UIObject['root_napcat_terminal']: + self.UIObject['root_napcat_terminal'][hash].tree_add_line( + rx_packet_data.key['data']['data']) + elif 'qrcode' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data'] and 'path' in \ + rx_packet_data.key['data']: + hash = rx_packet_data.key['data']['hash'] + if hash in self.bot_info: + if hash in self.UIObject['root_qrcode_window']: + try: + self.UIObject['root_qrcode_window'][hash].stop() + except: + pass + self.UIObject['root_qrcode_window'][hash] = QRcodeUI( + Model_name='qrcode_window', + logger_proc=self.Proc_info.logger_proc.log, + root=self, + root_tk=None, + bot=self.bot_info[hash], + path=rx_packet_data.key['data']['path'] + ) + self.UIObject['root_qrcode_window'][hash].start() + elif 'napcat_terminal_on' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data']: + self.startNapCatTerminalUI(rx_packet_data.key['data']['hash']) elif 'gocqhttp' == rx_packet_data.key['data']['action']: if 'event' in rx_packet_data.key['data']: if 'init' == rx_packet_data.key['data']['event']: @@ -450,6 +513,7 @@ def updateShallowMenuList(self): ['打开终端', self.startOlivOSTerminalUISend], #['账号管理', self.startAccountEditSendFunc()], #['账号管理', None], + ['NapCat管理', self.UIData['shallow_napcat_menu_list']], ['OPQBot管理', self.UIData['shallow_opqbot_menu_list']], ['gocqhttp管理', self.UIData['shallow_gocqhttp_menu_list']], ['walleq管理', self.UIData['shallow_walleq_menu_list']], @@ -463,12 +527,12 @@ def updateShallowMenuList(self): ['退出OlivOS', self.setOlivOSExit] ] for data_this in self.UIData['shallow_menu_list']: - if data_this[0] in ['OPQBot管理', 'gocqhttp管理', 'walleq管理', 'ComWeChat管理', '虚拟终端']: + if data_this[0] in ['NapCat管理', 'OPQBot管理', 'gocqhttp管理', 'walleq管理', 'ComWeChat管理', '虚拟终端']: if data_this[1] is not None: tmp_new.append(data_this) elif data_this[0] in ['更新OlivOS']: if self.UIObject['flag_have_update']: - data_this[0] = data_this[0] + '[有更新!]' + data_this[0] += '[有更新!]' tmp_new.append(data_this) else: tmp_new.append(data_this) @@ -509,6 +573,11 @@ def resFunc(): self.startOPQBotTerminalUISend(hash) return resFunc + def startNapCatTerminalUISendFunc(self, hash): + def resFunc(): + self.startNapCatTerminalUISend(hash) + return resFunc + def startGoCqhttpTerminalUISend(self, hash): self.sendRxEvent( 'send', { @@ -565,6 +634,20 @@ def startOPQBotTerminalUISend(self, hash): } ) + def startNapCatTerminalUISend(self, hash): + self.sendRxEvent( + 'send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'napcat', + 'event': 'napcat_terminal_on', + 'hash': hash, + } + } + ) + def startGoCqhttpTerminalUI(self, hash): if hash in self.bot_info: if hash in self.UIObject['root_gocqhttp_terminal']: @@ -629,6 +712,22 @@ def startOPQBotTerminalUI(self, hash): ) self.UIObject['root_opqbot_terminal'][hash].start() + def startNapCatTerminalUI(self, hash): + if hash in self.bot_info: + if hash in self.UIObject['root_napcat_terminal']: + try: + self.UIObject['root_napcat_terminal'][hash].stop() + except: + pass + self.UIObject['root_napcat_terminal'][hash] = napcatTerminalUI( + Model_name='napcat_terminal', + logger_proc=self.Proc_info.logger_proc.log, + root=self, + root_tk=None, + bot=self.bot_info[hash] + ) + self.UIObject['root_napcat_terminal'][hash].start() + def startVirtualTerminalUISendFunc(self, hash): def resFunc(): self.startVirtualTerminalUISend(hash) @@ -741,6 +840,19 @@ def setOPQBotModelSend(self, hash, data): } ) + def setNapCatModelSend(self, hash, data): + self.sendControlEventSend('send', { + 'target': { + 'type': 'napcat_lib_exe_model', + 'hash': hash + }, + 'data': { + 'action': 'input', + 'data': data + } + } + ) + def setVirtualModelSend(self, hash, data, user_conf=None): self.sendControlEventSend('send', { 'target': { @@ -1906,6 +2018,224 @@ def exit(self): self.root.UIObject['root_opqbot_terminal'].pop(self.bot.hash) +class napcatTerminalUI(object): + def __init__(self, Model_name, logger_proc=None, root=None, root_tk=None, bot=None): + self.Model_name = Model_name + self.root = root + self.root_tk = root_tk + self.bot = bot + self.UIObject = {} + self.UIData = {} + self.UIConfig = {} + self.logger_proc = logger_proc + self.UIConfig.update(dictColorContext) + + def start(self): + self.UIObject['root'] = tkinter.Toplevel() + self.UIObject['root'].title('NapCat 终端 - %s' % str(self.bot.id)) + self.UIObject['root'].geometry('800x600') + self.UIObject['root'].minsize(800, 600) + self.UIObject['root'].grid_rowconfigure(0, weight=15) + self.UIObject['root'].grid_rowconfigure(1, weight=0) + self.UIObject['root'].grid_columnconfigure(0, weight=0) + self.UIObject['root'].grid_columnconfigure(1, weight=2) + self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].resizable( + width=True, + height=True + ) + self.UIObject['root'].configure(bg=self.UIConfig['color_001']) + + self.UIObject['style'] = ttk.Style() + fix_Treeview_color(self.UIObject['style']) + + self.UIObject['tree'] = ttk.Treeview(self.UIObject['root']) + self.UIObject['tree']['show'] = 'headings' + self.UIObject['tree']['columns'] = ('DATA') + self.UIObject['tree'].column('DATA', width=800 - 15 * 2 - 18 - 5) + self.UIObject['tree'].heading('DATA', text='日志') + self.UIObject['tree']['selectmode'] = 'browse' + self.UIObject['tree_rightkey_menu'] = tkinter.Menu(self.UIObject['root'], tearoff=False) + self.UIObject['tree'].bind('', lambda x: self.tree_rightKey(x)) + # self.tree_load() + # self.UIObject['tree'].place(x = 15, y = 15, width = 800 - 15 * 2 - 18 , height = 600 - 15 * 2 - 24 - 8) + self.UIObject['tree'].grid( + row=0, + column=0, + sticky="nsew", + rowspan=1, + columnspan=2, + padx=(15, 0), + pady=(15, 0), + ipadx=0, + ipady=0 + ) + self.UIObject['tree_yscroll'] = ttk.Scrollbar( + self.UIObject['root'], + orient="vertical", + command=self.UIObject['tree'].yview + ) + # self.UIObject['tree_yscroll'].place( + # x = 800 - 15 - 18, + # y = 15, + # width = 18, + # height = 600 - 15 * 2 - 24 - 8 + # ) + self.UIObject['tree_yscroll'].grid( + row=0, + column=2, + sticky="nsw", + rowspan=1, + columnspan=1, + padx=(0, 15), + pady=(15, 0), + ipadx=0, + ipady=0 + ) + self.UIObject['tree'].configure( + yscrollcommand=self.UIObject['tree_yscroll'].set + ) + + self.root_Entry_init( + obj_root='root', + obj_name='root_input', + str_name='root_input_StringVar', + x=15, + y=600 - 15 * 1 - 24, + width_t=0, + width=800 - 15 * 2, + height=24, + action=None, + title='输入' + ) + self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) + self.UIObject['root_input'].grid( + row=1, + column=1, + sticky="s", + rowspan=1, + columnspan=3, + padx=(15, 15), + pady=(8, 15), + ipadx=0, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') + self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) + + self.tree_init_line() + + self.UIObject['root'].mainloop() + + self.exit() + + def tree_rightKey(self, event): + # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 + # iid = self.UIObject['tree'].identify_row(event.y) + # self.UIObject['tree'].selection_set(iid) + # self.UIObject['tree'].update() + self.UIObject['tree_rightkey_menu'].delete(0, tkinter.END) + self.UIObject['tree_rightkey_menu'].add_command(label='查看', command=lambda: self.rightKey_action('show')) + self.UIObject['tree_rightkey_menu'].add_command(label='复制', command=lambda: self.rightKey_action('copy')) + self.UIObject['tree_rightkey_menu'].post(event.x_root, event.y_root) + + def rightKey_action(self, action: str): + if action == 'show': + msg = get_tree_force(self.UIObject['tree'])['text'] + if len(msg) > 0: + tkinter.messagebox.showinfo('日志内容', msg) + elif action == 'copy': + msg = get_tree_force(self.UIObject['tree'])['text'] + if len(msg) > 0: + self.UIObject['root'].clipboard_clear() + self.UIObject['root'].clipboard_append(msg) + self.UIObject['root'].update() + + def root_Entry_enter_Func(self, name): + def resFunc(event): + self.root_Entry_enter(name, event) + + return resFunc + + def root_Entry_enter(self, name, event): + if name == 'root_input': + input = self.UIData['root_input_StringVar'].get() + if len(input) >= 0 and len(input) < 1000: + self.root.setNapCatModelSend(self.bot.hash, input) + self.UIData['root_input_StringVar'].set('') + + def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, height, action, title='', + mode='NONE'): + self.UIObject[obj_name + '=Label'] = tkinter.Label( + self.UIObject[obj_root], + text=title + ) + self.UIObject[obj_name + '=Label'].configure( + bg=self.UIConfig['color_001'], + fg=self.UIConfig['color_004'] + ) + # self.UIObject[obj_name + '=Label'].place( + # x = x - width_t, + # y = y, + # width = width_t, + # height = height + # ) + self.UIData[str_name] = tkinter.StringVar() + self.UIObject[obj_name] = tkinter.Entry( + self.UIObject[obj_root], + textvariable=self.UIData[str_name] + ) + self.UIObject[obj_name].configure( + bg=self.UIConfig['color_004'], + fg=self.UIConfig['color_005'], + bd=0 + ) + if mode == 'SAFE': + self.UIObject[obj_name].configure( + show='●' + ) + self.UIObject[obj_name].configure( + width=width + ) + # self.UIObject[obj_name].place( + # x = x, + # y = y, + # width = width, + # height = height + # ) + + def tree_init_line(self): + if self.bot.hash in self.root.UIObject['root_napcat_terminal_data']: + for line in self.root.UIObject['root_napcat_terminal_data'][self.bot.hash]: + self.tree_add_line(line, flagInit = True) + + def tree_add_line(self, data, flagInit = False): + res_data = re.sub(r'\033\[[\d;]*m?', '', data) + res_data_raw = res_data + res_data = res_data.encode(encoding='gb2312', errors='replace').decode(encoding='gb2312', errors='replace') + res_data_1 = res_data + res_data = res_data.replace(' ', '\ ') + if len(res_data.replace('\ ', '')) > 0: + try: + iid = self.UIObject['tree'].insert( + '', + tkinter.END, + text=res_data_1, + values=( + res_data + ) + ) + self.UIObject['tree'].see(iid) + self.UIObject['tree'].update() + except: + pass + + def stop(self): + self.exit() + self.UIObject['root'].destroy() + + def exit(self): + self.root.UIObject['root_napcat_terminal'].pop(self.bot.hash) @@ -2906,6 +3236,15 @@ def getMenu(self, data): ) ) ) + elif item_this[3] == 'napcat': + list_new.append( + pystray.MenuItem( + item_this[0], + self.root.startNapCatTerminalUISendFunc( + item_this[1] + ) + ) + ) if len(list_new) > 0: return pystray.Menu(*list_new) else: From 7a434c9459c6424eba1434d09500c4e9d665be89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Tue, 28 May 2024 17:11:49 +0800 Subject: [PATCH 38/76] =?UTF-8?q?QQ=EF=BC=9A=E6=BF=80=E6=B4=BB=E5=86=85?= =?UTF-8?q?=E7=BD=AENapCat=E7=9A=84=E8=B5=84=E6=BA=90=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/libBooter/libNapCatEXEModelAPI.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index deedc73e..191d0214 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -59,14 +59,14 @@ def startNapCatLibExeModel( flagActive = True if flagActive: releaseDir('./lib') - #OlivOS.updateAPI.checkResouceFile( - # logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], - # resouce_api=resourceUrlPath, - # resouce_name='NapCat', - # 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', + filePath='./lib/NapCat.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 From d9292b1b2e6120cfb1660a44f2b7e2a20d044ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Tue, 28 May 2024 17:23:05 +0800 Subject: [PATCH 39/76] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 79b1be2d..3021c1c9 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ [![OnebotV11](https://img.shields.io/badge/-OnebotV11-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![OnebotV12](https://img.shields.io/badge/-OnebotV12-111111?style=flat-square&logoColor=white)](https://github.com/botuniverse/onebot) [![RED](https://img.shields.io/badge/-RED-111111?style=flat-square&logoColor=white)](https://chrononeko.github.io/QQNTRedProtocol/) +[![QQ](https://img.shields.io/badge/-QQ-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://im.qq.com/index/) +[![NapCat](https://img.shields.io/badge/-NapCat-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://github.com/NapNeko/NapCatQQ) +[![Go-CQHttp](https://img.shields.io/badge/-GoCQHttp-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://github.com/Mrs4s/go-cqhttp) +[![Walle-Q](https://img.shields.io/badge/-WalleQ-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://github.com/onebot-walle/walle-q) +[![WeChat](https://img.shields.io/badge/-WeChat-07C160?style=flat-square&logo=wechat&logoColor=white)](https://weixin.qq.com/) +[![ComWeChatBotClient](https://img.shields.io/badge/-ComWeChatBotClient-07C160?style=flat-square&logo=wechat&logoColor=white)](https://github.com/JustUndertaker/ComWeChatBotClient) [![QQ全域](https://img.shields.io/badge/-QQ%E5%85%A8%E5%9F%9F-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![QQ频道](https://img.shields.io/badge/-QQ%E9%A2%91%E9%81%93-EB1923?style=flat-square&logo=Tencent%20QQ&logoColor=white)](https://bot.q.qq.com/wiki/) [![DingTalk](https://img.shields.io/badge/-%E9%92%89%E9%92%89-007FFF?style=flat-square&logo=alibabadotcom&logoColor=white)](https://open.dingtalk.com/) From 9be8fb6989a7b2099ce5dbd8f6fdaa8c70d68ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 29 May 2024 13:01:28 +0800 Subject: [PATCH 40/76] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8E=A8=E8=BF=9B?= =?UTF-8?q?=E8=87=B30.11.30=EF=BC=8C=E8=A1=A5=E5=85=85=E5=85=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8E=E6=9C=AC=E5=9C=B0=E5=8C=96=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/onebotV11/flaskServerAPI.py | 11 +++++++++-- OlivOS/core/L10N/L10NDataAPI.py | 14 ++++++++++++++ OlivOS/core/core/accountAPI.py | 3 ++- OlivOS/core/info/infoAPI.py | 4 ++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/OlivOS/adapter/onebotV11/flaskServerAPI.py b/OlivOS/adapter/onebotV11/flaskServerAPI.py index 3e604824..84e63457 100644 --- a/OlivOS/adapter/onebotV11/flaskServerAPI.py +++ b/OlivOS/adapter/onebotV11/flaskServerAPI.py @@ -69,8 +69,10 @@ def app(self): def set_config(self): with self.Proc_config['Flask_app'].app_context(): - @current_app.route(self.Proc_config['Flask_server_xpath'] + '///', - methods=self.Proc_config['Flask_server_methods']) + @current_app.route( + f"{self.Proc_config['Flask_server_xpath']}///", + methods=self.Proc_config['Flask_server_methods'] + ) def Flask_server_func(sdk_path, platform_path, model_path): sdk_event = OlivOS.onebotSDK.event(request.get_data(as_text=True)) sdk_event.platform['sdk'] = sdk_path @@ -92,6 +94,11 @@ def run(self): str(self.Proc_config['Flask_server_port']) ], modelName )) + self.log(2, OlivOS.L10NAPI.getTrans('OlivOS flask server [{0}] is running on [{1}]', [ + self.Proc_config['Flask_name'], + f"http://127.0.0.1:{self.Proc_config['Flask_server_port']}{self.Proc_config['Flask_server_xpath']}/qq/onebot/default" + ], modelName + )) if self.Proc_config['config'].debug_mode: self.Proc_config['Flask_app'].run(host=self.Proc_config['Flask_server_host'], port=self.Proc_config['Flask_server_port']) diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index 3b928fcd..c707e5ae 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -96,7 +96,14 @@ 'libEXEModelAPI_0004': 'OlivOS libEXEModel failed: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS libEXEModel server [{0}] is running', 'libEXEModelAPI_0006': 'OlivOS libEXEModel server [{0}] exited', + 'libNapCatEXEModelAPI_0001': 'OlivOS libNapCatEXEModel server [{0}] can`t found target lib', + 'libNapCatEXEModelAPI_0002': 'OlivOS libNapCatEXEModel server [{0}] will run under visiable mode', + 'libNapCatEXEModelAPI_0003': 'OlivOS libNapCatEXEModel server [{0}] will retry in 10s...', + 'libNapCatEXEModelAPI_0004': 'OlivOS libNapCatEXEModel failed: {0}\n{1}', + 'libNapCatEXEModelAPI_0005': 'OlivOS libNapCatEXEModel server [{0}] is running', + 'libNapCatEXEModelAPI_0006': 'OlivOS libNapCatEXEModel server [{0}] exited', 'flaskServerAPI_0001': 'OlivOS flask server [{0}] is running on port [{1}]', + 'flaskServerAPI_0002': 'OlivOS flask server [{0}] is running on [{1}]', 'libCWCBEXEModelAPI_0001': 'OlivOS libCWCBEXEModel server [{0}] can`t found target lib', 'libCWCBEXEModelAPI_0002': 'OlivOS libCWCBEXEModel server [{0}] will run under visiable mode', 'libCWCBEXEModelAPI_0003': 'OlivOS libCWCBEXEModel server [{0}] will retry in 10s...', @@ -186,7 +193,14 @@ 'libEXEModelAPI_0004': 'OlivOS GoCq进程托管服务组件 错误: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS GoCq进程托管服务组件 [{0}] 正在运作', 'libEXEModelAPI_0006': 'OlivOS GoCq进程托管服务组件 [{0}] 已经存在', + 'libNapCatEXEModelAPI_0001': 'OlivOS NapCat进程托管服务组件 [{0}] 无法找到库文件', + 'libNapCatEXEModelAPI_0002': 'OlivOS NapCat进程托管服务组件 [{0}] 将在前台模式下运行', + 'libNapCatEXEModelAPI_0003': 'OlivOS NapCat进程托管服务组件 [{0}] 将在10秒后重试...', + 'libNapCatEXEModelAPI_0004': 'OlivOS NapCat进程托管服务组件 错误: {0}\n{1}', + 'libNapCatEXEModelAPI_0005': 'OlivOS NapCat进程托管服务组件 [{0}] 正在运作', + 'libNapCatEXEModelAPI_0006': 'OlivOS NapCat进程托管服务组件 [{0}] 已经存在', 'flaskServerAPI_0001': 'OlivOS onebotV11 flask POST服务组件 [{0}] 正在运作于端口 [{1}]', + 'flaskServerAPI_0002': 'OlivOS onebotV11 flask POST服务组件 [{0}] 的参考上报地址为 [{1}]', 'libCWCBEXEModelAPI_0001': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 无法找到库文件', 'libCWCBEXEModelAPI_0002': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 将在前台模式下运行', 'libCWCBEXEModelAPI_0003': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 将在10秒后重试...', diff --git a/OlivOS/core/core/accountAPI.py b/OlivOS/core/core/accountAPI.py index 1f8baaf2..4747492a 100644 --- a/OlivOS/core/core/accountAPI.py +++ b/OlivOS/core/core/accountAPI.py @@ -113,7 +113,8 @@ def accountFix(basic_conf_models, bot_info_dict, logger_proc): for bot_info_dict_this in bot_info_dict: Account_data_this = bot_info_dict[bot_info_dict_this] if platform.system() == 'Windows': - if Account_data_this.platform['model'] in OlivOS.libEXEModelAPI.gCheckList: + if Account_data_this.platform['model'] in OlivOS.libEXEModelAPI.gCheckList \ + or Account_data_this.platform['model'] in OlivOS.libNapCatEXEModelAPI.gCheckList: if Account_data_this.post_info.auto == True: Account_data_this.post_info.type = 'post' Account_data_this.post_info.host = 'http://127.0.0.1' diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index b0c7c27a..942c3ed2 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.28' -OlivOS_SVN = 148 +OlivOS_Version = '0.11.30' +OlivOS_SVN = 150 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 3c4bd4d804b07730f56a17d88d7a7ed7cedbb767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Wed, 29 May 2024 16:12:19 +0800 Subject: [PATCH 41/76] =?UTF-8?q?0.11.31=EF=BC=8C=E4=BF=AE=E6=AD=A3NapCat?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=98=E7=AE=A1=E6=97=B6=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E9=94=81=E6=AD=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/boot/bootDataAPI.py | 2 +- OlivOS/core/info/infoAPI.py | 4 ++-- OlivOS/libBooter/libNapCatEXEModelAPI.py | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index 0103e701..1fd4ab69 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -529,7 +529,7 @@ "rx_queue": "OlivOS_napcat_lib_rx_queue", "tx_queue": "OlivOS_rx_queue", "logger_proc": "OlivOS_logger", - "target_proc": None, + "target_proc": "OlivOS_flask_post_rx", "control_queue": "OlivOS_control_queue", "debug": False }, diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 942c3ed2..715a6db3 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.30' -OlivOS_SVN = 150 +OlivOS_Version = '0.11.31' +OlivOS_SVN = 151 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index 191d0214..afa7b46f 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -81,7 +81,7 @@ def startNapCatLibExeModel( control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], bot_info_dict=plugin_bot_info_dict[bot_info_key], - target_proc=None, + target_proc=basic_conf_models[basic_conf_models_this['target_proc']], debug_mode=False ) Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) @@ -127,7 +127,7 @@ def run(self): 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}") - napcatTypeConfig(self.Proc_data['bot_info_dict']).setConfig() + 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' @@ -317,8 +317,9 @@ def sendControlEventSend(self, action, data): class napcatTypeConfig(object): - def __init__(self, bot_info_dict:OlivOS.API.bot_info_T): + def __init__(self, bot_info_dict:OlivOS.API.bot_info_T, target_proc): self.bot_info_dict = bot_info_dict + self.target_proc = target_proc self.config_file_str = '' self.config_file_data = '' self.config_file_format = {} @@ -327,7 +328,7 @@ def setConfig(self): self.config_file_format['uin'] = str(self.bot_info_dict.id) self.config_file_format['token'] = self.bot_info_dict.post_info.access_token self.config_file_format['port'] = str(self.bot_info_dict.post_info.port) - self.config_file_format['postUrls'] = 'http://127.0.0.1:55001/OlivOSMsgApi/qq/onebot/default' + self.config_file_format['postUrls'] = f"http://127.0.0.1:{self.target_proc['server']['port']}/OlivOSMsgApi/qq/onebot/default" self.config_file_data = { "http": { From cd72e48bbb22cad94e8acb2c559bce99be95811c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sat, 1 Jun 2024 12:19:38 +0800 Subject: [PATCH 42/76] =?UTF-8?q?OnebotV11=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=94=B6=E5=88=B0=E9=87=8D=E5=A4=8Dflag=E7=9A=84?= =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E3=80=81=E5=8A=A0=E7=BE=A4=E9=82=80=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/adapter/onebotV11/onebotSDK.py | 61 +++++++++++++++------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index b2a30900..5c3d6fac 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -29,6 +29,8 @@ 'para_default' ] +gFlagCheckList = [] + class bot_info_T(object): def __init__(self, id=-1, host='', port=-1, access_token=None): self.id = id @@ -184,6 +186,7 @@ def format_cq_code_msg(msg): # 支持OlivOS API事件生成的映射实现 def get_Event_from_SDK(target_event): + global gFlagCheckList target_event.base_info['time'] = target_event.sdk_event.base_info.get('time', int(time.time())) target_event.base_info['self_id'] = str(target_event.sdk_event.base_info['self_id']) target_event.base_info['type'] = target_event.sdk_event.base_info['post_type'] @@ -420,33 +423,37 @@ def get_Event_from_SDK(target_event): elif target_event.sdk_event.json['honor_type'] == 'emotion': target_event.data.type = 'emotion' elif target_event.base_info['type'] == 'request': - if target_event.sdk_event.json['request_type'] == 'friend': - target_event.active = True - target_event.plugin_info['func_type'] = 'friend_add_request' - target_event.data = target_event.friend_add_request( - str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['comment'] - ) - target_event.data.flag = target_event.sdk_event.json['flag'] - elif target_event.sdk_event.json['request_type'] == 'group': - if target_event.sdk_event.json['sub_type'] == 'add': - target_event.active = True - target_event.plugin_info['func_type'] = 'group_add_request' - target_event.data = target_event.group_add_request( - str(target_event.sdk_event.json['group_id']), - str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['comment'] - ) - target_event.data.flag = target_event.sdk_event.json['flag'] - elif target_event.sdk_event.json['sub_type'] == 'invite': - target_event.active = True - target_event.plugin_info['func_type'] = 'group_invite_request' - target_event.data = target_event.group_invite_request( - str(target_event.sdk_event.json['group_id']), - str(target_event.sdk_event.json['user_id']), - target_event.sdk_event.json['comment'] - ) - target_event.data.flag = target_event.sdk_event.json['flag'] + if 'flag' in target_event.sdk_event.json: + tmp_flag = target_event.sdk_event.json['flag'] + if tmp_flag not in gFlagCheckList: + gFlagCheckList.append(tmp_flag) + if target_event.sdk_event.json['request_type'] == 'friend': + target_event.active = True + target_event.plugin_info['func_type'] = 'friend_add_request' + target_event.data = target_event.friend_add_request( + str(target_event.sdk_event.json['user_id']), + target_event.sdk_event.json['comment'] + ) + target_event.data.flag = tmp_flag + elif target_event.sdk_event.json['request_type'] == 'group': + if target_event.sdk_event.json['sub_type'] == 'add': + target_event.active = True + target_event.plugin_info['func_type'] = 'group_add_request' + target_event.data = target_event.group_add_request( + str(target_event.sdk_event.json['group_id']), + str(target_event.sdk_event.json['user_id']), + target_event.sdk_event.json['comment'] + ) + target_event.data.flag = tmp_flag + elif target_event.sdk_event.json['sub_type'] == 'invite': + target_event.active = True + target_event.plugin_info['func_type'] = 'group_invite_request' + target_event.data = target_event.group_invite_request( + str(target_event.sdk_event.json['group_id']), + str(target_event.sdk_event.json['user_id']), + target_event.sdk_event.json['comment'] + ) + target_event.data.flag = tmp_flag elif target_event.base_info['type'] == 'meta_event': if target_event.sdk_event.json['meta_event_type'] == 'lifecycle': target_event.active = True From 53a536c0812d3c6ca3e0ef765ea807b06b7c1383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sat, 1 Jun 2024 15:37:34 +0800 Subject: [PATCH 43/76] =?UTF-8?q?0.11.32=EF=BC=8C=E5=86=85=E7=BD=AEAstralQ?= =?UTF-8?q?sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/__init__.py | 1 + OlivOS/core/L10N/L10NDataAPI.py | 14 + OlivOS/core/boot/bootAPI.py | 22 +- OlivOS/core/boot/bootDataAPI.py | 19 + OlivOS/core/core/accountAPI.py | 25 +- OlivOS/core/info/infoAPI.py | 4 +- OlivOS/libBooter/libAstralQsignEXEModelAPI.py | 217 ++++++++++ OlivOS/libBooter/libEXEModelAPI.py | 409 +++++++++++------- OlivOS/nativeGUI/multiLoginUIAPI.py | 41 +- 9 files changed, 566 insertions(+), 186 deletions(-) create mode 100644 OlivOS/libBooter/libAstralQsignEXEModelAPI.py diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index 2e5fa8c4..10dcea99 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -79,6 +79,7 @@ from .libBooter import libCWCBEXEModelAPI from .libBooter import libOPQBotEXEModelAPI from .libBooter import libNapCatEXEModelAPI + from .libBooter import libAstralQsignEXEModelAPI from .nativeGUI import nativeWinUIAPI from .nativeGUI import webviewUIAPI from . import userModule diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index c707e5ae..ca444ee1 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -110,6 +110,13 @@ 'libCWCBEXEModelAPI_0004': 'OlivOS libCWCBEXEModel failed: {0}\n{1}', 'libCWCBEXEModelAPI_0005': 'OlivOS libCWCBEXEModel server [{0}] is running', 'libCWCBEXEModelAPI_0006': 'OlivOS libCWCBEXEModel server [{0}] exited', + 'libAstralQsignEXEModelAPI_0001': 'OlivOS libAstralQsignEXEModel server [{0}] can`t found target lib', + 'libAstralQsignEXEModelAPI_0002': 'OlivOS libAstralQsignEXEModel server [{0}] will run under visiable mode', + 'libAstralQsignEXEModelAPI_0003': 'OlivOS libAstralQsignEXEModel server [{0}] will retry in 10s...', + 'libAstralQsignEXEModelAPI_0004': 'OlivOS libAstralQsignEXEModel failed: {0}\n{1}', + 'libAstralQsignEXEModelAPI_0005': 'OlivOS libAstralQsignEXEModel server [{0}] is running', + 'libAstralQsignEXEModelAPI_0006': 'OlivOS libAstralQsignEXEModel server [{0}] exited', + 'libAstralQsignEXEModelAPI_0007': 'OlivOS libAstralQsignEXEModel server [{0}] is running on port [{1}]', 'bootAPI_0001': 'OlivOS model [{0}] will init', 'bootAPI_0002': 'OlivOS model [{0}] init', 'bootAPI_0003': 'OlivOS model [{0}] will try init', @@ -207,6 +214,13 @@ 'libCWCBEXEModelAPI_0004': 'OlivOS ComWeChatBotClient进程托管服务组件 错误: {0}\n{1}', 'libCWCBEXEModelAPI_0005': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 正在运作', 'libCWCBEXEModelAPI_0006': 'OlivOS ComWeChatBotClient进程托管服务组件 [{0}] 已经存在', + 'libAstralQsignEXEModelAPI_0001': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 无法找到库文件', + 'libAstralQsignEXEModelAPI_0002': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 将在前台模式下运行', + 'libAstralQsignEXEModelAPI_0003': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 将在10秒后重试...', + 'libAstralQsignEXEModelAPI_0004': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 错误: {0}\n{1}', + 'libAstralQsignEXEModelAPI_0005': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 正在运作', + 'libAstralQsignEXEModelAPI_0006': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 已经存在', + 'libAstralQsignEXEModelAPI_0007': 'OlivOS libAstralQsignEXEModelAPI进程托管服务组件 [{0}] 正在运作于端口 [{1}]', 'bootAPI_0001': 'OlivOS 组件 [{0}] 即将初始化', 'bootAPI_0002': 'OlivOS 组件 [{0}] 初始化', 'bootAPI_0003': 'OlivOS 组件 [{0}] 即将尝试初始化', diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index 89e37d01..a8675ea1 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -776,9 +776,27 @@ def start(self): 'tmp_proc_mode': tmp_proc_mode } ).start() + elif basic_conf_models_this['type'] == 'astralqsign_lib_exe_model': + if not OlivOS.libAstralQsignEXEModelAPI.isBotActive(plugin_bot_info_dict): + continue + if platform.system() == 'Windows': + threading.Thread( + target = OlivOS.libAstralQsignEXEModelAPI.startAstralQsignLibExeModel, + kwargs = { + 'plugin_bot_info_dict': plugin_bot_info_dict, + 'basic_conf_models_this': basic_conf_models_this, + 'multiprocessing_dict': multiprocessing_dict, + 'Proc_dict': Proc_dict, + 'Proc_Proc_dict': Proc_Proc_dict, + 'basic_conf_models': basic_conf_models, + 'tmp_proc_mode': tmp_proc_mode + } + ).start() elif basic_conf_models_this['type'] == 'update_get': - threading.Thread(target=update_get_func, - args=(Proc_dict, basic_conf_models, basic_conf_models_this)).start() + threading.Thread( + target=update_get_func, + args=(Proc_dict, basic_conf_models, basic_conf_models_this) + ).start() elif basic_conf_models_this['type'] == 'update_replace': OlivOS.updateAPI.OlivOSUpdateReplace( logger_proc=Proc_dict[basic_conf_models_this['logger_proc']] diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index 1fd4ab69..d12c9ae8 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -29,6 +29,7 @@ "OlivOS_account_config_save", "OlivOS_account_config", "OlivOS_nativeWinUIAPI", + "OlivOS_astralqsign_lib_exe_model", "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", @@ -75,6 +76,7 @@ "OlivOS_account_config_update" ], "account_update": [ + "OlivOS_astralqsign_lib_exe_model", "OlivOS_gocqhttp_lib_exe_model", "OlivOS_walleq_lib_exe_model", "OlivOS_cwcb_lib_exe_model", @@ -100,6 +102,7 @@ }, "type_event": { "account_update": [ + "astralqsign_lib_exe_model", "gocqhttp_lib_exe_model", "walleq_lib_exe_model", "cwcb_lib_exe_model", @@ -478,6 +481,7 @@ "tx_queue": "OlivOS_rx_queue", "logger_proc": "OlivOS_logger", "target_proc": "OlivOS_flask_post_rx", + "sub_target_proc": "OlivOS_astralqsign_lib_exe_model", "control_queue": "OlivOS_control_queue", "debug": False }, @@ -533,6 +537,21 @@ "control_queue": "OlivOS_control_queue", "debug": False }, + "OlivOS_astralqsign_lib_exe_model": { + "enable": True, + "name": "OlivOS_astralqsign_lib_exe_model", + "type": "astralqsign_lib_exe_model", + "tx_queue": "OlivOS_rx_queue", + "logger_proc": "OlivOS_logger", + "control_queue": "OlivOS_control_queue", + "debug": False, + "server": { + "auto": True, + "host": "0.0.0.0", + "port": 55011, + "token": "114514" + } + }, "OlivOS_webview_page": { "enable": True, "name": "OlivOS_webview_page", diff --git a/OlivOS/core/core/accountAPI.py b/OlivOS/core/core/accountAPI.py index 4747492a..fc46e33d 100644 --- a/OlivOS/core/core/accountAPI.py +++ b/OlivOS/core/core/accountAPI.py @@ -102,14 +102,23 @@ def accountFix(basic_conf_models, bot_info_dict, logger_proc): res = {} with free_port_selector() as g: # 在端口选择过程中使用上下文 for basic_conf_models_this in basic_conf_models: - if basic_conf_models[basic_conf_models_this]['type'] == 'post': - if basic_conf_models[basic_conf_models_this]['server']['auto'] == True: - basic_conf_models[basic_conf_models_this]['server']['host'] = '0.0.0.0' - if isInuse( - '127.0.0.1', - basic_conf_models[basic_conf_models_this]['server']['port'] - ): - basic_conf_models[basic_conf_models_this]['server']['port'] = g.get_free_port() + if basic_conf_models[basic_conf_models_this]['type'] == 'post' \ + and basic_conf_models[basic_conf_models_this]['server']['auto'] is True: + basic_conf_models[basic_conf_models_this]['server']['host'] = '0.0.0.0' + if isInuse( + '127.0.0.1', + basic_conf_models[basic_conf_models_this]['server']['port'] + ): + basic_conf_models[basic_conf_models_this]['server']['port'] = g.get_free_port() + if platform.system() == 'Windows' \ + and basic_conf_models[basic_conf_models_this]['type'] == 'astralqsign_lib_exe_model' \ + and basic_conf_models[basic_conf_models_this]['server']['auto'] is True: + basic_conf_models[basic_conf_models_this]['server']['host'] = '0.0.0.0' + if isInuse( + '127.0.0.1', + basic_conf_models[basic_conf_models_this]['server']['port'] + ): + basic_conf_models[basic_conf_models_this]['server']['port'] = g.get_free_port() for bot_info_dict_this in bot_info_dict: Account_data_this = bot_info_dict[bot_info_dict_this] if platform.system() == 'Windows': diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 715a6db3..636d807f 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.31' -OlivOS_SVN = 151 +OlivOS_Version = '0.11.32' +OlivOS_SVN = 152 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py new file mode 100644 index 00000000..810e9362 --- /dev/null +++ b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py @@ -0,0 +1,217 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/libAstralQsignEXEModelAPI.py +@Author : MetaLeo元理 +@Contact : lunzhipenxil@gmail.com +@License : AGPL +@Copyright : (C) 2020-2024, OlivOS-Team +@Desc : None +''' + +import subprocess +import time +import os +import traceback +import platform +import zipfile + +import OlivOS + +modelName = 'libAstralQsignEXEModelAPI' + +resourceUrlPath = OlivOS.infoAPI.resourceUrlPath + +gCheckList = [ + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Pad' +] + +def startAstralQsignLibExeModel( + plugin_bot_info_dict, + basic_conf_models_this, + multiprocessing_dict, + Proc_dict, + Proc_Proc_dict, + basic_conf_models, + tmp_proc_mode +): + if platform.system() == 'Windows': + flagActive = False + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['model'] in gCheckList: + flagActive = True + if flagActive: + releaseDir('./lib') + OlivOS.updateAPI.checkResouceFile( + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + resouce_api=resourceUrlPath, + resouce_name='astral-qsign', + filePath='./lib/astral-qsign.zip', + filePathUpdate='./lib/astral-qsign.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'] + Proc_dict[tmp_Proc_name] = OlivOS.libAstralQsignEXEModelAPI.server( + Proc_name=tmp_Proc_name, + tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], + control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + server_data=basic_conf_models_this['server'], + debug_mode=False + ) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) + +class server(OlivOS.API.Proc_templet): + def __init__( + self, + Proc_name, + scan_interval=0.001, + dead_interval=1, + rx_queue=None, + tx_queue=None, + control_queue=None, + logger_proc=None, + server_data=None, + debug_mode=False + ): + OlivOS.API.Proc_templet.__init__( + self, + Proc_name=Proc_name, + Proc_type='astralqsign_lib_exe_model', + scan_interval=scan_interval, + dead_interval=dead_interval, + rx_queue=rx_queue, + tx_queue=tx_queue, + control_queue=control_queue, + logger_proc=logger_proc + ) + self.Proc_config['debug_mode'] = debug_mode + self.server_data=server_data + self.flag_run = True + + def run(self): + while self.flag_run: + self.sendLog( + 2, 'OlivOS libAstralQsignEXEModel server [{0}] will run under visiable mode', + [self.Proc_name] + ) + time.sleep(2) + releaseDir("./conf") + releaseDir("./conf/astral-qsign") + unzip('./lib/astral-qsign.zip', "./conf/astral-qsign") + tmp_env = dict(os.environ) + tmp_env['FORCE_TTY'] = '' + model_Proc = subprocess.Popen( + f".\\start.bat {self.server_data['port']}", + cwd='.\\conf\\astral-qsign', + shell=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + creationflags=subprocess.CREATE_NEW_CONSOLE, + env=tmp_env + ) + self.sendLog( + 2, 'OlivOS libAstralQsignEXEModel server [{0}] is running on port [{1}]', + [self.Proc_name, str(self.server_data['port'])] + ) + self.Proc_data['model_Proc'] = model_Proc + self.get_model_stdout(model_Proc) + # model_Proc.communicate(timeout = None) + self.log(3, OlivOS.L10NAPI.getTrans( + 'OlivOS libAstralQsignEXEModel server [{0}] will retry in 10s...', + [self.Proc_name], modelName + )) + self.Proc_data['model_Proc'] = None + time.sleep(8) + + def get_model_stdout(self, model_Proc: subprocess.Popen): + for line in iter(model_Proc.stdout.readline, b''): + try: + log_data = ('%s' % line.decode('utf-8', errors='replace')).rstrip('\n').rstrip('\r') + self.log(2, log_data, [('AstralQsign', 'default')]) + except Exception as e: + self.log(4, OlivOS.L10NAPI.getTrans('OlivOS libAstralQsignEXEModel failed: %s\n%s' % [ + str(e), + traceback.format_exc() + ], + modelName + )) + + def send_log_event(self, data): + self.sendControlEventSend('send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'AstralQsign', + 'event': 'log', + 'hash': self.Proc_data['bot_info_dict'].hash, + 'data': data + } + } + ) + + def sendControlEventSend(self, action, data): + if self.Proc_info.control_queue is not None: + self.Proc_info.control_queue.put( + OlivOS.API.Control.packet( + action, + data + ), + block=False + ) + + def sendLog(self, log_level:int, log_message:str, log_message_list:list): + self.log( + log_level, + OlivOS.L10NAPI.getTrans( + log_message, + log_message_list, + modelName + ), + [('AstralQsign', 'default')] + ) + + + +def isBotActive(plugin_bot_info_dict:dict): + flag_need_enable = False + for bot_info_key in plugin_bot_info_dict: + if plugin_bot_info_dict[bot_info_key].platform['sdk'] == 'onebot' \ + and plugin_bot_info_dict[bot_info_key].platform['platform'] == 'qq' \ + and plugin_bot_info_dict[bot_info_key].platform['model'] in OlivOS.libAstralQsignEXEModelAPI.gCheckList \ + and plugin_bot_info_dict[bot_info_key].extends.get('qsign-server-protocal', None) == 'AstralQsign': + flag_need_enable = True + return flag_need_enable + +def releaseDir(dir_path): + if not os.path.exists(dir_path): + os.makedirs(dir_path) + +def support_gbk(zip_file: zipfile.ZipFile): + name_to_info = zip_file.NameToInfo + # copy map first + for name, info in name_to_info.copy().items(): + try: + real_name = name.encode('cp437').decode('gbk') + except: + real_name = name + if real_name != name: + info.filename = real_name + del name_to_info[name] + name_to_info[real_name] = info + return zip_file + +def unzip(zip_file_path, target_dir): + with support_gbk(zipfile.ZipFile(zip_file_path, 'r', zipfile.ZIP_DEFLATED)) as zip_file: + zip_file = support_gbk(zip_file) + zip_file.extractall(target_dir) diff --git a/OlivOS/libBooter/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py index 1eac7eee..359ef0b7 100644 --- a/OlivOS/libBooter/libEXEModelAPI.py +++ b/OlivOS/libBooter/libEXEModelAPI.py @@ -48,90 +48,90 @@ gProtocalInfo = { 'android_pad': { - '8.9.58': '''{ + 'AstralQsign': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537161402, - "sub_app_id": 537161402, + "app_id": 537220362, + "sub_app_id": 537220362, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.58.11170", - "build_time": 1684467300, + "sort_version_name": "9.0.56.16830", + "build_time": 1713424357, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2545", - "sso_version": 20, + "sdk_version": "6.0.0.2560", + "sso_version": 21, "misc_bitmap": 150470524, "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1686334718, - "qua": "V1_AND_SQ_8.9.58_4106_YYB_D", + "dump_time": 1713424357, + "qua": "V1_AND_SQ_9.0.56_6372_YYB_D", "protocol_type": 6 }''', - '8.9.63': '''{ + '9.0.56': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537164888, - "sub_app_id": 537164888, + "app_id": 537220362, + "sub_app_id": 537220362, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.63.11390", - "build_time": 1685069178, + "sort_version_name": "9.0.56.16830", + "build_time": 1713424357, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2546", - "sso_version": 20, + "sdk_version": "6.0.0.2560", + "sso_version": 21, "misc_bitmap": 150470524, "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1687796862, - "qua": "V1_AND_SQ_8.9.63_4194_YYB_D", + "dump_time": 1713424357, + "qua": "V1_AND_SQ_9.0.56_6372_YYB_D", "protocol_type": 6 }''', - '8.9.68': '''{ + '8.9.85': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537168361, - "sub_app_id": 537168361, + "app_id": 537180607, + "sub_app_id": 537180607, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.68.11565", - "build_time": 1688523354, - "apk_sign": "7772804f3cb4961f57cb764fbe4973e6", - "sdk_version": "6.0.0.2549", + "sort_version_name": "8.9.85.12820", + "build_time": 1697015435, + "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", + "sdk_version": "6.0.0.2556", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 34869472, + "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1689780543, - "qua": "V1_AND_SQ_8.9.68_4264_YYB_D", + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.85_4766_YYB_D", "protocol_type": 6 }''', - '8.9.70': '''{ + '8.9.83': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537169976, - "sub_app_id": 537169976, + "app_id": 537178685, + "sub_app_id": 537178685, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.70.11730", - "build_time": 1689956914, - "apk_sign": "e686fa90d9a33950c46de9cfb4ec7e71", - "sdk_version": "6.0.0.2551", + "sort_version_name": "8.9.83.12605", + "build_time": 1691565978, + "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", + "sdk_version": "6.0.0.2554", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 34869472, + "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1690350020, - "qua": "V1_AND_SQ_8.9.70_4330_YYB_D", + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.83_4680_YYB_D", "protocol_type": 6 }''', - '8.9.71': '''{ + '8.9.80': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537170072, - "sub_app_id": 537170072, + "app_id": 537176902, + "sub_app_id": 537176902, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.71.11735", - "build_time": 1688560152, + "sort_version_name": "8.9.80.12440", + "build_time": 1691565978, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2551", + "sdk_version": "6.0.0.2554", "sso_version": 20, "misc_bitmap": 150470524, "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1688560152, - "qua": "V1_AND_SQ_8.9.71_4332_YYB_D", - "protocol_type": 1 + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.80_4614_YYB_D", + "protocol_type": 6 }''', '8.9.73': '''{ "apk_id": "com.tencent.mobileqq", @@ -150,63 +150,78 @@ "qua": "V1_AND_SQ_8.9.73_4354_HDBM_T", "protocol_type": 6 }''', - '8.9.80': '''{ + '8.9.71': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537176902, - "sub_app_id": 537176902, + "app_id": 537170072, + "sub_app_id": 537170072, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.80.12440", - "build_time": 1691565978, + "sort_version_name": "8.9.71.11735", + "build_time": 1688560152, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2554", + "sdk_version": "6.0.0.2551", "sso_version": 20, "misc_bitmap": 150470524, "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.80_4614_YYB_D", + "dump_time": 1688560152, + "qua": "V1_AND_SQ_8.9.71_4332_YYB_D", + "protocol_type": 1 +}''', + '8.9.70': '''{ + "apk_id": "com.tencent.mobileqq", + "app_id": 537169976, + "sub_app_id": 537169976, + "app_key": "0S200MNJT807V3GE", + "sort_version_name": "8.9.70.11730", + "build_time": 1689956914, + "apk_sign": "e686fa90d9a33950c46de9cfb4ec7e71", + "sdk_version": "6.0.0.2551", + "sso_version": 20, + "misc_bitmap": 150470524, + "main_sig_map": 34869472, + "sub_sig_map": 66560, + "dump_time": 1690350020, + "qua": "V1_AND_SQ_8.9.70_4330_YYB_D", "protocol_type": 6 }''', - '8.9.83': '''{ + '8.9.68': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537178685, - "sub_app_id": 537178685, + "app_id": 537168361, + "sub_app_id": 537168361, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.83.12605", - "build_time": 1691565978, - "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2554", + "sort_version_name": "8.9.68.11565", + "build_time": 1688523354, + "apk_sign": "7772804f3cb4961f57cb764fbe4973e6", + "sdk_version": "6.0.0.2549", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 16724722, + "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.83_4680_YYB_D", + "dump_time": 1689780543, + "qua": "V1_AND_SQ_8.9.68_4264_YYB_D", "protocol_type": 6 }''', - '8.9.85': '''{ + '8.9.63': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537180607, - "sub_app_id": 537180607, + "app_id": 537164888, + "sub_app_id": 537164888, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.85.12820", - "build_time": 1697015435, + "sort_version_name": "8.9.63.11390", + "build_time": 1685069178, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2556", + "sdk_version": "6.0.0.2546", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 16724722, + "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.85_4766_YYB_D", + "dump_time": 1687796862, + "qua": "V1_AND_SQ_8.9.63_4194_YYB_D", "protocol_type": 6 -}''' - }, - 'android_phone': { +}''', '8.9.58': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537163098, - "sub_app_id": 537163098, + "app_id": 537161402, + "sub_app_id": 537161402, "app_key": "0S200MNJT807V3GE", "sort_version_name": "8.9.58.11170", "build_time": 1684467300, @@ -218,74 +233,93 @@ "sub_sig_map": 66560, "dump_time": 1686334718, "qua": "V1_AND_SQ_8.9.58_4106_YYB_D", + "protocol_type": 6 +}''' + }, + 'android_phone': { + 'AstralQsign': '''{ + "apk_id": "com.tencent.mobileqq", + "app_id": 537220362, + "sub_app_id": 537220362, + "app_key": "0S200MNJT807V3GE", + "sort_version_name": "9.0.56.16830", + "build_time": 1713424357, + "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", + "sdk_version": "6.0.0.2560", + "sso_version": 21, + "misc_bitmap": 150470524, + "main_sig_map": 34869472, + "sub_sig_map": 66560, + "dump_time": 1713424357, + "qua": "V1_AND_SQ_9.0.56_6372_YYB_D", "protocol_type": 1 }''', - '8.9.63': '''{ + '9.0.56': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537164840, - "sub_app_id": 537164840, + "app_id": 537220362, + "sub_app_id": 537220362, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.63.11390", - "build_time": 1685069178, + "sort_version_name": "9.0.56.16830", + "build_time": 1713424357, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2546", - "sso_version": 20, + "sdk_version": "6.0.0.2560", + "sso_version": 21, "misc_bitmap": 150470524, "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1687796862, - "qua": "V1_AND_SQ_8.9.63_4194_YYB_D", + "dump_time": 1713424357, + "qua": "V1_AND_SQ_9.0.56_6372_YYB_D", "protocol_type": 1 }''', - '8.9.68': '''{ + '8.9.85': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537168313, - "sub_app_id": 537168313, + "app_id": 537180568, + "sub_app_id": 537180568, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.68.11565", - "build_time": 1688523354, - "apk_sign": "7772804f3cb4961f57cb764fbe4973e6", - "sdk_version": "6.0.0.2549", + "sort_version_name": "8.9.85.12820", + "build_time": 1697015435, + "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", + "sdk_version": "6.0.0.2556", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 34869472, + "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1689780543, - "qua": "V1_AND_SQ_8.9.68_4264_YYB_D", + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.85_4766_YYB_D", "protocol_type": 1 }''', - '8.9.70': '''{ + '8.9.83': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537169928, - "sub_app_id": 537169928, + "app_id": 537178646, + "sub_app_id": 537178646, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.70.11730", - "build_time": 1689956914, - "apk_sign": "e686fa90d9a33950c46de9cfb4ec7e71", - "sdk_version": "6.0.0.2551", + "sort_version_name": "8.9.83.12605", + "build_time": 1691565978, + "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", + "sdk_version": "6.0.0.2554", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 34869472, + "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1690350020, - "qua": "V1_AND_SQ_8.9.70_4330_YYB_D", + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.83_4680_YYB_D", "protocol_type": 1 }''', - '8.9.71': '''{ + '8.9.80': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537170024, - "sub_app_id": 537170024, + "app_id": 537176863, + "sub_app_id": 537176863, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.71.11735", - "build_time": 1688560152, + "sort_version_name": "8.9.80.12440", + "build_time": 1691565978, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2551", + "sdk_version": "6.0.0.2554", "sso_version": 20, "misc_bitmap": 150470524, "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1688560152, - "qua": "V1_AND_SQ_8.9.71_4332_YYB_D", + "dump_time": 1692110632, + "qua": "V1_AND_SQ_8.9.80_4614_YYB_D", "protocol_type": 1 }''', '8.9.73': '''{ @@ -305,55 +339,89 @@ "qua": "V1_AND_SQ_8.9.73_4354_HDBM_T", "protocol_type": 1 }''', - '8.9.80': '''{ + '8.9.71': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537176863, - "sub_app_id": 537176863, + "app_id": 537170024, + "sub_app_id": 537170024, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.80.12440", - "build_time": 1691565978, + "sort_version_name": "8.9.71.11735", + "build_time": 1688560152, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2554", + "sdk_version": "6.0.0.2551", "sso_version": 20, "misc_bitmap": 150470524, "main_sig_map": 16724722, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.80_4614_YYB_D", + "dump_time": 1688560152, + "qua": "V1_AND_SQ_8.9.71_4332_YYB_D", "protocol_type": 1 }''', - '8.9.83': '''{ + '8.9.70': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537178646, - "sub_app_id": 537178646, + "app_id": 537169928, + "sub_app_id": 537169928, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.83.12605", - "build_time": 1691565978, + "sort_version_name": "8.9.70.11730", + "build_time": 1689956914, + "apk_sign": "e686fa90d9a33950c46de9cfb4ec7e71", + "sdk_version": "6.0.0.2551", + "sso_version": 20, + "misc_bitmap": 150470524, + "main_sig_map": 34869472, + "sub_sig_map": 66560, + "dump_time": 1690350020, + "qua": "V1_AND_SQ_8.9.70_4330_YYB_D", + "protocol_type": 1 +}''', + '8.9.68': '''{ + "apk_id": "com.tencent.mobileqq", + "app_id": 537168313, + "sub_app_id": 537168313, + "app_key": "0S200MNJT807V3GE", + "sort_version_name": "8.9.68.11565", + "build_time": 1688523354, + "apk_sign": "7772804f3cb4961f57cb764fbe4973e6", + "sdk_version": "6.0.0.2549", + "sso_version": 20, + "misc_bitmap": 150470524, + "main_sig_map": 34869472, + "sub_sig_map": 66560, + "dump_time": 1689780543, + "qua": "V1_AND_SQ_8.9.68_4264_YYB_D", + "protocol_type": 1 +}''', + '8.9.63': '''{ + "apk_id": "com.tencent.mobileqq", + "app_id": 537164840, + "sub_app_id": 537164840, + "app_key": "0S200MNJT807V3GE", + "sort_version_name": "8.9.63.11390", + "build_time": 1685069178, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2554", + "sdk_version": "6.0.0.2546", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 16724722, + "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.83_4680_YYB_D", + "dump_time": 1687796862, + "qua": "V1_AND_SQ_8.9.63_4194_YYB_D", "protocol_type": 1 }''', - '8.9.85': '''{ + '8.9.58': '''{ "apk_id": "com.tencent.mobileqq", - "app_id": 537180568, - "sub_app_id": 537180568, + "app_id": 537163098, + "sub_app_id": 537163098, "app_key": "0S200MNJT807V3GE", - "sort_version_name": "8.9.85.12820", - "build_time": 1697015435, + "sort_version_name": "8.9.58.11170", + "build_time": 1684467300, "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2556", + "sdk_version": "6.0.0.2545", "sso_version": 20, "misc_bitmap": 150470524, - "main_sig_map": 16724722, + "main_sig_map": 34869472, "sub_sig_map": 66560, - "dump_time": 1692110632, - "qua": "V1_AND_SQ_8.9.85_4766_YYB_D", + "dump_time": 1686334718, + "qua": "V1_AND_SQ_8.9.58_4106_YYB_D", "protocol_type": 1 }''' } @@ -398,14 +466,27 @@ def startGoCqhttpLibExeModel( logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], bot_info_dict=plugin_bot_info_dict[bot_info_key], target_proc=basic_conf_models[basic_conf_models_this['target_proc']], + sub_target_proc=basic_conf_models.get(basic_conf_models_this.get('sub_target_proc', None), None), debug_mode=False ) Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) class server(OlivOS.API.Proc_templet): - def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=None, tx_queue=None, - control_queue=None, logger_proc=None, target_proc=None, debug_mode=False, bot_info_dict=None): + def __init__( + self, + Proc_name, + scan_interval=0.001, + dead_interval=1, + rx_queue=None, + tx_queue=None, + control_queue=None, + logger_proc=None, + target_proc=None, + sub_target_proc=None, + debug_mode=False, + bot_info_dict=None + ): OlivOS.API.Proc_templet.__init__( self, Proc_name=Proc_name, @@ -420,6 +501,7 @@ def __init__(self, Proc_name, scan_interval=0.001, dead_interval=1, rx_queue=Non self.Proc_config['debug_mode'] = debug_mode self.Proc_data['bot_info_dict'] = bot_info_dict self.Proc_config['target_proc'] = target_proc + self.Proc_config['sub_target_proc'] = sub_target_proc self.Proc_data['check_qrcode_flag'] = False self.Proc_data['check_stdin'] = False self.Proc_data['model_Proc'] = None @@ -448,7 +530,7 @@ def run(self): with open('./conf/gocqhttp/filter.json', 'w+') as tmp: tmp.write('{}') releaseDir('./conf/gocqhttp/' + self.Proc_data['bot_info_dict'].hash) - goTypeConfig(self.Proc_data['bot_info_dict'], self.Proc_config['target_proc']).setConfig() + goTypeConfig(self.Proc_data['bot_info_dict'], self.Proc_config['target_proc'], self.Proc_config['sub_target_proc']).setConfig() if False and (self.Proc_data['bot_info_dict'].platform['model'] in [ 'gocqhttp', 'gocqhttp_hide' @@ -664,9 +746,10 @@ def sendControlEventSend(self, action, data): class goTypeConfig(object): - def __init__(self, bot_info_dict, target_proc): + def __init__(self, bot_info_dict, target_proc, sub_target_proc): self.bot_info_dict = bot_info_dict self.target_proc = target_proc + self.sub_target_proc = sub_target_proc self.config_file_str = '' self.config_file_format = {} @@ -868,7 +951,17 @@ def setConfig(self): self.config_file_format['sign-servers-data'] += ''' - url: '%s' key: '%s' - authorization: '-' ''' % (tmp_data_this['addr'], tmp_data_this['key']) + authorization: '-' +''' % (tmp_data_this['addr'], tmp_data_this['key']) + + if 'qsign-server-protocal' in self.bot_info_dict.extends \ + and type(self.bot_info_dict.extends['qsign-server-protocal']) is str \ + and self.bot_info_dict.extends['qsign-server-protocal'] == 'AstralQsign': + self.config_file_format['sign-servers-data'] = ''' + - url: 'http://localhost:%s/' + key: '%s' + authorization: '-' +''' % (str(self.sub_target_proc['server']['port']), str(self.sub_target_proc['server']['token'])) self.config_file_str = self.config_file_str.format(**self.config_file_format) @@ -932,17 +1025,21 @@ def accountFix(bot_info_dict, logger_proc): if 'qsign-server-protocal' in bot_info_dict[bot_hash].extends \ and type(bot_info_dict[bot_hash].extends['qsign-server-protocal']) is str: if bot_info_dict[bot_hash].platform['model'] in [ - 'gocqhttp_show_Android_Pad' - ]: - if bot_info_dict[bot_hash].extends['qsign-server-protocal'] in gProtocalInfo['android_pad']: - protocal_info = gProtocalInfo['android_pad'][bot_info_dict[bot_hash].extends['qsign-server-protocal']] - protocal_num = 6 - if bot_info_dict[bot_hash].platform['model'] in [ + 'gocqhttp_show_Android_Pad', 'gocqhttp_show_Android_Phone' ]: - if bot_info_dict[bot_hash].extends['qsign-server-protocal'] in gProtocalInfo['android_phone']: - protocal_info = gProtocalInfo['android_phone'][bot_info_dict[bot_hash].extends['qsign-server-protocal']] - protocal_num = 1 + if bot_info_dict[bot_hash].platform['model'] in [ + 'gocqhttp_show_Android_Pad', + ]: + if bot_info_dict[bot_hash].extends['qsign-server-protocal'] in gProtocalInfo['android_pad']: + protocal_info = gProtocalInfo['android_pad'][bot_info_dict[bot_hash].extends['qsign-server-protocal']] + protocal_num = 6 + elif bot_info_dict[bot_hash].platform['model'] in [ + 'gocqhttp_show_Android_Phone' + ]: + if bot_info_dict[bot_hash].extends['qsign-server-protocal'] in gProtocalInfo['android_phone']: + protocal_info = gProtocalInfo['android_phone'][bot_info_dict[bot_hash].extends['qsign-server-protocal']] + protocal_num = 1 if protocal_info is not None: file_path = './conf/gocqhttp/' + bot_hash + '/data/versions/%d.json' % protocal_num try: diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index bf803229..c921d7f8 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -340,16 +340,21 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'edit_root_Entry_Extend2_StringVar': tkinter.StringVar(), 'edit_root_Combobox_qsign_protocal_StringVar': tkinter.StringVar(), 'edit_root_Combobox_qsign_protocal_list': [ + 'AstralQsign', '手动', - '8.9.58', - '8.9.63', - '8.9.68', - '8.9.70', - '8.9.71', - '8.9.73', - '8.9.80', + '9.0.56', + '8.9.85', '8.9.83', - '8.9.85' + '8.9.80', + '8.9.73', + '8.9.71', + '8.9.70', + '8.9.68', + '8.9.63', + '8.9.58', + ], + 'edit_root_Combobox_qsign_protocal_list_exemod': [ + 'AstralQsign' ], 'edit_root_Entry_Extend_list': [ 'edit_root_Entry_Extend', @@ -361,6 +366,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'type_list': [ 'QQ/NapCat/默认', 'QQ/OPQ/默认', + 'QQ/GoCq/安卓平板', + 'QQ/GoCq/安卓手机', 'KOOK', 'KOOK/消息兼容', 'QQ官方/公域/V2', @@ -376,16 +383,6 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'Fanbook', 'Hack.Chat', 'Hack.Chat/私有', - 'QQ/OPQ/指定端口', - 'QQ/GoCq/安卓手表', - 'QQ/GoCq/安卓手机', - 'QQ/GoCq/安卓平板', - 'QQ/GoCq/默认', - 'QQ/GoCq/iPad', - 'QQ/GoCq/iMac', - 'QQ/Wq/安卓手表', - 'QQ/Wq/安卓手机', - 'QQ/Wq/安卓平板', 'onebotV12/正向WS', 'onebotV11/Http', 'onebotV11/Http/Shamrock', @@ -402,6 +399,14 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'B站直播间/登录', 'FF14终端', '虚拟终端', + 'QQ/OPQ/指定端口', + 'QQ/GoCq/安卓手表', + 'QQ/GoCq/默认', + 'QQ/GoCq/iPad', + 'QQ/GoCq/iMac', + 'QQ/Wq/安卓手表', + 'QQ/Wq/安卓手机', + 'QQ/Wq/安卓平板', '接口终端', 'QQ/NapCat/旧', 'QQ/OPQ/指定端口/旧', From 8c2fabe2fab5cef2dd4437ab189f93971b5431cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Mon, 3 Jun 2024 15:48:22 +0800 Subject: [PATCH 44/76] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E4=BE=9D=E8=B5=96=E7=8A=B6=E5=86=B5=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/boot/bootAPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index a8675ea1..0b167242 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -777,9 +777,9 @@ def start(self): } ).start() elif basic_conf_models_this['type'] == 'astralqsign_lib_exe_model': - if not OlivOS.libAstralQsignEXEModelAPI.isBotActive(plugin_bot_info_dict): - continue if platform.system() == 'Windows': + if not OlivOS.libAstralQsignEXEModelAPI.isBotActive(plugin_bot_info_dict): + continue threading.Thread( target = OlivOS.libAstralQsignEXEModelAPI.startAstralQsignLibExeModel, kwargs = { From e9565ae2602c0d15efdcf24b7d906b2d5351c81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Tue, 4 Jun 2024 16:27:51 +0800 Subject: [PATCH 45/76] =?UTF-8?q?0.11.33=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=86=85=E7=BD=AEAstralQsign=E7=9A=84=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/core/L10N/L10NDataAPI.py | 2 + OlivOS/core/boot/bootAPI.py | 1 - OlivOS/core/info/infoAPI.py | 4 +- OlivOS/libBooter/libAstralQsignEXEModelAPI.py | 67 +++++--- OlivOS/libBooter/libEXEModelAPI.py | 39 ++++- OlivOS/nativeGUI/multiLoginUIAPI.py | 148 +++++++++++------- 6 files changed, 177 insertions(+), 84 deletions(-) diff --git a/OlivOS/core/L10N/L10NDataAPI.py b/OlivOS/core/L10N/L10NDataAPI.py index ca444ee1..1b1b51f3 100644 --- a/OlivOS/core/L10N/L10NDataAPI.py +++ b/OlivOS/core/L10N/L10NDataAPI.py @@ -96,6 +96,7 @@ 'libEXEModelAPI_0004': 'OlivOS libEXEModel failed: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS libEXEModel server [{0}] is running', 'libEXEModelAPI_0006': 'OlivOS libEXEModel server [{0}] exited', + 'libEXEModelAPI_0007': 'OlivOS libEXEModel server [{0}] will run in {1}s...', 'libNapCatEXEModelAPI_0001': 'OlivOS libNapCatEXEModel server [{0}] can`t found target lib', 'libNapCatEXEModelAPI_0002': 'OlivOS libNapCatEXEModel server [{0}] will run under visiable mode', 'libNapCatEXEModelAPI_0003': 'OlivOS libNapCatEXEModel server [{0}] will retry in 10s...', @@ -200,6 +201,7 @@ 'libEXEModelAPI_0004': 'OlivOS GoCq进程托管服务组件 错误: {0}\n{1}', 'libEXEModelAPI_0005': 'OlivOS GoCq进程托管服务组件 [{0}] 正在运作', 'libEXEModelAPI_0006': 'OlivOS GoCq进程托管服务组件 [{0}] 已经存在', + 'libEXEModelAPI_0007': 'OlivOS GoCq进程托管服务组件 [{0}] 将在{1}秒内启动...', 'libNapCatEXEModelAPI_0001': 'OlivOS NapCat进程托管服务组件 [{0}] 无法找到库文件', 'libNapCatEXEModelAPI_0002': 'OlivOS NapCat进程托管服务组件 [{0}] 将在前台模式下运行', 'libNapCatEXEModelAPI_0003': 'OlivOS NapCat进程托管服务组件 [{0}] 将在10秒后重试...', diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index 0b167242..cba8027b 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -831,7 +831,6 @@ def start(self): flag_fliter = rx_packet_data.key['target']['fliter'] for tmp_Proc_name in basic_conf_models: basic_conf_models_this = basic_conf_models[tmp_Proc_name] - if flag_target_all or basic_conf_models_this['type'] == rx_packet_data.key['target']['type']: model_name = basic_conf_models_this['name'] if 'hash' in rx_packet_data.key['target']: diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 636d807f..b79aca55 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.32' -OlivOS_SVN = 152 +OlivOS_Version = '0.11.33' +OlivOS_SVN = 153 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py index 810e9362..b91f1cdb 100644 --- a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py +++ b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py @@ -56,18 +56,17 @@ def startAstralQsignLibExeModel( filePathUpdate='./lib/astral-qsign.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'] - Proc_dict[tmp_Proc_name] = OlivOS.libAstralQsignEXEModelAPI.server( - Proc_name=tmp_Proc_name, - tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], - control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], - logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], - server_data=basic_conf_models_this['server'], - debug_mode=False - ) - Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) + tmp_Proc_name = basic_conf_models_this['name'] + Proc_dict[tmp_Proc_name] = OlivOS.libAstralQsignEXEModelAPI.server( + Proc_name=tmp_Proc_name, + tx_queue=multiprocessing_dict[basic_conf_models_this['tx_queue']], + control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + server_data=basic_conf_models_this['server'], + bot_info_dict=plugin_bot_info_dict, + debug_mode=False + ) + Proc_Proc_dict[tmp_Proc_name] = Proc_dict[tmp_Proc_name].start_unity(tmp_proc_mode) class server(OlivOS.API.Proc_templet): def __init__( @@ -80,6 +79,7 @@ def __init__( control_queue=None, logger_proc=None, server_data=None, + bot_info_dict=None, debug_mode=False ): OlivOS.API.Proc_templet.__init__( @@ -94,16 +94,20 @@ def __init__( logger_proc=logger_proc ) self.Proc_config['debug_mode'] = debug_mode + self.Proc_data['bot_info_dict'] = {} + if type(bot_info_dict) is dict: + self.Proc_data['bot_info_dict'] = bot_info_dict self.server_data=server_data self.flag_run = True def run(self): while self.flag_run: - self.sendLog( + self.sendLogSim( 2, 'OlivOS libAstralQsignEXEModel server [{0}] will run under visiable mode', [self.Proc_name] ) time.sleep(2) + self.setGoCqhttpModelEnableSendAll() releaseDir("./conf") releaseDir("./conf/astral-qsign") unzip('./lib/astral-qsign.zip', "./conf/astral-qsign") @@ -126,17 +130,17 @@ def run(self): self.Proc_data['model_Proc'] = model_Proc self.get_model_stdout(model_Proc) # model_Proc.communicate(timeout = None) - self.log(3, OlivOS.L10NAPI.getTrans( - 'OlivOS libAstralQsignEXEModel server [{0}] will retry in 10s...', - [self.Proc_name], modelName - )) + self.sendLogSim( + 3, 'OlivOS libAstralQsignEXEModel server [{0}] will retry in 10s...', + [self.Proc_name] + ) self.Proc_data['model_Proc'] = None time.sleep(8) def get_model_stdout(self, model_Proc: subprocess.Popen): for line in iter(model_Proc.stdout.readline, b''): try: - log_data = ('%s' % line.decode('utf-8', errors='replace')).rstrip('\n').rstrip('\r') + log_data = ('%s' % line.decode('gbk', errors='replace')).rstrip('\n').rstrip('\r') self.log(2, log_data, [('AstralQsign', 'default')]) except Exception as e: self.log(4, OlivOS.L10NAPI.getTrans('OlivOS libAstralQsignEXEModel failed: %s\n%s' % [ @@ -160,6 +164,18 @@ def send_log_event(self, data): } ) + def setGoCqhttpModelEnableSend(self, hash): + self.sendControlEventSend('send', { + 'target': { + 'type': 'gocqhttp_lib_exe_model', + 'hash': hash + }, + 'data': { + 'action': 'skipDelay' + } + } + ) + def sendControlEventSend(self, action, data): if self.Proc_info.control_queue is not None: self.Proc_info.control_queue.put( @@ -170,6 +186,11 @@ def sendControlEventSend(self, action, data): block=False ) + def setGoCqhttpModelEnableSendAll(self): + for bot_info_key in self.Proc_data['bot_info_dict']: + if self.Proc_data['bot_info_dict'][bot_info_key].platform['model'] in gCheckList: + self.setGoCqhttpModelEnableSend(self.Proc_data['bot_info_dict'][bot_info_key].hash) + def sendLog(self, log_level:int, log_message:str, log_message_list:list): self.log( log_level, @@ -181,6 +202,16 @@ def sendLog(self, log_level:int, log_message:str, log_message_list:list): [('AstralQsign', 'default')] ) + def sendLogSim(self, log_level:int, log_message:str, log_message_list:list): + self.log( + log_level, + OlivOS.L10NAPI.getTrans( + log_message, + log_message_list, + modelName + ), + [] + ) def isBotActive(plugin_bot_info_dict:dict): diff --git a/OlivOS/libBooter/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py index 359ef0b7..f1e55729 100644 --- a/OlivOS/libBooter/libEXEModelAPI.py +++ b/OlivOS/libBooter/libEXEModelAPI.py @@ -46,6 +46,10 @@ 'gocqhttp_show_old' ] +gProtocalEXECheckList = [ + 'AstralQsign' +] + gProtocalInfo = { 'android_pad': { 'AstralQsign': '''{ @@ -531,10 +535,15 @@ def run(self): tmp.write('{}') releaseDir('./conf/gocqhttp/' + self.Proc_data['bot_info_dict'].hash) goTypeConfig(self.Proc_data['bot_info_dict'], self.Proc_config['target_proc'], self.Proc_config['sub_target_proc']).setConfig() - if False and (self.Proc_data['bot_info_dict'].platform['model'] in [ - 'gocqhttp', - 'gocqhttp_hide' - ]): + if 'qsign-server-protocal' in self.Proc_data['bot_info_dict'].extends \ + and type(self.Proc_data['bot_info_dict'].extends['qsign-server-protocal']) is str \ + and self.Proc_data['bot_info_dict'].extends['qsign-server-protocal'] in gProtocalEXECheckList: + self.log(2, OlivOS.L10NAPI.getTrans( + 'OlivOS libEXEModel server [{0}] will run in {1}s...', + [self.Proc_name, str(8)], modelName + )) + self.check_protocalEXE(8, 0.25) + if False and (self.Proc_data['bot_info_dict'].platform['model'] in ['gocqhttp', 'gocqhttp_hide']): model_Proc = subprocess.Popen( '..\\..\\..\\lib\\go-cqhttp.exe faststart', cwd='.\\conf\\gocqhttp\\' + self.Proc_data['bot_info_dict'].hash, @@ -720,6 +729,25 @@ def send_QRCode_event(self, path: str): } ) + def check_protocalEXE(self, delayS:int, interval:int): + flag_skip = False + for i in range(int(delayS / interval)): + if self.Proc_info.rx_queue.empty(): + time.sleep(interval) + else: + try: + rx_packet_data = self.Proc_info.rx_queue.get(block=False) + if type(rx_packet_data.key) is dict \ + and 'data' in rx_packet_data.key \ + and 'action' in rx_packet_data.key['data'] \ + and 'skipDelay' == rx_packet_data.key['data']['action']: + flag_skip = True + break + except: + rx_packet_data = None + if flag_skip: + time.sleep(2) + def send_log_event(self, data): self.sendControlEventSend('send', { 'target': { @@ -754,6 +782,7 @@ def __init__(self, bot_info_dict, target_proc, sub_target_proc): self.config_file_format = {} def setConfig(self): + global gProtocalEXECheckList self.config_file_str = ''' account: # 账号相关 uin: {uin} # QQ账号 @@ -956,7 +985,7 @@ def setConfig(self): if 'qsign-server-protocal' in self.bot_info_dict.extends \ and type(self.bot_info_dict.extends['qsign-server-protocal']) is str \ - and self.bot_info_dict.extends['qsign-server-protocal'] == 'AstralQsign': + and self.bot_info_dict.extends['qsign-server-protocal'] in gProtocalEXECheckList: self.config_file_format['sign-servers-data'] = ''' - url: 'http://localhost:%s/' key: '%s' diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index c921d7f8..c9736497 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -1231,8 +1231,7 @@ def tree_edit_commit(self): tmp_offset += 1 if type_this is not None \ and type_this in self.UIData['edit_root_Combobox_dict']['type_qsign_array_note_list']: - tmp_res_bot_info.extends['qsign-server-protocal'] = self.UIData[ - 'edit_root_Combobox_qsign_protocal_StringVar'].get() + tmp_res_bot_info.extends['qsign-server-protocal'] = self.UIData['edit_root_Combobox_qsign_protocal_StringVar'].get() tmp_res_bot_info.extends['qsign-server'] = [] for tmp_i in range(self.UIData['edit_root_Entry_qsign_num']): key_pare = [ @@ -1240,6 +1239,8 @@ def tree_edit_commit(self): 'edit_root_Entry_qsign_key_%d' % tmp_i ] tmp_data = {} + tmp_data['addr'] = '' + tmp_data['key'] = '' if key_pare[0] + '_StringVar' in self.UIData: tmp_data['addr'] = self.UIData[key_pare[0] + '_StringVar'].get() if key_pare[1] + '_StringVar' in self.UIData: @@ -1434,10 +1435,12 @@ def tree_edit_UI_Combobox_init(self, obj_root, obj_name, str_name, x, y, width, height=height ) self.UIObject[obj_name].configure(state='readonly') - self.UIObject[obj_name].bind('<>', - lambda x: self.tree_edit_UI_Combobox_ComboboxSelected(x, action, obj_name)) + self.UIObject[obj_name].bind( + '<>', + lambda x: self.tree_edit_UI_Combobox_ComboboxSelected(x, action, obj_name) + ) - def tree_edit_UI_Combobox_ComboboxSelected(self, action, event, target): + def tree_edit_UI_Combobox_ComboboxSelected(self, event, action, target): if target == 'edit_root_Combobox_Account_type': self.tree_edit_UI_Combobox_update(action, 'type') elif target == 'edit_root_Combobox_platform': @@ -1446,6 +1449,8 @@ def tree_edit_UI_Combobox_ComboboxSelected(self, action, event, target): self.tree_edit_UI_Combobox_update(action, 'sdk') elif target == 'edit_root_Combobox_model': self.tree_edit_UI_Combobox_update(action, 'model') + elif target == 'edit_root_Combobox_qsign_protocal': + self.tree_edit_UI_Combobox_update(action, 'qsign_protocal') def tree_edit_UI_type_clear_note_GEN(self, tmp_type:str): def tree_edit_UI_type_clear_note(): @@ -1467,7 +1472,7 @@ def tree_edit_UI_qsign_list_set(): self.UIData['edit_root_Entry_qsign_num'] = 1 if self.UIData['edit_root_Entry_qsign_num'] > 10: self.UIData['edit_root_Entry_qsign_num'] = 10 - self.tree_edit_UI_Combobox_update(self.action, 'type') + self.tree_edit_UI_Combobox_update(self.action, 'qsign_protocal') return tree_edit_UI_qsign_list_set def tree_edit_UI_Combobox_update(self, action, con_action): @@ -1536,7 +1541,7 @@ def tree_edit_UI_Combobox_update(self, action, con_action): self.UIData['edit_root_Combobox_dict']['type_list'].index('自定义') ) tmp_type = self.UIObject['edit_root_Combobox_Account_type'].get() - if con_action in ['init', 'type', 'platform', 'sdk', 'model']: + if con_action in ['init', 'type', 'platform', 'sdk', 'model', 'qsign_protocal']: if tmp_type in self.UIData['edit_root_Combobox_dict']['type_mapping_list']: count = 1 if tmp_type != '自定义': @@ -1649,7 +1654,7 @@ def tree_edit_UI_Combobox_update(self, action, con_action): y=40 + count * (24 + 6), width=200, height=24, - title='QSign服务器列表' + title='Qsign 服务器设置' ) count += 1 self.tree_edit_UI_Combobox_init( @@ -1666,6 +1671,7 @@ def tree_edit_UI_Combobox_update(self, action, con_action): self.UIObject['edit_root_Combobox_qsign_protocal']['value'] = tuple( self.UIData['edit_root_Combobox_qsign_protocal_list'] ) + tmp_qsign_protocal = self.UIData['edit_root_Combobox_qsign_protocal_StringVar'].get() self.UIObject['edit_root_Combobox_qsign_protocal'].current(0) if con_action == 'init': if action == 'update': @@ -1679,63 +1685,89 @@ def tree_edit_UI_Combobox_update(self, action, con_action): Account_data_this.extends['qsign-server-protocal'] ) ) + if con_action == 'qsign_protocal': + if action == 'update': + if tmp_qsign_protocal in self.UIData['edit_root_Combobox_qsign_protocal_list']: + self.UIObject['edit_root_Combobox_qsign_protocal'].current( + self.UIData['edit_root_Combobox_qsign_protocal_list'].index( + tmp_qsign_protocal + ) + ) + tmp_qsign_protocal = self.UIData['edit_root_Combobox_qsign_protocal_StringVar'].get() count += 1 - self.tree_UI_Button_init( - name='edit_root_Button_qsign_list_set_+', - text='增加一行', - command=self.tree_edit_UI_qsign_list_set_GEN('+'), - x=310, - y=40 + 5 * (24 + 6), - width=70, - height=24 - ) - self.tree_UI_Button_init( - name='edit_root_Button_qsign_list_set_-', - text='减少一行', - command=self.tree_edit_UI_qsign_list_set_GEN('-'), - x=310, - y=40 + 6 * (24 + 6), - width=70, - height=24 - ) - array_num = self.UIData['edit_root_Entry_qsign_num'] - for tmp_i in range(array_num): - key_pare = [ - 'edit_root_Entry_qsign_addr_%d' % tmp_i, - 'edit_root_Entry_qsign_key_%d' % tmp_i - ] - self.UIData['edit_root_Entry_qsign_list'].append(key_pare[0]) - self.UIData['edit_root_Entry_qsign_list'].append(key_pare[1]) - if key_pare[0] + '_StringVar' not in self.UIData: - self.UIData[key_pare[0] + '_StringVar'] = tkinter.StringVar() - self.tree_edit_UI_Entry_init( + if tmp_qsign_protocal in self.UIData['edit_root_Combobox_qsign_protocal_list_exemod']: + tmp_note_name = 'edit_root_Label_qsign_note_astalqsign_will_set' + if tmp_note_name not in self.UIData['edit_root_Entry_qsign_list']: + self.UIData['edit_root_Entry_qsign_list'].append(tmp_note_name) + self.tree_edit_UI_Label_init( obj_root='edit_root', - obj_name=key_pare[0], - str_name=key_pare[0] + '_StringVar', - x=100, + obj_name=tmp_note_name, + x=15, y=40 + count * (24 + 6), - width=200, + width=400 - 15 * 2, height=24, - action=self.action, - title='地址', - mode='NONE' + title='OlivOS 将会同步为你自动配置本地 AstralQsign 服务' ) count += 1 - if key_pare[1] + '_StringVar' not in self.UIData: - self.UIData[key_pare[1] + '_StringVar'] = tkinter.StringVar() - self.tree_edit_UI_Entry_init( - obj_root='edit_root', - obj_name=key_pare[1], - str_name=key_pare[1] + '_StringVar', - x=100, - y=40 + count * (24 + 6), - width=200, - height=24, - action=self.action, - title='KEY', - mode='NONE' + else: + self.tree_UI_Button_init( + name='edit_root_Button_qsign_list_set_+', + text='增加一行', + command=self.tree_edit_UI_qsign_list_set_GEN('+'), + x=310, + y=40 + 5 * (24 + 6), + width=70, + height=24 ) - count += 1 + self.tree_UI_Button_init( + name='edit_root_Button_qsign_list_set_-', + text='减少一行', + command=self.tree_edit_UI_qsign_list_set_GEN('-'), + x=310, + y=40 + 6 * (24 + 6), + width=70, + height=24 + ) + array_num = self.UIData['edit_root_Entry_qsign_num'] + for tmp_i in range(array_num): + key_pare = [ + 'edit_root_Entry_qsign_addr_%d' % tmp_i, + 'edit_root_Entry_qsign_key_%d' % tmp_i + ] + if key_pare[0] not in self.UIData['edit_root_Entry_qsign_list']: + self.UIData['edit_root_Entry_qsign_list'].append(key_pare[0]) + if key_pare[1] not in self.UIData['edit_root_Entry_qsign_list']: + self.UIData['edit_root_Entry_qsign_list'].append(key_pare[1]) + if key_pare[0] + '_StringVar' not in self.UIData: + self.UIData[key_pare[0] + '_StringVar'] = tkinter.StringVar() + self.tree_edit_UI_Entry_init( + obj_root='edit_root', + obj_name=key_pare[0], + str_name=key_pare[0] + '_StringVar', + x=100, + y=40 + count * (24 + 6), + width=200, + height=24, + action=self.action, + title='地址', + mode='NONE' + ) + count += 1 + if key_pare[1] + '_StringVar' not in self.UIData: + self.UIData[key_pare[1] + '_StringVar'] = tkinter.StringVar() + self.tree_edit_UI_Entry_init( + obj_root='edit_root', + obj_name=key_pare[1], + str_name=key_pare[1] + '_StringVar', + x=100, + y=40 + count * (24 + 6), + width=200, + height=24, + action=self.action, + title='KEY', + mode='NONE' + ) + count += 1 count -= 1 self.UIObject['edit_root'].geometry('400x%s' % (count * (24 + 6) + 100 + 10)) count += 1 From cd159a67e7dd2986b6c8def991e0376dd37fa6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Sat, 8 Jun 2024 00:45:47 +0800 Subject: [PATCH 46/76] =?UTF-8?q?0.11.34=EF=BC=8C=E5=86=85=E7=BD=AE?= =?UTF-8?q?=E4=BA=BA=E6=9C=BA=E9=AA=8C=E8=AF=81=E5=8A=A9=E6=89=8B=EF=BC=88?= =?UTF-8?q?=E6=BB=91=E5=9D=97=E5=8A=A9=E6=89=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 赵怡然 <63996691+zhaodice@users.noreply.github.com> --- OlivOS/core/boot/bootAPI.py | 33 +++++++ OlivOS/core/boot/bootDataAPI.py | 10 +++ OlivOS/core/info/infoAPI.py | 4 +- OlivOS/libBooter/libEXEModelAPI.py | 140 +++++++++++++++++++++++++++++ OlivOS/nativeGUI/nativeWinUIAPI.py | 47 ++++++---- 5 files changed, 217 insertions(+), 17 deletions(-) diff --git a/OlivOS/core/boot/bootAPI.py b/OlivOS/core/boot/bootAPI.py index cba8027b..b6b8b2a7 100644 --- a/OlivOS/core/boot/bootAPI.py +++ b/OlivOS/core/boot/bootAPI.py @@ -890,6 +890,39 @@ def start(self): ) if model_name not in Proc_Proc_dict: Proc_Proc_dict[model_name] = Proc_dict[model_name].start_unity('processing') + elif rx_packet_data.action == 'init_type_open_tx_turingTest_webview_page': + if platform.system() == 'Windows': + if type(rx_packet_data.key) is dict \ + and 'target' in rx_packet_data.key \ + and type(rx_packet_data.key['target']) is dict \ + and 'data' in rx_packet_data.key \ + and type(rx_packet_data.key['data']) is dict \ + and 'action' in rx_packet_data.key['target'] \ + and 'name' in rx_packet_data.key['target'] \ + and 'title' in rx_packet_data.key['data'] \ + and 'url' in rx_packet_data.key['data']: + if 'init' == rx_packet_data.key['target']['action']: + for basic_conf_models_this_key in basic_conf_models: + basic_conf_models_this = basic_conf_models[basic_conf_models_this_key] + if 'tx_turingTest_webview_page' == basic_conf_models_this['type']: + if basic_conf_models_this['name'] not in Proc_dict: + model_name = '%s+%s' % ( + basic_conf_models_this['name'], + rx_packet_data.key['target']['name'] + ) + Proc_dict[model_name] = OlivOS.libEXEModelAPI.txTuringTestPage( + Proc_name=model_name, + scan_interval=basic_conf_models_this['interval'], + dead_interval=basic_conf_models_this['dead_interval'], + rx_queue=None, + tx_queue=None, + control_queue=multiprocessing_dict[basic_conf_models_this['control_queue']], + logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], + title=rx_packet_data.key['data']['title'], + url=rx_packet_data.key['data']['url'] + ) + if model_name not in Proc_Proc_dict: + Proc_Proc_dict[model_name] = Proc_dict[model_name].start_unity('processing') elif rx_packet_data.action == 'call_system_event': if type(rx_packet_data.key) is dict \ and 'action' in rx_packet_data.key \ diff --git a/OlivOS/core/boot/bootDataAPI.py b/OlivOS/core/boot/bootDataAPI.py index d12c9ae8..dcd37841 100644 --- a/OlivOS/core/boot/bootDataAPI.py +++ b/OlivOS/core/boot/bootDataAPI.py @@ -562,6 +562,16 @@ "control_queue": "OlivOS_control_queue", "debug": False }, + "OlivOS_tx_turingTest_webview_page": { + "enable": True, + "name": "OlivOS_tx_turingTest_webview_page", + "type": "tx_turingTest_webview_page", + "interval": 0.2, + "dead_interval": 1, + "logger_proc": "OlivOS_logger", + "control_queue": "OlivOS_control_queue", + "debug": False + }, "OlivOS_update_get": { "enable": True, "name": "OlivOS_update_get", diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index b79aca55..e6701642 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.33' -OlivOS_SVN = 153 +OlivOS_Version = '0.11.34' +OlivOS_SVN = 154 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py index f1e55729..6034bf3d 100644 --- a/OlivOS/libBooter/libEXEModelAPI.py +++ b/OlivOS/libBooter/libEXEModelAPI.py @@ -27,6 +27,7 @@ import hashlib import platform import shutil +import webview import OlivOS @@ -1173,3 +1174,142 @@ def getRandomStringRange(length:int, string:str): def releaseDir(dir_path): if not os.path.exists(dir_path): os.makedirs(dir_path) + + +def setGoCqhttpTokenSend( + control_queue, + hash, + token +): + if control_queue is not None: + control_queue.put( + OlivOS.API.Control.packet('send', { + 'target': { + 'type': 'nativeWinUI' + }, + 'data': { + 'action': 'gocqhttp', + 'event': 'token_get', + 'token': token, + 'hash': hash, + } + } + ), + block=False + ) + +def sendOpentxTuringTestPage( + control_queue, + name:str, + title:str, + url:str +): + if control_queue is not None: + control_queue.put( + OlivOS.API.Control.packet( + 'init_type_open_tx_turingTest_webview_page', + { + 'target': { + 'action': 'init', + 'name': name + }, + 'data': { + 'title': title, + 'url': url + } + } + ), + block=False + ) + +def sendStopTxTuringTestPage(control_queue, Proc_name): + if control_queue is not None: + control_queue.put( + OlivOS.API.Control.packet('stop', Proc_name), + block=False + ) + +def txTuringTest_evaluate_js(window): + window.evaluate_js( + r""" + mqq.invoke = function(a,b,c){return pywebview.api.invoke(b, JSON.stringify(c))}; + """ + ) + +class txTuringTestApi(object): + def __init__(self, Proc_name, hash, control_queue): + self.Proc_name = Proc_name + self.hash = hash + self.control_queue = control_queue + + def invoke(self, b, c): + data = json.loads(c) + if type(data) is dict \ + and 'ticket' in data \ + and type(data['ticket']) is str: + setGoCqhttpTokenSend( + self.control_queue, + self.hash, + data['ticket'] + ) + sendStopTxTuringTestPage( + self.control_queue, + self.Proc_name + ) + +class txTuringTestPage(OlivOS.API.Proc_templet): + def __init__( + self, + Proc_name='tx_turingTest_webview_page', + scan_interval=0.001, + dead_interval=1, + rx_queue=None, + tx_queue=None, + logger_proc=None, + control_queue=None, + title='OlivOS Turing Test Page', + url=None + ): + OlivOS.API.Proc_templet.__init__( + self, + Proc_name=Proc_name, + Proc_type='tx_turingTest_webview_page', + scan_interval=scan_interval, + dead_interval=dead_interval, + rx_queue=rx_queue, + tx_queue=tx_queue, + control_queue=control_queue, + logger_proc=logger_proc + ) + self.UIObject = {} + self.UIData = { + 'title': title, + 'url': url, + 'control_queue': control_queue + } + + def run(self): + releaseDir('./data') + releaseDir('./data/webview') + releaseDir('./data/webview/%s' % self.Proc_name) + if self.UIData['url'] != None: + txTuringTestApi_obj = txTuringTestApi( + self.Proc_name, + self.Proc_name.split('=')[-1], + self.UIData['control_queue'], + ) + window = webview.create_window( + title=self.UIData['title'], + url=self.UIData['url'], + background_color='#00A0EA', + js_api=txTuringTestApi_obj + ) + webview.start( + txTuringTest_evaluate_js, + window, + private_mode=False, + storage_path='./data/webview/%s' % self.Proc_name, + ) + + # 发送并等待结束 + sendStopTxTuringTestPage(self.Proc_info.control_queue, self.Proc_name) diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index 484d24e6..fd4ae6ec 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -305,6 +305,14 @@ def mainrun(self): path=rx_packet_data.key['data']['path'] ) self.UIObject['root_qrcode_window'][hash].start() + elif 'token_get' == rx_packet_data.key['data']['event']: + if 'hash' in rx_packet_data.key['data'] \ + and 'token' in rx_packet_data.key['data']: + hash = rx_packet_data.key['data']['hash'] + self.setGoCqhttpModelSend( + hash=rx_packet_data.key['data']['hash'], + data=rx_packet_data.key['data']['token'] + ) elif 'gocqhttp_terminal_on' == rx_packet_data.key['data']['event']: if 'hash' in rx_packet_data.key['data']: self.startGoCqhttpTerminalUI(rx_packet_data.key['data']['hash']) @@ -1224,11 +1232,14 @@ def resFunc(event): def root_Entry_enter(self, name, event): if name == 'root_input': - input = self.UIData['root_input_StringVar'].get() - if len(input) >= 0 and len(input) < 1000: - self.root.setGoCqhttpModelSend(self.bot.hash, input) + input_data = self.UIData['root_input_StringVar'].get() + if len(input_data) >= 0 and len(input_data) < 1000: + self.root_setGoCqhttpModelSend(input_data) self.UIData['root_input_StringVar'].set('') + def root_setGoCqhttpModelSend(self, input_data): + self.root.setGoCqhttpModelSend(self.bot.hash, input_data) + def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, height, action, title='', mode='NONE'): self.UIObject[obj_name + '=Label'] = tkinter.Label( @@ -1270,19 +1281,17 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he # ) def show_url_webbrowser(self, url): - res = tkinter.messagebox.askquestion("请完成验证", "是否通过浏览器访问 \"" + url + "\" ?") + res = tkinter.messagebox.askquestion("请完成验证", "是否使用内置人机验证助手访问 \"" + url + "\" ?") try: if res == 'yes': - res = tkinter.messagebox.askquestion("请完成验证", "是否使用内置浏览器?") - if res == 'yes': - OlivOS.webviewUIAPI.sendOpenWebviewPage( - control_queue=self.root.Proc_info.control_queue, - name='slider_verification_code=%s' % self.bot.hash, - title='请完成验证', - url=url - ) - else: - webbrowser.open(url) + OlivOS.libEXEModelAPI.sendOpentxTuringTestPage( + control_queue=self.root.Proc_info.control_queue, + name='slider_verification_code=%s' % self.bot.hash, + title='请完成验证', + url=url + ) + else: + webbrowser.open(url) except webbrowser.Error as error_info: tkinter.messagebox.showerror("webbrowser.Error", error_info) @@ -1315,7 +1324,15 @@ def tree_add_line(self, data, flagInit = False): if not flagInit and platform.system() == 'Windows': try: matchRes = re.match( - r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s请前往该地址验证\s+->\s+(http[s]{0,1}://captcha\.go-cqhttp\.org/captcha\?[^\s]+).*$', + r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s请选择提交滑块ticket方式:.*$', + res_data_raw + ) + if matchRes != None: + self.tree_add_line('=================================================================') + self.tree_add_line(' 【推荐】 选择手动抓取ticket方式将会允许OlivOS接管验证流程 【推荐】') + self.tree_add_line('=================================================================') + matchRes = re.match( + r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s请前往该地址验证\s+->\s+(http[s]{0,1}://ti\.qq\.com/safe/tools/captcha/sms-verify-login\?[^\s]+).*$', res_data_raw ) if matchRes != None: From c0edc169ee4c007c787bf42d00d0ceb7287d8068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Sat, 8 Jun 2024 09:26:55 +0800 Subject: [PATCH 47/76] =?UTF-8?q?0.11.35=EF=BC=8C=E4=BC=98=E5=8C=96QQ?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BD=BF=E7=94=A8=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 赵怡然 <63996691+zhaodice@users.noreply.github.com> --- OlivOS/core/info/infoAPI.py | 4 +-- OlivOS/libBooter/libAstralQsignEXEModelAPI.py | 1 + OlivOS/nativeGUI/nativeWinUIAPI.py | 31 ++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index e6701642..62028dcd 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.34' -OlivOS_SVN = 154 +OlivOS_Version = '0.11.35' +OlivOS_SVN = 155 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py index b91f1cdb..95697e16 100644 --- a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py +++ b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py @@ -111,6 +111,7 @@ def run(self): releaseDir("./conf") releaseDir("./conf/astral-qsign") unzip('./lib/astral-qsign.zip', "./conf/astral-qsign") + time.sleep(1) tmp_env = dict(os.environ) tmp_env['FORCE_TTY'] = '' model_Proc = subprocess.Popen( diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index fd4ae6ec..f4a7b012 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -1280,7 +1280,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he # height = height # ) - def show_url_webbrowser(self, url): + def show_tx_url_webbrowser(self, url): res = tkinter.messagebox.askquestion("请完成验证", "是否使用内置人机验证助手访问 \"" + url + "\" ?") try: if res == 'yes': @@ -1295,6 +1295,23 @@ def show_url_webbrowser(self, url): except webbrowser.Error as error_info: tkinter.messagebox.showerror("webbrowser.Error", error_info) + def show_url_webbrowser(self, url): + res = tkinter.messagebox.askquestion("请完成验证", "是否通过浏览器访问 \"" + url + "\" ?") + try: + if res == 'yes': + res = tkinter.messagebox.askquestion("请完成验证", "是否使用内置浏览器?") + if res == 'yes': + OlivOS.webviewUIAPI.sendOpenWebviewPage( + control_queue=self.root.Proc_info.control_queue, + name='slider_verification_code=%s' % self.bot.hash, + title='请完成验证', + url=url + ) + else: + webbrowser.open(url) + except webbrowser.Error as error_info: + tkinter.messagebox.showerror("webbrowser.Error", error_info) + def tree_init_line(self): if self.bot.hash in self.root.UIObject['root_gocqhttp_terminal_data']: for line in self.root.UIObject['root_gocqhttp_terminal_data'][self.bot.hash]: @@ -1331,6 +1348,7 @@ def tree_add_line(self, data, flagInit = False): self.tree_add_line('=================================================================') self.tree_add_line(' 【推荐】 选择手动抓取ticket方式将会允许OlivOS接管验证流程 【推荐】') self.tree_add_line('=================================================================') + matchRes = re.match( r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s请前往该地址验证\s+->\s+(http[s]{0,1}://ti\.qq\.com/safe/tools/captcha/sms-verify-login\?[^\s]+).*$', res_data_raw @@ -1339,6 +1357,17 @@ def tree_add_line(self, data, flagInit = False): matchResList = list(matchRes.groups()) if len(matchResList) == 1: matchResUrl = matchResList[0] + self.show_tx_url_webbrowser(matchResUrl) + + matchRes = re.match( + r'^\[\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\]\s\[WARNING\]:\s账号已开启设备锁,请前往\s+->\s+(http[s]{0,1}://accounts\.qq\.com/safe/verify[^\s]+).*$', + res_data_raw + ) + if matchRes != None: + matchResList = list(matchRes.groups()) + if len(matchResList) == 1: + matchResUrl = matchResList[0] + matchResUrl = matchResUrl.replace('accounts.qq.com/safe/verify', 'accounts.qq.com/safe/qrcode') self.show_url_webbrowser(matchResUrl) except: pass From 6f7f0d0c090fd6ad9f4789ef30b3f35149ab7944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Sun, 9 Jun 2024 10:37:31 +0800 Subject: [PATCH 48/76] =?UTF-8?q?0.11.36=EF=BC=8C=E6=8C=87=E5=AE=9AWebview?= =?UTF-8?q?=E5=BC=95=E6=93=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/info/infoAPI.py | 4 ++-- OlivOS/libBooter/libEXEModelAPI.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 62028dcd..24b679cd 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.35' -OlivOS_SVN = 155 +OlivOS_Version = '0.11.36' +OlivOS_SVN = 156 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py index 6034bf3d..b26e1ce7 100644 --- a/OlivOS/libBooter/libEXEModelAPI.py +++ b/OlivOS/libBooter/libEXEModelAPI.py @@ -1309,6 +1309,7 @@ def run(self): window, private_mode=False, storage_path='./data/webview/%s' % self.Proc_name, + gui='edgechromium' ) # 发送并等待结束 From 961131993031016870823bce815c4db887929eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 10 Jun 2024 23:17:50 +0800 Subject: [PATCH 49/76] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E7=BD=AEAstra?= =?UTF-8?q?lQsign=E7=9A=84=E5=90=AF=E5=8A=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 赵怡然 <63996691+zhaodice@users.noreply.github.com> Co-Authored-By: 元理 --- OlivOS/libBooter/libAstralQsignEXEModelAPI.py | 2 +- OlivOS/libBooter/libEXEModelAPI.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py index 95697e16..65700968 100644 --- a/OlivOS/libBooter/libAstralQsignEXEModelAPI.py +++ b/OlivOS/libBooter/libAstralQsignEXEModelAPI.py @@ -115,7 +115,7 @@ def run(self): tmp_env = dict(os.environ) tmp_env['FORCE_TTY'] = '' model_Proc = subprocess.Popen( - f".\\start.bat {self.server_data['port']}", + f".\\start.bat \"localhost\" \"{self.server_data['port']}\" \"{self.server_data['token']}\"", cwd='.\\conf\\astral-qsign', shell=True, stdin=subprocess.PIPE, diff --git a/OlivOS/libBooter/libEXEModelAPI.py b/OlivOS/libBooter/libEXEModelAPI.py index b26e1ce7..39183f9b 100644 --- a/OlivOS/libBooter/libEXEModelAPI.py +++ b/OlivOS/libBooter/libEXEModelAPI.py @@ -839,7 +839,7 @@ def setConfig(self): # 为 false 时,将不会自动注册实例,在签名服务器重启或实例被销毁后需要重启 go-cqhttp 以获取实例 # 否则后续消息将不会正常签名。关闭此项后可以考虑开启签名服务器端 auto_register 避免需要重启 # 由于实现问题,当前建议关闭此项,推荐开启签名服务器的自动注册实例 - auto-register: false + auto-register: {auto-register} # 是否在 token 过期后立即自动刷新签名 token(在需要签名时才会检测到,主要防止 token 意外丢失) # 独立于定时刷新 auto-refresh-token: false @@ -970,6 +970,7 @@ def setConfig(self): key: '-' authorization: '-' ''' + self.config_file_format['auto-register'] = 'false' if 'qsign-server' in self.bot_info_dict.extends \ and type(self.bot_info_dict.extends['qsign-server']) is list \ and len(self.bot_info_dict.extends['qsign-server']) > 0: @@ -992,6 +993,7 @@ def setConfig(self): key: '%s' authorization: '-' ''' % (str(self.sub_target_proc['server']['port']), str(self.sub_target_proc['server']['token'])) + self.config_file_format['auto-register'] = 'true' self.config_file_str = self.config_file_str.format(**self.config_file_format) From 69d8fca1fb061ca87f1093ea06cb1a1bec9707b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Mon, 10 Jun 2024 23:24:44 +0800 Subject: [PATCH 50/76] 0.11.37 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 元理 --- OlivOS/core/info/infoAPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 24b679cd..53311c21 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.36' -OlivOS_SVN = 156 +OlivOS_Version = '0.11.37' +OlivOS_SVN = 157 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From a840707ddb8cb6870a219a8845318b3acb63565d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Wed, 12 Jun 2024 13:08:06 +0800 Subject: [PATCH 51/76] =?UTF-8?q?0.11.38=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=86=85=E7=BD=AENapCat=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/core/info/infoAPI.py | 4 ++-- OlivOS/libBooter/libNapCatEXEModelAPI.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 53311c21..1ec1ebca 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.37' -OlivOS_SVN = 157 +OlivOS_Version = '0.11.38' +OlivOS_SVN = 158 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index afa7b46f..8008f460 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -62,7 +62,7 @@ def startNapCatLibExeModel( OlivOS.updateAPI.checkResouceFile( logger_proc=Proc_dict[basic_conf_models_this['logger_proc']], resouce_api=resourceUrlPath, - resouce_name='NapCat', + resouce_name='NapCat-QQ-Win-9.9.11-24568', filePath='./lib/NapCat.zip', filePathUpdate='./lib/NapCat.zip.tmp', filePathFORCESKIP='./lib/FORCESKIP' From 9c4fa3d06944c82ba98274c60e86d0eac2384cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Wed, 12 Jun 2024 14:25:11 +0800 Subject: [PATCH 52/76] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E7=9A=84=E5=B9=B6=E5=8F=91=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- .../virtualTerminal/virtualTerminalLinkServerAPI.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py b/OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py index 738e5473..a9f82789 100644 --- a/OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py +++ b/OlivOS/adapter/virtualTerminal/virtualTerminalLinkServerAPI.py @@ -14,6 +14,7 @@ @Desc : None ''' +import gevent from gevent import pywsgi from flask import Flask from flask import current_app @@ -139,10 +140,13 @@ def Flask_server_func(): res = json.dumps(self.Proc_data['reply_event_pool'][event_id]) self.Proc_data['reply_event_pool'].pop(event_id) break - time.sleep(0.25) + gevent.sleep(0.25) return res, status, header - server = pywsgi.WSGIServer(('0.0.0.0', self.Proc_data['bot_info_dict'].post_info.port), - self.Proc_config['Flask_app'], log=None) + server = pywsgi.WSGIServer( + ('0.0.0.0', self.Proc_data['bot_info_dict'].post_info.port), + self.Proc_config['Flask_app'], + log=None + ) server.serve_forever() def send_init_event(self): From 2157a0542161c7928e121d0578d9360ebf1f451d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Wed, 12 Jun 2024 14:39:47 +0800 Subject: [PATCH 53/76] 0.11.39 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/core/info/infoAPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 1ec1ebca..e049f70c 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.38' -OlivOS_SVN = 158 +OlivOS_Version = '0.11.39' +OlivOS_SVN = 159 # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 8f57958bb2ed2207a9ed408426d8df758fe8646d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Thu, 13 Jun 2024 00:23:46 +0800 Subject: [PATCH 54/76] =?UTF-8?q?0.11.40=EF=BC=8C=E5=A4=8F=E8=87=B3?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 未来将为每个发行版本指定一个名称,目前该名称来自临近节气 --- OlivOS/core/info/infoAPI.py | 6 ++++-- OlivOS/nativeGUI/multiLoginUIAPI.py | 2 +- OlivOS/nativeGUI/nativeWinUIAPI.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index e049f70c..20a3995e 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.39' -OlivOS_SVN = 159 +OlivOS_Version = '0.11.40' +OlivOS_SVN = 160 +OlivOS_Version_Slogan = '夏至' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn @@ -28,6 +29,7 @@ OlivOS_compatible_svn_default = 0 OlivOS_Version_Short = '%s(%s)' % (OlivOS_Version, str(OlivOS_SVN)) +OlivOS_Version_Title = '%s(%s) - %s' % (OlivOS_Version, str(OlivOS_SVN), OlivOS_Version_Slogan) OlivOS_Header_UA = 'OlivOS/' + OlivOS_Version diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index c9736497..f7582637 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -139,7 +139,7 @@ def start(self): self.UIObject['root'] = tkinter.Tk() else: self.UIObject['root'] = tkinter.Toplevel() - self.UIObject['root'].title('OlivOS 登录管理器') + self.UIObject['root'].title('OlivOS 登录管理器 - %s' % OlivOS.infoAPI.OlivOS_Version_Title) self.UIObject['root'].geometry('518x400') self.UIObject['root'].resizable( width=False, diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index f4a7b012..fb2b2010 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -2298,7 +2298,7 @@ def __init__(self, Model_name, logger_proc=None, root=None, root_tk=None): def start(self): self.UIObject['root'] = tkinter.Toplevel() - self.UIObject['root'].title('OlivOS 终端') + self.UIObject['root'].title('OlivOS 终端 - %s' % OlivOS.infoAPI.OlivOS_Version_Title) self.UIObject['root'].geometry('900x600') self.UIObject['root'].minsize(900, 600) self.UIObject['root'].grid_rowconfigure(0, weight=15) From 0164ae57f09839aeee438ee0e60b29ba882dcf85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 28 Jun 2024 17:21:06 +0800 Subject: [PATCH 55/76] =?UTF-8?q?0.11.41=EF=BC=8C=E5=B0=8F=E6=9A=91?= =?UTF-8?q?=EF=BC=8C=E8=A1=A5=E5=85=85NapCat=E7=AB=AF=E7=9A=84OlivOS?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=BD=AC=E6=8D=A2=E5=85=83=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/core/messageAPI.py | 9 ++++++++- OlivOS/core/info/infoAPI.py | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OlivOS/core/core/messageAPI.py b/OlivOS/core/core/messageAPI.py index fe53a1ae..87dc67de 100644 --- a/OlivOS/core/core/messageAPI.py +++ b/OlivOS/core/core/messageAPI.py @@ -51,7 +51,14 @@ 'walleq_show_iPad': 'obv12_para', 'walleq_show_iMac': 'obv12_para', 'walleq_show_old': 'obv12_para', - 'opqbot_default': 'olivos_string' + 'opqbot_default': 'olivos_string', + 'opqbot_auto': 'old_string', + 'opqbot_port': 'old_string', + 'opqbot_port_old': 'old_string', + 'napcat': 'old_string', + 'napcat_hide': 'old_string', + 'napcat_show': 'old_string', + 'napcat_show_old': 'old_string' } }, 'qqGuild': { diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 20a3995e..9d21fe24 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.40' -OlivOS_SVN = 160 -OlivOS_Version_Slogan = '夏至' +OlivOS_Version = '0.11.41' +OlivOS_SVN = 161 +OlivOS_Version_Slogan = '小暑' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 681bbd3c02ba4e3e0e550a2b5204c1d7d4737767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 28 Jun 2024 21:11:57 +0800 Subject: [PATCH 56/76] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 3021c1c9..2da8de6e 100644 --- a/README.md +++ b/README.md @@ -146,3 +146,8 @@ if __name__ == '__main__': - 若引用 OlivOS 发布的软件包而不修改 OlivOS,则衍生项目需在描述的任意部位提及使用 OlivOS。 - 若修改 OlivOS 源代码再发布,**或参考 OlivOS 内部实现发布另一个项目**,则衍生项目必须在**文章首部**或 'OlivOS' 相关内容**首次出现**的位置**明确声明**来源于本仓库 (`https://github.com/OlivOS-Team/OlivOS`)。不得扭曲或隐藏免费且开源的事实。 + +## 特别声明 +有[CSDN旗下GitCode被曝批量搬运Github项目](https://tech.ifeng.com/c/8ako6om7AC7)的珠玉在前,本项目特别在此声明,本项目的官方源代码仅在以下平台发布: ++ [Github - OlivOS-Team/OlivOS](https://github.com/OlivOS-Team/OlivOS) +任何未经本仓库所属的组织允许的超出以上代码托管平台的冒充行为,都是侵权的。 From b1fccd6f49e9b605e06371b8ebe64cee2cd12a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 28 Jun 2024 21:12:30 +0800 Subject: [PATCH 57/76] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2da8de6e..186ae22f 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,8 @@ if __name__ == '__main__': - 若修改 OlivOS 源代码再发布,**或参考 OlivOS 内部实现发布另一个项目**,则衍生项目必须在**文章首部**或 'OlivOS' 相关内容**首次出现**的位置**明确声明**来源于本仓库 (`https://github.com/OlivOS-Team/OlivOS`)。不得扭曲或隐藏免费且开源的事实。 ## 特别声明 -有[CSDN旗下GitCode被曝批量搬运Github项目](https://tech.ifeng.com/c/8ako6om7AC7)的珠玉在前,本项目特别在此声明,本项目的官方源代码仅在以下平台发布: +有[CSDN旗下GitCode被曝批量搬运Github项目](https://tech.ifeng.com/c/8ako6om7AC7)的珠玉在前,本项目特别在此声明,本项目的官方源代码仅在以下平台发布: + + [Github - OlivOS-Team/OlivOS](https://github.com/OlivOS-Team/OlivOS) + 任何未经本仓库所属的组织允许的超出以上代码托管平台的冒充行为,都是侵权的。 From 458363b3eb60f350d7bf83f0aaf5eb9e8869641f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 28 Jun 2024 21:17:05 +0800 Subject: [PATCH 58/76] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 186ae22f..6f779dfd 100644 --- a/README.md +++ b/README.md @@ -152,4 +152,4 @@ if __name__ == '__main__': + [Github - OlivOS-Team/OlivOS](https://github.com/OlivOS-Team/OlivOS) -任何未经本仓库所属的组织允许的超出以上代码托管平台的冒充行为,都是侵权的。 +任何未经本仓库所属的组织允许的超出以上代码托管平台的冒充行为,都是未授权的,请警惕。 From d08afa597e4eb654950deafd0a5f1e1fd8407bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 5 Jul 2024 12:15:01 +0800 Subject: [PATCH 59/76] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20QQ=E5=AE=98=E6=96=B9?= =?UTF-8?q?/=E6=B2=99=E7=9B=92/V2=20=E8=B4=A6=E5=8F=B7=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/qqGuild/qqGuildv2SDK.py | 12 ++++++++++-- OlivOS/core/core/messageAPI.py | 6 +++++- OlivOS/nativeGUI/multiLoginUIAPI.py | 18 +++++++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py index 6206e5bd..b944deae 100644 --- a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py +++ b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py @@ -181,12 +181,12 @@ def __init__(self, bot_info:bot_info_T, intents=(int(intents_T.GUILDS) | int(int if bot_info.model == 'private': tmp_intents |= int(intents_T.GUILD_MESSAGES) #tmp_intents |= int(intents_T.QQ_MESSAGES) - elif bot_info.model == 'public': + elif bot_info.model == ['public', 'sandbox']: tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) tmp_intents |= int(intents_T.PUBLIC_QQ_MESSAGES) elif bot_info.model == 'public_guild_only': tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) - elif bot_info.model in ['private_intents', 'public_intents']: + elif bot_info.model in ['private_intents', 'public_intents', 'sandbox_intents']: tmp_intents = bot_info.intents payload_template.__init__(self) self.data.op = 2 @@ -232,8 +232,15 @@ def __init__(self): self.route = None self.res = None + def __switch_host(self): + global sdkAPIHost + if self.bot_info.model in ['sandbox', 'sandbox_intents']: + if self.host == sdkAPIHost['default']: + self.host = sdkAPIHost['sandbox'] + def do_api_plant(self, req_type='POST'): try: + self.__switch_host() tmp_payload_dict = {} tmp_sdkAPIRouteTemp = sdkAPIRouteTemp.copy() if self.metadata is not None: @@ -264,6 +271,7 @@ def do_api_plant(self, req_type='POST'): def do_api(self, req_type='POST'): try: + self.__switch_host() tmp_payload_dict = {} tmp_sdkAPIRouteTemp = sdkAPIRouteTemp.copy() if self.metadata is not None: diff --git a/OlivOS/core/core/messageAPI.py b/OlivOS/core/core/messageAPI.py index 87dc67de..f481fc0e 100644 --- a/OlivOS/core/core/messageAPI.py +++ b/OlivOS/core/core/messageAPI.py @@ -69,8 +69,12 @@ }, 'qqGuildv2_link': { 'default': 'olivos_para', + 'sandbox': 'olivos_para', + 'sandbox_intents': 'olivos_para', 'private': 'olivos_para', - 'public': 'olivos_para' + 'private_intents': 'olivos_para', + 'public': 'olivos_para', + 'public_intents': 'olivos_para' } }, 'telegram': { diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index f7582637..636a744d 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -375,6 +375,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ官方/公域/V2/指定intents', 'QQ官方/私域/V2', 'QQ官方/私域/V2/指定intents', + 'QQ官方/沙盒/V2', + 'QQ官方/沙盒/V2/指定intents', 'QQ官方/公域/V1', 'QQ官方/私域/V1', 'Discord', @@ -710,6 +712,17 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'intents': 'edit_root_Entry_Server_port' } ], + 'QQ官方/沙盒/V2': ['qqGuild', 'qqGuildv2_link', 'sandbox', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + } + ], + 'QQ官方/沙盒/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'sandbox_intents', 'True', 'websocket', { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + } + ], 'Telegram': ['telegram', 'telegram_poll', 'default', 'True', 'post', { 'TOKEN': 'edit_root_Entry_Server_access_token' } @@ -891,6 +904,8 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'public_intents', 'private', 'private_intents', + 'sandbox', + 'sandbox_intents', 'default' ] }, @@ -1046,7 +1061,8 @@ def tree_edit_commit(self): tmp_host = 'NONEED' if tmp_platform_model not in [ 'public_intents', - 'private_intents' + 'private_intents', + 'sandbox_intents' ]: if tmp_port == '': tmp_port = '0' From cb9c5c881cff4eeeebaa48fc675541285ab1eea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Fri, 5 Jul 2024 13:35:35 +0800 Subject: [PATCH 60/76] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E7=BD=AENapCa?= =?UTF-8?q?t=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/libBooter/libNapCatEXEModelAPI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index 8008f460..cbc54036 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -62,7 +62,7 @@ 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', filePath='./lib/NapCat.zip', filePathUpdate='./lib/NapCat.zip.tmp', filePathFORCESKIP='./lib/FORCESKIP' From 2b95c4679bc1cb15d3bc13a00511df36ba9034cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=91=E8=B4=A8?= Date: Thu, 18 Jul 2024 12:34:48 +0800 Subject: [PATCH 61/76] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9c8d3c05..3b6692b5 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms -custom: ['https://afdian.net/@OlivOS'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +custom: ['https://afdian.com/a/OlivOS'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From b7f542c0e4500fdece817453afcbf2f5dccdc300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Fri, 2 Aug 2024 14:15:17 +0800 Subject: [PATCH 62/76] Update infoAPI.py --- OlivOS/core/info/infoAPI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 9d21fe24..c72871d1 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.41' -OlivOS_SVN = 161 -OlivOS_Version_Slogan = '小暑' +OlivOS_Version = '0.11.42' +OlivOS_SVN = 162 +OlivOS_Version_Slogan = '大暑' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 9184d8b61bb387b2cc9032a5ca605ecd10b4f50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Fri, 2 Aug 2024 19:18:59 +0800 Subject: [PATCH 63/76] =?UTF-8?q?=E5=9B=9E=E6=BB=9A=E5=86=85=E7=BD=AENapCa?= =?UTF-8?q?t=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 启动脚本需要重新调整,所以先行回滚 --- OlivOS/libBooter/libNapCatEXEModelAPI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OlivOS/libBooter/libNapCatEXEModelAPI.py b/OlivOS/libBooter/libNapCatEXEModelAPI.py index cbc54036..efa7988c 100644 --- a/OlivOS/libBooter/libNapCatEXEModelAPI.py +++ b/OlivOS/libBooter/libNapCatEXEModelAPI.py @@ -62,7 +62,7 @@ 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.12-26000', + resouce_name='NapCat-QQ-Win-9.9.11-24568', # resouce_name='NapCat-QQ-Win-9.9.12-26000', filePath='./lib/NapCat.zip', filePathUpdate='./lib/NapCat.zip.tmp', filePathFORCESKIP='./lib/FORCESKIP' From edfb6e981e93e2e2968d2befacb20399e73fc9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Fri, 2 Aug 2024 20:41:01 +0800 Subject: [PATCH 64/76] =?UTF-8?q?=E9=87=87=E7=94=A8=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=84=9A=E6=9C=AC=E5=90=AF=E5=8A=A8=E6=96=B0?= =?UTF-8?q?=E7=89=88NapCat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/onebotV11/flaskServerAPI.py | 1 + OlivOS/core/core/messageAPI.py | 1 + OlivOS/libBooter/libNapCatEXEModelAPI.py | 81 ++++++++++++++-------- OlivOS/nativeGUI/multiLoginUIAPI.py | 12 +++- 4 files changed, 66 insertions(+), 29 deletions(-) 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' ] }, From 3e7ee46a85dc076f58c63bd7befb230627d13b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sat, 3 Aug 2024 15:51:13 +0800 Subject: [PATCH 65/76] =?UTF-8?q?0.11.43=EF=BC=8C=E4=BF=AE=E6=AD=A3QQ?= =?UTF-8?q?=E9=A2=91=E9=81=93=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/adapter/qqGuild/qqGuildv2SDK.py | 6 +++--- OlivOS/core/info/infoAPI.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py index b944deae..1c5dce34 100644 --- a/OlivOS/adapter/qqGuild/qqGuildv2SDK.py +++ b/OlivOS/adapter/qqGuild/qqGuildv2SDK.py @@ -178,13 +178,13 @@ def __init__(self, data): class sendIdentify(payload_template): def __init__(self, bot_info:bot_info_T, intents=(int(intents_T.GUILDS) | int(intents_T.DIRECT_MESSAGE))): tmp_intents = intents - if bot_info.model == 'private': + if bot_info.model in ['private']: tmp_intents |= int(intents_T.GUILD_MESSAGES) #tmp_intents |= int(intents_T.QQ_MESSAGES) - elif bot_info.model == ['public', 'sandbox']: + elif bot_info.model in ['public', 'sandbox']: tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) tmp_intents |= int(intents_T.PUBLIC_QQ_MESSAGES) - elif bot_info.model == 'public_guild_only': + elif bot_info.model in ['public_guild_only']: tmp_intents |= int(intents_T.PUBLIC_GUILD_MESSAGES) elif bot_info.model in ['private_intents', 'public_intents', 'sandbox_intents']: tmp_intents = bot_info.intents diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index c72871d1..46785d22 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.42' -OlivOS_SVN = 162 -OlivOS_Version_Slogan = '大暑' +OlivOS_Version = '0.11.43' +OlivOS_SVN = 163 +OlivOS_Version_Slogan = '大暑条' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 3747716faf2cf898454245ef5a5d13364b6bd2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sat, 3 Aug 2024 16:09:16 +0800 Subject: [PATCH 66/76] =?UTF-8?q?0.11.44=EF=BC=8C=E5=87=86=E5=A4=87?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/info/infoAPI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 46785d22..069dbdf4 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.43' -OlivOS_SVN = 163 +OlivOS_Version = '0.11.44' +OlivOS_SVN = 164 OlivOS_Version_Slogan = '大暑条' # Compatible <= Plugin[compatible_svn] : Compatible From f938cfc76ecfd381f4851ea2bbb0f1fdec3ac774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sat, 3 Aug 2024 16:11:15 +0800 Subject: [PATCH 67/76] Update infoAPI.py --- OlivOS/core/info/infoAPI.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 069dbdf4..a4a8642f 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -19,7 +19,7 @@ OlivOS_Version = '0.11.44' OlivOS_SVN = 164 -OlivOS_Version_Slogan = '大暑条' +OlivOS_Version_Slogan = '大薯条' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 367a17b2415551c8cf6a963b5621cc8836068cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 4 Aug 2024 13:52:19 +0800 Subject: [PATCH 68/76] =?UTF-8?q?0.11.45=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E6=BB=9A=E5=8A=A8=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/info/infoAPI.py | 6 +- OlivOS/nativeGUI/nativeWinUIAPI.py | 119 ++++++++++++++++++++++++----- 2 files changed, 101 insertions(+), 24 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index a4a8642f..ae722ec0 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.44' -OlivOS_SVN = 164 -OlivOS_Version_Slogan = '大薯条' +OlivOS_Version = '0.11.45' +OlivOS_SVN = 165 +OlivOS_Version_Slogan = '立秋' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index fb2b2010..41015581 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -1165,8 +1165,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -1202,6 +1203,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -1333,8 +1343,9 @@ def tree_add_line(self, data, flagInit = False): res_data ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -1454,8 +1465,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -1491,6 +1503,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -1595,8 +1616,9 @@ def tree_add_line(self, data, flagInit = False): res_data ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -1697,8 +1719,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -1734,6 +1757,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -1830,8 +1862,9 @@ def tree_add_line(self, data, flagInit = False): res_data ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -1918,8 +1951,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -1955,6 +1989,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -2051,8 +2094,9 @@ def tree_add_line(self, data, flagInit = False): res_data ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -2138,8 +2182,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -2175,6 +2220,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -2271,8 +2325,9 @@ def tree_add_line(self, data, flagInit = False): res_data ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -2372,8 +2427,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.tree_edit_UI_Combobox_init( @@ -2442,6 +2498,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): # 右键设置的选择在后续流程中未生效,不知为何,等后续解决 # iid = self.UIObject['tree'].identify_row(event.y) @@ -2596,8 +2661,9 @@ def tree_add_line(self, data): ), tag=log_level ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass @@ -3027,8 +3093,9 @@ def start(self): ipadx=0, ipady=0 ) + self.UIData['flag_tree_is_bottom'] = True self.UIObject['tree'].configure( - yscrollcommand=self.UIObject['tree_yscroll'].set + yscrollcommand=self.scroll_onChange(self.UIObject['tree_yscroll'].set) ) self.root_Entry_init( @@ -3065,6 +3132,15 @@ def start(self): self.exit() + def scroll_onChange(self, command): + def res(*arg, **kwarg): + if arg[1] == '1.0': + self.UIData['flag_tree_is_bottom'] = True + else: + self.UIData['flag_tree_is_bottom'] = False + return command(*arg, **kwarg) + return res + def tree_rightKey(self, event): self.UIObject['tree_rightkey_menu'].delete(0, tkinter.END) self.UIObject['tree_rightkey_menu'].add_command(label='查看', command=lambda: self.rightKey_action('show')) @@ -3176,8 +3252,9 @@ def tree_add_line(self, data, user_conf=None): res_data_list_this ) ) - self.UIObject['tree'].see(iid) - self.UIObject['tree'].update() + if self.UIData['flag_tree_is_bottom']: + self.UIObject['tree'].see(iid) + #self.UIObject['tree'].update() except: pass From 60e4df9ec52ec84c3e4e29c330682b44e3171945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 4 Aug 2024 18:27:50 +0800 Subject: [PATCH 69/76] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/nativeGUI/nativeWinUIAPI.py | 395 ++++++++++++++++++++++++----- 1 file changed, 338 insertions(+), 57 deletions(-) diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index 41015581..a95cb7e8 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -1112,7 +1112,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -1137,7 +1138,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -1156,7 +1157,7 @@ def start(self): # ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -1185,15 +1186,37 @@ def start(self): self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -1235,8 +1258,8 @@ def rightKey_action(self, action: str): self.UIObject['root'].update() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc @@ -1269,7 +1292,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -1383,6 +1407,29 @@ def tree_add_line(self, data, flagInit = False): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + def stop(self): self.exit() self.UIObject['root'].destroy() @@ -1412,7 +1459,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -1437,7 +1485,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -1456,7 +1504,7 @@ def start(self): # ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -1485,15 +1533,37 @@ def start(self): self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -1535,8 +1605,8 @@ def rightKey_action(self, action: str): self.UIObject['root'].update() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc @@ -1566,7 +1636,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -1636,6 +1707,29 @@ def tree_add_line(self, data, flagInit = False): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + def stop(self): self.exit() self.UIObject['root'].destroy() @@ -1666,7 +1760,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -1691,7 +1786,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -1710,7 +1805,7 @@ def start(self): # ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -1739,15 +1834,37 @@ def start(self): self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -1789,8 +1906,8 @@ def rightKey_action(self, action: str): self.UIObject['root'].update() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc @@ -1820,7 +1937,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -1868,6 +1986,29 @@ def tree_add_line(self, data, flagInit = False): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + def stop(self): self.exit() self.UIObject['root'].destroy() @@ -1898,7 +2039,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -1923,7 +2065,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -1942,7 +2084,7 @@ def start(self): # ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -1971,15 +2113,37 @@ def start(self): self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -2021,8 +2185,8 @@ def rightKey_action(self, action: str): self.UIObject['root'].update() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc @@ -2052,7 +2216,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -2100,6 +2265,29 @@ def tree_add_line(self, data, flagInit = False): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + def stop(self): self.exit() self.UIObject['root'].destroy() @@ -2129,7 +2317,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -2154,7 +2343,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -2173,7 +2362,7 @@ def start(self): # ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -2202,15 +2391,37 @@ def start(self): self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -2252,8 +2463,8 @@ def rightKey_action(self, action: str): self.UIObject['root'].update() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc @@ -2283,7 +2494,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -2331,6 +2543,30 @@ def tree_add_line(self, data, flagInit = False): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + + def stop(self): self.exit() self.UIObject['root'].destroy() @@ -3048,7 +3284,8 @@ def start(self): self.UIObject['root'].grid_rowconfigure(1, weight=0) self.UIObject['root'].grid_columnconfigure(0, weight=0) self.UIObject['root'].grid_columnconfigure(1, weight=2) - self.UIObject['root'].grid_columnconfigure(2, weight=0) + self.UIObject['root'].grid_columnconfigure(2, weight=2) + self.UIObject['root'].grid_columnconfigure(3, weight=0) self.UIObject['root'].resizable( width=True, height=True @@ -3071,7 +3308,7 @@ def start(self): column=0, sticky="nsew", rowspan=1, - columnspan=2, + columnspan=3, padx=(15, 0), pady=(15, 0), ipadx=0, @@ -3084,7 +3321,7 @@ def start(self): ) self.UIObject['tree_yscroll'].grid( row=0, - column=2, + column=3, sticky="nsw", rowspan=1, columnspan=1, @@ -3111,18 +3348,39 @@ def start(self): title='输入' ) self.UIObject['root_input'].bind("", self.root_Entry_enter_Func('root_input')) - self.UIObject['root_input'].grid( row=1, - column=1, + column=0, sticky="s", rowspan=1, - columnspan=3, - padx=(15, 15), + columnspan=2, + padx=(15, 0), pady=(8, 15), ipadx=0, ipady=0 ) + + self.root_Button_init( + name='root_button_save', + text='>', + command=self.root_Entry_enter_Func('root_input'), + x=800 - 15 * 2 - 5, + y=600 - 15 * 1 - 24, + width=16, + height=1 + ) + self.UIObject['root_button_save'].grid( + row=1, + column=2, + sticky="swe", + rowspan=1, + columnspan=2, + padx=(0, 15), + pady=(8, 15), + ipadx=8, + ipady=0 + ) + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].protocol("WM_DELETE_WINDOW", self.stop) @@ -3180,17 +3438,16 @@ def root_AccountEdit_init(self): self.UIObject['root_terminal_account_edit'].start() def root_Entry_enter_Func(self, name): - def resFunc(event): - self.root_Entry_enter(name, event) + def resFunc(*arg, **kwarg): + self.root_Entry_enter(name, None) return resFunc def root_Entry_enter(self, name, event): if name == 'root_input': input = self.UIData['root_input_StringVar'].get() - if len(input) >= 0 and len(input) < 1000: + if len(input) > 0 and len(input) < 1000: self.root.setVirtualModelSend(self.bot.hash, input, self.user_conf_data) - pass self.UIData['root_input_StringVar'].set('') def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, height, action, title='', @@ -3206,7 +3463,8 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIData[str_name] = tkinter.StringVar() self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], - textvariable=self.UIData[str_name] + textvariable=self.UIData[str_name], + font=('TkDefaultFont 18') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -3258,6 +3516,29 @@ def tree_add_line(self, data, user_conf=None): except: pass + def buttom_action(self, name, action): + if name in self.UIObject: + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_006']) + if action == '': + self.UIObject[name].configure(bg=self.UIConfig['color_003']) + + def root_Button_init(self, name, text, command, x, y, width, height): + self.UIObject[name] = tkinter.Button( + self.UIObject['root'], + text=text, + command=command, + bd=0, + activebackground=self.UIConfig['color_002'], + activeforeground=self.UIConfig['color_001'], + bg=self.UIConfig['color_003'], + fg=self.UIConfig['color_004'], + relief='groove', + height=height + ) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) + def stop(self): self.exit() self.UIObject['root'].destroy() From 04456431e2cfa45c09f355c802c225431f80ce11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Mon, 5 Aug 2024 22:32:16 +0800 Subject: [PATCH 70/76] =?UTF-8?q?0.11.46=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=AE=A1=E7=90=86=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/__init__.py | 1 + OlivOS/core/core/accountMetadataAPI.py | 335 ++++++++++ OlivOS/core/info/infoAPI.py | 4 +- OlivOS/nativeGUI/multiLoginUIAPI.py | 857 +++++++++---------------- 4 files changed, 632 insertions(+), 565 deletions(-) create mode 100644 OlivOS/core/core/accountMetadataAPI.py diff --git a/OlivOS/__init__.py b/OlivOS/__init__.py index 10dcea99..c62a791f 100644 --- a/OlivOS/__init__.py +++ b/OlivOS/__init__.py @@ -31,6 +31,7 @@ from .core.core import API from . import thirdPartyModule from .core.core import accountAPI +from .core.core import accountMetadataAPI from .core.core import diagnoseAPI from .adapter.onebotV11 import flaskServerAPI from .adapter.onebotV12 import onebotV12SDK diff --git a/OlivOS/core/core/accountMetadataAPI.py b/OlivOS/core/core/accountMetadataAPI.py new file mode 100644 index 00000000..c1d3afae --- /dev/null +++ b/OlivOS/core/core/accountMetadataAPI.py @@ -0,0 +1,335 @@ +# -*- encoding: utf-8 -*- +''' +_______________________ ________________ +__ __ \__ /____ _/_ | / /_ __ \_ ___/ +_ / / /_ / __ / __ | / /_ / / /____ \ +/ /_/ /_ /____/ / __ |/ / / /_/ /____/ / +\____/ /_____/___/ _____/ \____/ /____/ + +@File : OlivOS/accountAPI.py +@Author : MetaLeo元理 +@Contact : +@License : AGPL +@Copyright : (C) 2020-2024, OlivOS-Team +@Desc : None +''' + +import OlivOS + +accountTypeList = [ + 'QQ/NapCat/默认', + 'QQ/NapCat/9.9.11', + 'QQ/OPQ/默认', + 'QQ/GoCq/安卓平板', + 'QQ/GoCq/安卓手机', + 'KOOK', + 'KOOK/消息兼容', + 'QQ官方/公域/V2', + 'QQ官方/公域/V2/纯频道', + 'QQ官方/公域/V2/指定intents', + 'QQ官方/私域/V2', + 'QQ官方/私域/V2/指定intents', + 'QQ官方/沙盒/V2', + 'QQ官方/沙盒/V2/指定intents', + 'QQ官方/公域/V1', + 'QQ官方/私域/V1', + 'Discord', + 'Discord/指定intents', + 'Telegram', + 'Fanbook', + 'Hack.Chat', + 'Hack.Chat/私有', + 'onebotV12/正向WS', + 'onebotV11/Http', + 'onebotV11/Http/Shamrock', + 'RED协议', + 'OPQBot/正向WS', + '微信/ComWeChat', + '米游社/大别野/公域', + '米游社/大别野/私域', + '米游社/大别野/沙盒', + '渡渡语音/Dodo/V2', + '渡渡语音/Dodo/V1', + '钉钉', + 'B站直播间/游客', + 'B站直播间/登录', + 'FF14终端', + '虚拟终端', + 'QQ/OPQ/指定端口', + 'QQ/GoCq/安卓手表', + 'QQ/GoCq/默认', + 'QQ/GoCq/iPad', + 'QQ/GoCq/iMac', + 'QQ/Wq/安卓手表', + 'QQ/Wq/安卓手机', + 'QQ/Wq/安卓平板', + '接口终端', + 'QQ/NapCat/旧', + 'QQ/OPQ/指定端口/旧', + 'QQ/GoCq/旧', + 'QQ/Wq/旧', + '自定义' +] + +accountTypeMappingList = { + 'onebotV11/Http': ['qq', 'onebot', 'default', 'False', 'post'], + 'onebotV11/Http/Shamrock': ['qq', 'onebot', 'shamrock_default', 'False', 'post'], + 'onebotV11/Http/消息段': ['qq', 'onebot', 'array_default', 'False', 'post'], + 'onebotV12/正向WS': ['qq', 'onebot', 'onebotV12', 'False', 'websocket'], + 'RED协议': ['qq', 'onebot', 'red', 'False', 'websocket'], + 'OPQBot/正向WS': ['qq', 'onebot', 'opqbot_default', 'False', 'websocket'], + 'QQ/OPQ/默认': ['qq', 'onebot', 'opqbot_auto', 'True', 'websocket'], + 'QQ/OPQ/指定端口': ['qq', 'onebot', 'opqbot_port', 'True', 'websocket'], + 'QQ/OPQ/指定端口/旧': ['qq', 'onebot', 'opqbot_port_old', 'True', 'websocket'], + 'QQ/NapCat/默认': ['qq', 'onebot', 'napcat_show_new', 'True', 'post'], + 'QQ/NapCat/9.9.11': ['qq', 'onebot', 'napcat_show', 'True', 'post'], + 'QQ/NapCat/旧': ['qq', 'onebot', 'napcat_show_old', 'True', 'post'], + 'QQ/GoCq/默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post'], + 'QQ/GoCq/安卓手机': ['qq', 'onebot', 'gocqhttp_show_Android_Phone', 'True', 'post'], + 'QQ/GoCq/安卓平板': ['qq', 'onebot', 'gocqhttp_show_Android_Pad', 'True', 'post'], + 'QQ/GoCq/安卓手表': ['qq', 'onebot', 'gocqhttp_show_Android_Watch', 'True', 'post'], + 'QQ/GoCq/iPad': ['qq', 'onebot', 'gocqhttp_show_iPad', 'True', 'post'], + 'QQ/GoCq/iMac': ['qq', 'onebot', 'gocqhttp_show_iMac', 'True', 'post'], + 'QQ/GoCq/旧': ['qq', 'onebot', 'gocqhttp_show_old', 'True', 'post'], + 'QQ/Wq/默认': ['qq', 'onebot', 'walleq_show', 'True', 'websocket'], + 'QQ/Wq/安卓手机': ['qq', 'onebot', 'walleq_show_Android_Phone', 'True', 'websocket'], + 'QQ/Wq/安卓平板': ['qq', 'onebot', 'walleq_show_Android_Pad', 'True', 'websocket'], + 'QQ/Wq/安卓手表': ['qq', 'onebot', 'walleq_show_Android_Watch', 'True', 'websocket'], + 'QQ/Wq/iPad': ['qq', 'onebot', 'walleq_show_iPad', 'True', 'websocket'], + 'QQ/Wq/iMac': ['qq', 'onebot', 'walleq_show_iMac', 'True', 'websocket'], + 'QQ/Wq/旧': ['qq', 'onebot', 'walleq_show_old', 'True', 'websocket'], + '微信/ComWeChat': ['wechat', 'onebot', 'ComWeChatBotClient', 'True', 'websocket'], + 'KOOK': ['kaiheila', 'kaiheila_link', 'default', 'True', 'websocket'], + 'KOOK/消息兼容': ['kaiheila', 'kaiheila_link', 'text', 'True', 'websocket'], + '米游社/大别野/公域': ['mhyVila', 'mhyVila_link', 'public', 'True', 'websocket'], + '米游社/大别野/私域': ['mhyVila', 'mhyVila_link', 'private', 'True', 'websocket'], + '米游社/大别野/沙盒': ['mhyVila', 'mhyVila_link', 'sandbox', 'True', 'websocket'], + 'B站直播间/游客': ['biliLive', 'biliLive_link', 'default', 'True', 'websocket'], + 'B站直播间/登录': ['biliLive', 'biliLive_link', 'login', 'True', 'websocket'], + 'QQ官方/公域/V1': ['qqGuild', 'qqGuild_link', 'public', 'True', 'websocket'], + 'QQ官方/私域/V1': ['qqGuild', 'qqGuild_link', 'private', 'True', 'websocket'], + 'QQ官方/公域/V2': ['qqGuild', 'qqGuildv2_link', 'public', 'True', 'websocket'], + 'QQ官方/公域/V2/纯频道': ['qqGuild', 'qqGuildv2_link', 'public_guild_only', 'True', 'websocket'], + 'QQ官方/公域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'public_intents', 'True', 'websocket'], + 'QQ官方/私域/V2': ['qqGuild', 'qqGuildv2_link', 'private', 'True', 'websocket'], + 'QQ官方/私域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'private_intents', 'True', 'websocket'], + 'QQ官方/沙盒/V2': ['qqGuild', 'qqGuildv2_link', 'sandbox', 'True', 'websocket'], + 'QQ官方/沙盒/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'sandbox_intents', 'True', 'websocket'], + 'Telegram': ['telegram', 'telegram_poll', 'default', 'True', 'post'], + 'Discord': ['discord', 'discord_link', 'default', 'True', 'websocket'], + 'Discord/指定intents': ['discord', 'discord_link', 'intents', 'True', 'websocket'], + '渡渡语音/Dodo/V2': ['dodo', 'dodo_link', 'default', 'True', 'websocket'], + '渡渡语音/Dodo/V1': ['dodo', 'dodo_link', 'v1', 'True', 'websocket'], + 'Fanbook': ['fanbook', 'fanbook_poll', 'default', 'True', 'post'], + 'Hack.Chat': ['hackChat', 'hackChat_link', 'default', 'True', 'websocket'], + 'Hack.Chat/私有': ['hackChat', 'hackChat_link', 'private', 'True', 'websocket'], + '虚拟终端': ['terminal', 'terminal_link', 'default', 'True', 'websocket'], + '接口终端': ['terminal', 'terminal_link', 'postapi', 'True', 'post'], + 'FF14终端': ['terminal', 'terminal_link', 'ff14', 'True', 'post'], + "钉钉": ["dingtalk", "dingtalk_link", "default", "True", "websocket"], + # 这个自定义屁用没有,只是占位用的 + # 对应代码里这个作为缺省项使用,不走这个逻辑 + '自定义': ['qq', 'default', 'default', 'True', 'post'] +} + +accountTypeDataList_platform = [ + 'wechat', + 'qq', + 'qqGuild', + 'kaiheila', + 'mhyVila', + 'telegram', + 'dodo', + 'fanbook', + 'discord', + 'terminal', + 'hackChat', + 'biliLive', + "dingtalk" +] + +accountTypeDataList_platform_sdk = { + 'wechat': [ + 'onebot' + ], + 'qq': [ + 'onebot' + ], + 'qqGuild': [ + 'qqGuild_link', + 'qqGuildv2_link' + ], + 'kaiheila': [ + 'kaiheila_link' + ], + 'telegram': [ + 'telegram_poll' + ], + 'dodo': [ + 'dodo_link' + # 'dodo_poll', + # 'dodobot_ea' + ], + 'mhyVila': [ + 'mhyVila_link' + ], + 'fanbook': [ + 'fanbook_poll' + ], + 'discord': [ + 'discord_link' + ], + 'terminal': [ + 'terminal_link' + ], + 'hackChat': [ + 'hackChat_link' + ], + 'biliLive': [ + 'biliLive_link' + ], + "dingtalk": [ + "dingtalk_link" + ] +} + +accountTypeDataList_platform_sdk_model = { + 'wechat': { + 'onebot': [ + 'onebotV12', + 'ComWeChatBotClient' + ] + }, + 'qq': { + 'onebot': [ + # 'gocqhttp', + # 'gocqhttp_hide', + 'default', + 'shamrock_default', + 'para_default', + 'onebotV12', + 'red', + 'gocqhttp_show', + 'gocqhttp_show_Android_Phone', + 'gocqhttp_show_Android_Pad', + 'gocqhttp_show_Android_Watch', + 'gocqhttp_show_iPad', + 'gocqhttp_show_iMac', + 'gocqhttp_show_old', + 'walleq', + 'walleq_hide', + 'walleq_show', + 'walleq_show_Android_Phone', + #'walleq_show_Android_Pad', + 'walleq_show_Android_Watch', + 'walleq_show_iPad', + 'walleq_show_iMac', + 'walleq_show_old', + 'opqbot_default', + 'opqbot_auto', + 'opqbot_port', + 'opqbot_port_old', + 'napcat', + #'napcat_hide', + 'napcat_show', + 'napcat_show_new', + 'napcat_show_old' + ] + }, + 'qqGuild': { + 'qqGuild_link': [ + 'private', + 'public', + 'default' + ], + 'qqGuildv2_link': [ + 'public', + 'public_guild_only', + 'public_intents', + 'private', + 'private_intents', + 'sandbox', + 'sandbox_intents', + 'default' + ] + }, + 'kaiheila': { + 'kaiheila_link': [ + 'default', + 'card', + 'text' + ] + }, + 'mhyVila': { + 'mhyVila_link': [ + 'private', + 'public', + 'sandbox', + 'default' + ] + }, + 'telegram': { + 'telegram_poll': [ + 'default' + ] + }, + 'discord': { + 'discord_link': [ + 'default', + 'intents' + ] + }, + 'dodo': { + 'dodo_link': [ + 'default', + 'v1', + 'v2' + ], + 'dodo_poll': [ + 'default' + ], + 'dodobot_ea': [ + 'default' + ] + }, + 'fanbook': { + 'fanbook_poll': [ + 'default', + 'private' + ] + }, + 'terminal': { + 'terminal_link': [ + 'default', + 'postapi', + 'ff14' + ] + }, + 'hackChat': { + 'hackChat_link': [ + 'default', + 'private' + ] + }, + 'biliLive': { + 'biliLive_link': [ + 'default', + 'login' + ] + }, + "dingtalk": { + "dingtalk_link": [ + "default" + ] + } +} + +accountTypeDataList_server_auto = [ + str(True), + str(False) +] + +accountTypeDataList_server_type = [ + 'post', + 'websocket' +] diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index ae722ec0..79229579 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,8 +17,8 @@ import OlivOS -OlivOS_Version = '0.11.45' -OlivOS_SVN = 165 +OlivOS_Version = '0.11.46' +OlivOS_SVN = 166 OlivOS_Version_Slogan = '立秋' # Compatible <= Plugin[compatible_svn] : Compatible diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 4ddd3aeb..6a897991 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -23,6 +23,7 @@ import platform import traceback import json +import copy from tkinter import ttk from tkinter import messagebox @@ -149,15 +150,18 @@ def start(self): self.UIObject['tree'] = ttk.Treeview(self.UIObject['root']) self.UIObject['tree']['show'] = 'headings' - self.UIObject['tree']['columns'] = ('ID', 'PLATFORM', 'SDK', 'MODEL') - self.UIObject['tree'].column('ID', width=100) - self.UIObject['tree'].column('PLATFORM', width=100) - self.UIObject['tree'].column('SDK', width=100) - self.UIObject['tree'].column('MODEL', width=100) + #self.UIObject['tree']['columns'] = ('ID', 'PLATFORM', 'SDK', 'MODEL') + self.UIObject['tree']['columns'] = ('ID', 'TYPE') + self.UIObject['tree'].column('ID', width=200) + self.UIObject['tree'].column('TYPE', width=200) + #self.UIObject['tree'].column('PLATFORM', width=100) + #self.UIObject['tree'].column('SDK', width=100) + #self.UIObject['tree'].column('MODEL', width=100) self.UIObject['tree'].heading('ID', text='ID') - self.UIObject['tree'].heading('PLATFORM', text='PLATFORM') - self.UIObject['tree'].heading('SDK', text='SDK') - self.UIObject['tree'].heading('MODEL', text='MODEL') + self.UIObject['tree'].heading('TYPE', text='账号类型') + #self.UIObject['tree'].heading('PLATFORM', text='PLATFORM') + #self.UIObject['tree'].heading('SDK', text='SDK') + #self.UIObject['tree'].heading('MODEL', text='MODEL') self.UIObject['tree']['selectmode'] = 'browse' self.tree_load() self.UIObject['tree'].place(x=0, y=0, width=500, height=350) @@ -272,9 +276,10 @@ def tree_load(self): text=Account_hash_this, values=( self.UIData['Account_data'][Account_hash_this].id, - self.UIData['Account_data'][Account_hash_this].platform['platform'], - self.UIData['Account_data'][Account_hash_this].platform['sdk'], - self.UIData['Account_data'][Account_hash_this].platform['model'] + self.get_account_data_type_name(Account_hash_this) + #self.UIData['Account_data'][Account_hash_this].platform['platform'], + #self.UIData['Account_data'][Account_hash_this].platform['sdk'], + #self.UIData['Account_data'][Account_hash_this].platform['model'] ) ) @@ -313,6 +318,27 @@ def account_data_commit(self): sendAccountUpdate(self, self.control_queue, self.UIData['Account_data']) self.UIObject['root'].destroy() + def get_account_data_type_name(self, hash_key): + res = '自定义' + list_data_check = [ + str(self.UIData['Account_data'][hash_key].platform['platform']), + str(self.UIData['Account_data'][hash_key].platform['sdk']), + str(self.UIData['Account_data'][hash_key].platform['model']), + str(self.UIData['Account_data'][hash_key].post_info.auto), + str(self.UIData['Account_data'][hash_key].post_info.type) + ] + for type_this in OlivOS.accountMetadataAPI.accountTypeList: + flag_hit = True + for list_data_check_i in range(len(list_data_check)): + if list_data_check[list_data_check_i] \ + != OlivOS.accountMetadataAPI.accountTypeMappingList[type_this][list_data_check_i]: + flag_hit = False + break + if flag_hit: + break + if flag_hit: + res = type_this + return res class TreeEditUI(object): def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=None): @@ -363,62 +389,7 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'edit_root_Entry_qsign_list': [], 'edit_root_Entry_qsign_num': 1, 'edit_root_Combobox_dict': { - 'type_list': [ - 'QQ/NapCat/默认', - 'QQ/NapCat/9.9.11', - 'QQ/OPQ/默认', - 'QQ/GoCq/安卓平板', - 'QQ/GoCq/安卓手机', - 'KOOK', - 'KOOK/消息兼容', - 'QQ官方/公域/V2', - 'QQ官方/公域/V2/纯频道', - 'QQ官方/公域/V2/指定intents', - 'QQ官方/私域/V2', - 'QQ官方/私域/V2/指定intents', - 'QQ官方/沙盒/V2', - 'QQ官方/沙盒/V2/指定intents', - 'QQ官方/公域/V1', - 'QQ官方/私域/V1', - 'Discord', - 'Discord/指定intents', - 'Telegram', - 'Fanbook', - 'Hack.Chat', - 'Hack.Chat/私有', - 'onebotV12/正向WS', - 'onebotV11/Http', - 'onebotV11/Http/Shamrock', - 'RED协议', - 'OPQBot/正向WS', - '微信/ComWeChat', - '米游社/大别野/公域', - '米游社/大别野/私域', - '米游社/大别野/沙盒', - '渡渡语音/Dodo/V2', - '渡渡语音/Dodo/V1', - '钉钉', - 'B站直播间/游客', - 'B站直播间/登录', - 'FF14终端', - '虚拟终端', - 'QQ/OPQ/指定端口', - 'QQ/GoCq/安卓手表', - 'QQ/GoCq/默认', - 'QQ/GoCq/iPad', - 'QQ/GoCq/iMac', - 'QQ/Wq/安卓手表', - 'QQ/Wq/安卓手机', - 'QQ/Wq/安卓平板', - '接口终端', - 'QQ/NapCat/旧', - 'QQ/OPQ/指定端口/旧', - 'QQ/GoCq/旧', - 'QQ/Wq/旧', - '自定义' - ], - # 各类账号组合的匹配与注册表 - # type: [platform, sdk, model, server_auto, server_type, {data_dict}] + 'type_list': OlivOS.accountMetadataAPI.accountTypeList, 'type_note_list': { 'QQ/GoCq/安卓手表': '密码留空即尝试使用扫码登录', 'QQ/GoCq/旧': '密码留空即尝试使用扫码登录', @@ -486,514 +457,274 @@ def __init__(self, action, Account_data, hash_key=None, edit_commit_callback=Non 'QQ/GoCq/安卓平板': {'地址': 'sign-server', 'KEY': 'key'}, 'QQ/GoCq/旧': {'地址': 'sign-server', 'KEY': 'key'} }, - 'type_mapping_list': { - 'onebotV11/Http': ['qq', 'onebot', 'default', 'False', 'post', { - '账号': 'edit_root_Entry_ID', - '地址': 'edit_root_Entry_Server_host', - '端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'onebotV11/Http/Shamrock': ['qq', 'onebot', 'shamrock_default', 'False', 'post', { - '账号': 'edit_root_Entry_ID', - '地址': 'edit_root_Entry_Server_host', - '端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'onebotV11/Http/消息段': ['qq', 'onebot', 'array_default', 'False', 'post', { - '账号': 'edit_root_Entry_ID', - '地址': 'edit_root_Entry_Server_host', - '端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'onebotV12/正向WS': ['qq', 'onebot', 'onebotV12', 'False', 'websocket', { - '账号': 'edit_root_Entry_ID', - '地址': 'edit_root_Entry_Server_host', - '端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'RED协议': ['qq', 'onebot', 'red', 'False', 'websocket', { - '账号': 'edit_root_Entry_ID', - 'WS地址': 'edit_root_Entry_Server_host', - 'WS端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'OPQBot/正向WS': ['qq', 'onebot', 'opqbot_default', 'False', 'websocket', { - 'QQ号': 'edit_root_Entry_ID', - '服务地址': 'edit_root_Entry_Server_host', - '服务端口': 'edit_root_Entry_Server_port', - } - ], - 'QQ/OPQ/默认': ['qq', 'onebot', 'opqbot_auto', 'True', 'websocket', { - 'QQ号': 'edit_root_Entry_ID', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'QQ/OPQ/指定端口': ['qq', 'onebot', 'opqbot_port', 'True', 'websocket', { - 'QQ号': 'edit_root_Entry_ID', - '服务端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - 'QQ/OPQ/指定端口/旧': ['qq', 'onebot', 'opqbot_port_old', 'True', 'websocket', { - 'QQ号': 'edit_root_Entry_ID', - '服务端口': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token', - } - ], - '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', - } - ], - 'QQ/NapCat/旧': ['qq', 'onebot', 'napcat_show_old', 'True', 'post', { - 'QQ号': 'edit_root_Entry_ID', - 'TOKEN': 'edit_root_Entry_Server_access_token', - '服务端口': 'edit_root_Entry_Server_port', - } - ], - 'QQ/GoCq/默认': ['qq', 'onebot', 'gocqhttp_show', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/安卓手机': ['qq', 'onebot', 'gocqhttp_show_Android_Phone', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/安卓平板': ['qq', 'onebot', 'gocqhttp_show_Android_Pad', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/安卓手表': ['qq', 'onebot', 'gocqhttp_show_Android_Watch', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/iPad': ['qq', 'onebot', 'gocqhttp_show_iPad', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/iMac': ['qq', 'onebot', 'gocqhttp_show_iMac', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/GoCq/旧': ['qq', 'onebot', 'gocqhttp_show_old', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/默认': ['qq', 'onebot', 'walleq_show', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/安卓手机': ['qq', 'onebot', 'walleq_show_Android_Phone', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/安卓平板': ['qq', 'onebot', 'walleq_show_Android_Pad', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/安卓手表': ['qq', 'onebot', 'walleq_show_Android_Watch', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/iPad': ['qq', 'onebot', 'walleq_show_iPad', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/iMac': ['qq', 'onebot', 'walleq_show_iMac', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - 'QQ/Wq/旧': ['qq', 'onebot', 'walleq_show_old', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID', - '密码': 'edit_root_Entry_Password', - # 推荐使用扫码登录时,可以隐藏密码栏 - } - ], - '微信/ComWeChat': ['wechat', 'onebot', 'ComWeChatBotClient', 'True', 'websocket', { - '微信号': 'edit_root_Entry_ID' - } - ], - 'KOOK': ['kaiheila', 'kaiheila_link', 'default', 'True', 'websocket', { - 'Token': 'edit_root_Entry_Server_access_token' - } - ], - 'KOOK/消息兼容': ['kaiheila', 'kaiheila_link', 'text', 'True', 'websocket', { - 'Token': 'edit_root_Entry_Server_access_token' - } - ], - '米游社/大别野/公域': ['mhyVila', 'mhyVila_link', 'public', 'True', 'websocket', { - 'Bot_Id': 'edit_root_Entry_ID', - 'Secret': 'edit_root_Entry_Password', - 'Pub_Key': 'edit_root_Entry_Server_access_token' - } - ], - '米游社/大别野/私域': ['mhyVila', 'mhyVila_link', 'private', 'True', 'websocket', { - 'Bot_Id': 'edit_root_Entry_ID', - 'Secret': 'edit_root_Entry_Password', - 'Pub_Key': 'edit_root_Entry_Server_access_token' - } - ], - '米游社/大别野/沙盒': ['mhyVila', 'mhyVila_link', 'sandbox', 'True', 'websocket', { - 'Bot_Id': 'edit_root_Entry_ID', - 'Secret': 'edit_root_Entry_Password', - 'Pub_Key': 'edit_root_Entry_Server_access_token', - '别野号': 'edit_root_Entry_Server_port' - } - ], - 'B站直播间/游客': ['biliLive', 'biliLive_link', 'default', 'True', 'websocket', { - '直播间ID': 'edit_root_Entry_Server_access_token' - } - ], - 'B站直播间/登录': ['biliLive', 'biliLive_link', 'login', 'True', 'websocket', { - '直播间ID': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/公域/V1': ['qqGuild', 'qqGuild_link', 'public', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - '机器人令牌': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/私域/V1': ['qqGuild', 'qqGuild_link', 'private', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - '机器人令牌': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/公域/V2': ['qqGuild', 'qqGuildv2_link', 'public', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/公域/V2/纯频道': ['qqGuild', 'qqGuildv2_link', 'public_guild_only', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/公域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'public_intents', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token', - 'intents': 'edit_root_Entry_Server_port' - } - ], - 'QQ官方/私域/V2': ['qqGuild', 'qqGuildv2_link', 'private', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/私域/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'private_intents', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token', - 'intents': 'edit_root_Entry_Server_port' - } - ], - 'QQ官方/沙盒/V2': ['qqGuild', 'qqGuildv2_link', 'sandbox', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token' - } - ], - 'QQ官方/沙盒/V2/指定intents': ['qqGuild', 'qqGuildv2_link', 'sandbox_intents', 'True', 'websocket', { - 'AppID': 'edit_root_Entry_ID', - 'AppSecret': 'edit_root_Entry_Server_access_token', - 'intents': 'edit_root_Entry_Server_port' - } - ], - 'Telegram': ['telegram', 'telegram_poll', 'default', 'True', 'post', { - 'TOKEN': 'edit_root_Entry_Server_access_token' - } - ], - 'Discord': ['discord', 'discord_link', 'default', 'True', 'websocket', { - 'TOKEN': 'edit_root_Entry_Server_access_token' - } - ], - 'Discord/指定intents': ['discord', 'discord_link', 'intents', 'True', 'websocket', { - 'TOKEN': 'edit_root_Entry_Server_access_token', - 'intents': 'edit_root_Entry_Server_port' - } - ], - '渡渡语音/Dodo/V2': ['dodo', 'dodo_link', 'default', 'True', 'websocket', { - 'BotID': 'edit_root_Entry_ID', - 'Bot私钥': 'edit_root_Entry_Server_access_token' - } - ], - '渡渡语音/Dodo/V1': ['dodo', 'dodo_link', 'v1', 'True', 'websocket', { - 'BotID': 'edit_root_Entry_ID', - 'Bot私钥': 'edit_root_Entry_Server_access_token' - } - ], - 'Fanbook': ['fanbook', 'fanbook_poll', 'default', 'True', 'post', { - 'Token': 'edit_root_Entry_Server_access_token' - } - ], - 'Hack.Chat': ['hackChat', 'hackChat_link', 'default', 'True', 'websocket', { - '房间名称': 'edit_root_Entry_Server_host', - 'Bot名称': 'edit_root_Entry_Server_access_token', - '密码': 'edit_root_Entry_Password' - } - ], - 'Hack.Chat/私有': ['hackChat', 'hackChat_link', 'private', 'True', 'websocket', { - '房间名称': 'edit_root_Entry_Server_host', - 'Bot名称': 'edit_root_Entry_Server_access_token', - '密码': 'edit_root_Entry_Password' - } - ], - '虚拟终端': ['terminal', 'terminal_link', 'default', 'True', 'websocket', { - '账号': 'edit_root_Entry_ID' - } - ], - '接口终端': ['terminal', 'terminal_link', 'postapi', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '端口': 'edit_root_Entry_Server_port' - } - ], - 'FF14终端': ['terminal', 'terminal_link', 'ff14', 'True', 'post', { - '账号': 'edit_root_Entry_ID', - '端口': 'edit_root_Entry_Server_port', - '回调端口': 'edit_root_Entry_Server_access_token' - } - ], - "钉钉": ["dingtalk", "dingtalk_link", "default", "True", "websocket", { - "Robot Code": 'edit_root_Entry_ID', - # "" - } - ], - '自定义': ['qq', 'default', 'default', 'True', 'post', { - 'ID': 'edit_root_Entry_ID', - 'PASSWORD': 'edit_root_Entry_Password', - 'HOST': 'edit_root_Entry_Server_host', - 'PORT': 'edit_root_Entry_Server_port', - 'TOKEN': 'edit_root_Entry_Server_access_token' - } - ], - }, - 'platform_list': [ - 'wechat', - 'qq', - 'qqGuild', - 'kaiheila', - 'mhyVila', - 'telegram', - 'dodo', - 'fanbook', - 'discord', - 'terminal', - 'hackChat', - 'biliLive', - "dingtalk" - ], - 'platform_sdk_list': { - 'wechat': [ - 'onebot' - ], - 'qq': [ - 'onebot' - ], - 'qqGuild': [ - 'qqGuild_link', - 'qqGuildv2_link' - ], - 'kaiheila': [ - 'kaiheila_link' - ], - 'telegram': [ - 'telegram_poll' - ], - 'dodo': [ - 'dodo_link' - # 'dodo_poll', - # 'dodobot_ea' - ], - 'mhyVila': [ - 'mhyVila_link' - ], - 'fanbook': [ - 'fanbook_poll' - ], - 'discord': [ - 'discord_link' - ], - 'terminal': [ - 'terminal_link' - ], - 'hackChat': [ - 'hackChat_link' - ], - 'biliLive': [ - 'biliLive_link' - ], - "dingtalk": [ - "dingtalk_link" - ] - }, - 'platform_sdk_model_list': { - 'wechat': { - 'onebot': [ - 'onebotV12', - 'ComWeChatBotClient' - ] + # 各类账号组合的匹配与注册表 + # 原本为合并格式,并在此处维护 + # type: [platform, sdk, model, server_auto, server_type, {data_dict}] + # 现拆分为两个表,使用时合并,以便于维护 + # type: [platform, sdk, model, server_auto, server_type] + [{data_dict}] + # 前半位于 OlivOS.accountMetadataAPI + # 后半位于此处 + 'type_mapping_list': {}, + 'type_mapping_list_Entry_slot': { + 'onebotV11/Http': { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'qq': { - 'onebot': [ - # 'gocqhttp', - # 'gocqhttp_hide', - 'default', - 'shamrock_default', - 'para_default', - 'onebotV12', - 'red', - 'gocqhttp_show', - 'gocqhttp_show_Android_Phone', - 'gocqhttp_show_Android_Pad', - 'gocqhttp_show_Android_Watch', - 'gocqhttp_show_iPad', - 'gocqhttp_show_iMac', - 'gocqhttp_show_old', - 'walleq', - 'walleq_hide', - 'walleq_show', - 'walleq_show_Android_Phone', - #'walleq_show_Android_Pad', - 'walleq_show_Android_Watch', - 'walleq_show_iPad', - 'walleq_show_iMac', - 'walleq_show_old', - 'opqbot_default', - 'opqbot_auto', - 'opqbot_port', - 'opqbot_port_old', - 'napcat', - #'napcat_hide', - 'napcat_show', - 'napcat_show_new', - 'napcat_show_old' - ] + 'onebotV11/Http/Shamrock': { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'qqGuild': { - 'qqGuild_link': [ - 'private', - 'public', - 'default' - ], - 'qqGuildv2_link': [ - 'public', - 'public_guild_only', - 'public_intents', - 'private', - 'private_intents', - 'sandbox', - 'sandbox_intents', - 'default' - ] + 'onebotV11/Http/消息段': { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'kaiheila': { - 'kaiheila_link': [ - 'default', - 'card', - 'text' - ] + 'onebotV12/正向WS': { + '账号': 'edit_root_Entry_ID', + '地址': 'edit_root_Entry_Server_host', + '端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'mhyVila': { - 'mhyVila_link': [ - 'private', - 'public', - 'sandbox', - 'default' - ] + 'RED协议': { + '账号': 'edit_root_Entry_ID', + 'WS地址': 'edit_root_Entry_Server_host', + 'WS端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'telegram': { - 'telegram_poll': [ - 'default' - ] + 'OPQBot/正向WS': { + 'QQ号': 'edit_root_Entry_ID', + '服务地址': 'edit_root_Entry_Server_host', + '服务端口': 'edit_root_Entry_Server_port', }, - 'discord': { - 'discord_link': [ - 'default', - 'intents' - ] + 'QQ/OPQ/默认': { + 'QQ号': 'edit_root_Entry_ID', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'dodo': { - 'dodo_link': [ - 'default', - 'v1', - 'v2' - ], - 'dodo_poll': [ - 'default' - ], - 'dodobot_ea': [ - 'default' - ] + 'QQ/OPQ/指定端口': { + 'QQ号': 'edit_root_Entry_ID', + '服务端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'fanbook': { - 'fanbook_poll': [ - 'default', - 'private' - ] + 'QQ/OPQ/指定端口/旧': { + 'QQ号': 'edit_root_Entry_ID', + '服务端口': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token', }, - 'terminal': { - 'terminal_link': [ - 'default', - 'postapi', - 'ff14' - ] + 'QQ/NapCat/默认': { + 'QQ号': 'edit_root_Entry_ID', }, - 'hackChat': { - 'hackChat_link': [ - 'default', - 'private' - ] + 'QQ/NapCat/9.9.11': { + 'QQ号': 'edit_root_Entry_ID', }, - 'biliLive': { - 'biliLive_link': [ - 'default', - 'login' - ] + 'QQ/NapCat/旧': { + 'QQ号': 'edit_root_Entry_ID', + 'TOKEN': 'edit_root_Entry_Server_access_token', + '服务端口': 'edit_root_Entry_Server_port', }, - "dingtalk": { - "dingtalk_link": [ - "default" - ] - } - } - }, 'edit_root_Combobox_Server_auto_list': [ - 'True', - 'False' - ], 'edit_root_Combobox_Server_type_list': [ - 'post', - 'websocket' - ]} + 'QQ/GoCq/默认': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/安卓手机': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/安卓平板': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/安卓手表': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/iPad': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/iMac': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/GoCq/旧': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/默认': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/安卓手机': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/安卓平板': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/安卓手表': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/iPad': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/iMac': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + 'QQ/Wq/旧': { + '账号': 'edit_root_Entry_ID', + '密码': 'edit_root_Entry_Password', + }, + '微信/ComWeChat': { + '微信号': 'edit_root_Entry_ID' + }, + 'KOOK': { + 'Token': 'edit_root_Entry_Server_access_token' + }, + 'KOOK/消息兼容': { + 'Token': 'edit_root_Entry_Server_access_token' + }, + '米游社/大别野/公域': { + 'Bot_Id': 'edit_root_Entry_ID', + 'Secret': 'edit_root_Entry_Password', + 'Pub_Key': 'edit_root_Entry_Server_access_token' + }, + '米游社/大别野/私域': { + 'Bot_Id': 'edit_root_Entry_ID', + 'Secret': 'edit_root_Entry_Password', + 'Pub_Key': 'edit_root_Entry_Server_access_token' + }, + '米游社/大别野/沙盒': { + 'Bot_Id': 'edit_root_Entry_ID', + 'Secret': 'edit_root_Entry_Password', + 'Pub_Key': 'edit_root_Entry_Server_access_token', + '别野号': 'edit_root_Entry_Server_port' + }, + 'B站直播间/游客': { + '直播间ID': 'edit_root_Entry_Server_access_token' + }, + 'B站直播间/登录': { + '直播间ID': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/公域/V1': { + 'AppID': 'edit_root_Entry_ID', + '机器人令牌': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/私域/V1': { + 'AppID': 'edit_root_Entry_ID', + '机器人令牌': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/公域/V2': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/公域/V2/纯频道': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/公域/V2/指定intents': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + }, + 'QQ官方/私域/V2': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/私域/V2/指定intents': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + }, + 'QQ官方/沙盒/V2': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token' + }, + 'QQ官方/沙盒/V2/指定intents': { + 'AppID': 'edit_root_Entry_ID', + 'AppSecret': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + }, + 'Telegram': { + 'TOKEN': 'edit_root_Entry_Server_access_token' + }, + 'Discord': { + 'TOKEN': 'edit_root_Entry_Server_access_token' + }, + 'Discord/指定intents': { + 'TOKEN': 'edit_root_Entry_Server_access_token', + 'intents': 'edit_root_Entry_Server_port' + }, + '渡渡语音/Dodo/V2': { + 'BotID': 'edit_root_Entry_ID', + 'Bot私钥': 'edit_root_Entry_Server_access_token' + }, + '渡渡语音/Dodo/V1': { + 'BotID': 'edit_root_Entry_ID', + 'Bot私钥': 'edit_root_Entry_Server_access_token' + }, + 'Fanbook': { + 'Token': 'edit_root_Entry_Server_access_token' + }, + 'Hack.Chat': { + '房间名称': 'edit_root_Entry_Server_host', + 'Bot名称': 'edit_root_Entry_Server_access_token', + '密码': 'edit_root_Entry_Password' + }, + 'Hack.Chat/私有': { + '房间名称': 'edit_root_Entry_Server_host', + 'Bot名称': 'edit_root_Entry_Server_access_token', + '密码': 'edit_root_Entry_Password' + }, + '虚拟终端': { + '账号': 'edit_root_Entry_ID' + }, + '接口终端': { + '账号': 'edit_root_Entry_ID', + '端口': 'edit_root_Entry_Server_port' + }, + 'FF14终端': { + '账号': 'edit_root_Entry_ID', + '端口': 'edit_root_Entry_Server_port', + '回调端口': 'edit_root_Entry_Server_access_token' + }, + "钉钉": { + "Robot Code": 'edit_root_Entry_ID' + }, + '自定义': { + 'ID': 'edit_root_Entry_ID', + 'PASSWORD': 'edit_root_Entry_Password', + 'HOST': 'edit_root_Entry_Server_host', + 'PORT': 'edit_root_Entry_Server_port', + 'TOKEN': 'edit_root_Entry_Server_access_token' + }, + }, + 'platform_list': OlivOS.accountMetadataAPI.accountTypeDataList_platform, + 'platform_sdk_list': OlivOS.accountMetadataAPI.accountTypeDataList_platform_sdk, + 'platform_sdk_model_list': OlivOS.accountMetadataAPI.accountTypeDataList_platform_sdk_model, + }, + 'edit_root_Combobox_Server_auto_list': OlivOS.accountMetadataAPI.accountTypeDataList_server_auto, + 'edit_root_Combobox_Server_type_list': OlivOS.accountMetadataAPI.accountTypeDataList_server_type + } + # 此处进行type_mapping_list的拼合 + tmp_type_mapping_list = {} + for key_this in OlivOS.accountMetadataAPI.accountTypeMappingList: + tmp_mapping_slot = copy.deepcopy(OlivOS.accountMetadataAPI.accountTypeMappingList[key_this]) + tmp_Entry_slot = None + if key_this in self.UIData['edit_root_Combobox_dict']['type_mapping_list_Entry_slot']: + tmp_Entry_slot = self.UIData['edit_root_Combobox_dict']['type_mapping_list_Entry_slot'][key_this] + else: + tmp_Entry_slot = {} + tmp_mapping_slot.append(copy.deepcopy(tmp_Entry_slot)) + tmp_type_mapping_list[key_this] = tmp_mapping_slot + self.UIData['edit_root_Combobox_dict']['type_mapping_list'] = tmp_type_mapping_list def tree_edit_commit(self): miss_key_list = None From 1ee92dcd51a6234e73572d0c453eefffbd170640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Tue, 6 Aug 2024 17:43:53 +0800 Subject: [PATCH 71/76] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=99=A8=E6=96=B0=E5=A2=9E=E6=97=A0=E8=B4=A6=E5=8F=B7=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/nativeGUI/multiLoginUIAPI.py | 174 +++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 5 deletions(-) diff --git a/OlivOS/nativeGUI/multiLoginUIAPI.py b/OlivOS/nativeGUI/multiLoginUIAPI.py index 6a897991..6b8c600a 100644 --- a/OlivOS/nativeGUI/multiLoginUIAPI.py +++ b/OlivOS/nativeGUI/multiLoginUIAPI.py @@ -163,7 +163,9 @@ def start(self): #self.UIObject['tree'].heading('SDK', text='SDK') #self.UIObject['tree'].heading('MODEL', text='MODEL') self.UIObject['tree']['selectmode'] = 'browse' - self.tree_load() + # 这个加载流程现在需要后置 + # 因为它现在需要同时控制 self.UIObject['root_frame_first_root'] 这个遮罩层是否显示 + #self.tree_load() self.UIObject['tree'].place(x=0, y=0, width=500, height=350) self.UIObject['tree_rightkey_menu'] = tkinter.Menu(self.UIObject['root'], tearoff=False) self.UIObject['root'].bind('', lambda x: self.tree_rightKey(x)) @@ -215,7 +217,7 @@ def start(self): self.tree_UI_Button_init( name='root_Button_COMMIT', - text='确认', + text='启动 OlivOS', command=lambda: self.account_data_commit(), x=391, y=358, @@ -223,12 +225,169 @@ def start(self): height=34 ) + # 无账号时的引导遮罩层 + self.UIObject['root_frame_first_root'] = tkinter.Frame(self.UIObject['root']) + self.UIObject['root_frame_first_root'].configure(relief = tkinter.FLAT) + self.UIObject['root_frame_first_root'].configure(bg = self.UIConfig['color_001'], borderwidth = 0) + # 这个组件使用这两个方法进行显示和隐藏 + # 位置信息依赖此处的数据 + # 是否显示通常受到数据控制其是否显示 + # self.frame_show('root_frame_first_root') + # self.frame_hide('root_frame_first_root') + self.UIConfig['root_frame_first_root_place'] = { + 'x': 0, + 'y': 0, + 'width': 518, + 'height': 400 + } + + self.UIObject['root_frame_first_root_label_note_new'] = tkinter.Label( + self.UIObject['root_frame_first_root'], + text = '\n'.join( + [ + '欢迎使用 OlivOS', + '', + '你可以在这里创建你的第一个账号' + ] + ) + ) + self.UIObject['root_frame_first_root_label_note_new'].configure( + bg = self.UIConfig['color_001'], + fg = self.UIConfig['color_004'], + font = ('等线', 16, 'bold') + ) + self.UIObject['root_frame_first_root_label_note_new'].place( + x=int(518/2 - 518/2), + y=int(400/2/2 + 20 - 200/2), + width=518, + height=200 + ) + + self.tree_UI_Button_init( + name='root_frame_first_root_Button_FIRST_NEW', + text='创建一个账号', + command=lambda: self.tree_edit('create'), + x=int(518/2 - 250/2), + y=int(400/2 + 20 - 48/2), + width=250, + height=48, + root='root_frame_first_root' + ) + self.UIObject['root_frame_first_root_Button_FIRST_NEW'].configure(font='等线 16 bold') + + self.UIObject['root_frame_first_root_label_note_commit'] = tkinter.Label( + self.UIObject['root_frame_first_root'], + text = '\n'.join( + [ + '或者你也可以' + ] + ) + ) + self.UIObject['root_frame_first_root_label_note_commit'].configure( + bg = self.UIConfig['color_001'], + fg = self.UIConfig['color_004'], + font = ('等线', 12, 'bold') + ) + self.UIObject['root_frame_first_root_label_note_commit'].place( + x=391 - 16 * 6 - 8, + y=358, + width=16 * 6, + height=34 + ) + + self.tree_UI_Button_init( + name='root_frame_first_root_Button_FIRST_COMMIT', + text='直接启动', + command=lambda: self.frame_show('root_frame_skip_root'), + x=391, + y=358, + width=117, + height=34, + root='root_frame_first_root' + ) + + # 确认真的要无账号启动时的引导遮罩层 + self.UIObject['root_frame_skip_root'] = tkinter.Frame(self.UIObject['root']) + self.UIObject['root_frame_skip_root'].configure(relief = tkinter.FLAT) + self.UIObject['root_frame_skip_root'].configure(bg = self.UIConfig['color_001'], borderwidth = 0) + # 这个组件使用这两个方法进行显示和隐藏 + # 位置信息依赖此处的数据 + # 需要按钮流程控制其是否显示 + # self.frame_show('root_frame_skip_root') + # self.frame_hide('root_frame_skip_root') + self.UIConfig['root_frame_skip_root_place'] = { + 'x': 0, + 'y': 0, + 'width': 518, + 'height': 400 + } + + self.UIObject['root_frame_skip_root_label_note_commit'] = tkinter.Label( + self.UIObject['root_frame_skip_root'], + text = '\n'.join( + [ + 'OlivOS 的大部分功能都是基于账号进行的', + '', + '无账号的确可以正常运行', + '但请确保你真的明白你要做什么', + '', + '你真的要这么做吗?' + ] + ) + ) + self.UIObject['root_frame_skip_root_label_note_commit'].configure( + bg = self.UIConfig['color_001'], + fg = self.UIConfig['color_004'], + font = ('等线', 16, 'bold') + ) + self.UIObject['root_frame_skip_root_label_note_commit'].place( + x=int(518/2 - 518/2), + y=int(400/2/2 - 200/2), + width=518, + height=200 + ) + + self.tree_UI_Button_init( + name='root_frame_skip_root_Button_FIRST_COMMIT', + text='是的,我要直接启动', + command=lambda: self.account_data_commit(), + x=int(518/2 - 250/2), + y=int(400/2 + 20 - 48/2), + width=250, + height=48, + root='root_frame_skip_root' + ) + self.UIObject['root_frame_skip_root_Button_FIRST_COMMIT'].configure(font='等线 16 bold') + + self.tree_UI_Button_init( + name='root_frame_skip_root_Button_FIRST_COMMIT_BACK', + text='我点错了,让我回去', + command=lambda: self.frame_hide('root_frame_skip_root'), + x=int(518/2 - 250/2), + y=int(400/2 + 20 + 48 * 1 + 15 - 48/2), + width=250, + height=48, + root='root_frame_skip_root' + ) + self.UIObject['root_frame_skip_root_Button_FIRST_COMMIT_BACK'].configure(font='等线 16 bold') + + # 这个数据加载过程会在后续多次反复执行 + self.tree_load() + self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') self.UIObject['root'].mainloop() return self.res + def frame_show(self, name): + if name in ['root_frame_first_root', 'root_frame_skip_root']: + self.UIObject[name].place(**self.UIConfig[f'{name}_place']) + + def frame_hide(self, name): + if name in ['root_frame_first_root', 'root_frame_skip_root']: + self.UIObject[name].place_forget() + def buttom_action(self, name, action): if name in self.UIObject: if action == '': @@ -236,9 +395,9 @@ def buttom_action(self, name, action): if action == '': self.UIObject[name].configure(bg=self.UIConfig['color_003']) - def tree_UI_Button_init(self, name, text, command, x, y, width, height): + def tree_UI_Button_init(self, name, text, command, x, y, width, height, root='root'): self.UIObject[name] = tkinter.Button( - self.UIObject['root'], + self.UIObject[root], text=text, command=command, bd=0, @@ -246,7 +405,8 @@ def tree_UI_Button_init(self, name, text, command, x, y, width, height): activeforeground=self.UIConfig['color_001'], bg=self.UIConfig['color_003'], fg=self.UIConfig['color_004'], - relief='groove' + relief='groove', + font='等线 12 bold' ) self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) self.UIObject[name].bind('', lambda x: self.buttom_action(name, '')) @@ -282,6 +442,10 @@ def tree_load(self): #self.UIData['Account_data'][Account_hash_this].platform['model'] ) ) + if len(self.UIData['Account_data']) <= 0: + self.frame_show('root_frame_first_root') + else: + self.frame_hide('root_frame_first_root') def tree_edit(self, action): hash_key_how = None From 8e6980fd504a06559ed2a6879f18538b02534720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Tue, 6 Aug 2024 22:40:29 +0800 Subject: [PATCH 72/76] =?UTF-8?q?=E8=B0=83=E6=95=B4UI=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 仑质 --- OlivOS/nativeGUI/nativeWinUIAPI.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/OlivOS/nativeGUI/nativeWinUIAPI.py b/OlivOS/nativeGUI/nativeWinUIAPI.py index a95cb7e8..449b2e6b 100644 --- a/OlivOS/nativeGUI/nativeWinUIAPI.py +++ b/OlivOS/nativeGUI/nativeWinUIAPI.py @@ -1193,7 +1193,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -1293,7 +1293,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -1540,7 +1540,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -1637,7 +1637,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -1841,7 +1841,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -1938,7 +1938,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -2120,7 +2120,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -2217,7 +2217,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -2398,7 +2398,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -2495,7 +2495,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], @@ -2722,7 +2722,7 @@ def start(self): padx=(0, 15), pady=(8, 15), ipadx=0, - ipady=0 + ipady=2 ) self.UIObject['root'].iconbitmap('./resource/tmp_favoricon.ico') @@ -3357,7 +3357,7 @@ def start(self): padx=(15, 0), pady=(8, 15), ipadx=0, - ipady=0 + ipady=4 ) self.root_Button_init( @@ -3464,7 +3464,7 @@ def root_Entry_init(self, obj_root, obj_name, str_name, x, y, width_t, width, he self.UIObject[obj_name] = tkinter.Entry( self.UIObject[obj_root], textvariable=self.UIData[str_name], - font=('TkDefaultFont 18') + font=('TkDefaultFont 12') ) self.UIObject[obj_name].configure( bg=self.UIConfig['color_004'], From 40586ff69c40faa50c444c3feea7a4590312c52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 11 Aug 2024 11:43:46 +0800 Subject: [PATCH 73/76] =?UTF-8?q?0.11.47=EF=BC=8C=E4=B8=83=E5=A4=95?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/info/infoAPI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 79229579..958a4983 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.46' -OlivOS_SVN = 166 -OlivOS_Version_Slogan = '立秋' +OlivOS_Version = '0.11.47' +OlivOS_SVN = 167 +OlivOS_Version_Slogan = '七夕' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From e7a4ff23aa5f39c37ecc7d287ca2c782789f6cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 11 Aug 2024 13:29:50 +0800 Subject: [PATCH 74/76] pyinstaller==6.9.0 --- requirements310.txt | 2 +- requirements310_pure.txt | 2 +- requirements310_win.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements310.txt b/requirements310.txt index 26106166..92802a32 100644 --- a/requirements310.txt +++ b/requirements310.txt @@ -1,4 +1,4 @@ -pyinstaller +pyinstaller==6.9.0 flask Werkzeug==2.2.2 gevent diff --git a/requirements310_pure.txt b/requirements310_pure.txt index 83096c9f..3c30260a 100644 --- a/requirements310_pure.txt +++ b/requirements310_pure.txt @@ -1,4 +1,4 @@ -pyinstaller +pyinstaller==6.9.0 flask Werkzeug==2.2.2 gevent diff --git a/requirements310_win.txt b/requirements310_win.txt index 7d4e97a9..ff12155d 100644 --- a/requirements310_win.txt +++ b/requirements310_win.txt @@ -1,4 +1,4 @@ -pyinstaller +pyinstaller==6.9.0 flask Werkzeug==2.2.2 gevent From be739883acec694b4c007c35775e39fa8405471b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 11 Aug 2024 13:33:33 +0800 Subject: [PATCH 75/76] =?UTF-8?q?0.11.48=EF=BC=8C=E5=B7=A7=E5=85=8B?= =?UTF-8?q?=E5=8A=9B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OlivOS/core/info/infoAPI.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OlivOS/core/info/infoAPI.py b/OlivOS/core/info/infoAPI.py index 958a4983..b72eefea 100644 --- a/OlivOS/core/info/infoAPI.py +++ b/OlivOS/core/info/infoAPI.py @@ -17,9 +17,9 @@ import OlivOS -OlivOS_Version = '0.11.47' -OlivOS_SVN = 167 -OlivOS_Version_Slogan = '七夕' +OlivOS_Version = '0.11.48' +OlivOS_SVN = 168 +OlivOS_Version_Slogan = '巧克力' # Compatible <= Plugin[compatible_svn] : Compatible # OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn From 9a15fc274771a4f7a59b1a27ebdf4d0deb4ca593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E7=90=86?= Date: Sun, 11 Aug 2024 14:52:39 +0800 Subject: [PATCH 76/76] =?UTF-8?q?Pypi=E7=89=88=E6=9C=AC=E6=8E=A8=E8=BF=9B?= =?UTF-8?q?=E8=87=B30.11.48?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9e113c65..7282861b 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ long_description = f.read() setuptools.setup(name='olivos', - version='0.11.25', + version='0.11.48', description='OlivOS - Witness Union', long_description=long_description, long_description_content_type='text/markdown',