Merge remote-tracking branch 'origin' into eric/app-864-integrate-post-tags-into-app

* origin: (21 commits)
  resolve fork of zeed-dom (#1663)
  Port remaining lightbox code to Reanimated (#1669)
  Update testrunner to use new dev-env [WIP] (#1575)
  Fix MobX crash for Android lightbox (#1668)
  Change lightbox to use Pager (#1666)
  make empty feed required (#1667)
  Only warn on links to bsky.app if it represents itself as another url (#1662)
  Fix keyboard double pad issue in email change & verify modals (#1664)
  Don't highlight tags in composer yet (#1665)
  Fix: fetch follows on desktop search for typeahead (#1660)
  Remove duplicate modal container (#1661)
  Drive-by lightbox refactors (#1659)
  Only prompt users once to verify email (according to local storage) close #1657 (#1658)
  Revert "Fix invite codes flash on desktop, use loading placeholder (#1591)" (#1656)
  Refactor iOS lightbox to Reanimated (#1645)
  Bump package.json to 1.52
  Remove unnecessary opacity logic (#1646)
  Fix typo in image.ts (#1638)
  fix typo README.md (#1631)
  Typo fix in README.md: "small about" -> "small amount" (#1639)
  ...
This commit is contained in:
Eric Bailey
2023-10-10 19:30:55 -05:00
35 changed files with 875 additions and 866 deletions
+22 -5
View File
@@ -170,15 +170,32 @@ export function getYoutubeVideoId(link: string): string | undefined {
export function linkRequiresWarning(uri: string, label: string) {
const labelDomain = labelToDomain(label)
if (!labelDomain) {
return true
}
let urip
try {
const urip = new URL(uri)
return labelDomain !== urip.hostname
urip = new URL(uri)
} catch {
return true
}
if (urip.hostname === 'bsky.app') {
// if this is a link to internal content,
// warn if it represents itself as a URL to another app
if (
labelDomain &&
labelDomain !== 'bsky.app' &&
isPossiblyAUrl(labelDomain)
) {
return true
}
return false
} else {
// if this is a link to external content,
// warn if the label doesnt match the target
if (!labelDomain) {
return true
}
return labelDomain !== urip.hostname
}
}
function labelToDomain(label: string): string | undefined {