@atmo-dev/kit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PostData } from '../social/posts.js';
|
|
3
3
|
import { safeWebUrl } from '../social/richtext.js';
|
|
4
|
+
import { blueskyProfileUrl } from '../social/urls.js';
|
|
4
5
|
import Avatar from './Avatar.svelte';
|
|
5
6
|
import PostContent from './PostContent.svelte';
|
|
6
7
|
import NestedComments from './NestedComments.svelte';
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
<article class="min-w-0">
|
|
13
14
|
<div class="flex items-start gap-3">
|
|
14
15
|
<a
|
|
15
|
-
href={
|
|
16
|
+
href={blueskyProfileUrl(comment.author.did)}
|
|
16
17
|
target="_blank"
|
|
17
18
|
rel="noopener noreferrer"
|
|
18
19
|
class="shrink-0"
|
package/dist/social/posts.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { blueskyProfileUrl } from './urls.js';
|
|
1
2
|
export function blueskyPostToPostData(post, depth = 0) {
|
|
2
3
|
const record = post.record ?? post.value;
|
|
3
4
|
const result = {
|
|
4
5
|
uri: post.uri,
|
|
5
|
-
href:
|
|
6
|
+
href: `${blueskyProfileUrl(post.author.did)}/post/${encodeURIComponent(post.uri.split('/').at(-1) ?? '')}`,
|
|
6
7
|
author: {
|
|
7
8
|
did: post.author.did,
|
|
8
9
|
handle: post.author.handle,
|
package/dist/social/richtext.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tokenize } from '@atcute/bluesky-richtext-parser';
|
|
2
|
+
import { blueskyProfileUrl } from './urls.js';
|
|
2
3
|
export function safeWebUrl(url) {
|
|
3
4
|
if (!url)
|
|
4
5
|
return undefined;
|
|
@@ -81,7 +82,7 @@ export function richTextSegments(text, facets = []) {
|
|
|
81
82
|
continue;
|
|
82
83
|
const feature = facet.features?.[0];
|
|
83
84
|
const href = feature?.did
|
|
84
|
-
?
|
|
85
|
+
? blueskyProfileUrl(feature.did)
|
|
85
86
|
: feature?.uri
|
|
86
87
|
? safeWebUrl(feature.uri)
|
|
87
88
|
: feature?.tag
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { isDid } from '@atcute/lexicons/syntax';
|
|
2
|
+
/** Bluesky expects literal DIDs in its routes, including colons and did:web escapes. */
|
|
3
|
+
export function blueskyProfileUrl(identifier) {
|
|
4
|
+
const actor = isDid(identifier) ? identifier : encodeURIComponent(identifier);
|
|
5
|
+
return `https://bsky.app/profile/${actor}`;
|
|
6
|
+
}
|