ensure we post starter-pack not start links
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {startUriToStarterPackUri} from 'lib/strings/starter-pack'
|
||||||
|
|
||||||
export async function resolveShortLink(shortLink: string) {
|
export async function resolveShortLink(shortLink: string) {
|
||||||
const controller = new AbortController()
|
const controller = new AbortController()
|
||||||
@@ -12,7 +13,7 @@ export async function resolveShortLink(shortLink: string) {
|
|||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
return shortLink
|
return shortLink
|
||||||
}
|
}
|
||||||
return res.url
|
return startUriToStarterPackUri(res.url)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
logger.error('Failed to resolve short link', {safeMessage: e})
|
logger.error('Failed to resolve short link', {safeMessage: e})
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -99,3 +99,7 @@ export function createStarterPackUri({
|
|||||||
}): string | null {
|
}): string | null {
|
||||||
return new AtUri(`at://${did}/app.bsky.graph.starterpack/${rkey}`).toString()
|
return new AtUri(`at://${did}/app.bsky.graph.starterpack/${rkey}`).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function startUriToStarterPackUri(uri: string) {
|
||||||
|
return uri.replace('/start/', '/starter-pack/')
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user