Skip to content

Commit 79f4a5a

Browse files
author
CloudLobster
committed
fix: move ATTN price endpoint to /api/attn-price/:handle (public, no auth)
The /api/attn/* path was caught by attnRoutes auth middleware, blocking the public price check. Moved to /api/attn-price/:handle.
1 parent 285a932 commit 79f4a5a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

web/src/pages/Dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ function Compose({ auth }: { auth: AuthState }) {
17791779
const timer = setTimeout(async () => {
17801780
setAttnChecking(true);
17811781
try {
1782-
const res = await fetch(`${API_BASE}/api/attn/price/${handle}`);
1782+
const res = await fetch(`${API_BASE}/api/attn-price/${handle}`);
17831783
const data = await res.json();
17841784
if (data.attn_enabled) {
17851785
setAttnInfo({ cold_stake: data.cold_email_stake, reply_stake: data.reply_thread_stake, handle });

worker/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ app.route('/api/claim', claimRoutes);
578578
app.route('/api/attn', attnRoutes);
579579
app.route('/api/airdrop', airdropRoutes);
580580

581-
// Public ATTN price check (no auth required)
582-
app.get('/api/attn/price/:handle', async (c) => {
581+
// Public ATTN price check (no auth required) — outside /api/attn/* to avoid auth middleware
582+
app.get('/api/attn-price/:handle', async (c) => {
583583
const handle = c.req.param('handle').toLowerCase();
584584
const acct = await c.env.DB.prepare('SELECT handle FROM accounts WHERE handle = ?').bind(handle).first();
585585
if (!acct) return c.json({ error: 'User not found' }, 404);

0 commit comments

Comments
 (0)