Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
PORT=3005

# name of the app that sends the emails - featured in the message subject or body
APP_NAME=Tired.bike
APP_URL=https://tired.bike
APP_NAME=SolidCouch
APP_URL=https://app.solidcouch.org
# provide path to a logo to display on top of emails - keep it small!
# absolute path, or relative path to the base of the project
APP_LOGO=./logo.png
SUPPORT_EMAIL=support@tired.bike
SUPPORT_EMAIL=support@solidcouch.org

# server base url, e.g. to construct correct email verification link
# this is the base url that end users see
Expand Down Expand Up @@ -42,7 +42,7 @@ SMTP_TRANSPORT_AUTH_PASS=
SMTP_TRANSPORT_REQUIRE_TLS=

# email address which will be the sender of the notifications and email verification messages
EMAIL_SENDER=noreply@notifications.tired.bike
EMAIL_SENDER=noreply@notifications.solidcouch.org

# JWT
# path to JWT (private) key
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2023 Tired Bike
Copyright (c) 2023 SolidCouch contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export const baseUrl =
? `http://localhost:${port}`
: process.env.BASE_URL

export const appName = process.env.APP_NAME ?? 'Tired.bike'
export const appName = process.env.APP_NAME ?? 'SolidCouch'

export const appUrl = process.env.APP_URL ?? 'https://tired.bike'
export const appUrl = process.env.APP_URL ?? 'https://app.solidcouch.org'

// default is tired.bike logo
// default is SolidCouch logo
export const appLogo = process.env.APP_LOGO ?? './logo.png'

export const supportEmail = process.env.SUPPORT_EMAIL ?? 'support@tired.bike'
export const supportEmail =
process.env.SUPPORT_EMAIL ?? 'support@solidcouch.org'

// identity under which the mailer is operating
export const mailerCredentials = {
Expand Down Expand Up @@ -56,7 +57,7 @@ export const smtpTransportOptions: SMTPTransport.Options = {

// email address which will be the sender of the notifications and email verification messages
export const emailSender =
process.env.EMAIL_SENDER ?? 'noreply@notifications.tired.bike'
process.env.EMAIL_SENDER ?? 'noreply@notifications.solidcouch.org'

// email verification expiration in seconds (1 hour)
export const emailVerificationExpiration = 3600
Expand Down
6 changes: 5 additions & 1 deletion src/controllers/notification.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DefaultContext, Middleware } from 'koa'
import { appName, emailSender } from '../config/index.js'
import { appName, appUrl, emailSender } from '../config/index.js'
import { sendMail } from '../services/mailerService.js'
import { generateHtmlMessage } from '../templates/generateMessage.js'
import { getVerifiedEmails } from './status.js'
Expand Down Expand Up @@ -48,6 +48,10 @@ export const notification: Middleware<
html: await generateHtmlMessage('message', {
...body,
title: subject,
chatLink: new URL(
`messages?with=${encodeURIComponent(body.actor.id)}`,
appUrl,
).toString(),
}),
text: body.object.content,
})
Expand Down
2 changes: 1 addition & 1 deletion src/services/mailerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const sendMail = async (options: SendMailOptions) => {
{
filename: path.basename(appLogo),
path: appLogo,
cid: 'applogo@tired.bike',
cid: 'applogo@solidcouch.org',
},
...(options.attachments ?? []),
],
Expand Down
2 changes: 1 addition & 1 deletion src/templates/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<body>
<header><img
alt='logo of {{appName}}'
src='cid:applogo@tired.bike'
src='cid:applogo@solidcouch.org'
height='32'
/></header>
{{{body}}}
Expand Down
8 changes: 2 additions & 6 deletions src/templates/message.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>Hello{{#if target.name}}&nbsp;{{/if}}{{target.name}}!</p>
<p>
<a href={{actor.id}}>{{#if
<a href='{{actor.id}}'>{{#if
actor.name
}}{{actor.name}}{{else}}Somebody{{/if}}</a>
sent you a message from
Expand All @@ -10,9 +10,5 @@
<blockquote>{{object.content}}</blockquote>

<p>
<a
href='https://tired.bike/messages/{{encodeURIComponent actor.id}}'
class='action-button'
>Reply on
{{appName}}</a>
<a href='{{chatLink}}' class='action-button'>Reply on {{appName}}</a>
</p>