MCPcopy Create free account
hub / github.com/dailydotdev/apps / getSafeCommentUrl

Function getSafeCommentUrl

packages/shared/src/features/messages/contextLink.ts:15–24  ·  view source on GitHub ↗
(
  url: string,
  webappHost = getWebappHost(),
)

Source from the content-addressed store, hash-verified

13// only rendered when it is an http(s) URL on our own webapp. React would
14// happily render a `javascript:` href.
15export const getSafeCommentUrl = (
16 url: string,
17 webappHost = getWebappHost(),
18): string | undefined => {
19 if (!webappHost || !isValidHttpUrl(url)) {
20 return undefined;
21 }
22
23 return new URL(url).host === webappHost ? url : undefined;
24};

Callers 2

DmContextCardFunction · 0.90

Calls 2

isValidHttpUrlFunction · 0.90
getWebappHostFunction · 0.85

Tested by

no test coverage detected