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
import type { BlobRef } from "@atproto/lexicon";
2
import { isValidHandle } from "@atproto/syntax";
3
import { ctx } from "context";
4
-
import { and, desc, eq } from "drizzle-orm";
5
import { Hono } from "hono";
6
import jwt from "jsonwebtoken";
7
import * as Profile from "lexicon/types/app/bsky/actor/profile";
···
81
? Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365 * 1000
82
: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7,
83
},
84
-
env.JWT_SECRET,
85
);
86
ctx.kv.set(did, token);
87
} catch (err) {
···
93
.select()
94
.from(spotifyAccounts)
95
.where(
96
-
and(
97
-
eq(spotifyAccounts.userId, did),
98
-
eq(spotifyAccounts.isBetaUser, true),
99
-
),
100
)
101
.limit(1)
102
.execute();
···
148
await ctx.db
149
.insert(users)
150
.values({
0
151
did,
152
handle,
153
displayName: profile.displayName,
···
182
183
ctx.nc.publish(
184
"rocksky.user",
185
-
Buffer.from(JSON.stringify(deepSnakeCaseKeys(user))),
186
);
187
188
await ctx.kv.set("lastUser", lastUser[0].id);
···
195
.where(
196
and(
197
eq(spotifyAccounts.userId, did),
198
-
eq(spotifyAccounts.isBetaUser, true),
199
-
),
200
)
201
.limit(1)
202
.execute(),
···
212
.where(
213
and(
214
eq(googleDriveAccounts.userId, did),
215
-
eq(googleDriveAccounts.isBetaUser, true),
216
-
),
217
)
218
.limit(1)
219
.execute(),
···
223
.where(
224
and(
225
eq(dropboxAccounts.userId, did),
226
-
eq(dropboxAccounts.isBetaUser, true),
227
-
),
228
)
229
.limit(1)
230
.execute(),
···
1
import type { BlobRef } from "@atproto/lexicon";
2
import { isValidHandle } from "@atproto/syntax";
3
import { ctx } from "context";
4
+
import { and, desc, eq, sql } from "drizzle-orm";
5
import { Hono } from "hono";
6
import jwt from "jsonwebtoken";
7
import * as Profile from "lexicon/types/app/bsky/actor/profile";
···
81
? Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 365 * 1000
82
: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 7,
83
},
84
+
env.JWT_SECRET
85
);
86
ctx.kv.set(did, token);
87
} catch (err) {
···
93
.select()
94
.from(spotifyAccounts)
95
.where(
96
+
and(eq(spotifyAccounts.userId, did), eq(spotifyAccounts.isBetaUser, true))
0
0
0
97
)
98
.limit(1)
99
.execute();
···
145
await ctx.db
146
.insert(users)
147
.values({
148
+
id: sql`xata_id()`,
149
did,
150
handle,
151
displayName: profile.displayName,
···
180
181
ctx.nc.publish(
182
"rocksky.user",
183
+
Buffer.from(JSON.stringify(deepSnakeCaseKeys(user)))
184
);
185
186
await ctx.kv.set("lastUser", lastUser[0].id);
···
193
.where(
194
and(
195
eq(spotifyAccounts.userId, did),
196
+
eq(spotifyAccounts.isBetaUser, true)
197
+
)
198
)
199
.limit(1)
200
.execute(),
···
210
.where(
211
and(
212
eq(googleDriveAccounts.userId, did),
213
+
eq(googleDriveAccounts.isBetaUser, true)
214
+
)
215
)
216
.limit(1)
217
.execute(),
···
221
.where(
222
and(
223
eq(dropboxAccounts.userId, did),
224
+
eq(dropboxAccounts.isBetaUser, true)
225
+
)
226
)
227
.limit(1)
228
.execute(),