From 00383db9fa230826265ff9d5eca49eefe8da73a6 Mon Sep 17 00:00:00 2001 From: FromTheLOLAshes <153381408+FromTheLOLAshes@users.noreply.github.com> Date: Tue, 21 May 2024 13:06:21 -0400 Subject: [PATCH] correct proxy handling, add proxy to README, fix object locked issues (#407) Co-authored-by: Christopher Oliphant --- .env | 9 ++++----- .env-no-proxy | 5 +++++ .env-proxy | 4 ---- README.md | 6 ++++++ app/api/MakeRequest.ts | 8 ++------ app/components/reusable/InputVector/InputVector.tsx | 5 +++++ .../ControlPanelSceneObject/ControlPanelSceneObject.tsx | 4 ++++ proxy/proxy.js | 2 +- 8 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 .env-no-proxy delete mode 100644 .env-proxy diff --git a/.env b/.env index 7f83b9c696..bf2d0c312b 100644 --- a/.env +++ b/.env @@ -1,5 +1,4 @@ -BASE_API="https://api.storyteller.ai" -GOOGLE_API="https://storage.googleapis.com" -FUNNEL_API="https://style.storyteller.ai" -CDN_API="https://cdn.storyteller.ai" -EXPRESSIONS="true" +BASE_API="http://localhost:3000" +GOOGLE_API="http://localhost:3000/google" +FUNNEL_API="http://localhost:3000/funnel" +CDN_API="http://localhost:3000/cdn" diff --git a/.env-no-proxy b/.env-no-proxy new file mode 100644 index 0000000000..7f83b9c696 --- /dev/null +++ b/.env-no-proxy @@ -0,0 +1,5 @@ +BASE_API="https://api.storyteller.ai" +GOOGLE_API="https://storage.googleapis.com" +FUNNEL_API="https://style.storyteller.ai" +CDN_API="https://cdn.storyteller.ai" +EXPRESSIONS="true" diff --git a/.env-proxy b/.env-proxy deleted file mode 100644 index bf2d0c312b..0000000000 --- a/.env-proxy +++ /dev/null @@ -1,4 +0,0 @@ -BASE_API="http://localhost:3000" -GOOGLE_API="http://localhost:3000/google" -FUNNEL_API="http://localhost:3000/funnel" -CDN_API="http://localhost:3000/cdn" diff --git a/README.md b/README.md index e1e24b4c83..96b6cd02b4 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ if (condition) { No use of any type. If you can use chat gpt to create the interface. ``` +# Local Testing +use the .env file that directs all requests to localhost:3000 +from folder /proxy run + +```node proxy.js``` + # IF YOU ARE WORKING ON THIS PROJECT PLEASE ASK THE TEAM MEMBERS HOW TO SET UP THIS IS OUTDATED INFORMATION # GottaGoFast-SS diff --git a/app/api/MakeRequest.ts b/app/api/MakeRequest.ts index 43fedd7874..826e8e4491 100644 --- a/app/api/MakeRequest.ts +++ b/app/api/MakeRequest.ts @@ -2,10 +2,6 @@ import { environmentVariables, authentication } from "~/signals"; type UrlRoutingFunction = (urlRouteArgs: UrlRouteArgs) => string; -interface RequestHeaders { - [name: string]: string; -} - interface RouteSetup { method: string; multipart?: boolean; @@ -54,7 +50,7 @@ const MakeRequest = ( ...(methodOmitsBody ? {} : { "Content-Type": "application/json" }), session: sessionToken.value || "", }, - credentials: "include", + // credentials: "include", ...(methodOmitsBody ? {} : { body: JSON.stringify(request) }), }) .then((res) => res.json()) @@ -65,7 +61,7 @@ const MakeRequest = ( return res; } else Promise.reject(); }) - .catch((e) => ({ success: false })); + .catch(() => ({ success: false })); }; }; diff --git a/app/components/reusable/InputVector/InputVector.tsx b/app/components/reusable/InputVector/InputVector.tsx index b3516ca394..a95fb10e97 100644 --- a/app/components/reusable/InputVector/InputVector.tsx +++ b/app/components/reusable/InputVector/InputVector.tsx @@ -12,6 +12,7 @@ interface InputVectorProps { z: string; onChange: (v: Record) => void; increment?: number; + disabled?: boolean; } export const InputVector = ({ @@ -20,6 +21,7 @@ export const InputVector = ({ z, onChange, increment = 0.1, + disabled, }: InputVectorProps) => { const xRef = useRef(null); const yRef = useRef(null); @@ -135,6 +137,7 @@ export const InputVector = ({ onChange={handleOnChange} ref={xRef} value={x} + disabled={disabled} onFocus={() => { disableHotkeyInput(DomLevels.INPUT); }} @@ -156,6 +159,7 @@ export const InputVector = ({ onChange={handleOnChange} ref={yRef} value={y} + disabled={disabled} onFocus={() => { disableHotkeyInput(DomLevels.INPUT); }} @@ -177,6 +181,7 @@ export const InputVector = ({ onChange={handleOnChange} ref={zRef} value={z} + disabled={disabled} onFocus={() => { disableHotkeyInput(DomLevels.INPUT); }} diff --git a/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx b/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx index 9c4b1e6cbd..056eb29ef2 100644 --- a/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx +++ b/app/pages/PageEnigma/comps/ControlPanelSceneObject/ControlPanelSceneObject.tsx @@ -281,6 +281,7 @@ export const ControlPanelSceneObject = () => { }} type="color" value={color} + disabled={locked} />