v4: a handle with this instance's own host names the local user — another instance writes bob from here as bob@gerbeur.example, so a mention or a link copied from there named no one here: /@bob@gerbeur.example was a 404, and the mention notified nobody. localHandle (shared/validation.ts) drops this instance's host, its API's or its pages', from a handle; resolveUsername reads names by it, so the page, the API and the Open Graph 301 reach bob at /@bob, and so do the mention notifications and the chat's highlight and chime.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
import { API_URL } from "../../config/api.ts";
|
||||
import { splitHandle } from "../../../shared/validation.ts";
|
||||
|
||||
/**
|
||||
* Checks whether `host`, as a handle writes it, is this instance's: its API's,
|
||||
* which handles carry, or its pages'. Another instance writes this one's users
|
||||
* with it.
|
||||
*/
|
||||
export function isSelfHost(host: string): boolean {
|
||||
const h = host.toLowerCase();
|
||||
return h === new URL(API_URL || location.origin).host ||
|
||||
h === location.host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the host of `handle`'s home instance, or undefined for a local
|
||||
* user.
|
||||
|
||||
Reference in New Issue
Block a user