diff options
| author | Fuwn <[email protected]> | 2026-02-07 02:00:59 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-07 02:00:59 -0800 |
| commit | f93bad7da47093a12116ff0f390abb548289b600 (patch) | |
| tree | e2a9debcca3473af8f293c3215704549e5bde17f /apps/web/app/api | |
| parent | style: format Go worker with iku (diff) | |
| download | asa.news-f93bad7da47093a12116ff0f390abb548289b600.tar.xz asa.news-f93bad7da47093a12116ff0f390abb548289b600.zip | |
style: lowercase all user-facing strings and add custom eslint rule
Comprehensive sweep of all user-facing text to enforce lowercase
convention, including acronyms (api, rest, http, opml, json, totp,
mfa, qr, hmac). Added asa-lowercase/lowercase-strings eslint rule
that reports uppercase in notify() calls, error messages, jsx text,
and checked attributes (placeholder, alt, title).
Diffstat (limited to 'apps/web/app/api')
| -rw-r--r-- | apps/web/app/api/account/data/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/account/route.ts | 4 | ||||
| -rw-r--r-- | apps/web/app/api/billing/create-checkout-session/route.ts | 14 | ||||
| -rw-r--r-- | apps/web/app/api/billing/create-portal-session/route.ts | 8 | ||||
| -rw-r--r-- | apps/web/app/api/billing/webhook/route.ts | 8 | ||||
| -rw-r--r-- | apps/web/app/api/export/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/share/[token]/route.ts | 8 | ||||
| -rw-r--r-- | apps/web/app/api/share/route.ts | 8 | ||||
| -rw-r--r-- | apps/web/app/api/v1/entries/[entryIdentifier]/route.ts | 4 | ||||
| -rw-r--r-- | apps/web/app/api/v1/entries/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/v1/feeds/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/v1/folders/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/v1/keys/[keyIdentifier]/route.ts | 4 | ||||
| -rw-r--r-- | apps/web/app/api/v1/keys/route.ts | 14 | ||||
| -rw-r--r-- | apps/web/app/api/v1/profile/route.ts | 2 | ||||
| -rw-r--r-- | apps/web/app/api/webhook-config/route.ts | 16 | ||||
| -rw-r--r-- | apps/web/app/api/webhook-config/test/route.ts | 10 |
17 files changed, 55 insertions, 55 deletions
diff --git a/apps/web/app/api/account/data/route.ts b/apps/web/app/api/account/data/route.ts index dbee725..bec6ab9 100644 --- a/apps/web/app/api/account/data/route.ts +++ b/apps/web/app/api/account/data/route.ts @@ -8,7 +8,7 @@ export async function GET() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const [ diff --git a/apps/web/app/api/account/route.ts b/apps/web/app/api/account/route.ts index 6b1bc2d..35408d7 100644 --- a/apps/web/app/api/account/route.ts +++ b/apps/web/app/api/account/route.ts @@ -9,7 +9,7 @@ export async function DELETE() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const adminClient = createSupabaseAdminClient() @@ -18,7 +18,7 @@ export async function DELETE() { if (error) { return NextResponse.json( - { error: "Failed to delete account" }, + { error: "failed to delete account" }, { status: 500 } ) } diff --git a/apps/web/app/api/billing/create-checkout-session/route.ts b/apps/web/app/api/billing/create-checkout-session/route.ts index cfbb388..d165cbc 100644 --- a/apps/web/app/api/billing/create-checkout-session/route.ts +++ b/apps/web/app/api/billing/create-checkout-session/route.ts @@ -12,12 +12,12 @@ export async function POST(request: Request) { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const rateLimitResult = rateLimit(`checkout:${user.id}`, 10, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const body = await request.json().catch(() => ({})) @@ -38,7 +38,7 @@ export async function POST(request: Request) { if (!stripePriceIdentifier) { return NextResponse.json( - { error: "Invalid plan configuration" }, + { error: "invalid plan configuration" }, { status: 500 } ) } @@ -51,7 +51,7 @@ export async function POST(request: Request) { if (profileError || !profile) { return NextResponse.json( - { error: "Failed to load profile" }, + { error: "failed to load profile" }, { status: 500 } ) } @@ -62,7 +62,7 @@ export async function POST(request: Request) { if (currentRank >= targetRank) { return NextResponse.json( - { error: `Already on ${profile.tier} plan` }, + { error: `already on ${profile.tier} plan` }, { status: 400 } ) } @@ -76,7 +76,7 @@ export async function POST(request: Request) { if (!existingItemIdentifier) { return NextResponse.json( - { error: "Could not find existing subscription item" }, + { error: "could not find existing subscription item" }, { status: 500 } ) } @@ -123,7 +123,7 @@ export async function POST(request: Request) { if (updateError) { console.error("Admin client update error:", updateError) return NextResponse.json( - { error: "Failed to save customer: " + updateError.message }, + { error: "failed to save customer: " + updateError.message }, { status: 500 } ) } diff --git a/apps/web/app/api/billing/create-portal-session/route.ts b/apps/web/app/api/billing/create-portal-session/route.ts index 3832c0d..29698e2 100644 --- a/apps/web/app/api/billing/create-portal-session/route.ts +++ b/apps/web/app/api/billing/create-portal-session/route.ts @@ -11,12 +11,12 @@ export async function POST() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const rateLimitResult = rateLimit(`portal:${user.id}`, 10, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const { data: profile, error: profileError } = await supabaseClient @@ -27,14 +27,14 @@ export async function POST() { if (profileError || !profile) { return NextResponse.json( - { error: "Failed to load profile" }, + { error: "failed to load profile" }, { status: 500 } ) } if (!profile.stripe_customer_identifier) { return NextResponse.json( - { error: "No billing account found" }, + { error: "no billing account found" }, { status: 400 } ) } diff --git a/apps/web/app/api/billing/webhook/route.ts b/apps/web/app/api/billing/webhook/route.ts index 8aed7d0..297ef8e 100644 --- a/apps/web/app/api/billing/webhook/route.ts +++ b/apps/web/app/api/billing/webhook/route.ts @@ -44,7 +44,7 @@ async function updateBillingState( .eq("stripe_customer_identifier", stripeCustomerIdentifier) if (error) { - console.error("Failed to update billing state:", error) + console.error("failed to update billing state:", error) } } @@ -131,14 +131,14 @@ export async function POST(request: Request) { const clientIp = request.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ?? "unknown" const rateLimitResult = rateLimit(`webhook:${clientIp}`, 60, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const body = await request.text() const signature = request.headers.get("stripe-signature") if (!signature) { - return NextResponse.json({ error: "Missing signature" }, { status: 400 }) + return NextResponse.json({ error: "missing signature" }, { status: 400 }) } let event: Stripe.Event @@ -150,7 +150,7 @@ export async function POST(request: Request) { process.env.STRIPE_WEBHOOK_SECRET! ) } catch { - return NextResponse.json({ error: "Invalid signature" }, { status: 400 }) + return NextResponse.json({ error: "invalid signature" }, { status: 400 }) } switch (event.type) { diff --git a/apps/web/app/api/export/route.ts b/apps/web/app/api/export/route.ts index 4842f83..4d15c5a 100644 --- a/apps/web/app/api/export/route.ts +++ b/apps/web/app/api/export/route.ts @@ -8,7 +8,7 @@ export async function GET() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const { data: profile } = await supabaseClient diff --git a/apps/web/app/api/share/[token]/route.ts b/apps/web/app/api/share/[token]/route.ts index 45224aa..d1d57b5 100644 --- a/apps/web/app/api/share/[token]/route.ts +++ b/apps/web/app/api/share/[token]/route.ts @@ -13,7 +13,7 @@ export async function DELETE( } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const { token } = await params @@ -26,7 +26,7 @@ export async function DELETE( if (error) { return NextResponse.json( - { error: "Failed to delete share" }, + { error: "failed to delete share" }, { status: 500 } ) } @@ -44,7 +44,7 @@ export async function PATCH( } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const { token } = await params @@ -76,7 +76,7 @@ export async function PATCH( if (error) { return NextResponse.json( - { error: "Failed to update share" }, + { error: "failed to update share" }, { status: 500 } ) } diff --git a/apps/web/app/api/share/route.ts b/apps/web/app/api/share/route.ts index 2558560..f330bd0 100644 --- a/apps/web/app/api/share/route.ts +++ b/apps/web/app/api/share/route.ts @@ -22,7 +22,7 @@ export async function POST(request: Request) { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const { data: userProfile } = await supabaseClient @@ -73,7 +73,7 @@ export async function POST(request: Request) { if (!entryAccess) { return NextResponse.json( - { error: "Entry not found or not accessible" }, + { error: "entry not found or not accessible" }, { status: 404 } ) } @@ -87,7 +87,7 @@ export async function POST(request: Request) { if (!subscriptionAccess) { return NextResponse.json( - { error: "You do not have access to this entry" }, + { error: "you do not have access to this entry" }, { status: 403 } ) } @@ -121,7 +121,7 @@ export async function POST(request: Request) { if (error) { return NextResponse.json( - { error: "Failed to create share" }, + { error: "failed to create share" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/entries/[entryIdentifier]/route.ts b/apps/web/app/api/v1/entries/[entryIdentifier]/route.ts index 157366b..d420f92 100644 --- a/apps/web/app/api/v1/entries/[entryIdentifier]/route.ts +++ b/apps/web/app/api/v1/entries/[entryIdentifier]/route.ts @@ -28,7 +28,7 @@ export async function GET( .single() if (error || !entry) { - return NextResponse.json({ error: "Entry not found" }, { status: 404 }) + return NextResponse.json({ error: "entry not found" }, { status: 404 }) } const { data: subscription } = await adminClient @@ -39,7 +39,7 @@ export async function GET( .single() if (!subscription) { - return NextResponse.json({ error: "Entry not found" }, { status: 404 }) + return NextResponse.json({ error: "entry not found" }, { status: 404 }) } const { data: stateRow } = await adminClient diff --git a/apps/web/app/api/v1/entries/route.ts b/apps/web/app/api/v1/entries/route.ts index 653c79b..e782e3b 100644 --- a/apps/web/app/api/v1/entries/route.ts +++ b/apps/web/app/api/v1/entries/route.ts @@ -57,7 +57,7 @@ export async function GET(request: Request) { if (error) { return NextResponse.json( - { error: "Failed to load entries" }, + { error: "failed to load entries" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/feeds/route.ts b/apps/web/app/api/v1/feeds/route.ts index adf5422..5b59856 100644 --- a/apps/web/app/api/v1/feeds/route.ts +++ b/apps/web/app/api/v1/feeds/route.ts @@ -22,7 +22,7 @@ export async function GET(request: Request) { if (error) { return NextResponse.json( - { error: "Failed to load feeds" }, + { error: "failed to load feeds" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/folders/route.ts b/apps/web/app/api/v1/folders/route.ts index 5fb006d..3b808a6 100644 --- a/apps/web/app/api/v1/folders/route.ts +++ b/apps/web/app/api/v1/folders/route.ts @@ -21,7 +21,7 @@ export async function GET(request: Request) { if (error) { return NextResponse.json( - { error: "Failed to load folders" }, + { error: "failed to load folders" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/keys/[keyIdentifier]/route.ts b/apps/web/app/api/v1/keys/[keyIdentifier]/route.ts index 8026f27..9835227 100644 --- a/apps/web/app/api/v1/keys/[keyIdentifier]/route.ts +++ b/apps/web/app/api/v1/keys/[keyIdentifier]/route.ts @@ -12,7 +12,7 @@ export async function DELETE( } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const { keyIdentifier } = await params @@ -27,7 +27,7 @@ export async function DELETE( if (error) { return NextResponse.json( - { error: "Failed to revoke API key" }, + { error: "failed to revoke api key" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/keys/route.ts b/apps/web/app/api/v1/keys/route.ts index 7ac7144..1461532 100644 --- a/apps/web/app/api/v1/keys/route.ts +++ b/apps/web/app/api/v1/keys/route.ts @@ -14,7 +14,7 @@ export async function GET() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const adminClient = createSupabaseAdminClient() @@ -26,7 +26,7 @@ export async function GET() { if (error) { return NextResponse.json( - { error: "Failed to load API keys" }, + { error: "failed to load api keys" }, { status: 500 } ) } @@ -50,12 +50,12 @@ export async function POST(request: Request) { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const rateLimitResult = rateLimit(`api-keys:${user.id}`, 10, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const adminClient = createSupabaseAdminClient() @@ -71,7 +71,7 @@ export async function POST(request: Request) { !TIER_LIMITS[userProfile.tier as SubscriptionTier]?.allowsApiAccess ) { return NextResponse.json( - { error: "API access requires the developer plan" }, + { error: "api access requires the developer plan" }, { status: 403 } ) } @@ -84,7 +84,7 @@ export async function POST(request: Request) { if ((activeKeyCount ?? 0) >= MAXIMUM_ACTIVE_KEYS) { return NextResponse.json( - { error: `Maximum of ${MAXIMUM_ACTIVE_KEYS} active keys allowed` }, + { error: `maximum of ${MAXIMUM_ACTIVE_KEYS} active keys allowed` }, { status: 400 } ) } @@ -103,7 +103,7 @@ export async function POST(request: Request) { if (insertError) { return NextResponse.json( - { error: "Failed to create API key" }, + { error: "failed to create api key" }, { status: 500 } ) } diff --git a/apps/web/app/api/v1/profile/route.ts b/apps/web/app/api/v1/profile/route.ts index f7ec308..a7773dd 100644 --- a/apps/web/app/api/v1/profile/route.ts +++ b/apps/web/app/api/v1/profile/route.ts @@ -24,7 +24,7 @@ export async function GET(request: Request) { if (error || !profile) { return NextResponse.json( - { error: "Failed to load profile" }, + { error: "failed to load profile" }, { status: 500 } ) } diff --git a/apps/web/app/api/webhook-config/route.ts b/apps/web/app/api/webhook-config/route.ts index 1ce9a30..049f4f3 100644 --- a/apps/web/app/api/webhook-config/route.ts +++ b/apps/web/app/api/webhook-config/route.ts @@ -11,7 +11,7 @@ export async function GET() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const adminClient = createSupabaseAdminClient() @@ -25,7 +25,7 @@ export async function GET() { if (error || !profile) { return NextResponse.json( - { error: "Failed to load webhook config" }, + { error: "failed to load webhook config" }, { status: 500 } ) } @@ -45,12 +45,12 @@ export async function PUT(request: Request) { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const rateLimitResult = rateLimit(`webhook-config:${user.id}`, 10, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const adminClient = createSupabaseAdminClient() @@ -66,7 +66,7 @@ export async function PUT(request: Request) { !TIER_LIMITS[profile.tier as SubscriptionTier]?.allowsWebhooks ) { return NextResponse.json( - { error: "Webhooks require the developer plan" }, + { error: "webhooks require the developer plan" }, { status: 403 } ) } @@ -79,7 +79,7 @@ export async function PUT(request: Request) { const trimmedUrl = body.webhookUrl.trim() if (trimmedUrl && !trimmedUrl.startsWith("https://")) { return NextResponse.json( - { error: "Webhook URL must use HTTPS" }, + { error: "webhook url must use https" }, { status: 400 } ) } @@ -98,7 +98,7 @@ export async function PUT(request: Request) { } if (Object.keys(updates).length === 0) { - return NextResponse.json({ error: "No updates provided" }, { status: 400 }) + return NextResponse.json({ error: "no updates provided" }, { status: 400 }) } const { error } = await adminClient @@ -108,7 +108,7 @@ export async function PUT(request: Request) { if (error) { return NextResponse.json( - { error: "Failed to update webhook config" }, + { error: "failed to update webhook config" }, { status: 500 } ) } diff --git a/apps/web/app/api/webhook-config/test/route.ts b/apps/web/app/api/webhook-config/test/route.ts index 684ec0c..6171da4 100644 --- a/apps/web/app/api/webhook-config/test/route.ts +++ b/apps/web/app/api/webhook-config/test/route.ts @@ -12,12 +12,12 @@ export async function POST() { } = await supabaseClient.auth.getUser() if (!user) { - return NextResponse.json({ error: "Not authenticated" }, { status: 401 }) + return NextResponse.json({ error: "not authenticated" }, { status: 401 }) } const rateLimitResult = rateLimit(`webhook-test:${user.id}`, 5, 60_000) if (!rateLimitResult.success) { - return NextResponse.json({ error: "Too many requests" }, { status: 429 }) + return NextResponse.json({ error: "too many requests" }, { status: 429 }) } const adminClient = createSupabaseAdminClient() @@ -34,14 +34,14 @@ export async function POST() { !TIER_LIMITS[profile.tier as SubscriptionTier]?.allowsWebhooks ) { return NextResponse.json( - { error: "Webhooks require the developer plan" }, + { error: "webhooks require the developer plan" }, { status: 403 } ) } if (!profile.webhook_url) { return NextResponse.json( - { error: "No webhook URL configured" }, + { error: "no webhook url configured" }, { status: 400 } ) } @@ -53,7 +53,7 @@ export async function POST() { { entryIdentifier: "test-entry-000", feedIdentifier: "test-feed-000", - title: "Test webhook delivery", + title: "test webhook delivery", url: "https://asa.news", author: "asa.news", summary: "This is a test webhook payload to verify your endpoint.", |