about summary refs log tree commit diff
path: root/src/state
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-03-09 10:35:23 -0600
committerGitHub <noreply@github.com>2024-03-09 10:35:23 -0600
commit594958c6dc2a69155c19bcd108f19fe9c64f98be (patch)
tree72180011d9d227f24c3eb47df79bd5567357c718 /src/state
parentaad8c080eda81ad96875c817420d719a8c80874f (diff)
downloadvoidsky-594958c6dc2a69155c19bcd108f19fe9c64f98be.tar.zst
Fix RSS URLs treated as internal (#3156)
* Fix RSS URLs treated as internal

* Add utils to patch relative RSS external links

* modify router to support multiple paths

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state')
-rw-r--r--src/state/preferences/in-app-browser.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state/preferences/in-app-browser.tsx b/src/state/preferences/in-app-browser.tsx
index 4f033db65..2398f1f81 100644
--- a/src/state/preferences/in-app-browser.tsx
+++ b/src/state/preferences/in-app-browser.tsx
@@ -5,6 +5,11 @@ import * as WebBrowser from 'expo-web-browser'
 import {isNative} from '#/platform/detection'
 import {useModalControls} from '../modals'
 import {usePalette} from 'lib/hooks/usePalette'
+import {
+  isBskyRSSUrl,
+  isRelativeUrl,
+  createBskyAppAbsoluteUrl,
+} from 'lib/strings/url-helpers'
 
 type StateContext = persisted.Schema['useInAppBrowser']
 type SetContext = (v: persisted.Schema['useInAppBrowser']) => void
@@ -57,6 +62,10 @@ export function useOpenLink() {
 
   const openLink = React.useCallback(
     (url: string, override?: boolean) => {
+      if (isBskyRSSUrl(url) && isRelativeUrl(url)) {
+        url = createBskyAppAbsoluteUrl(url)
+      }
+
       if (isNative && !url.startsWith('mailto:')) {
         if (override === undefined && enabled === undefined) {
           openModal({