diff --git a/src/lib/routes/links.ts b/src/lib/routes/links.ts
index 88b599c07..02106134e 100644
--- a/src/lib/routes/links.ts
+++ b/src/lib/routes/links.ts
@@ -1,5 +1,8 @@
import {type AppBskyGraphDefs, AtUri} from '@atproto/api'
+import {isInvalidHandle, isValidHandle} from '#/lib/strings/handles'
+import * as persisted from '#/state/persisted'
+
export function makeProfileLink(
info: {
did: string
@@ -7,7 +10,15 @@ export function makeProfileLink(
},
...segments: string[]
) {
- return [`/profile`, info.did, ...segments].join('/')
+ const useHandle = persisted.get('useHandleInLinks') ?? false
+ const identifier =
+ useHandle &&
+ info.handle &&
+ !isInvalidHandle(info.handle) &&
+ isValidHandle(info.handle)
+ ? info.handle
+ : info.did
+ return [`/profile`, identifier, ...segments].join('/')
}
export function makeCustomFeedLink(
diff --git a/src/screens/Settings/RunesSettings.tsx b/src/screens/Settings/RunesSettings.tsx
index a504b66ba..212514dec 100644
--- a/src/screens/Settings/RunesSettings.tsx
+++ b/src/screens/Settings/RunesSettings.tsx
@@ -132,6 +132,10 @@ import {
useSetTranslationServicePreference,
useTranslationServicePreference,
} from '#/state/preferences/translation-service-preference'
+import {
+ useHandleInLinks,
+ useSetHandleInLinks,
+} from '#/state/preferences/use-handle-in-links'
import {useProfilesQuery} from '#/state/queries/profile'
import * as SettingsList from '#/screens/Settings/components/SettingsList'
import {atoms as a, useBreakpoints} from '#/alf'
@@ -710,6 +714,9 @@ export function RunesSettingsScreen({}: Props) {
const showLinkInHandle = useShowLinkInHandle()
const setShowLinkInHandle = useSetShowLinkInHandle()
+ const handleInLinks = useHandleInLinks()
+ const setHandleInLinks = useSetHandleInLinks()
+
const translationServicePreference = useTranslationServicePreference()
const setTranslationServicePreference = useSetTranslationServicePreference()
@@ -751,6 +758,17 @@ export function RunesSettingsScreen({}: Props) {
+ setHandleInLinks(value)}
+ style={[a.w_full]}>
+
+ Use handles in profile links instead of DIDs
+
+
+
diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts
index 107052e6e..c1e0fe87a 100644
--- a/src/state/persisted/schema.ts
+++ b/src/state/persisted/schema.ts
@@ -191,6 +191,8 @@ const schema = z.object({
openRouterApiKey: z.string().optional(),
openRouterModel: z.string().optional(),
+ useHandleInLinks: z.boolean().optional(),
+
/** @deprecated */
mutedThreads: z.array(z.string()),
trendingDisabled: z.boolean().optional(),
@@ -307,6 +309,8 @@ export const defaults: Schema = {
openRouterApiKey: undefined,
openRouterModel: DEFAULT_ALT_TEXT_AI_MODEL,
+ useHandleInLinks: false,
+
postReplacement: {
enabled: false,
postName: 'skeet',
diff --git a/src/state/preferences/index.tsx b/src/state/preferences/index.tsx
index f5bf44a44..8afa9b433 100644
--- a/src/state/preferences/index.tsx
+++ b/src/state/preferences/index.tsx
@@ -43,6 +43,7 @@ import {Provider as ShowLinkInHandleProvider} from './show-link-in-handle'
import {Provider as SubtitlesProvider} from './subtitles'
import {Provider as TranslationServicePreferenceProvider} from './translation-service-preference'
import {Provider as TrendingSettingsProvider} from './trending'
+import {Provider as UseHandleInLinksProvider} from './use-handle-in-links'
import {Provider as UsedStarterPacksProvider} from './used-starter-packs'
export {
@@ -97,75 +98,77 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- children
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ children
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+