Skip to content

2.1

Compare
Choose a tag to compare
@MiraiSubject MiraiSubject released this 01 Apr 23:16
· 17 commits to master since this release
fc7704f

What's Changed

  • Simplify CALLBACK_URLs to one single BASE_URL by @MiraiSubject in #4
  • Move eligibility check into the configuration module by @MiraiSubject in #5
  • Write documentation for eligibility check.

Breaking Changes

PUBLIC_DISCORD_CALLBACK_URL & PUBLIC_OSU2_CALLBACK_URL have been replaced with one singular BASE_URL environment variable. When upgrading to this version make sure to just specify your desired domain name.

If you had

PUBLIC_DISCORD_CALLBACK_URL=https://example.com/auth/discord/callback
PUBLIC_OSU2_CALLBACK_URL=https://example.com/auth/osu/callback

then you can replace those with:

BASE_URL=https://example.com

New Features

You can now also modify the newly created isUserEligible function to customise it according to your needs. The function just has to return a boolean for the condition where a user is eligible.

The default implementation that we use for verification on the osu! Tournament Hub:
https://github.com/MiraiSubject/cosette-lite/blob/9ee4cb86f20debf4e2e7f86e9d52f5610408fe5e/packages/config/config.ts#L21-L34

Note: By default the OsuUser in the parameter uses their favourite game mode.

To modify it to use your desired game mode ./apps/webstack/src/routes/auth/osu/callback/+server.ts this file to match the game mode.

Currently the valid modes according to the current osu! API documentation are:

  • fruits for osu!catch
  • mania for osu!mania
  • osu for osu!standard
  • taiko for osu!taiko

Here is how you would modify the function to get the user's data for the appropriate game mode:

async function getUserData(tokens: {
    access_token: string;
    token_type: string;
}) {
-   const url = 'https://osu.ppy.sh/api/v2/me';
+   const url = 'https://osu.ppy.sh/api/v2/me/osu';
// ...
}

Full Changelog: https://github.com/MiraiSubject/cosette-lite/commits/2.1