From 325463a40b0211b11b88d89b968cc20b0efc018f Mon Sep 17 00:00:00 2001 From: Lukas Miklosko Date: Fri, 5 Apr 2024 23:07:20 +0200 Subject: [PATCH] Change localhost to process.env.HOST for client requests --- src/pages/_app.tsx | 4 ++-- src/pages/collection/[collectionId]/index.tsx | 2 +- src/pages/movie/[movieId]/index.tsx | 2 +- src/pages/tv/[tvId]/index.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index ceb5734e..db0e9ab4 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -191,7 +191,7 @@ CoreApp.getInitialProps = async (initialProps) => { if (ctx.res) { // Check if app is initialized and redirect if necessary const response = await axios.get( - `http://localhost:${process.env.PORT || 5055}/api/v1/settings/public` + `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/settings/public` ); currentSettings = response.data; @@ -209,7 +209,7 @@ CoreApp.getInitialProps = async (initialProps) => { try { // Attempt to get the user by running a request to the local api const response = await axios.get( - `http://localhost:${process.env.PORT || 5055}/api/v1/auth/me`, + `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/auth/me`, { headers: ctx.req && ctx.req.headers.cookie diff --git a/src/pages/collection/[collectionId]/index.tsx b/src/pages/collection/[collectionId]/index.tsx index 5802577b..5afbeb20 100644 --- a/src/pages/collection/[collectionId]/index.tsx +++ b/src/pages/collection/[collectionId]/index.tsx @@ -15,7 +15,7 @@ export const getServerSideProps: GetServerSideProps< CollectionPageProps > = async (ctx) => { const response = await axios.get( - `http://localhost:${process.env.PORT || 5055}/api/v1/collection/${ + `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/collection/${ ctx.query.collectionId }`, { diff --git a/src/pages/movie/[movieId]/index.tsx b/src/pages/movie/[movieId]/index.tsx index 053ee3ff..c45bd882 100644 --- a/src/pages/movie/[movieId]/index.tsx +++ b/src/pages/movie/[movieId]/index.tsx @@ -15,7 +15,7 @@ export const getServerSideProps: GetServerSideProps = async ( ctx ) => { const response = await axios.get( - `http://localhost:${process.env.PORT || 5055}/api/v1/movie/${ + `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/movie/${ ctx.query.movieId }`, { diff --git a/src/pages/tv/[tvId]/index.tsx b/src/pages/tv/[tvId]/index.tsx index a8a3cbd7..16b09455 100644 --- a/src/pages/tv/[tvId]/index.tsx +++ b/src/pages/tv/[tvId]/index.tsx @@ -15,7 +15,7 @@ export const getServerSideProps: GetServerSideProps = async ( ctx ) => { const response = await axios.get( - `http://localhost:${process.env.PORT || 5055}/api/v1/tv/${ctx.query.tvId}`, + `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/tv/${ctx.query.tvId}`, { headers: ctx.req?.headers?.cookie ? { cookie: ctx.req.headers.cookie }