From b834d02aa9b8d5a1001d1dcc69b6f9e129b6f564 Mon Sep 17 00:00:00 2001 From: oiseauroch Date: Tue, 30 Apr 2024 19:15:14 +0200 Subject: [PATCH] try to patch crabfit to allow custom url --- conf/front.env | 1 + sources/patches/custom_url.patch | 73 ++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 sources/patches/custom_url.patch diff --git a/conf/front.env b/conf/front.env index 2cd37e2..e869e1f 100644 --- a/conf/front.env +++ b/conf/front.env @@ -1,3 +1,4 @@ NEXT_PUBLIC_API_URL=https://__DOMAIN__/api/ NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production +NEXT_PUBLIC_DOMAIN_URL=__DOMAIN__ diff --git a/sources/patches/custom_url.patch b/sources/patches/custom_url.patch new file mode 100644 index 0000000..63a20b7 --- /dev/null +++ b/sources/patches/custom_url.patch @@ -0,0 +1,73 @@ +diff --git a/frontend/.env.local b/frontend/.env.local +index ee43468..f862dac 100644 +--- a/frontend/.env.local ++++ b/frontend/.env.local +@@ -1,4 +1,5 @@ + NEXT_PUBLIC_API_URL="http://127.0.0.1:3000" ++NEXT_PUBLIC_DOMAIN_BASE="crab.fit" + + # Google auth for calendar syncing, feature will be disabled if these aren't set + # NEXT_PUBLIC_GOOGLE_CLIENT_ID="" +diff --git a/frontend/src/app/[id]/page.tsx b/frontend/src/app/[id]/page.tsx +index a3af022..b807f1c 100644 +--- a/frontend/src/app/[id]/page.tsx ++++ b/frontend/src/app/[id]/page.tsx +@@ -6,6 +6,7 @@ import { Temporal } from '@js-temporal/polyfill' + + import Content from '/src/components/Content/Content' + import Copyable from '/src/components/Copyable/Copyable' ++import DOMAIN_URL from '/src/components/Copyable/Copyable' + import { getEvent } from '/src/config/api' + import { useTranslation } from '/src/i18n/server' + import { makeClass, relativeTimeFormat } from '/src/utils' +@@ -49,10 +50,10 @@ const Page = async ({ params }: PageProps) => { + >{t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })} + + +- {`https://crab.fit/${event.id}`} ++ {`https://${DOMAIN_URL}/${event.id}`} + +

+- ___ ++ ___ +

+ + +diff --git a/frontend/src/components/Copyable/Copyable.tsx b/frontend/src/components/Copyable/Copyable.tsx +index aa14220..82b726c 100644 +--- a/frontend/src/components/Copyable/Copyable.tsx ++++ b/frontend/src/components/Copyable/Copyable.tsx +@@ -7,6 +7,8 @@ import { makeClass } from '/src/utils' + + import styles from './Copyable.module.scss' + ++export const DOMAIN_URL = process.env.NEXT_PUBLIC_DOMAIN_URL ++ + interface CopyableProps extends Omit, 'children'> { + children: string + } +diff --git a/frontend/src/components/CreateForm/components/EventInfo/EventInfo.tsx b/frontend/src/components/CreateForm/components/EventInfo/EventInfo.tsx +index 4376001..bb33518 100644 +--- a/frontend/src/components/CreateForm/components/EventInfo/EventInfo.tsx ++++ b/frontend/src/components/CreateForm/components/EventInfo/EventInfo.tsx +@@ -1,6 +1,7 @@ + import { Trans } from 'react-i18next/TransWithoutContext' + + import Copyable from '/src/components/Copyable/Copyable' ++import DOMAIN_URL from '/src/components/Copyable/Copyable' + import { EventResponse } from '/src/config/api' + import { useTranslation } from '/src/i18n/client' + +@@ -16,10 +17,10 @@ const EventInfo = ({ event }: EventInfoProps) => { + return
+

{event.name}

+ +- {`https://crab.fit/${event.id}`} ++ {`https://${DOMAIN_URL}/${event.id}`} + +

+- ___ ++ ___ +

+
+ }