Add federated room detail page and improve address parsing in invites
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m18s
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m18s
This commit is contained in:
@@ -149,12 +149,15 @@ export async function discoverInstance(domain) {
|
||||
* @returns {{ username: string, domain: string | null }}
|
||||
*/
|
||||
export function parseAddress(address) {
|
||||
if (!address || !address.includes('@')) {
|
||||
return { username: address, domain: null };
|
||||
if (!address) return { username: address, domain: null };
|
||||
// Accept both @user@domain (Mastodon-style) and user@domain
|
||||
const normalized = address.startsWith('@') ? address.slice(1) : address;
|
||||
if (!normalized.includes('@')) {
|
||||
return { username: normalized, domain: null };
|
||||
}
|
||||
const atIndex = address.lastIndexOf('@');
|
||||
const atIndex = normalized.lastIndexOf('@');
|
||||
return {
|
||||
username: address.substring(0, atIndex),
|
||||
domain: address.substring(atIndex + 1),
|
||||
username: normalized.substring(0, atIndex),
|
||||
domain: normalized.substring(atIndex + 1),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ router.post('/invite', authenticateToken, async (req, res) => {
|
||||
const inviteId = uuidv4();
|
||||
const payload = {
|
||||
invite_id: inviteId,
|
||||
from_user: `${req.user.name}@${getFederationDomain()}`,
|
||||
from_user: `@${req.user.name}@${getFederationDomain()}`,
|
||||
to_user: to,
|
||||
room_name: room.name,
|
||||
room_uid: room.uid,
|
||||
@@ -195,7 +195,7 @@ router.post('/receive', async (req, res) => {
|
||||
|
||||
// Send notification email (truly fire-and-forget – never blocks the response)
|
||||
if (targetUser.email) {
|
||||
const appUrl = process.env.APP_URL || '';
|
||||
const appUrl = process.env.APP_URL || `${req.protocol}://${req.get('host')}`;
|
||||
const inboxUrl = `${appUrl}/federation/inbox`;
|
||||
const appName = process.env.APP_NAME || 'Redlight';
|
||||
sendFederationInviteEmail(
|
||||
|
||||
Reference in New Issue
Block a user