Opencord

From Discord Client Modding Wiki
Revision as of 07:06, 8 March 2024 by Rushii (talk | contribs) (change category)
Jump to navigation Jump to search
Opencord's original logo

Opencord was an open-source Material You implementation of the Discord Android app. Created in late August of 2021, it has reimplemented a sizable portion of the mobile Discord client, completely from scratch. It aims to replicate the functionality and behavior of the Legacy Android Discord app, the last release of which was in the summer of 2022. Despite steady development initially, it alternated between periods of rapid progress and months of inactivity. Progress completely stopped by May 2023, and it was archived on Jan 12, 2024. As of March 2024, it still has over 1.2k stars on GitHub.

Backstory

While the original reason for its creation is unknown[Xinto needed], as another mobile client mod started to mature, it became apparent that adding dozens of fixes onto an outdated client would eventually become unsustainable. While the first 8 months of development were only propelled by Xinto, in Apr 2022, rushii started contributing to the project and eventually became one of the two main developers. After an amount of time, most contributions started to be done by only rushii as Xinto focused on other projects. Eventually, rushii stopped work on it as well due to roadblocks in designing a proper architecture, exacerbated by loads of technical debt, and dozens of heated debates over the most minuscule of changes.

One of the main goals of the project was to avoid the instability of client mods by reimplementing everything from scratch, instead of relying on patching Discord code which can easily due to updates. In doing so, a lot of things could be omitted or simplified, like the intentional exclusion of nitro features. (i.e. super reactions, profile effects, etc.) Having a clean interface that focused on usability and simplicity while remaining functional was an important design goal.

While Discord doesn't "care" about client mods or 3rd party clients, the truth is that if certain API and gateway requests are incorrect, the account will be flagged in a variety of ways and could cause additional captchas, forcing phone verification, or an outright ban.[1] This is one of the major reasons why development took so long since the client must act exactly like a v126.21 Discord client, from the identification sent to the API and gateway, to the request content on specific endpoints, to even TLS metadata.[2]

Architecture

Opencord is written in Kotlin with the use of Jetpack Compose, a modern declarative native UI framework for Android. Most of the codebase is based on dependency injection with Koin, in such a way that it would be theoretically testable in the future. While basic gateway functionality lives independently, most of the complex logic, including caching and live state, lives in Stores, a concept taken from the original Discord codebase.

While most of the UI is broken up into small @Composable components, complex UI was wrongly implemented, leading to dozens of recomposition issues that took an insane amount of effort to fix. Additionally, due to the idiomaticity of Compose, complex UI components can be split up into the layout and content, where invoking the layout forces you to provide all the content to the layout. This led to a lot of repetitiveness throughout the codebase, quickly becoming unmaintainable. While this was eventually planned to be refactored out, that never happened. This has been taken into consideration regarding future projects of the developers and it hasn't happened to this extent since.

Notes

  1. "Cordless shutdown notice".
  2. "JA3 TLS fingerprinting".