mirror of
https://github.com/fosrl/olm.git
synced 2026-05-07 03:07:55 -05:00
[PR #75] [MERGED] refactor: convert excessive olm state globals into a struct #187
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/olm/pull/75
Author: @water-sucks
Created: 1/10/2026
Status: ✅ Merged
Merged: 1/14/2026
Merged by: @oschwartz10612
Base:
dev← Head:stop-with-the-globals-omg📝 Commits (1)
555400frefactor(olm): convert global state into an olm instance📊 Changes
8 files changed (+841 additions, -799 deletions)
View changed files
📝
api/api.go(+16 -13)📝
main.go(+8 -4)➕
olm/connect.go(+223 -0)➕
olm/data.go(+197 -0)📝
olm/olm.go(+198 -778)➕
olm/peer.go(+195 -0)📝
olm/ping.go(+3 -3)📝
olm/types.go(+1 -1)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
This refactors the globals in
olm/olm.gointo a struct with all the required state for an Olm client connection.It also moves websocket handlers into separate, more organized files, instead of defining all handlers in a single method with lots of nested indentation, and adds nil checks in many other places that would have otherwise resulted in panics.
Requires #74 to be merged into
devbeforehand, and then the branch base can be changed afterwards.How to test?
No observable changes in behavior should exist.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.