fix: only strip inline /status for allowlisted senders
This commit is contained in:
@@ -488,9 +488,10 @@ export async function getReplyFromConfig(
|
|||||||
.map((entry) => entry.alias?.trim())
|
.map((entry) => entry.alias?.trim())
|
||||||
.filter((alias): alias is string => Boolean(alias))
|
.filter((alias): alias is string => Boolean(alias))
|
||||||
.filter((alias) => !reservedCommands.has(alias.toLowerCase()));
|
.filter((alias) => !reservedCommands.has(alias.toLowerCase()));
|
||||||
|
const allowStatusDirective = allowTextCommands && command.isAuthorizedSender;
|
||||||
let parsedDirectives = parseInlineDirectives(commandSource, {
|
let parsedDirectives = parseInlineDirectives(commandSource, {
|
||||||
modelAliases: configuredAliases,
|
modelAliases: configuredAliases,
|
||||||
allowStatusDirective: allowTextCommands && command.isAuthorizedSender,
|
allowStatusDirective,
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
isGroup &&
|
isGroup &&
|
||||||
@@ -521,7 +522,7 @@ export async function getReplyFromConfig(
|
|||||||
if (noMentions.trim().length > 0) {
|
if (noMentions.trim().length > 0) {
|
||||||
const directiveOnlyCheck = parseInlineDirectives(noMentions, {
|
const directiveOnlyCheck = parseInlineDirectives(noMentions, {
|
||||||
modelAliases: configuredAliases,
|
modelAliases: configuredAliases,
|
||||||
allowStatusDirective: allowTextCommands && command.isAuthorizedSender,
|
allowStatusDirective,
|
||||||
});
|
});
|
||||||
if (directiveOnlyCheck.cleaned.trim().length > 0) {
|
if (directiveOnlyCheck.cleaned.trim().length > 0) {
|
||||||
const allowInlineStatus =
|
const allowInlineStatus =
|
||||||
@@ -555,7 +556,7 @@ export async function getReplyFromConfig(
|
|||||||
if (!sessionCtx.CommandBody && !sessionCtx.RawBody) {
|
if (!sessionCtx.CommandBody && !sessionCtx.RawBody) {
|
||||||
return parseInlineDirectives(existingBody, {
|
return parseInlineDirectives(existingBody, {
|
||||||
modelAliases: configuredAliases,
|
modelAliases: configuredAliases,
|
||||||
allowStatusDirective: allowTextCommands && command.isAuthorizedSender,
|
allowStatusDirective,
|
||||||
}).cleaned;
|
}).cleaned;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +564,7 @@ export async function getReplyFromConfig(
|
|||||||
if (markerIndex < 0) {
|
if (markerIndex < 0) {
|
||||||
return parseInlineDirectives(existingBody, {
|
return parseInlineDirectives(existingBody, {
|
||||||
modelAliases: configuredAliases,
|
modelAliases: configuredAliases,
|
||||||
allowStatusDirective: allowTextCommands && command.isAuthorizedSender,
|
allowStatusDirective,
|
||||||
}).cleaned;
|
}).cleaned;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +577,7 @@ export async function getReplyFromConfig(
|
|||||||
);
|
);
|
||||||
const cleanedTail = parseInlineDirectives(tail, {
|
const cleanedTail = parseInlineDirectives(tail, {
|
||||||
modelAliases: configuredAliases,
|
modelAliases: configuredAliases,
|
||||||
allowStatusDirective: allowTextCommands && command.isAuthorizedSender,
|
allowStatusDirective,
|
||||||
}).cleaned;
|
}).cleaned;
|
||||||
return `${head}${cleanedTail}`;
|
return `${head}${cleanedTail}`;
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user