Auto-indexing service and GraphQL API for AT Protocol Records
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: remove unused upload handler

The /upload endpoint was a stub placeholder that was never implemented.

-65
-62
server/src/handlers/upload.gleam
··· 1 - /// Upload interface handler 2 - /// 3 - /// Serves a simple form to upload blobs and test the uploadBlob mutation 4 - import admin_session as session 5 - import gleam/erlang/process.{type Subject} 6 - import gleam/http 7 - import lib/oauth/did_cache 8 - import sqlight 9 - import wisp 10 - 11 - pub fn handle_upload_request( 12 - req: wisp.Request, 13 - db: sqlight.Connection, 14 - did_cache: Subject(did_cache.Message), 15 - ) -> wisp.Response { 16 - case req.method { 17 - http.Get -> handle_upload_form(req, db, did_cache) 18 - http.Post -> handle_upload_submit(req) 19 - _ -> method_not_allowed_response() 20 - } 21 - } 22 - 23 - fn handle_upload_form( 24 - req: wisp.Request, 25 - db: sqlight.Connection, 26 - did_cache: Subject(did_cache.Message), 27 - ) -> wisp.Response { 28 - // Require authentication - get token from session 29 - case session.get_current_user(req, db, did_cache) { 30 - Error(_) -> { 31 - // User is not logged in - redirect to home with error 32 - wisp.redirect("/?error=Please+log+in+to+upload+blobs") 33 - } 34 - Ok(#(_did, handle, _access_token)) -> { 35 - // TODO: Migrate upload page to client SPA 36 - wisp.html_response( 37 - "<h1>Upload</h1><p>Upload page will be migrated to the client SPA. Logged in as @" 38 - <> handle 39 - <> "</p>", 40 - 200, 41 - ) 42 - } 43 - } 44 - } 45 - 46 - fn handle_upload_submit(_req: wisp.Request) -> wisp.Response { 47 - // For now, we'll handle uploads via JavaScript on the client side 48 - // If we need server-side processing, we can implement it here 49 - wisp.response(405) 50 - |> wisp.set_header("content-type", "application/json") 51 - |> wisp.set_body(wisp.Text( 52 - "{\"error\": \"Not implemented\", \"message\": \"Use client-side upload\"}", 53 - )) 54 - } 55 - 56 - fn method_not_allowed_response() -> wisp.Response { 57 - wisp.response(405) 58 - |> wisp.set_header("content-type", "application/json") 59 - |> wisp.set_body(wisp.Text( 60 - "{\"error\": \"MethodNotAllowed\", \"message\": \"Only GET is allowed\"}", 61 - )) 62 - }
-3
server/src/server.gleam
··· 35 35 import handlers/oauth/par as oauth_par_handler 36 36 import handlers/oauth/register as oauth_register_handler 37 37 import handlers/oauth/token as oauth_token_handler 38 - import handlers/upload as upload_handler 39 38 import jetstream_consumer 40 39 import lib/oauth/did_cache 41 40 import logging ··· 500 499 ) 501 500 ["graphiql"] -> 502 501 graphiql_handler.handle_graphiql_request(req, ctx.db, ctx.did_cache) 503 - ["upload"] -> 504 - upload_handler.handle_upload_request(req, ctx.db, ctx.did_cache) 505 502 // MCP endpoint for AI assistant introspection 506 503 ["mcp"] -> { 507 504 let mcp_ctx =