Skip to content

Commit a10d0df

Browse files
committed
finishing touches
1 parent c40f7b3 commit a10d0df

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

modules/standard-site-sync.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export default defineNuxtModule({
8686
rkey: possiblePublication.tid,
8787
},
8888
)
89+
// Wait for the firehose and indexers to catch up if we create a publication
90+
await new Promise(sleepResolve => setTimeout(sleepResolve, 2_000))
8991
}
9092
if (documentsToSync.length > 0) {
9193
await syncsiteStandardDocuments(authenticatedClient, documentsToSync)
@@ -167,13 +169,13 @@ function createContentHash(data: unknown): string {
167169

168170
function buildATProtoDocument(siteUrl: string, data: BlogPostDocument) {
169171
return site.standard.document.$build({
170-
// site: siteUrl as `${string}:${string}`,
171172
site: `at://${NPMX_DEV_DID}/site.standard.publication/${npmxPublicationRkey()}`,
172173
path: data.path,
173174
title: data.title,
174175
description: data.description ?? data.excerpt,
175176
tags: data.tags,
176-
publishedAt: new Date(data.date).toISOString(),
177+
// Publish on the record with the current date
178+
publishedAt: new Date().toISOString(),
177179
})
178180
}
179181

@@ -279,7 +281,7 @@ const checkPublication = async (identifier: AtIdentifierString, pdsPublicClient:
279281
tid: publicationTid,
280282
record: site.standard.publication.$build({
281283
name: 'npmx.dev',
282-
url: 'https://npmx.dev/blog',
284+
url: 'https://npmx.dev',
283285
description: 'a fast, modern browser for the npm registry',
284286
preferences: {
285287
showInDiscover: true,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { npmxPublicationRkey } from '#shared/utils/atproto'
22

3-
export default defineEventHandler(async _ => {
3+
export default defineEventHandler(async event => {
4+
setResponseHeader(event, 'content-type', 'text/plain')
45
return `at://${NPMX_DEV_DID}/site.standard.publication/${npmxPublicationRkey()}`
56
})

shared/utils/atproto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ export const generateBlogTID = (dateString: string, slug: string): string => {
2828

2929
// Using our release date as the tid for the publication
3030
export const npmxPublicationRkey = () =>
31-
TID.create(new Date('2026-03-03 06:00:00').getTime() * MS_TO_MICROSECONDS, TID_CLOCK_ID)
31+
TID.create(new Date('2026-03-03').getTime() * MS_TO_MICROSECONDS, TID_CLOCK_ID)

shared/utils/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export const PACKAGE_SUBJECT_REF = (packageName: string) =>
5151
// OAuth scopes as we add new ones we need to check these on certain actions. If not redirect the user to login again to upgrade the scopes
5252
export const LIKES_SCOPE = `repo:${dev.npmx.feed.like.$nsid}`
5353
export const PROFILE_SCOPE = `repo:${dev.npmx.actor.profile.$nsid}`
54+
export const NPMX_DEV_DID = 'did:plc:u5zp7npt5kpueado77kuihyz'
55+
export const TID_CLOCK_ID = 3
5456

5557
// Discord
5658
export const DISCORD_COMMUNITY_URL = 'https://chat.npmx.dev'

0 commit comments

Comments
 (0)