This commit is contained in:
Tom Moor committed 2025-02-17 20:24:18 -05:00
1 parent 9f55b46204
commit b097ac4be6
2 files changed
+7 -3

No files matched your search

+5 -3
View File
@@ -147,10 +147,12 @@ router.get("*", shareDomains(), async (ctx, next) => {
}
// Redirect if subdomain is not the current team's subdomain
if (team?.subdomain && !ctx.hostname.startsWith(team.subdomain)) {
if (team?.subdomain) {
const { teamSubdomain } = parseDomain(ctx.href);
ctx.redirect(ctx.href.replace(teamSubdomain, team.subdomain));
return;
if (team?.subdomain !== teamSubdomain) {
ctx.redirect(ctx.href.replace(teamSubdomain, team.subdomain));
return;
}
}
const analytics = team
+2
View File
@@ -127,6 +127,8 @@ export async function getTeamFromContext(ctx: Context) {
} else if (domain.custom) {
team = await Team.findOne({ where: { domain: domain.host } });
} else if (domain.teamSubdomain) {
// Preference is always given to the team with the subdomain currently
// otherwise we can try and find a team that previously used the subdomain.
team =
(await Team.findOne({
where: { subdomain: domain.teamSubdomain },