fix: Add protocol prefix to invitation links (#2986)
This commit is contained in:
Mauricio Siu
2025-11-13 12:35:52 -06:00
committed by GitHub
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -4,6 +4,7 @@ import {
findNotificationById, findNotificationById,
findOrganizationById, findOrganizationById,
findUserById, findUserById,
getDokployUrl,
getUserByToken, getUserByToken,
IS_CLOUD, IS_CLOUD,
removeUserById, removeUserById,
@@ -419,11 +420,10 @@ export const userRouter = createTRPCRouter({
}); });
} }
const admin = await findAdmin();
const host = const host =
process.env.NODE_ENV === "development" process.env.NODE_ENV === "development"
? "http://localhost:3000" ? "http://localhost:3000"
: admin.user.host; : await getDokployUrl();
const inviteLink = `${host}/invitation?token=${input.invitationId}`; const inviteLink = `${host}/invitation?token=${input.invitationId}`;
const organization = await findOrganizationById( const organization = await findOrganizationById(
+2 -1
View File
@@ -110,7 +110,8 @@ export const getDokployUrl = async () => {
const admin = await findAdmin(); const admin = await findAdmin();
if (admin.user.host) { if (admin.user.host) {
return `https://${admin.user.host}`; const protocol = admin.user.https ? "https" : "http";
return `${protocol}://${admin.user.host}`;
} }
return `http://${admin.user.serverIp}:${process.env.PORT}`; return `http://${admin.user.serverIp}:${process.env.PORT}`;
}; };