From d5c02889de0d879ba3cff889a02a8de48a031950 Mon Sep 17 00:00:00 2001 From: BananaJeanss <18456310+BananaJeanss@users.noreply.github.com> Date: Sun, 25 Jan 2026 19:49:39 +0200 Subject: [PATCH 1/3] feat: add input regex filter to universalform, add filter to onboarding, add .env.examples along with gitignore exemption, and improve dev guide by a bit --- .gitignore | 1 + apps/docs/src/content/docs/guides/dev.mdx | 21 +++++++++++---- apps/web/.env.example | 26 +++++++++++++++++++ .../(ui)/(public)/onboarding/page.client.tsx | 4 ++- .../app/UniversalForm/UniversalForm.tsx | 8 ++++++ .../src/components/app/UniversalForm/types.ts | 2 ++ packages/db/.env.example | 2 ++ 7 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 apps/web/.env.example create mode 100644 packages/db/.env.example diff --git a/.gitignore b/.gitignore index 952a1c8..c127e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ yarn-error.log* # local env files .env*.local .env* +!.env.example # vercel .vercel diff --git a/apps/docs/src/content/docs/guides/dev.mdx b/apps/docs/src/content/docs/guides/dev.mdx index 25da3d4..b15be02 100644 --- a/apps/docs/src/content/docs/guides/dev.mdx +++ b/apps/docs/src/content/docs/guides/dev.mdx @@ -5,30 +5,41 @@ description: Instructions to set up a local development environment for hackclub 1. clone repo 2. `pnpm install` -3. `pnpm dev` -4. `pnpm db:migrate` (RUN THIS AFTER POPULATING BELOW ENV) +3. `cp apps/web/.env.example apps/web/.env && cp packages/db/.env.example packages/db/.env` +4. `pnpm dev` +5. `pnpm db:migrate` (RUN THIS AFTER POPULATING ENV) -- create file at apps/web/.env: +- create file at apps/web/.env (skip if you did step 3): ``` DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres + +# make a slack app here: https://api.slack.com/apps SLACK_NOTIFIER_TOKEN= + # invite your bot to the channel you created. below is #hctv-dev, so use that if you want! NOTIFICATION_CHANNEL_ID=C08M3MGE6PJ + REDIS_URL=redis://localhost:6379 + +# get from https://uploadthing.com/ UPLOADTHING_TOKEN= -# enable oauth mode on your hca account + +# enable oauth mode on your hca account and make an app: https://auth.hackclub.com/identity/edit HCID_CLIENT= HCID_SECRET= # make sure to put this as one of the redirect uri HCID_REDIRECT_URI=http://localhost:3000/auth/hackclub/callback + +# mediamtx settings NEXT_PUBLIC_MEDIAMTX_URL=http://localhost:8891 MEDIAMTX_API=http://localhost:9997 + # idt you should change this MEDIAMTX_PUBLISH_KEY=rjq1xdpCPA4qyt3jge NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE=localhost:8890 ``` -- create file at packages/db/.env: +- create file at packages/db/.env (skip if you did step 3): ``` DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres DATABASE_DIRECT_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres diff --git a/apps/web/.env.example b/apps/web/.env.example new file mode 100644 index 0000000..e353b3d --- /dev/null +++ b/apps/web/.env.example @@ -0,0 +1,26 @@ +DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres + +# make a slack app here: https://api.slack.com/apps +SLACK_NOTIFIER_TOKEN= + +# invite your bot to the channel you created. below is #hctv-dev, so use that if you want! +NOTIFICATION_CHANNEL_ID=C08M3MGE6PJ + +REDIS_URL=redis://localhost:6379 + +# get from https://uploadthing.com/ +UPLOADTHING_TOKEN= + +# enable oauth mode on your hca account and make an app: https://auth.hackclub.com/identity/edit +HCID_CLIENT= +HCID_SECRET= +# make sure to put this as one of the redirect uri +HCID_REDIRECT_URI=http://localhost:3000/auth/hackclub/callback + +# mediamtx settings +NEXT_PUBLIC_MEDIAMTX_URL=http://localhost:8891 +MEDIAMTX_API=http://localhost:9997 + +# idt you should change this +MEDIAMTX_PUBLISH_KEY=rjq1xdpCPA4qyt3jge +NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE=localhost:8890 \ No newline at end of file diff --git a/apps/web/src/app/(ui)/(public)/onboarding/page.client.tsx b/apps/web/src/app/(ui)/(public)/onboarding/page.client.tsx index 729e798..1d6c16a 100644 --- a/apps/web/src/app/(ui)/(public)/onboarding/page.client.tsx +++ b/apps/web/src/app/(ui)/(public)/onboarding/page.client.tsx @@ -107,7 +107,9 @@ export default function OnboardingClient() { name: 'username', label: 'Channel Username', type: 'text', - placeholder: 'e.g., yourname or yourname-codes' + placeholder: 'e.g., yourname or yourname-codes', + maxChars: 20, + inputFilter: /[^a-z0-9_-]/g, }, ]} schemaName="onboard" diff --git a/apps/web/src/components/app/UniversalForm/UniversalForm.tsx b/apps/web/src/components/app/UniversalForm/UniversalForm.tsx index 6e5bb7d..3d4f85e 100644 --- a/apps/web/src/components/app/UniversalForm/UniversalForm.tsx +++ b/apps/web/src/components/app/UniversalForm/UniversalForm.tsx @@ -97,13 +97,21 @@ export function UniversalForm({ {...formField} value={formField.value ?? ''} rows={field.textAreaRows ?? 5} + maxLength={field.maxChars} /> ) : ( { + if (field.inputFilter) { + e.target.value = e.target.value.replace(field.inputFilter, ''); + } + formField.onChange(e); + }} value={formField.value ?? ''} + maxLength={field.maxChars} /> )} diff --git a/apps/web/src/components/app/UniversalForm/types.ts b/apps/web/src/components/app/UniversalForm/types.ts index b547072..7167cd3 100644 --- a/apps/web/src/components/app/UniversalForm/types.ts +++ b/apps/web/src/components/app/UniversalForm/types.ts @@ -12,6 +12,8 @@ export type FormFieldConfig = { value?: any; textArea?: boolean; textAreaRows?: number; + maxChars?: number; + inputFilter?: RegExp; component?: (props: { field: ControllerRenderProps } & any) => React.ReactNode; componentProps?: Record; required?: boolean; diff --git a/packages/db/.env.example b/packages/db/.env.example new file mode 100644 index 0000000..1430954 --- /dev/null +++ b/packages/db/.env.example @@ -0,0 +1,2 @@ +DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres +DATABASE_DIRECT_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres \ No newline at end of file From b4d3cd5bb8330f54841cdf0e0cb036cd1a363d7f Mon Sep 17 00:00:00 2001 From: BananaJeans <18456310+BananaJeanss@users.noreply.github.com> Date: Sun, 25 Jan 2026 21:48:15 +0200 Subject: [PATCH 2/3] docs: also add development setup guide link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e65c4b7..86cf612 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,6 @@ This is the source code for [hackclub.tv (hackclub.tv)](https://hackclub.tv), a Development has been ongoing for a few months, and the site is now live! There are some half-baked features, but I'm all ears for feedback. +The development setup guide can be read at + Join [#hctv](https://hackclub.slack.com/archives/C08HGLXGXAB) on the HC Slack for discussion and updates! From a22dcf074698274a4298a971e2613e5586fea06d Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Sun, 25 Jan 2026 21:41:24 +0100 Subject: [PATCH 3/3] docs: refine readme.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 86cf612..768a412 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # hackclub.tv -This is the source code for [hackclub.tv (hackclub.tv)](https://hackclub.tv), a livestreaming website for hackclubbers. - -Development has been ongoing for a few months, and the site is now live! There are some half-baked features, but I'm all ears for feedback. +This is the source code for [hackclub.tv](https://hackclub.tv), a livestreaming website for hackclubbers. The development setup guide can be read at -Join [#hctv](https://hackclub.slack.com/archives/C08HGLXGXAB) on the HC Slack for discussion and updates! +Join [#hctv](https://hackclub.slack.com/archives/C08HGLXGXAB) on the Hack Club Slack for discussion and updates!