From 31cbaa120e11fba3082e437d4ea862a9d349e9b0 Mon Sep 17 00:00:00 2001 From: "nise.moe" Date: Mon, 10 Jun 2024 16:52:33 +0200 Subject: [PATCH] Changed /api to /docs for frontend --- nise-frontend/src/app/api/api.component.css | 4 + nise-frontend/src/app/api/api.component.html | 233 +++++++++++-------- nise-frontend/src/app/app-routing.module.ts | 2 +- 3 files changed, 139 insertions(+), 100 deletions(-) diff --git a/nise-frontend/src/app/api/api.component.css b/nise-frontend/src/app/api/api.component.css index e69de29..6d94c53 100644 --- a/nise-frontend/src/app/api/api.component.css +++ b/nise-frontend/src/app/api/api.component.css @@ -0,0 +1,4 @@ +section { + padding-bottom: 30px; + border-bottom: 2px dotted rgba(224, 224, 224, 0.32); +} diff --git a/nise-frontend/src/app/api/api.component.html b/nise-frontend/src/app/api/api.component.html index 941faa1..7ec006e 100644 --- a/nise-frontend/src/app/api/api.component.html +++ b/nise-frontend/src/app/api/api.component.html @@ -14,114 +14,149 @@
  • The X-NISE-API header with a value of 20240218 in every request. This should prevent random shit from breaking in the future (if you keep passing it)
  • The Accept header with a value of application/json (if you want JSON instead of XML)
  • -

    ## scores search

    -

    score search is based on predicates. a predicate is a list of specifications/conditions to match results. predicates can be combined with operators such as AND and OR

    -

    COMING SOON; the route exists but its cancer for api users to form the requests.

    -

    ## get single score

    -

    if you have a replay_id, you can retrieve all the information 'bout that score.

    - - Example: -
    - - curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439 - +
    +

    ## scores search

    +

    score search is based on predicates. a predicate is a list of specifications/conditions to match results. predicates can be combined with operators such as AND and OR

    +

    COMING SOON; the route exists but its cancer for api users to form the requests.

    +
    -

    ## get single replay (data)

    -

    if you have a replay_id, you can retrieve the data that is used for the replay viewer (replay.nise.moe) -

    it contains the beatmap data, the full replay data, and all calculated judgements (by circleguard)

    - - Example: -
    - - curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439/replay - +
    +

    ## get single score

    +

    if you have a replay_id, you can retrieve all the information 'bout that score.

    + + Example: +
    + + curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439 + +
    -

    ## get single replay (.osr)

    -

    if you have a replay_id, you can retrieve the emulated .osr replay file.

    -

    wtf is an emulated .osr replay file? 🡒 the osu!api does NOT return a "real" replay, so we fill the rest of the details.

    -

    COMING SOON

    +
    +

    ## get single replay (data)

    +

    if you have a replay_id, you can retrieve the data that is used for the replay viewer (replay.nise.moe) +

    it contains the beatmap data, the full replay data, and all calculated judgements (by circleguard)

    + + Example: +
    + + curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/score/3808640439/replay + +
    -

    ## get user details

    -

    if you have an user_id, you can retrieve everything we know 'bout that user. -

    >> user_id is the username. sry.

    - - Example: -
    - - curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"userId": "degenerate"}' https://nise.moe/api/user-details - +
    +

    ## get single replay (.osr)

    +

    if you have a replay_id, you can retrieve the emulated .osr replay file.

    +

    wtf is an emulated .osr replay file? 🡒 the osu!api does NOT return a "real" replay, so we fill the rest of the details.

    +

    COMING SOON

    +
    -

    ## get suspicious scores

    -

    returns a list of suspicious scores (e.g. cvUR <= 25, basically /sus/)

    -

    it is not live, but rather updates every N minutes depending on server load (usually ~10 minutes)

    - - Example: -
    - - curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/suspicious-scores - +
    +

    ## get user details

    +

    if you have an userId, you can retrieve everything we know 'bout that user. +

    >> userId is the username. sry.

    + + Example: +
    + + curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"userId": "degenerate"}' https://nise.moe/api/user-details + +
    -

    ## get stolen replays

    -

    returns a list of all replay pairs with < 10 similarity ratio (basically /nu/)

    -

    it is not live, but rather updates every N minutes depending on server load (usually ~10 minutes)

    - - Example: -
    - - curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/similar-replays - +
    +

    ## request user score update

    +

    if you have an userId, you can queue a request to update all scores for that user.

    +

    >> ! we rate limit this at a single update every 4 hours for each individual user.

    +

    >> this endpoint is AUTHED, you need to send your SESSION cookie for now. ill work on API keys or smth.

    + + Example: +
    + + curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" --cookie "SESSION=xxx" -d '{"userId": 8184689}' https://nise.moe/api/user-queue + +
    -

    ## get banlist

    -

    returns a list of all possibly* banned users
    *(so users for which the osu!web page returned the User not found! ;_; response.)

    -

    >> page size aint configurable, it's 100 atm. maybe a TODO.

    - - Example: -
    - - curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"page": 1}' https://nise.moe/api/banlist - +
    +

    ## get suspicious scores

    +

    returns a list of suspicious scores (e.g. cvUR <= 25, basically /sus/)

    +

    it is not live, but rather updates every N minutes depending on server load (usually ~10 minutes)

    + + Example: +
    + + curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/suspicious-scores + +
    -

    ## analyze replay file (.osr)

    -

    if you have an .osr file, you can analyze it and get results + an always-online static page for it.

    - - - curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -F "replay=@replay1.osr" https://nise.moe/api/analyze - -

    the response will include an id parameter, which identifies the replay you've uploaded.

    -

    that id will be subsequently available at:

    - +
    +

    ## get stolen replays

    +

    returns a list of all replay pairs with < 10 similarity ratio (basically /nu/)

    +

    it is not live, but rather updates every N minutes depending on server load (usually ~10 minutes)

    + + Example: +
    + + curl -H "X-NISE-API: 20240218" -H "Accept: application/json" https://nise.moe/api/similar-replays + +
    -
    +
    +

    ## get banlist

    +

    returns a list of all possibly* banned users
    *(so users for which the osu!web page returned the User not found! ;_; response.)

    +

    >> page size aint configurable, it's 100 atm. maybe a TODO.

    + + Example: +
    + + curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"page": 1}' https://nise.moe/api/banlist + +
    + +
    +

    ## analyze replay file (.osr)

    +

    if you have an .osr file, you can analyze it and get results + an always-online static page for it.

    + + + curl -X POST -H "X-NISE-API: 20240218" -H "Accept: application/json" -F "replay=@replay1.osr" https://nise.moe/api/analyze + +

    the response will include an id parameter, which identifies the replay you've uploaded.

    +

    that id will be subsequently available at:

    + +

    diff --git a/nise-frontend/src/app/app-routing.module.ts b/nise-frontend/src/app/app-routing.module.ts index 02b9684..f2fc2ad 100644 --- a/nise-frontend/src/app/app-routing.module.ts +++ b/nise-frontend/src/app/app-routing.module.ts @@ -30,7 +30,7 @@ const routes: Routes = [ {path: 'banlist', component: BanlistComponent, title: '/ban/'}, {path: 'contribute', component: ContributeComponent, title: '/contribute/ <3'}, - {path: 'api', component: ApiComponent, title: '/api/ explanation'}, + {path: 'docs', component: ApiComponent, title: '/api/ explanation'}, {path: '**', component: HomeComponent, title: '/nise.moe/'}, ];