Skip to content

Commit 5c1ad6a

Browse files
committed
feat(api): include taps in config response
Extract taps from snapshot and return them in /[username]/[slug]/config endpoint to support third-party tap packages like steipete/tap.
1 parent 244bb66 commit 5c1ad6a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/routes/[username]/[slug]/config/+server.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,29 @@ export const GET: RequestHandler = async ({ platform, params }) => {
3131

3232
const packages = JSON.parse(config.packages || '[]');
3333

34+
let taps: string[] = [];
35+
const snapshotRow = await env.DB.prepare(
36+
'SELECT snapshot FROM configs WHERE user_id = ? AND slug = ?'
37+
)
38+
.bind(user.id, params.slug)
39+
.first<{ snapshot: string }>();
40+
41+
if (snapshotRow?.snapshot) {
42+
try {
43+
const snapshot = JSON.parse(snapshotRow.snapshot);
44+
taps = snapshot.packages?.taps || [];
45+
} catch {
46+
taps = [];
47+
}
48+
}
49+
3450
return json({
3551
username: user.username,
3652
slug: config.slug,
3753
name: config.name,
3854
preset: config.base_preset,
3955
packages: packages,
56+
taps: taps,
4057
dotfiles_repo: config.dotfiles_repo || ''
4158
});
4259
};

0 commit comments

Comments
 (0)