tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
Merge branch 'main' into feat/feed-generator
tsiry-sandratraina.com
3 months ago
d3573087
2460f5a3
+11
-13
1 changed file
expand all
collapse all
unified
split
apps
api
src
bsky
app.ts
+11
-13
apps/api/src/bsky/app.ts
···
1
1
import type { BlobRef } from "@atproto/lexicon";
2
2
import { isValidHandle } from "@atproto/syntax";
3
3
import { ctx } from "context";
4
4
-
import { and, desc, eq } from "drizzle-orm";
4
4
+
import { and, desc, eq, sql } from "drizzle-orm";
5
5
import { Hono } from "hono";
6
6
import jwt from "jsonwebtoken";
7
7
import * as Profile from "lexicon/types/app/bsky/actor/profile";
···
81
81
? Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365 * 1000
82
82
: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7,
83
83
},
84
84
-
env.JWT_SECRET,
84
84
+
env.JWT_SECRET
85
85
);
86
86
ctx.kv.set(did, token);
87
87
} catch (err) {
···
93
93
.select()
94
94
.from(spotifyAccounts)
95
95
.where(
96
96
-
and(
97
97
-
eq(spotifyAccounts.userId, did),
98
98
-
eq(spotifyAccounts.isBetaUser, true),
99
99
-
),
96
96
+
and(eq(spotifyAccounts.userId, did), eq(spotifyAccounts.isBetaUser, true))
100
97
)
101
98
.limit(1)
102
99
.execute();
···
148
145
await ctx.db
149
146
.insert(users)
150
147
.values({
148
148
+
id: sql`xata_id()`,
151
149
did,
152
150
handle,
153
151
displayName: profile.displayName,
···
182
180
183
181
ctx.nc.publish(
184
182
"rocksky.user",
185
185
-
Buffer.from(JSON.stringify(deepSnakeCaseKeys(user))),
183
183
+
Buffer.from(JSON.stringify(deepSnakeCaseKeys(user)))
186
184
);
187
185
188
186
await ctx.kv.set("lastUser", lastUser[0].id);
···
195
193
.where(
196
194
and(
197
195
eq(spotifyAccounts.userId, did),
198
198
-
eq(spotifyAccounts.isBetaUser, true),
199
199
-
),
196
196
+
eq(spotifyAccounts.isBetaUser, true)
197
197
+
)
200
198
)
201
199
.limit(1)
202
200
.execute(),
···
212
210
.where(
213
211
and(
214
212
eq(googleDriveAccounts.userId, did),
215
215
-
eq(googleDriveAccounts.isBetaUser, true),
216
216
-
),
213
213
+
eq(googleDriveAccounts.isBetaUser, true)
214
214
+
)
217
215
)
218
216
.limit(1)
219
217
.execute(),
···
223
221
.where(
224
222
and(
225
223
eq(dropboxAccounts.userId, did),
226
226
-
eq(dropboxAccounts.isBetaUser, true),
227
227
-
),
224
224
+
eq(dropboxAccounts.isBetaUser, true)
225
225
+
)
228
226
)
229
227
.limit(1)
230
228
.execute(),