[PR #75] [MERGED] refactor: convert excessive olm state globals into a struct #187

Closed
opened 2026-04-16 07:42:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 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: devHead: stop-with-the-globals-omg


📝 Commits (1)

  • 555400f refactor(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.go into 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 dev beforehand, 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.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/olm/pull/75 **Author:** [@water-sucks](https://github.com/water-sucks) **Created:** 1/10/2026 **Status:** ✅ Merged **Merged:** 1/14/2026 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `dev` ← **Head:** `stop-with-the-globals-omg` --- ### 📝 Commits (1) - [`555400f`](https://github.com/fosrl/olm/commit/555400ff686497e677bfc2c60de2bf59c08e2e11) refactor(olm): convert global state into an olm instance ### 📊 Changes **8 files changed** (+841 additions, -799 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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.go` into 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 `dev` beforehand, and then the branch base can be changed afterwards. ## How to test? No observable changes in behavior should exist. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 07:42:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/olm#187