diff options
author | Raphael <mail@raphaelkabo.com> | 2025-02-11 23:46:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-11 23:46:53 +0000 |
commit | 227787d28fc91aada6106218fac186f4f5c6269f (patch) | |
tree | ce84abd4f10f1baf5c987808b97f8a7494bde5ef | |
parent | 0fea3393d63858e1585dd1f16ca4e75cc16dbdc0 (diff) | |
parent | fe5d47e46a96c541f1bf472607d4158a9a7c6e18 (diff) |
Merge branch 'main' into update/remove-google-fonts
-rw-r--r-- | config/config.example.toml | 2 | ||||
-rw-r--r-- | docker-compose.yml | 3 | ||||
-rw-r--r-- | docs/running-gathio/installation.md | 44 | ||||
-rw-r--r-- | src/lib/email.ts | 11 | ||||
-rw-r--r-- | src/routes/event.ts | 9 | ||||
-rw-r--r-- | src/routes/group.ts | 1 | ||||
-rw-r--r-- | src/routes/magicLink.ts | 1 |
7 files changed, 58 insertions, 13 deletions
diff --git a/config/config.example.toml b/config/config.example.toml index d58fe35..32e2039 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -20,7 +20,7 @@ show_kofi = false # 'Display this event/group on the public event/group list'. show_public_event_list = false # Which mail service to use to send emails to hosts and attendees. Options are -# 'nodemailer' or 'sendgrid'. Configure settings for this mail +# 'nodemailer', 'sendgrid', or 'none'. Configure settings for this mail # service below. mail_service = "none" # An array of email addresses which are permitted to create events. If this is diff --git a/docker-compose.yml b/docker-compose.yml index 5a8a0d9..f799a9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,9 @@ services: volumes: # The path to Gathio's config folder - change to match your system - ./gathio-docker/config:/app/config + # The path to Gathio's static, public pages including instance description + # and privacy policy - change to match your system + - ./gathio-docker/static:/app/static # The path to Gathio's user-uploaded event images folder - change to match your system - ./gathio-docker/images:/app/public/events mongo: diff --git a/docs/running-gathio/installation.md b/docs/running-gathio/installation.md index cdb3f44..f2c08a3 100644 --- a/docs/running-gathio/installation.md +++ b/docs/running-gathio/installation.md @@ -94,24 +94,43 @@ The easiest way to run Gathio using Docker is by using the provided `docker-compose` configuration. We provide a Docker image at [GitHub Container Repository](https://github.com/lowercasename/gathio/pkgs/container/gathio). -Create a directory on your system where you'll keep the Gathio configuration -file and another where Gathio can store user-uploaded event images. Copy the -example config file into the config directory: +Clone the Gathio repository onto your system - you'll need a few files from it in a minute. + +Create a few directories on your system: + +- One where you'll keep the Gathio configuration file +- One where you'll keep Gathio's static files, such as the instance description + and any custom pages you may want to create +- And another where Gathio can store user-uploaded event images. + +```bash +mkdir -p ~/docker/gathio-docker/{config,images,static} +``` + +Copy the example config file from the Gathio repository directory into the Docker config directory, +renaming it to `config.toml`: ```bash -mkdir -p ~/docker/gathio-docker/{config,images} cp config/config.example.toml ~/docker/gathio-docker/config/config.toml ``` -Under the `volumes` section of the `docker-compose.yml` configuration, adjust the -configuration volume to match the folder you created: +In the `docker-compose.yml` configuration file, adjust +the `volumes` configuration to match the three folders you created: ```dockerfile volumes: - '/home/username/docker/gathio-docker/config:/app/config' + - '/home/username/docker/gathio-docker/static:/app/static' - '/home/username/docker/gathio-docker/images:/app/public/events' ``` +As with all things in the Docker universe, two things seperated by a colon +means `<thing on host computer>:<thing inside Docker container>`. So +here you're saying "any files I put in the folder called +`/home/username/docker/gathio-docker/config` on my computer will appear inside +the Docker container at the path `/app/static`. Don't change the paths on the +Docker container side - only the ones on the host side! + Adjust any settings in the config file, especially the MongoDB URL, which should read as follows for the standard Docker Compose config, and the email service if you want to enable it: @@ -121,19 +140,22 @@ mongodb_url = "mongodb://mongo:27017/gathio" mail_service = "nodemailer" ``` -You can copy the `docker-compose.yml` file into that same `gathio-docker` directory -you created - you don't need any of the source code. Once you're done, your directory -should look something like this: +You can copy the `docker-compose.yml` file into that same `gathio-docker` +directory you created - you don't need to keep any of the other source code. Once +you're done, your directory should look something like this: ``` gathio-docker ├── config │ └── config.toml ├── docker-compose.yml -└── images +├── images +└── static + ├── instance-description.md + └── privacy-policy.md ``` -Finally, from wherever you've put your `docker-compose.yml` file, start the Docker stack: +Finally, from wherever you've put your `docker-compose.yml` file, start the Docker Compose stack: ```bash cd gathio-docker diff --git a/src/lib/email.ts b/src/lib/email.ts index 40b5200..82dd48e 100644 --- a/src/lib/email.ts +++ b/src/lib/email.ts @@ -83,6 +83,7 @@ export const initEmailService = async (): Promise<boolean> => { export const sendEmail = async ( to: string, + bcc: string, subject: string, text: string, html?: string, @@ -92,6 +93,7 @@ export const sendEmail = async ( try { await sgMail.send({ to, + bcc, from: config.general.email, subject: `${config.general.site_name}: ${subject}`, text, @@ -123,8 +125,14 @@ export const sendEmail = async ( const nodemailerTransporter = nodemailer.createTransport(nodemailerConfig); await nodemailerTransporter.sendMail({ + envelope: { + from: config.general.email, + to, + bcc, + }, from: config.general.email, to, + bcc, subject, text, html, @@ -141,6 +149,7 @@ export const sendEmail = async ( export const sendEmailFromTemplate = async ( to: string, + bcc: string, subject: string, template: EmailTemplate, templateData: Record<string, unknown>, @@ -159,5 +168,5 @@ export const sendEmailFromTemplate = async ( `${template}/${template}Text`, templateData, ); - return await sendEmail(to, subject, text, html); + return await sendEmail(to, bcc, subject, text, html); }; diff --git a/src/routes/event.ts b/src/routes/event.ts index 1b79f12..de5cb4c 100644 --- a/src/routes/event.ts +++ b/src/routes/event.ts @@ -27,6 +27,9 @@ import crypto from "crypto"; import ical from "ical"; import { markdownToSanitizedHTML } from "../util/markdown.js"; import { checkMagicLink, getConfigMiddleware } from "../lib/middleware.js"; +import { getConfig } from "../lib/config.js"; +const config = getConfig(); + const storage = multer.memoryStorage(); // Accept only JPEG, GIF or PNG images, up to 10MB @@ -193,6 +196,7 @@ router.post( if (eventData.creatorEmail && req.app.locals.sendEmails) { sendEmailFromTemplate( eventData.creatorEmail, + "", `${eventData.eventName}`, "createEvent", { @@ -229,6 +233,7 @@ router.post( subscribers?.forEach((emailAddress) => { sendEmailFromTemplate( emailAddress, + "", `New event in ${eventGroup.name}`, "eventGroupUpdated", { @@ -493,6 +498,7 @@ router.put( .map((o) => o.email); if (attendeeEmails?.length) { sendEmailFromTemplate( + config.general.email, attendeeEmails.join(","), `${event.name} was just edited`, "editEvent", @@ -608,6 +614,7 @@ router.post( if (creatorEmail && req.app.locals.sendEmails) { sendEmailFromTemplate( creatorEmail, + "", `${importedEventData.summary}`, "createEvent", { @@ -688,6 +695,7 @@ router.delete( if (attendeeEmail && req.app.locals.sendEmails) { await sendEmailFromTemplate( attendeeEmail, + "", "You have been removed from an event", "unattendEvent", { @@ -739,6 +747,7 @@ router.get( if (req.app.locals.sendEmails && attendee.email) { sendEmailFromTemplate( attendee.email, + "", `You have been removed from ${event.name}`, "unattendEvent", { diff --git a/src/routes/group.ts b/src/routes/group.ts index 1bbf501..9f4105c 100644 --- a/src/routes/group.ts +++ b/src/routes/group.ts @@ -95,6 +95,7 @@ router.post( if (groupData.creatorEmail && req.app.locals.sendEmails) { sendEmailFromTemplate( groupData.creatorEmail, + "", `${eventGroup.name}`, "createEventGroup", { diff --git a/src/routes/magicLink.ts b/src/routes/magicLink.ts index 499d0a4..b4afca6 100644 --- a/src/routes/magicLink.ts +++ b/src/routes/magicLink.ts @@ -50,6 +50,7 @@ router.post("/magic-link/event/create", async (req: Request, res: Response) => { sendEmailFromTemplate( email, + "", `Magic link to create an event`, "createEventMagicLink", { |