reorganizes origin header middleware

This commit is contained in:
nai-degen 2023-06-24 14:25:01 -05:00
parent 602931bf7f
commit c8b3238398
3 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ class ForbiddenError extends Error {
* Blocks requests from Janitor AI users with a fake, scary error message so I * Blocks requests from Janitor AI users with a fake, scary error message so I
* stop getting emails asking for tech support. * stop getting emails asking for tech support.
*/ */
export const blockZoomers: ProxyRequestMiddleware = (_proxyReq, req) => { export const blockZoomerOrigins: ProxyRequestMiddleware = (_proxyReq, req) => {
if (!isCompletionRequest(req)) { if (!isCompletionRequest(req)) {
return; return;
} }
@ -28,7 +28,7 @@ export const blockZoomers: ProxyRequestMiddleware = (_proxyReq, req) => {
} }
throw new ForbiddenError( throw new ForbiddenError(
`This OpenAI account has been disabled due to fraud and potential CSAM violations. Your IP address, user agent, and request details have been logged and will be shared with the National Center for Missing and Exploited Children and local law enforcement's cybercrime division to assist in their investigation.` `Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact us through our help center at help.openai.com.`
); );
} }
}; };

View File

@ -10,12 +10,12 @@ export { transformOutboundPayload } from "./transform-outbound-payload";
// HPM middleware (runs on onProxyReq, cannot be async) // HPM middleware (runs on onProxyReq, cannot be async)
export { addKey } from "./add-key"; export { addKey } from "./add-key";
export { addAnthropicPreamble } from "./add-anthropic-preamble"; export { addAnthropicPreamble } from "./add-anthropic-preamble";
export { blockZoomers } from "./block-zoomers"; export { blockZoomerOrigins } from "./block-zoomer-origins";
export { finalizeBody } from "./finalize-body"; export { finalizeBody } from "./finalize-body";
export { languageFilter } from "./language-filter"; export { languageFilter } from "./language-filter";
export { limitCompletions } from "./limit-completions"; export { limitCompletions } from "./limit-completions";
export { limitOutputTokens } from "./limit-output-tokens"; export { limitOutputTokens } from "./limit-output-tokens";
export { removeOrigin } from "./remove-origin"; export { removeOriginHeaders } from "./remove-origin-headers";
export { transformKoboldPayload } from "./transform-kobold-payload"; export { transformKoboldPayload } from "./transform-kobold-payload";
/** /**

View File

@ -4,7 +4,7 @@ import { ProxyRequestMiddleware } from ".";
* Removes origin and referer headers before sending the request to the API for * Removes origin and referer headers before sending the request to the API for
* privacy reasons. * privacy reasons.
**/ **/
export const removeOrigin: ProxyRequestMiddleware = (proxyReq) => { export const removeOriginHeaders: ProxyRequestMiddleware = (proxyReq) => {
proxyReq.setHeader("origin", ""); proxyReq.setHeader("origin", "");
proxyReq.setHeader("referer", ""); proxyReq.setHeader("referer", "");
}; };