@xmanrui/dsh-im 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +7 -1
- package/README.md +8 -2
- package/lib/client.js +1 -1
- package/lib/index.js +189 -189
- package/package.json +1 -1
- package/src/channels/qq/qq-bridge.mjs +12 -3
package/package.json
CHANGED
|
@@ -109,6 +109,15 @@ function conversationKey(message) {
|
|
|
109
109
|
return `${message.kind}:${message.kind === 'group' ? message.groupOpenid : message.senderId}`;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
function senderAllowed(message, ownerUserOpenid) {
|
|
113
|
+
// QR binding yields a C2C user_openid, while group events identify senders
|
|
114
|
+
// with a group-scoped member_openid. Treat group membership plus @mention as
|
|
115
|
+
// the access boundary, and keep the scanner restriction for private chats.
|
|
116
|
+
return message?.kind === 'group'
|
|
117
|
+
|| ownerUserOpenid === '*'
|
|
118
|
+
|| message?.senderId === ownerUserOpenid;
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
function safeText(message) {
|
|
113
122
|
return typeof message?.content === 'string' ? message.content.trim() : '';
|
|
114
123
|
}
|
|
@@ -442,7 +451,7 @@ export class QqHarnessBridge {
|
|
|
442
451
|
}
|
|
443
452
|
const pending = this.#pendingInteractions.get(key);
|
|
444
453
|
const commandText = safeText(message);
|
|
445
|
-
const allowed =
|
|
454
|
+
const allowed = senderAllowed(message, this.#ownerUserOpenid);
|
|
446
455
|
const addressed = message.kind !== 'group'
|
|
447
456
|
|| message.rawEventType === 'GROUP_AT_MESSAGE_CREATE';
|
|
448
457
|
const batchCommand = isBatchInputCommand(commandText);
|
|
@@ -569,7 +578,7 @@ export class QqHarnessBridge {
|
|
|
569
578
|
alreadyRecorded = false,
|
|
570
579
|
batchSubmission = null,
|
|
571
580
|
} = {}) {
|
|
572
|
-
const allowed =
|
|
581
|
+
const allowed = senderAllowed(message, this.#ownerUserOpenid);
|
|
573
582
|
const addressed = message.kind !== 'group'
|
|
574
583
|
|| message.rawEventType === 'GROUP_AT_MESSAGE_CREATE';
|
|
575
584
|
const preparedMessage = allowed && addressed
|
|
@@ -721,7 +730,7 @@ export class QqHarnessBridge {
|
|
|
721
730
|
await this.#state.markSeen(messageId);
|
|
722
731
|
messageRecorded = true;
|
|
723
732
|
};
|
|
724
|
-
if (
|
|
733
|
+
if (!senderAllowed(message, this.#ownerUserOpenid)) {
|
|
725
734
|
this.#status.messagesRejected += 1;
|
|
726
735
|
this.#status.lastRejectedAt = new Date().toISOString();
|
|
727
736
|
return;
|