Skip to content

Commit 7cbd40c

Browse files
fullstackjamclaude
andcommitted
feat: treat unlisted configs same as public, exclude from explore
Unlisted configs are now served through the public API endpoint and shown on user profile pages, but filtered out of the explore page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3ab94bd commit 7cbd40c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/routes/[username]/+page.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export const load: PageServerLoad = async ({ params, platform, locals, request,
6565
if (!profileUser) throw error(404, 'User not found');
6666

6767
const configsResult = await env.DB.prepare(
68-
'SELECT id, slug, name, description, base_preset, packages, install_count, updated_at FROM configs WHERE user_id = ? AND visibility = ? ORDER BY install_count DESC'
68+
'SELECT id, slug, name, description, base_preset, packages, install_count, updated_at FROM configs WHERE user_id = ? AND visibility IN (?, ?) ORDER BY install_count DESC'
6969
)
70-
.bind(profileUser.id, 'public')
70+
.bind(profileUser.id, 'public', 'unlisted')
7171
.all<any>();
7272

7373
const configs = configsResult.results || [];

src/routes/api/configs/public/+server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ export const GET: RequestHandler = async ({ platform, url }) => {
77

88
const username = url.searchParams.get('username');
99
const sort = url.searchParams.get('sort') || 'recent';
10+
const visibility = url.searchParams.get('visibility');
1011
const limit = Math.min(parseInt(url.searchParams.get('limit') || '50'), 100);
1112
const offset = Math.max(parseInt(url.searchParams.get('offset') || '0'), 0);
1213

1314
let orderClause: string;
14-
let whereClause = `c.visibility = 'public'`;
15+
let whereClause = visibility === 'public'
16+
? `c.visibility = 'public'`
17+
: `c.visibility IN ('public', 'unlisted')`;
1518

1619
if (!username) {
1720
whereClause += ` AND NOT (u.username = 'openboot' AND c.slug = 'default')`;

src/routes/explore/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
3434
loading = true;
3535
try {
36-
const response = await fetch(`/api/configs/public?sort=${sortBy}&limit=${limit}&offset=${offset}`);
36+
const response = await fetch(`/api/configs/public?sort=${sortBy}&limit=${limit}&offset=${offset}&visibility=public`);
3737
if (response.ok) {
3838
const data = await response.json();
3939
if (reset) {

0 commit comments

Comments
 (0)