this repo has no description

clean up routing

authored by nelind and committed by tangled.org 4fbd820c 2dee1445

Changed files
+207 -281
src
+207 -281
src/lib.rs
··· 34 34 use tower_http::services::{ServeDir, ServeFile}; 35 35 36 36 pub fn app(state: AppState) -> Router { 37 - let router = Router::new() 38 - .route("/metrics", get(metrics::metrics_handler)) 39 - .route("/health", get(api::server::health)) 40 - .route("/xrpc/_health", get(api::server::health)) 41 - .route("/robots.txt", get(api::server::robots_txt)) 42 - .route("/logo", get(api::server::get_logo)) 37 + let xrpc_router = Router::new() 38 + .route("/_health", get(api::server::health)) 43 39 .route( 44 - "/xrpc/com.atproto.server.describeServer", 40 + "/com.atproto.server.describeServer", 45 41 get(api::server::describe_server), 46 42 ) 47 43 .route( 48 - "/xrpc/com.atproto.server.createAccount", 44 + "/com.atproto.server.createAccount", 49 45 post(api::identity::create_account), 50 46 ) 51 47 .route( 52 - "/xrpc/com.atproto.server.createSession", 48 + "/com.atproto.server.createSession", 53 49 post(api::server::create_session), 54 50 ) 55 51 .route( 56 - "/xrpc/com.atproto.server.getSession", 52 + "/com.atproto.server.getSession", 57 53 get(api::server::get_session), 58 54 ) 59 - .route( 60 - "/xrpc/_account.listSessions", 61 - get(api::server::list_sessions), 62 - ) 55 + .route("/_account.listSessions", get(api::server::list_sessions)) 56 + .route("/_account.revokeSession", post(api::server::revoke_session)) 63 57 .route( 64 - "/xrpc/_account.revokeSession", 65 - post(api::server::revoke_session), 66 - ) 67 - .route( 68 - "/xrpc/_account.revokeAllSessions", 58 + "/_account.revokeAllSessions", 69 59 post(api::server::revoke_all_sessions), 70 60 ) 71 61 .route( 72 - "/xrpc/com.atproto.server.deleteSession", 62 + "/com.atproto.server.deleteSession", 73 63 post(api::server::delete_session), 74 64 ) 75 65 .route( 76 - "/xrpc/com.atproto.server.refreshSession", 66 + "/com.atproto.server.refreshSession", 77 67 post(api::server::refresh_session), 78 68 ) 79 69 .route( 80 - "/xrpc/com.atproto.server.confirmSignup", 70 + "/com.atproto.server.confirmSignup", 81 71 post(api::server::confirm_signup), 82 72 ) 83 73 .route( 84 - "/xrpc/com.atproto.server.resendVerification", 74 + "/com.atproto.server.resendVerification", 85 75 post(api::server::resend_verification), 86 76 ) 87 77 .route( 88 - "/xrpc/com.atproto.server.getServiceAuth", 78 + "/com.atproto.server.getServiceAuth", 89 79 get(api::server::get_service_auth), 90 80 ) 91 81 .route( 92 - "/xrpc/com.atproto.identity.resolveHandle", 82 + "/com.atproto.identity.resolveHandle", 93 83 get(api::identity::resolve_handle), 94 84 ) 95 85 .route( 96 - "/xrpc/com.atproto.repo.createRecord", 86 + "/com.atproto.repo.createRecord", 97 87 post(api::repo::create_record), 98 88 ) 99 - .route( 100 - "/xrpc/com.atproto.repo.putRecord", 101 - post(api::repo::put_record), 102 - ) 103 - .route( 104 - "/xrpc/com.atproto.repo.getRecord", 105 - get(api::repo::get_record), 106 - ) 89 + .route("/com.atproto.repo.putRecord", post(api::repo::put_record)) 90 + .route("/com.atproto.repo.getRecord", get(api::repo::get_record)) 107 91 .route( 108 - "/xrpc/com.atproto.repo.deleteRecord", 92 + "/com.atproto.repo.deleteRecord", 109 93 post(api::repo::delete_record), 110 94 ) 111 95 .route( 112 - "/xrpc/com.atproto.repo.listRecords", 96 + "/com.atproto.repo.listRecords", 113 97 get(api::repo::list_records), 114 98 ) 115 99 .route( 116 - "/xrpc/com.atproto.repo.describeRepo", 100 + "/com.atproto.repo.describeRepo", 117 101 get(api::repo::describe_repo), 118 102 ) 119 - .route( 120 - "/xrpc/com.atproto.repo.uploadBlob", 121 - post(api::repo::upload_blob), 122 - ) 103 + .route("/com.atproto.repo.uploadBlob", post(api::repo::upload_blob)) 123 104 .route( 124 - "/xrpc/com.atproto.repo.applyWrites", 105 + "/com.atproto.repo.applyWrites", 125 106 post(api::repo::apply_writes), 126 107 ) 127 108 .route( 128 - "/xrpc/com.atproto.sync.getLatestCommit", 109 + "/com.atproto.sync.getLatestCommit", 129 110 get(sync::get_latest_commit), 130 111 ) 131 - .route("/xrpc/com.atproto.sync.listRepos", get(sync::list_repos)) 132 - .route("/xrpc/com.atproto.sync.getBlob", get(sync::get_blob)) 133 - .route("/xrpc/com.atproto.sync.listBlobs", get(sync::list_blobs)) 112 + .route("/com.atproto.sync.listRepos", get(sync::list_repos)) 113 + .route("/com.atproto.sync.getBlob", get(sync::get_blob)) 114 + .route("/com.atproto.sync.listBlobs", get(sync::list_blobs)) 134 115 .route( 135 - "/xrpc/com.atproto.sync.getRepoStatus", 116 + "/com.atproto.sync.getRepoStatus", 136 117 get(sync::get_repo_status), 137 118 ) 138 119 .route( 139 - "/xrpc/com.atproto.server.checkAccountStatus", 120 + "/com.atproto.server.checkAccountStatus", 140 121 get(api::server::check_account_status), 141 122 ) 142 123 .route( 143 - "/xrpc/com.atproto.identity.getRecommendedDidCredentials", 124 + "/com.atproto.identity.getRecommendedDidCredentials", 144 125 get(api::identity::get_recommended_did_credentials), 145 126 ) 146 127 .route( 147 - "/xrpc/com.atproto.repo.listMissingBlobs", 128 + "/com.atproto.repo.listMissingBlobs", 148 129 get(api::repo::list_missing_blobs), 149 130 ) 150 131 .route( 151 - "/xrpc/com.atproto.sync.notifyOfUpdate", 132 + "/com.atproto.sync.notifyOfUpdate", 152 133 post(sync::notify_of_update), 153 134 ) 135 + .route("/com.atproto.sync.requestCrawl", post(sync::request_crawl)) 136 + .route("/com.atproto.sync.getBlocks", get(sync::get_blocks)) 137 + .route("/com.atproto.sync.getRepo", get(sync::get_repo)) 138 + .route("/com.atproto.sync.getRecord", get(sync::get_record)) 154 139 .route( 155 - "/xrpc/com.atproto.sync.requestCrawl", 156 - post(sync::request_crawl), 157 - ) 158 - .route("/xrpc/com.atproto.sync.getBlocks", get(sync::get_blocks)) 159 - .route("/xrpc/com.atproto.sync.getRepo", get(sync::get_repo)) 160 - .route("/xrpc/com.atproto.sync.getRecord", get(sync::get_record)) 161 - .route( 162 - "/xrpc/com.atproto.sync.subscribeRepos", 140 + "/com.atproto.sync.subscribeRepos", 163 141 get(sync::subscribe_repos), 164 142 ) 165 - .route("/xrpc/com.atproto.sync.getHead", get(sync::get_head)) 143 + .route("/com.atproto.sync.getHead", get(sync::get_head)) 144 + .route("/com.atproto.sync.getCheckout", get(sync::get_checkout)) 166 145 .route( 167 - "/xrpc/com.atproto.sync.getCheckout", 168 - get(sync::get_checkout), 169 - ) 170 - .route( 171 - "/xrpc/com.atproto.moderation.createReport", 146 + "/com.atproto.moderation.createReport", 172 147 post(api::moderation::create_report), 173 148 ) 174 149 .route( 175 - "/xrpc/com.atproto.admin.getAccountInfo", 150 + "/com.atproto.admin.getAccountInfo", 176 151 get(api::admin::get_account_info), 177 152 ) 178 153 .route( 179 - "/xrpc/com.atproto.admin.getAccountInfos", 154 + "/com.atproto.admin.getAccountInfos", 180 155 get(api::admin::get_account_infos), 181 156 ) 182 157 .route( 183 - "/xrpc/com.atproto.admin.searchAccounts", 158 + "/com.atproto.admin.searchAccounts", 184 159 get(api::admin::search_accounts), 185 160 ) 186 161 .route( 187 - "/xrpc/com.atproto.server.activateAccount", 162 + "/com.atproto.server.activateAccount", 188 163 post(api::server::activate_account), 189 164 ) 190 165 .route( 191 - "/xrpc/com.atproto.server.deactivateAccount", 166 + "/com.atproto.server.deactivateAccount", 192 167 post(api::server::deactivate_account), 193 168 ) 194 169 .route( 195 - "/xrpc/com.atproto.server.requestAccountDelete", 170 + "/com.atproto.server.requestAccountDelete", 196 171 post(api::server::request_account_delete), 197 172 ) 198 173 .route( 199 - "/xrpc/com.atproto.server.deleteAccount", 174 + "/com.atproto.server.deleteAccount", 200 175 post(api::server::delete_account), 201 176 ) 202 177 .route( 203 - "/xrpc/com.atproto.server.requestPasswordReset", 178 + "/com.atproto.server.requestPasswordReset", 204 179 post(api::server::request_password_reset), 205 180 ) 206 181 .route( 207 - "/xrpc/com.atproto.server.resetPassword", 182 + "/com.atproto.server.resetPassword", 208 183 post(api::server::reset_password), 209 184 ) 210 185 .route( 211 - "/xrpc/_account.changePassword", 186 + "/_account.changePassword", 212 187 post(api::server::change_password), 213 188 ) 214 189 .route( 215 - "/xrpc/_account.removePassword", 190 + "/_account.removePassword", 216 191 post(api::server::remove_password), 217 192 ) 218 193 .route( 219 - "/xrpc/_account.getPasswordStatus", 194 + "/_account.getPasswordStatus", 220 195 get(api::server::get_password_status), 221 196 ) 222 197 .route( 223 - "/xrpc/_account.getReauthStatus", 198 + "/_account.getReauthStatus", 224 199 get(api::server::get_reauth_status), 225 200 ) 226 201 .route( 227 - "/xrpc/_account.reauthPassword", 202 + "/_account.reauthPassword", 228 203 post(api::server::reauth_password), 229 204 ) 230 - .route("/xrpc/_account.reauthTotp", post(api::server::reauth_totp)) 205 + .route("/_account.reauthTotp", post(api::server::reauth_totp)) 231 206 .route( 232 - "/xrpc/_account.reauthPasskeyStart", 207 + "/_account.reauthPasskeyStart", 233 208 post(api::server::reauth_passkey_start), 234 209 ) 235 210 .route( 236 - "/xrpc/_account.reauthPasskeyFinish", 211 + "/_account.reauthPasskeyFinish", 237 212 post(api::server::reauth_passkey_finish), 238 213 ) 239 214 .route( 240 - "/xrpc/_account.getLegacyLoginPreference", 215 + "/_account.getLegacyLoginPreference", 241 216 get(api::server::get_legacy_login_preference), 242 217 ) 243 218 .route( 244 - "/xrpc/_account.updateLegacyLoginPreference", 219 + "/_account.updateLegacyLoginPreference", 245 220 post(api::server::update_legacy_login_preference), 246 221 ) 222 + .route("/_account.updateLocale", post(api::server::update_locale)) 247 223 .route( 248 - "/xrpc/_account.updateLocale", 249 - post(api::server::update_locale), 250 - ) 251 - .route( 252 - "/xrpc/_account.listTrustedDevices", 224 + "/_account.listTrustedDevices", 253 225 get(api::server::list_trusted_devices), 254 226 ) 255 227 .route( 256 - "/xrpc/_account.revokeTrustedDevice", 228 + "/_account.revokeTrustedDevice", 257 229 post(api::server::revoke_trusted_device), 258 230 ) 259 231 .route( 260 - "/xrpc/_account.updateTrustedDevice", 232 + "/_account.updateTrustedDevice", 261 233 post(api::server::update_trusted_device), 262 234 ) 263 235 .route( 264 - "/xrpc/_account.createPasskeyAccount", 236 + "/_account.createPasskeyAccount", 265 237 post(api::server::create_passkey_account), 266 238 ) 267 239 .route( 268 - "/xrpc/_account.startPasskeyRegistrationForSetup", 240 + "/_account.startPasskeyRegistrationForSetup", 269 241 post(api::server::start_passkey_registration_for_setup), 270 242 ) 271 243 .route( 272 - "/xrpc/_account.completePasskeySetup", 244 + "/_account.completePasskeySetup", 273 245 post(api::server::complete_passkey_setup), 274 246 ) 275 247 .route( 276 - "/xrpc/_account.requestPasskeyRecovery", 248 + "/_account.requestPasskeyRecovery", 277 249 post(api::server::request_passkey_recovery), 278 250 ) 279 251 .route( 280 - "/xrpc/_account.recoverPasskeyAccount", 252 + "/_account.recoverPasskeyAccount", 281 253 post(api::server::recover_passkey_account), 282 254 ) 283 255 .route( 284 - "/xrpc/_account.updateDidDocument", 256 + "/_account.updateDidDocument", 285 257 post(api::server::update_did_document), 286 258 ) 287 259 .route( 288 - "/xrpc/_account.getDidDocument", 260 + "/_account.getDidDocument", 289 261 get(api::server::get_did_document), 290 262 ) 291 263 .route( 292 - "/xrpc/com.atproto.server.requestEmailUpdate", 264 + "/com.atproto.server.requestEmailUpdate", 293 265 post(api::server::request_email_update), 294 266 ) 295 267 .route( 296 - "/xrpc/_checkEmailVerified", 268 + "/_checkEmailVerified", 297 269 post(api::server::check_email_verified), 298 270 ) 299 271 .route( 300 - "/xrpc/com.atproto.server.confirmEmail", 272 + "/com.atproto.server.confirmEmail", 301 273 post(api::server::confirm_email), 302 274 ) 303 275 .route( 304 - "/xrpc/com.atproto.server.updateEmail", 276 + "/com.atproto.server.updateEmail", 305 277 post(api::server::update_email), 306 278 ) 307 279 .route( 308 - "/xrpc/com.atproto.server.reserveSigningKey", 280 + "/com.atproto.server.reserveSigningKey", 309 281 post(api::server::reserve_signing_key), 310 282 ) 311 283 .route( 312 - "/xrpc/com.atproto.server.verifyMigrationEmail", 284 + "/com.atproto.server.verifyMigrationEmail", 313 285 post(api::server::verify_migration_email), 314 286 ) 315 287 .route( 316 - "/xrpc/com.atproto.server.resendMigrationVerification", 288 + "/com.atproto.server.resendMigrationVerification", 317 289 post(api::server::resend_migration_verification), 318 290 ) 319 291 .route( 320 - "/xrpc/com.atproto.identity.updateHandle", 292 + "/com.atproto.identity.updateHandle", 321 293 post(api::identity::update_handle), 322 294 ) 323 295 .route( 324 - "/xrpc/com.atproto.identity.requestPlcOperationSignature", 296 + "/com.atproto.identity.requestPlcOperationSignature", 325 297 post(api::identity::request_plc_operation_signature), 326 298 ) 327 299 .route( 328 - "/xrpc/com.atproto.identity.signPlcOperation", 300 + "/com.atproto.identity.signPlcOperation", 329 301 post(api::identity::sign_plc_operation), 330 302 ) 331 303 .route( 332 - "/xrpc/com.atproto.identity.submitPlcOperation", 304 + "/com.atproto.identity.submitPlcOperation", 333 305 post(api::identity::submit_plc_operation), 334 306 ) 335 - .route( 336 - "/xrpc/com.atproto.repo.importRepo", 337 - post(api::repo::import_repo), 338 - ) 307 + .route("/com.atproto.repo.importRepo", post(api::repo::import_repo)) 339 308 .route( 340 - "/xrpc/com.atproto.admin.deleteAccount", 309 + "/com.atproto.admin.deleteAccount", 341 310 post(api::admin::delete_account), 342 311 ) 343 312 .route( 344 - "/xrpc/com.atproto.admin.updateAccountEmail", 313 + "/com.atproto.admin.updateAccountEmail", 345 314 post(api::admin::update_account_email), 346 315 ) 347 316 .route( 348 - "/xrpc/com.atproto.admin.updateAccountHandle", 317 + "/com.atproto.admin.updateAccountHandle", 349 318 post(api::admin::update_account_handle), 350 319 ) 351 320 .route( 352 - "/xrpc/com.atproto.admin.updateAccountPassword", 321 + "/com.atproto.admin.updateAccountPassword", 353 322 post(api::admin::update_account_password), 354 323 ) 355 324 .route( 356 - "/xrpc/com.atproto.server.listAppPasswords", 325 + "/com.atproto.server.listAppPasswords", 357 326 get(api::server::list_app_passwords), 358 327 ) 359 328 .route( 360 - "/xrpc/com.atproto.server.createAppPassword", 329 + "/com.atproto.server.createAppPassword", 361 330 post(api::server::create_app_password), 362 331 ) 363 332 .route( 364 - "/xrpc/com.atproto.server.revokeAppPassword", 333 + "/com.atproto.server.revokeAppPassword", 365 334 post(api::server::revoke_app_password), 366 335 ) 367 336 .route( 368 - "/xrpc/com.atproto.server.createInviteCode", 337 + "/com.atproto.server.createInviteCode", 369 338 post(api::server::create_invite_code), 370 339 ) 371 340 .route( 372 - "/xrpc/com.atproto.server.createInviteCodes", 341 + "/com.atproto.server.createInviteCodes", 373 342 post(api::server::create_invite_codes), 374 343 ) 375 344 .route( 376 - "/xrpc/com.atproto.server.getAccountInviteCodes", 345 + "/com.atproto.server.getAccountInviteCodes", 377 346 get(api::server::get_account_invite_codes), 378 347 ) 379 348 .route( 380 - "/xrpc/com.atproto.server.createTotpSecret", 349 + "/com.atproto.server.createTotpSecret", 381 350 post(api::server::create_totp_secret), 382 351 ) 383 352 .route( 384 - "/xrpc/com.atproto.server.enableTotp", 353 + "/com.atproto.server.enableTotp", 385 354 post(api::server::enable_totp), 386 355 ) 387 356 .route( 388 - "/xrpc/com.atproto.server.disableTotp", 357 + "/com.atproto.server.disableTotp", 389 358 post(api::server::disable_totp), 390 359 ) 391 360 .route( 392 - "/xrpc/com.atproto.server.getTotpStatus", 361 + "/com.atproto.server.getTotpStatus", 393 362 get(api::server::get_totp_status), 394 363 ) 395 364 .route( 396 - "/xrpc/com.atproto.server.regenerateBackupCodes", 365 + "/com.atproto.server.regenerateBackupCodes", 397 366 post(api::server::regenerate_backup_codes), 398 367 ) 399 368 .route( 400 - "/xrpc/com.atproto.server.startPasskeyRegistration", 369 + "/com.atproto.server.startPasskeyRegistration", 401 370 post(api::server::start_passkey_registration), 402 371 ) 403 372 .route( 404 - "/xrpc/com.atproto.server.finishPasskeyRegistration", 373 + "/com.atproto.server.finishPasskeyRegistration", 405 374 post(api::server::finish_passkey_registration), 406 375 ) 407 376 .route( 408 - "/xrpc/com.atproto.server.listPasskeys", 377 + "/com.atproto.server.listPasskeys", 409 378 get(api::server::list_passkeys), 410 379 ) 411 380 .route( 412 - "/xrpc/com.atproto.server.deletePasskey", 381 + "/com.atproto.server.deletePasskey", 413 382 post(api::server::delete_passkey), 414 383 ) 415 384 .route( 416 - "/xrpc/com.atproto.server.updatePasskey", 385 + "/com.atproto.server.updatePasskey", 417 386 post(api::server::update_passkey), 418 387 ) 419 388 .route( 420 - "/xrpc/com.atproto.admin.getInviteCodes", 389 + "/com.atproto.admin.getInviteCodes", 421 390 get(api::admin::get_invite_codes), 422 391 ) 423 - .route( 424 - "/xrpc/_admin.getServerStats", 425 - get(api::admin::get_server_stats), 426 - ) 427 - .route( 428 - "/xrpc/_server.getConfig", 429 - get(api::admin::get_server_config), 430 - ) 392 + .route("/_admin.getServerStats", get(api::admin::get_server_stats)) 393 + .route("/_server.getConfig", get(api::admin::get_server_config)) 431 394 .route( 432 - "/xrpc/_admin.updateServerConfig", 395 + "/_admin.updateServerConfig", 433 396 post(api::admin::update_server_config), 434 397 ) 435 398 .route( 436 - "/xrpc/com.atproto.admin.disableAccountInvites", 399 + "/com.atproto.admin.disableAccountInvites", 437 400 post(api::admin::disable_account_invites), 438 401 ) 439 402 .route( 440 - "/xrpc/com.atproto.admin.enableAccountInvites", 403 + "/com.atproto.admin.enableAccountInvites", 441 404 post(api::admin::enable_account_invites), 442 405 ) 443 406 .route( 444 - "/xrpc/com.atproto.admin.disableInviteCodes", 407 + "/com.atproto.admin.disableInviteCodes", 445 408 post(api::admin::disable_invite_codes), 446 409 ) 447 410 .route( 448 - "/xrpc/com.atproto.admin.getSubjectStatus", 411 + "/com.atproto.admin.getSubjectStatus", 449 412 get(api::admin::get_subject_status), 450 413 ) 451 414 .route( 452 - "/xrpc/com.atproto.admin.updateSubjectStatus", 415 + "/com.atproto.admin.updateSubjectStatus", 453 416 post(api::admin::update_subject_status), 454 417 ) 418 + .route("/com.atproto.admin.sendEmail", post(api::admin::send_email)) 455 419 .route( 456 - "/xrpc/com.atproto.admin.sendEmail", 457 - post(api::admin::send_email), 458 - ) 459 - .route( 460 - "/xrpc/app.bsky.actor.getPreferences", 420 + "/app.bsky.actor.getPreferences", 461 421 get(api::actor::get_preferences), 462 422 ) 463 423 .route( 464 - "/xrpc/app.bsky.actor.putPreferences", 424 + "/app.bsky.actor.putPreferences", 465 425 post(api::actor::put_preferences), 466 - ) 467 - .route("/.well-known/did.json", get(api::identity::well_known_did)) 468 - .route( 469 - "/.well-known/atproto-did", 470 - get(api::identity::well_known_atproto_did), 471 - ) 472 - .route("/u/{handle}/did.json", get(api::identity::user_did_doc)) 473 - .route( 474 - "/.well-known/oauth-protected-resource", 475 - get(oauth::endpoints::oauth_protected_resource), 476 - ) 477 - .route( 478 - "/.well-known/oauth-authorization-server", 479 - get(oauth::endpoints::oauth_authorization_server), 480 - ) 481 - .route("/oauth/jwks", get(oauth::endpoints::oauth_jwks)) 482 - .route( 483 - "/oauth/client-metadata.json", 484 - get(oauth::endpoints::frontend_client_metadata), 485 - ) 486 - .route( 487 - "/oauth/par", 488 - post(oauth::endpoints::pushed_authorization_request), 489 - ) 490 - .route("/oauth/authorize", get(oauth::endpoints::authorize_get)) 491 - .route("/oauth/authorize", post(oauth::endpoints::authorize_post)) 492 - .route( 493 - "/oauth/authorize/accounts", 494 - get(oauth::endpoints::authorize_accounts), 495 - ) 496 - .route( 497 - "/oauth/authorize/select", 498 - post(oauth::endpoints::authorize_select), 499 - ) 500 - .route( 501 - "/oauth/authorize/2fa", 502 - get(oauth::endpoints::authorize_2fa_get), 503 426 ) 504 427 .route( 505 - "/oauth/authorize/2fa", 506 - post(oauth::endpoints::authorize_2fa_post), 507 - ) 508 - .route( 509 - "/oauth/authorize/passkey", 510 - get(oauth::endpoints::authorize_passkey_start), 511 - ) 512 - .route( 513 - "/oauth/authorize/passkey", 514 - post(oauth::endpoints::authorize_passkey_finish), 515 - ) 516 - .route( 517 - "/oauth/passkey/check", 518 - get(oauth::endpoints::check_user_has_passkeys), 519 - ) 520 - .route( 521 - "/oauth/security-status", 522 - get(oauth::endpoints::check_user_security_status), 523 - ) 524 - .route( 525 - "/oauth/passkey/start", 526 - post(oauth::endpoints::passkey_start), 527 - ) 528 - .route( 529 - "/oauth/passkey/finish", 530 - post(oauth::endpoints::passkey_finish), 531 - ) 532 - .route( 533 - "/oauth/authorize/deny", 534 - post(oauth::endpoints::authorize_deny), 535 - ) 536 - .route( 537 - "/oauth/authorize/consent", 538 - get(oauth::endpoints::consent_get), 539 - ) 540 - .route( 541 - "/oauth/authorize/consent", 542 - post(oauth::endpoints::consent_post), 543 - ) 544 - .route( 545 - "/oauth/delegation/auth", 546 - post(oauth::endpoints::delegation_auth), 547 - ) 548 - .route( 549 - "/oauth/delegation/totp", 550 - post(oauth::endpoints::delegation_totp_verify), 551 - ) 552 - .route("/oauth/token", post(oauth::endpoints::token_endpoint)) 553 - .route("/oauth/revoke", post(oauth::endpoints::revoke_token)) 554 - .route( 555 - "/oauth/introspect", 556 - post(oauth::endpoints::introspect_token), 557 - ) 558 - .route( 559 - "/xrpc/com.atproto.temp.checkSignupQueue", 428 + "/com.atproto.temp.checkSignupQueue", 560 429 get(api::temp::check_signup_queue), 561 430 ) 562 431 .route( 563 - "/xrpc/com.atproto.temp.dereferenceScope", 432 + "/com.atproto.temp.dereferenceScope", 564 433 post(api::temp::dereference_scope), 565 434 ) 566 435 .route( 567 - "/xrpc/_account.getNotificationPrefs", 436 + "/_account.getNotificationPrefs", 568 437 get(api::notification_prefs::get_notification_prefs), 569 438 ) 570 439 .route( 571 - "/xrpc/_account.updateNotificationPrefs", 440 + "/_account.updateNotificationPrefs", 572 441 post(api::notification_prefs::update_notification_prefs), 573 442 ) 574 443 .route( 575 - "/xrpc/_account.getNotificationHistory", 444 + "/_account.getNotificationHistory", 576 445 get(api::notification_prefs::get_notification_history), 577 446 ) 578 447 .route( 579 - "/xrpc/_account.confirmChannelVerification", 448 + "/_account.confirmChannelVerification", 580 449 post(api::verification::confirm_channel_verification), 581 450 ) 582 - .route( 583 - "/xrpc/_account.verifyToken", 584 - post(api::server::verify_token), 585 - ) 451 + .route("/_account.verifyToken", post(api::server::verify_token)) 586 452 .route( 587 - "/xrpc/_delegation.listControllers", 453 + "/_delegation.listControllers", 588 454 get(api::delegation::list_controllers), 589 455 ) 590 456 .route( 591 - "/xrpc/_delegation.addController", 457 + "/_delegation.addController", 592 458 post(api::delegation::add_controller), 593 459 ) 594 460 .route( 595 - "/xrpc/_delegation.removeController", 461 + "/_delegation.removeController", 596 462 post(api::delegation::remove_controller), 597 463 ) 598 464 .route( 599 - "/xrpc/_delegation.updateControllerScopes", 465 + "/_delegation.updateControllerScopes", 600 466 post(api::delegation::update_controller_scopes), 601 467 ) 602 468 .route( 603 - "/xrpc/_delegation.listControlledAccounts", 469 + "/_delegation.listControlledAccounts", 604 470 get(api::delegation::list_controlled_accounts), 605 471 ) 606 472 .route( 607 - "/xrpc/_delegation.getAuditLog", 473 + "/_delegation.getAuditLog", 608 474 get(api::delegation::get_audit_log), 609 475 ) 610 476 .route( 611 - "/xrpc/_delegation.getScopePresets", 477 + "/_delegation.getScopePresets", 612 478 get(api::delegation::get_scope_presets), 613 479 ) 614 480 .route( 615 - "/xrpc/_delegation.createDelegatedAccount", 481 + "/_delegation.createDelegatedAccount", 616 482 post(api::delegation::create_delegated_account), 617 483 ) 618 - .route("/xrpc/_backup.listBackups", get(api::backup::list_backups)) 619 - .route("/xrpc/_backup.getBackup", get(api::backup::get_backup)) 484 + .route("/_backup.listBackups", get(api::backup::list_backups)) 485 + .route("/_backup.getBackup", get(api::backup::get_backup)) 486 + .route("/_backup.createBackup", post(api::backup::create_backup)) 487 + .route("/_backup.deleteBackup", post(api::backup::delete_backup)) 488 + .route("/_backup.setEnabled", post(api::backup::set_backup_enabled)) 489 + .route("/_backup.exportBlobs", get(api::backup::export_blobs)) 620 490 .route( 621 - "/xrpc/_backup.createBackup", 622 - post(api::backup::create_backup), 491 + "/app.bsky.ageassurance.getState", 492 + get(api::age_assurance::get_state), 623 493 ) 624 494 .route( 625 - "/xrpc/_backup.deleteBackup", 626 - post(api::backup::delete_backup), 495 + "/app.bsky.unspecced.getAgeAssuranceState", 496 + get(api::age_assurance::get_age_assurance_state), 627 497 ) 498 + .route("/{*method}", any(api::proxy::proxy_handler)); 499 + 500 + let oauth_router = Router::new() 501 + .route("/jwks", get(oauth::endpoints::oauth_jwks)) 628 502 .route( 629 - "/xrpc/_backup.setEnabled", 630 - post(api::backup::set_backup_enabled), 503 + "/client-metadata.json", 504 + get(oauth::endpoints::frontend_client_metadata), 631 505 ) 632 - .route("/xrpc/_backup.exportBlobs", get(api::backup::export_blobs)) 506 + .route("/par", post(oauth::endpoints::pushed_authorization_request)) 507 + .route("/authorize", get(oauth::endpoints::authorize_get)) 508 + .route("/authorize", post(oauth::endpoints::authorize_post)) 633 509 .route( 634 - "/xrpc/app.bsky.ageassurance.getState", 635 - get(api::age_assurance::get_state), 510 + "/authorize/accounts", 511 + get(oauth::endpoints::authorize_accounts), 636 512 ) 637 513 .route( 638 - "/xrpc/app.bsky.unspecced.getAgeAssuranceState", 639 - get(api::age_assurance::get_age_assurance_state), 514 + "/authorize/select", 515 + post(oauth::endpoints::authorize_select), 640 516 ) 641 - .route("/xrpc/{*method}", any(api::proxy::proxy_handler)) 517 + .route("/authorize/2fa", get(oauth::endpoints::authorize_2fa_get)) 518 + .route("/authorize/2fa", post(oauth::endpoints::authorize_2fa_post)) 519 + .route( 520 + "/authorize/passkey", 521 + get(oauth::endpoints::authorize_passkey_start), 522 + ) 523 + .route( 524 + "/authorize/passkey", 525 + post(oauth::endpoints::authorize_passkey_finish), 526 + ) 527 + .route( 528 + "/passkey/check", 529 + get(oauth::endpoints::check_user_has_passkeys), 530 + ) 531 + .route( 532 + "/security-status", 533 + get(oauth::endpoints::check_user_security_status), 534 + ) 535 + .route("/passkey/start", post(oauth::endpoints::passkey_start)) 536 + .route("/passkey/finish", post(oauth::endpoints::passkey_finish)) 537 + .route("/authorize/deny", post(oauth::endpoints::authorize_deny)) 538 + .route("/authorize/consent", get(oauth::endpoints::consent_get)) 539 + .route("/authorize/consent", post(oauth::endpoints::consent_post)) 540 + .route("/delegation/auth", post(oauth::endpoints::delegation_auth)) 541 + .route( 542 + "/delegation/totp", 543 + post(oauth::endpoints::delegation_totp_verify), 544 + ) 545 + .route("/token", post(oauth::endpoints::token_endpoint)) 546 + .route("/revoke", post(oauth::endpoints::revoke_token)) 547 + .route("/introspect", post(oauth::endpoints::introspect_token)); 548 + 549 + let well_known_router = Router::new() 550 + .route("/did.json", get(api::identity::well_known_did)) 551 + .route("/atproto-did", get(api::identity::well_known_atproto_did)) 552 + .route( 553 + "/oauth-protected-resource", 554 + get(oauth::endpoints::oauth_protected_resource), 555 + ) 556 + .route( 557 + "/oauth-authorization-server", 558 + get(oauth::endpoints::oauth_authorization_server), 559 + ); 560 + 561 + let router = Router::new() 562 + .nest("/xrpc", xrpc_router) 563 + .nest("/oauth", oauth_router) 564 + .route("/metrics", get(metrics::metrics_handler)) 565 + .route("/health", get(api::server::health)) 566 + .route("/robots.txt", get(api::server::robots_txt)) 567 + .route("/logo", get(api::server::get_logo)) 568 + .route("/u/{handle}/did.json", get(api::identity::user_did_doc)) 642 569 .layer(DefaultBodyLimit::max(util::get_max_blob_size())) 643 570 .layer(middleware::from_fn(metrics::metrics_middleware)) 644 571 .layer( ··· 651 578 652 579 let frontend_dir = 653 580 std::env::var("FRONTEND_DIR").unwrap_or_else(|_| "./frontend/dist".to_string()); 654 - 655 581 if std::path::Path::new(&frontend_dir) 656 582 .join("index.html") 657 583 .exists() ··· 673 599 router 674 600 .route_service("/", ServeFile::new(&homepage_file)) 675 601 .nest("/app", spa_router) 676 - .fallback_service(serve_dir) 677 - } else { 678 - router 602 + .fallback_service(serve_dir); 679 603 } 604 + 605 + router 680 606 }