docs: update readme

This commit is contained in:
dusk 2023-05-09 08:46:28 +03:00
parent a1c09cd404
commit cd94bb08dc
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,19 @@
# musikquadrupled # musikquadrupled
A proxy server for musikcubed that implements TLS, alternative authentication solution and CORS for proper Web support. Compatible with musikcube. A proxy server for musikcubed that implements TLS, alternative authentication solution and CORS for proper Web support. Compatible with musikcube.
# API (public)
All of the `musikcubed` APIs are implemented. On top of those:
- `share/generate/:external_id`: Returns a "scoped token" for the specified ID of a music. This allows one to access `share/*` APIs. The `token` query parameter must be present and must have a valid token, if not `401 Unauthorized` will be returned.
- `share/audio/:scoped_token`: Returns the music (or a range of it if `RANGE` header is present) corresponding to the specified `scoped_token`. Returns `404 Not Found` if the requested music isn't available.
- `share/info/:scoped_token`: Returns information (title, album, artist etc.) of the music corresponding to the specified `scoped_token` in JSON. Returns `404 Not Found` if the requested music isn't available.
- `share/thumbnail/:scoped_token`: Returns the thumbnail for the music corresponding to the specified `scoped_token`. Returns `404 Not Found` if the requested thumbnail isn't available.
# API (internal)
These are only exposed to `localhost` clients.
- `token/generate`: Generates a new token for use with the `token` query paramater in the public APIs.
- `token/revoke_all`: Revokes all tokens.

View File

@ -73,12 +73,9 @@ pub(super) async fn handler(state: AppState) -> Result<(Router, Router), AppErro
let request_id_layer = SetRequestIdLayer::new(REQUEST_ID.clone(), MakeRequestUuid); let request_id_layer = SetRequestIdLayer::new(REQUEST_ID.clone(), MakeRequestUuid);
let router = Router::new() let router = Router::new()
.route(
"/token/generate_for_music/:id",
get(handlers::generate_scoped_token),
)
.route("/thumbnail/:id", get(handlers::http)) .route("/thumbnail/:id", get(handlers::http))
.route("/audio/external_id/:id", get(handlers::get_music)) .route("/audio/external_id/:id", get(handlers::get_music))
.route("/share/generate/:id", get(handlers::generate_scoped_token))
.route("/share/audio/:token", get(handlers::get_scoped_music_file)) .route("/share/audio/:token", get(handlers::get_scoped_music_file))
.route( .route(
"/share/thumbnail/:token", "/share/thumbnail/:token",