Gregory Schier
2025-07-10 13:49:53 -07:00
parent f63da432b9
commit a31f818424
12 changed files with 66 additions and 43 deletions

View File

@@ -65,7 +65,7 @@ extensions: Array<string>, };
export type FilterRequest = { content: string, filter: string, };
export type FilterResponse = { content: string, };
export type FilterResponse = { content: string, error?: string, };
export type FindHttpResponsesRequest = { requestId: string, limit?: number, };

View File

@@ -1,12 +1,11 @@
import { FilterResponse } from '../bindings/gen_events';
import type { Context } from './Context';
type FilterPluginResponse = { filtered: string };
export type FilterPlugin = {
name: string;
description?: string;
onFilter(
ctx: Context,
args: { payload: string; filter: string; mimeType: string },
): Promise<FilterPluginResponse> | FilterPluginResponse;
): Promise<FilterResponse> | FilterResponse;
};

View File

@@ -7,7 +7,8 @@ import {
GetCookieValueRequest,
GetCookieValueResponse,
GetHttpRequestByIdResponse,
GetKeyValueResponse, GrpcRequestAction,
GetKeyValueResponse,
GrpcRequestAction,
HttpAuthenticationAction,
HttpRequestAction,
InternalEvent,
@@ -15,8 +16,8 @@ import {
ListCookieNamesResponse,
PluginWindowContext,
PromptTextResponse,
RenderHttpRequestResponse,
RenderGrpcRequestResponse,
RenderHttpRequestResponse,
SendHttpRequestResponse,
TemplateFunction,
TemplateFunctionArg,
@@ -138,11 +139,7 @@ export class PluginInstance {
payload: payload.content,
mimeType: payload.type,
});
const replyPayload: InternalEventPayload = {
type: 'filter_response',
content: reply.filtered,
};
this.#sendPayload(windowContext, replyPayload, replyId);
this.#sendPayload(windowContext, { type: 'filter_response', ...reply }, replyId);
return;
}