From c8b32383987de4034c32d4cc39c953775ce8319d Mon Sep 17 00:00:00 2001 From: nai-degen Date: Sat, 24 Jun 2023 14:25:01 -0500 Subject: [PATCH] reorganizes origin header middleware --- .../request/{block-zoomers.ts => block-zoomer-origins.ts} | 4 ++-- src/proxy/middleware/request/index.ts | 4 ++-- .../request/{remove-origin.ts => remove-origin-headers.ts} | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/proxy/middleware/request/{block-zoomers.ts => block-zoomer-origins.ts} (69%) rename src/proxy/middleware/request/{remove-origin.ts => remove-origin-headers.ts} (75%) diff --git a/src/proxy/middleware/request/block-zoomers.ts b/src/proxy/middleware/request/block-zoomer-origins.ts similarity index 69% rename from src/proxy/middleware/request/block-zoomers.ts rename to src/proxy/middleware/request/block-zoomer-origins.ts index 17135d9..93f4c87 100644 --- a/src/proxy/middleware/request/block-zoomers.ts +++ b/src/proxy/middleware/request/block-zoomer-origins.ts @@ -14,7 +14,7 @@ class ForbiddenError extends Error { * Blocks requests from Janitor AI users with a fake, scary error message so I * stop getting emails asking for tech support. */ -export const blockZoomers: ProxyRequestMiddleware = (_proxyReq, req) => { +export const blockZoomerOrigins: ProxyRequestMiddleware = (_proxyReq, req) => { if (!isCompletionRequest(req)) { return; } @@ -28,7 +28,7 @@ export const blockZoomers: ProxyRequestMiddleware = (_proxyReq, req) => { } 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.` ); } }; diff --git a/src/proxy/middleware/request/index.ts b/src/proxy/middleware/request/index.ts index 42d1daa..eee478f 100644 --- a/src/proxy/middleware/request/index.ts +++ b/src/proxy/middleware/request/index.ts @@ -10,12 +10,12 @@ export { transformOutboundPayload } from "./transform-outbound-payload"; // HPM middleware (runs on onProxyReq, cannot be async) export { addKey } from "./add-key"; export { addAnthropicPreamble } from "./add-anthropic-preamble"; -export { blockZoomers } from "./block-zoomers"; +export { blockZoomerOrigins } from "./block-zoomer-origins"; export { finalizeBody } from "./finalize-body"; export { languageFilter } from "./language-filter"; export { limitCompletions } from "./limit-completions"; export { limitOutputTokens } from "./limit-output-tokens"; -export { removeOrigin } from "./remove-origin"; +export { removeOriginHeaders } from "./remove-origin-headers"; export { transformKoboldPayload } from "./transform-kobold-payload"; /** diff --git a/src/proxy/middleware/request/remove-origin.ts b/src/proxy/middleware/request/remove-origin-headers.ts similarity index 75% rename from src/proxy/middleware/request/remove-origin.ts rename to src/proxy/middleware/request/remove-origin-headers.ts index 75bbc25..ae44353 100644 --- a/src/proxy/middleware/request/remove-origin.ts +++ b/src/proxy/middleware/request/remove-origin-headers.ts @@ -4,7 +4,7 @@ import { ProxyRequestMiddleware } from "."; * Removes origin and referer headers before sending the request to the API for * privacy reasons. **/ -export const removeOrigin: ProxyRequestMiddleware = (proxyReq) => { +export const removeOriginHeaders: ProxyRequestMiddleware = (proxyReq) => { proxyReq.setHeader("origin", ""); proxyReq.setHeader("referer", ""); };