Skip to content

Commit

Permalink
版本推进至0.10.13
Browse files Browse the repository at this point in the history
+ 修正接口终端的一系列问题
+ 原生支持基于高级触发器+鲇鱼精邮差对接FF14 ACT
  • Loading branch information
lunzhiPenxil committed Nov 15, 2022
1 parent daf611a commit 09bcf8b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
4 changes: 2 additions & 2 deletions OlivOS/infoAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import OlivOS


OlivOS_Version = '0.10.12'
OlivOS_SVN = 112
OlivOS_Version = '0.10.13'
OlivOS_SVN = 113

# Compatible <= Plugin[compatible_svn] : Compatible
# OldCompatible <= Plugin[compatible_svn] < Compatible : OldCompatible Warn
Expand Down
10 changes: 9 additions & 1 deletion OlivOS/multiLoginUIAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def __init__(self, action, Account_data, hash_key = None, edit_commit_callback =
'Hack.Chat',
'虚拟终端',
'接口终端',
'FF14终端',
'自定义'
],
# 各类账号组合的匹配与注册表
Expand Down Expand Up @@ -329,6 +330,12 @@ def __init__(self, action, Account_data, hash_key = None, edit_commit_callback =
'端口': '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'
}
],
'自定义': ['qq', 'default', 'default', 'True', 'post', {
'ID': 'edit_root_Entry_ID',
'PASSWORD': 'edit_root_Entry_Password',
Expand Down Expand Up @@ -432,7 +439,8 @@ def __init__(self, action, Account_data, hash_key = None, edit_commit_callback =
'terminal': {
'terminal_link': [
'default',
'postapi'
'postapi',
'ff14'
]
},
'hackChat': {
Expand Down
12 changes: 9 additions & 3 deletions OlivOS/virtualTerminalLinkServerAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from flask import Flask
from flask import current_app
from flask import request
from flask import g

import multiprocessing
import threading
Expand Down Expand Up @@ -55,7 +54,7 @@ def __init__(self, Proc_name, scan_interval = 0.001, dead_interval = 1, rx_queue
def run(self):
time.sleep(2)
self.log(2, 'OlivOS virtual terminal link server [' + self.Proc_name + '] is running')
if self.Proc_data['bot_info_dict'].platform['model'] == 'postapi':
if self.Proc_data['bot_info_dict'].platform['model'] in ['postapi', 'ff14']:
threading.Thread(
target = self.set_flask,
args = ()
Expand Down Expand Up @@ -107,12 +106,19 @@ def Flask_server_func():
try:
event_id = str(uuid.uuid4())
rx_packet_data = json.loads(rx_packet_data_raw)
sdk_event = OlivOS.virtualTerminalSDK.event(rx_packet_data, self.Proc_data['bot_info_dict'], model = 'postapi', event_id = event_id)
sdk_event = OlivOS.virtualTerminalSDK.event(
rx_packet_data,
self.Proc_data['bot_info_dict'],
model = self.Proc_data['bot_info_dict'].platform['model'],
event_id = event_id
)
tx_packet_data = OlivOS.pluginAPI.shallow.rx_packet(sdk_event)
self.Proc_info.tx_queue.put(tx_packet_data, block = False)
flag_active = True
except:
flag_active = False
if self.Proc_data['bot_info_dict'].platform['model'] == 'ff14':
flag_active = False
if flag_active:
for count_i in range(30 * 4):
if event_id in self.Proc_data['reply_event_pool']:
Expand Down
19 changes: 15 additions & 4 deletions OlivOS/virtualTerminalSDK.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import OlivOS

class bot_info_T(object):
def __init__(self, id = -1, access_token = None, model = 'private'):
def __init__(self, id = -1, access_token = None, model = 'default'):
self.id = id
self.access_token = access_token
self.model = model
Expand All @@ -37,8 +37,6 @@ def get_SDK_bot_info_from_Plugin_bot_info(plugin_bot_info):
plugin_bot_info.post_info.access_token
)
res.debug_mode = plugin_bot_info.debug_mode
if plugin_bot_info.platform['model'] == 'public':
res.model = 'public'
return res

def get_SDK_bot_info_from_Event(target_event):
Expand Down Expand Up @@ -107,7 +105,7 @@ def get_Event_from_SDK(target_event):
target_event.data.sender['age'] = 0
target_event.data.sender['role'] = 'owner'
target_event.data.host_id = None
elif target_event.platform['model'] in ['postapi']:
elif target_event.platform['model'] in ['postapi', 'ff14']:
if 'type' in target_event.sdk_event.payload and target_event.sdk_event.payload['type'] == 'message':
if 'message_type' in target_event.sdk_event.payload and target_event.sdk_event.payload['message_type'] == 'group_message':
message_obj = OlivOS.messageAPI.Message_templet(
Expand Down Expand Up @@ -160,6 +158,9 @@ def send_msg(target_event, message, control_queue):
'reply': message
}
send_postapi_event(plugin_event_bot_hash, event_data, evnet_id, control_queue)
elif target_event.platform['model'] in ['ff14']:
send_ff14_post(target_event, message)
print(target_event.platform['model'])

def sendControlEventSend(action, data, control_queue):
if control_queue != None:
Expand Down Expand Up @@ -201,3 +202,13 @@ def send_postapi_event(hash, data, event_id, control_queue):
},
control_queue
)

def send_ff14_post(plugin_event, message:str):
if True:
send_url = 'http://127.0.0.1:%s/Command' % str(plugin_event.bot_info.post_info.access_token)
headers = {
'Content-Type': 'text/plain'
}
data = message.encode('UTF-8')
msg_res = req.request("POST", send_url, headers = headers, data = data)
return msg_res

0 comments on commit 09bcf8b

Please sign in to comment.