Self-echo filter for notify webhook (skip own-node messages) (#22)
CI / build + unit (push) Successful in 43s
CI / build + unit (push) Successful in 43s
This commit was merged in pull request #22.
This commit is contained in:
@@ -434,6 +434,11 @@ export class MeshService implements OnModuleInit, OnModuleDestroy {
|
||||
/** Fire-and-forget notify-webhook POST for an rx text on `channel` (no-op unless URL is set and channels match). */
|
||||
private notifyRx(channel: number, text: string, from?: number): void {
|
||||
if (this.notifyUrl && channel === this.notifyChannel) {
|
||||
// self-echo filter: our own node must never trigger a notification of itself
|
||||
if (from !== undefined && from === this.myNodeNum) {
|
||||
this.logger.debug(`notify skipped: rx from our own node ${from}`);
|
||||
return;
|
||||
}
|
||||
const body: Record<string, unknown> = { text };
|
||||
if (from !== undefined) body.from = from;
|
||||
void fetch(this.notifyUrl, {
|
||||
|
||||
Reference in New Issue
Block a user