Skip to content

Commit b81eda7

Browse files
committed
add TODOs, use LinkBase for profile website
1 parent c012a45 commit b81eda7

4 files changed

Lines changed: 9 additions & 26 deletions

File tree

app/pages/profile/[handle]/index.vue

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ defineOgImageComponent('Default', {
119119
<div class="flex gap-4 items-center font-mono text-sm">
120120
<h2>@{{ handle }}</h2>
121121
<div class="link-subtle font-mono text-sm inline-flex items-center gap-1.5">
122-
<span class="i-carbon:link w-4 h-4" aria-hidden="true" />
122+
<span class="text-white i-carbon:link w-4 h-4" aria-hidden="true" />
123123
<input
124124
name="website"
125125
type="url"
@@ -151,16 +151,9 @@ defineOgImageComponent('Default', {
151151
<p v-if="profile.description">{{ profile.description }}</p>
152152
<div class="flex gap-4 items-center font-mono text-sm">
153153
<h2>@{{ handle }}</h2>
154-
<a
155-
v-if="profile.website"
156-
:href="profile.website"
157-
target="_blank"
158-
rel="noopener noreferrer"
159-
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
160-
>
161-
<span class="i-carbon:link w-4 h-4" aria-hidden="true" />
154+
<LinkBase v-if="profile.website" :to="profile.website" classicon="i-lucide:link">
162155
{{ profile.website }}
163-
</a>
156+
</LinkBase>
164157
<button
165158
v-if="user?.handle === handle"
166159
@click="isEditing = true"

server/api/auth/atproto.get.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ async function getNpmxProfile(handle: string, authSession: OAuthSession) {
289289

290290
// get existing npmx profile OR create a new one
291291
const profileUri = `at://${client.did}/dev.npmx.actor.profile/self`
292+
293+
// TODO: update with safe client rpc, see `getMiniProfile` response variable
292294
const profileResponse = await fetch(
293295
`https://${SLINGSHOT_HOST}/xrpc/blue.microcosm.repo.getRecordByUri?at_uri=${profileUri}`,
294296
{ headers: { 'User-Agent': 'npmx' } },

server/api/social/profile/[identifier]/index.put.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { parse } from 'valibot'
22
import { Client } from '@atproto/lex'
33
import * as dev from '#shared/types/lexicons/dev'
4-
import type { NPMXProfile } from '~~/shared/types/social'
5-
import { ProfileEditBodySchema } from '~~/shared/schemas/social'
4+
import type { NPMXProfile } from '#shared/types/social'
5+
import { ProfileEditBodySchema } from '#shared/schemas/social'
66

77
export default eventHandlerWithOAuthSession(async (event, oAuthSession) => {
88
const loggedInUsersDid = oAuthSession?.did.toString()
@@ -11,8 +11,7 @@ export default eventHandlerWithOAuthSession(async (event, oAuthSession) => {
1111
throw createError({ statusCode: 401, statusMessage: 'Unauthorized' })
1212
}
1313

14-
//Checks if the user has a scope to like packages
15-
await throwOnMissingOAuthScope(oAuthSession, LIKES_SCOPE)
14+
await throwOnMissingOAuthScope(oAuthSession, PROFILE_SCOPE)
1615

1716
const body = parse(ProfileEditBodySchema, await readBody(event))
1817
const client = new Client(oAuthSession)

server/utils/atproto/utils/profile.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,10 @@ const CACHE_MAX_AGE = CACHE_MAX_AGE_ONE_MINUTE * 5
1111
* Logic to handle and update profile queries
1212
*/
1313
export class ProfileUtils {
14-
private readonly constellation: Constellation
1514
private readonly cache: CacheAdapter
15+
// TODO: create Slingshot client (like Constellation class)
1616

1717
constructor() {
18-
this.constellation = new Constellation(
19-
// Passes in a fetch wrapped as cachedfetch since are already doing some heavy caching here
20-
async <T = unknown>(
21-
url: string,
22-
options: Parameters<typeof $fetch>[1] = {},
23-
_ttl?: number,
24-
): Promise<CachedFetchResult<T>> => {
25-
const data = (await $fetch<T>(url, options)) as T
26-
return { data, isStale: false, cachedAt: null }
27-
},
28-
)
2918
this.cache = getCacheAdapter('generic')
3019
}
3120

0 commit comments

Comments
 (0)