mirror of
https://tangled.org/tranquil.farm/tranquil-pds
synced 2026-02-09 05:40:09 +00:00
195 lines
5.8 KiB
Rust
195 lines
5.8 KiB
Rust
pub mod api;
|
|
pub mod auth;
|
|
pub mod repo;
|
|
pub mod state;
|
|
pub mod storage;
|
|
pub mod sync;
|
|
|
|
use axum::{
|
|
Router,
|
|
routing::{any, get, post},
|
|
};
|
|
use state::AppState;
|
|
|
|
pub fn app(state: AppState) -> Router {
|
|
Router::new()
|
|
.route("/health", get(api::server::health))
|
|
.route(
|
|
"/xrpc/com.atproto.server.describeServer",
|
|
get(api::server::describe_server),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.createAccount",
|
|
post(api::identity::create_account),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.createSession",
|
|
post(api::server::create_session),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.getSession",
|
|
get(api::server::get_session),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.deleteSession",
|
|
post(api::server::delete_session),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.refreshSession",
|
|
post(api::server::refresh_session),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.getServiceAuth",
|
|
get(api::server::get_service_auth),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.identity.resolveHandle",
|
|
get(api::identity::resolve_handle),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.createRecord",
|
|
post(api::repo::create_record),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.putRecord",
|
|
post(api::repo::put_record),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.getRecord",
|
|
get(api::repo::get_record),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.deleteRecord",
|
|
post(api::repo::delete_record),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.listRecords",
|
|
get(api::repo::list_records),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.describeRepo",
|
|
get(api::repo::describe_repo),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.uploadBlob",
|
|
post(api::repo::upload_blob),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.applyWrites",
|
|
post(api::repo::apply_writes),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getLatestCommit",
|
|
get(sync::get_latest_commit),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.listRepos",
|
|
get(sync::list_repos),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getBlob",
|
|
get(sync::get_blob),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.listBlobs",
|
|
get(sync::list_blobs),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getRepoStatus",
|
|
get(sync::get_repo_status),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.checkAccountStatus",
|
|
get(api::server::check_account_status),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.identity.getRecommendedDidCredentials",
|
|
get(api::identity::get_recommended_did_credentials),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.repo.listMissingBlobs",
|
|
get(api::repo::list_missing_blobs),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.notifyOfUpdate",
|
|
post(sync::notify_of_update),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.requestCrawl",
|
|
post(sync::request_crawl),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getBlocks",
|
|
get(sync::get_blocks),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getRepo",
|
|
get(sync::get_repo),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.sync.getRecord",
|
|
get(sync::get_record),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.moderation.createReport",
|
|
post(api::moderation::create_report),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.getAccountInfo",
|
|
get(api::admin::get_account_info),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.getAccountInfos",
|
|
get(api::admin::get_account_infos),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.activateAccount",
|
|
post(api::server::activate_account),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.deactivateAccount",
|
|
post(api::server::deactivate_account),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.identity.updateHandle",
|
|
post(api::identity::update_handle),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.deleteAccount",
|
|
post(api::admin::delete_account),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.updateAccountEmail",
|
|
post(api::admin::update_account_email),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.updateAccountHandle",
|
|
post(api::admin::update_account_handle),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.admin.updateAccountPassword",
|
|
post(api::admin::update_account_password),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.listAppPasswords",
|
|
get(api::server::list_app_passwords),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.createAppPassword",
|
|
post(api::server::create_app_password),
|
|
)
|
|
.route(
|
|
"/xrpc/com.atproto.server.revokeAppPassword",
|
|
post(api::server::revoke_app_password),
|
|
)
|
|
// I know I know, I'm not supposed to implement appview endpoints. Leave me be
|
|
.route(
|
|
"/xrpc/app.bsky.feed.getTimeline",
|
|
get(api::feed::get_timeline),
|
|
)
|
|
.route("/.well-known/did.json", get(api::identity::well_known_did))
|
|
.route("/u/{handle}/did.json", get(api::identity::user_did_doc))
|
|
.route("/xrpc/{*method}", any(api::proxy::proxy_handler))
|
|
.with_state(state)
|
|
}
|