实现gmxhr
Some checks failed
build / Build (push) Failing after 6s
test / Run tests (push) Failing after 8s

This commit is contained in:
2025-04-07 00:37:58 +08:00
parent a8054451ac
commit 1a55bb348f
13 changed files with 1255 additions and 517 deletions

View File

@ -114,9 +114,15 @@ export class Group {
}
// 转发消息
export function forwardMessage(prefix: string, path: string, from: Server, to: MessageSend) {
from.on(path, (params, fromCon) => {
export function forwardMessage(prefix: string, path: string, from: Server, to: MessageSend, middleware?: ApiFunction) {
from.on(path, async (params, fromCon) => {
console.log("forwardMessage", path, prefix, params);
if (middleware) {
const resp = await middleware(params, new GetSender(fromCon));
if (resp !== false) {
return resp;
}
}
if (fromCon) {
const fromConnect = fromCon.getConnect();
to.connect({ action: prefix + "/" + path, data: params }).then((toCon) => {