mirror of
https://github.com/YunoHost-Apps/crabfit_ynh.git
synced 2024-09-03 18:16:21 +02:00
try to patch crabfit to allow custom url
This commit is contained in:
parent
08122ae355
commit
e39b4ea7bd
2 changed files with 74 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
NEXT_PUBLIC_API_URL=https://__DOMAIN__/api/
|
||||
NEXT_TELEMETRY_DISABLED=1
|
||||
NODE_ENV=production
|
||||
NEXT_PUBLIC_DOMAIN_URL=__DOMAIN__
|
||||
|
|
73
sources/patches/custom_url.patch
Normal file
73
sources/patches/custom_url.patch
Normal file
|
@ -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) })}</span>
|
||||
|
||||
<Copyable className={styles.info}>
|
||||
- {`https://crab.fit/${event.id}`}
|
||||
+ {`https://${DOMAIN_URL}/${event.id}`}
|
||||
</Copyable>
|
||||
<p className={makeClass(styles.info, styles.noPrint)}>
|
||||
- <Trans i18nKey="event:nav.shareinfo" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('event:nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('event:nav.email_body')} https://crab.fit/${event.id}`)}`}>_</a>_</Trans>
|
||||
+ <Trans i18nKey="event:nav.shareinfo" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('event:nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('event:nav.email_body')} https://${DOMAIN_URL}/${event.id}`)}`}>_</a>_</Trans>
|
||||
</p>
|
||||
</Content>
|
||||
</Suspense>
|
||||
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<React.ComponentProps<'p'>, '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 <div className={styles.wrapper}>
|
||||
<h2>{event.name}</h2>
|
||||
<Copyable className={styles.info}>
|
||||
- {`https://crab.fit/${event.id}`}
|
||||
+ {`https://${DOMAIN_URL}/${event.id}`}
|
||||
</Copyable>
|
||||
<p className={styles.info}>
|
||||
- <Trans i18nKey="event:nav.shareinfo_alt" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('nav.email_body')} https://crab.fit/${event.id}`)}`} target="_blank">_</a>_</Trans>
|
||||
+ <Trans i18nKey="event:nav.shareinfo_alt" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('nav.email_body')} https://${DOMAIN_URL}/${event.id}`)}`} target="_blank">_</a>_</Trans>
|
||||
</p>
|
||||
</div>
|
||||
}
|
Loading…
Add table
Reference in a new issue