Skip to content

Releases: MiraiSubject/cosette-lite

2.2

03 May 12:45
c7f0aa6
Compare
Choose a tag to compare

What's Changed

  • Replace Discordbot with REST API functions by @MiraiSubject in #6
  • Remove Discord bot application located in apps/discordbot

Migrating from Cosette-Lite 2.1

Important migration nodes:

  • Native Windows works again because we do not use Unix sockets anymore for IPC. In fact there is no IPC at all anymore and it's all contained in one app.
  • Make sure to remove the bot from your docker-compose.yml and delete any related images.

Full Changelog: 2.1...2.2

2.1

01 Apr 23:16
fc7704f
Compare
Choose a tag to compare
2.1

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

2.0-1

01 Apr 20:00
906609c
Compare
Choose a tag to compare

Quick hotfix because to fix redirect not happening properly on failures to join for any reason. This worked in the original version but regressed in 2.0. 2.0-1 fixes that.

2.0

09 Mar 21:36
2e55f45
Compare
Choose a tag to compare
2.0

What's Changed

New Contributors

This is a breaking change for consumers of the previous Nuxt version.

The migration to SvelteKit and Fastify is complete now.

This project is now a monorepo with 2 components:

  • discordbot, which is Discord bot on a Fastify Server listening on a Unix Socket
  • webstack, which is SvelteKit full stack application doing all of the OAuth2 backend logic as well as serving the frontend.

Major Changes

This project has an official name now: Cosette Lite.

Stack:

  • Minimum Node.js version is now 18.13
  • Framework changed from Nuxt to SvelteKit
  • Removed backend Express
  • Add Fastify for IPC between the Discord bot and SvelteKit through a unix socket
  • Changed package manager from yarn to pnpm
  • Added Turborepo with pnpm-workspaces for monorepo management
  • Add vitest & playwright for future testing opportunities.

Fixes:

  • Reason now gets properly displayed for manual verification
  • Other errors are now properly displayed on the user's side too
  • Not reliant on passport-osu and passport in general anymore.
    • All the OAuth2 code is now written using fetch and SvelteKit's native server.

Minor fixes

  • on the done page osu! Tournament Hub was hardcoded.

Advantages

  • No longer required to use Redis or in-memory cookie processing in the backend. Cookies are now fully stateless.
  • You get to benefit from all of Svelte's advantages, while keeping SSR.
  • Less dependencies for a lighter package.

Disadvantages

  • Learning a new syntax (Vue --> Svelte)
  • Native Windows compatibility is dropped due to the usage of unix sockets. WSL 2 is still supported.
  • More complex project structure (this is more subjective for people)

Migrating from vue2/nuxt-based oth-verification

If you only modified the config.json file then all you have to do is move the set configuration to the file in packages/config/config.ts.

Some important notes regarding the config.json:

  • domains is removed: It's not required anymore for CORS, everything is internalised.
  • dev, https is removed: It's not used anymore.

Important migration notes:

  • pnpm is now the chosen package manager due to the project becoming a monorepo with two components.
  • turborepo (turbo) is now a requirement for the same aforementioned reason
  • Native Windows is not supported anymore due to the usage of Unix Sockets for communication between the Discord bot and the web application.
    • Workaround: modify the fastify server to create an http server and point the web application to the same URLs. Make sure to properly configure your firewall and/or secure the endpoints if you're going this route.

Any custom modifications made in the Nuxt application will be lost and have to be rewritten using Svelte. Style modifications can easily be migrated if you only lightly modified your instance.

If for any reason you'd like to reference the old Nuxt version of this application you can do so here.

The future of this project

  • The plan is to commit to using Svelte as the frontend language of choice for the foreseeable future. SvelteKit by itself is relatively new and it will likely be a while until we see an EOL on the current version.
  • I will not commit to using unix sockets in the long term, for now this is what I considered the best case for most environments. I am aware that this likely brings compatibility issues when deploying to Vercel or similar platforms.
  • I have been considering changing the Discord bot component for a Rust equivalent version, but on the scale that most of us work at there will be no benefits whatsoever, so for now this won't happen.
  • In the undefined future I might try to make it easier to use an npx template or similar to scaffold a new project with the configuration burned in so all you have to do is run the build scripts and deploy.

Full Changelog: 1.0...2.0

1.0

09 Mar 21:35
2bb8cc5
Compare
Choose a tag to compare
1.0

First version of oth-verification using Nuxt and Express

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