feat: use my.immich.app for externalDomain fallback (#17209)

* feat: use my.immich.app for externalDomain fallback

This is probably more useful than localhost.

* chore: remove port param

* fix: update expected value in tests

* fix: update expected value in e2e
This commit is contained in:
bo0tzz
2025-03-31 13:08:41 +02:00
committed by GitHub
parent 74f7fd4b53
commit e4f83680d9
6 changed files with 14 additions and 21 deletions
+7 -12
View File
@@ -146,11 +146,10 @@ export class NotificationService extends BaseService {
}
const { server } = await this.getConfig({ withCache: false });
const { port } = this.configRepository.getEnv();
const { html, text } = await this.notificationRepository.renderEmail({
template: EmailTemplate.TEST_EMAIL,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
displayName: user.name,
},
customTemplate: tempTemplate!,
@@ -170,7 +169,6 @@ export class NotificationService extends BaseService {
async getTemplate(name: EmailTemplate, customTemplate: string) {
const { server, templates } = await this.getConfig({ withCache: false });
const { port } = this.configRepository.getEnv();
let templateResponse = '';
@@ -179,7 +177,7 @@ export class NotificationService extends BaseService {
const { html: _welcomeHtml } = await this.notificationRepository.renderEmail({
template: EmailTemplate.WELCOME,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
displayName: 'John Doe',
username: 'john@doe.com',
password: 'thisIsAPassword123',
@@ -194,7 +192,7 @@ export class NotificationService extends BaseService {
const { html: _updateAlbumHtml } = await this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_UPDATE,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
albumId: '1',
albumName: 'Favorite Photos',
recipientName: 'Jane Doe',
@@ -210,7 +208,7 @@ export class NotificationService extends BaseService {
const { html } = await this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_INVITE,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
albumId: '1',
albumName: "John Doe's Favorites",
senderName: 'John Doe',
@@ -239,11 +237,10 @@ export class NotificationService extends BaseService {
}
const { server, templates } = await this.getConfig({ withCache: true });
const { port } = this.configRepository.getEnv();
const { html, text } = await this.notificationRepository.renderEmail({
template: EmailTemplate.WELCOME,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
displayName: user.name,
username: user.email,
password: tempPassword,
@@ -285,11 +282,10 @@ export class NotificationService extends BaseService {
const attachment = await this.getAlbumThumbnailAttachment(album);
const { server, templates } = await this.getConfig({ withCache: false });
const { port } = this.configRepository.getEnv();
const { html, text } = await this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_INVITE,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
albumId: album.id,
albumName: album.albumName,
senderName: album.owner.name,
@@ -332,7 +328,6 @@ export class NotificationService extends BaseService {
const attachment = await this.getAlbumThumbnailAttachment(album);
const { server, templates } = await this.getConfig({ withCache: false });
const { port } = this.configRepository.getEnv();
for (const recipient of recipients) {
const user = await this.userRepository.get(recipient.id, { withDeleted: false });
@@ -349,7 +344,7 @@ export class NotificationService extends BaseService {
const { html, text } = await this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_UPDATE,
data: {
baseUrl: getExternalDomain(server, port),
baseUrl: getExternalDomain(server),
albumId: album.id,
albumName: album.albumName,
recipientName: recipient.name,