[PR #4428] Add ipaddress to playbacksession #4251

Open
opened 2026-04-25 00:19:00 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4428
Author: @peter1490
Created: 6/23/2025
Status: 🔄 Open

Base: masterHead: add-ipaddress-to-playbacksession


📝 Commits (4)

  • 7fb2acc Add IP Address to listening session to provide a more accurate history of the network location for each playback.
  • a5f33a5 Fix on print of LabelDevice + redundant code changes
  • a7e01ad Fix bad migration version
  • 8eeb9e3 Added v2.25.2 DB migration unit tests file

📊 Changes

6 files changed (+125 additions, -1 deletions)

View changed files

📝 client/components/modals/ListeningSessionModal.vue (+1 -1)
📝 server/managers/PlaybackSessionManager.js (+1 -0)
server/migrations/v2.25.2-add-ipaddress-to-playbacksession.js (+67 -0)
📝 server/models/PlaybackSession.js (+5 -0)
📝 server/objects/PlaybackSession.js (+5 -0)
test/server/migrations/v2.25.2-add-ipaddress-to-playbacksession.test.js (+46 -0)

📄 Description

Brief summary

Store IP address per listening session instead of per device.

Which issue is fixed?

No issue.

In-depth Description

Previously, the application only stored the last known IP address for a device. This meant that if a user connected from different networks, the IP address history for their listening sessions was lost, and the UI would only show the most recent IP for the device, not the IP used for that specific session.

This change modifies the PlaybackSession object and its corresponding database model to include an ipAddress field. A database migration has been added to support this new column. The PlaybackSessionManager has been updated to capture the IP address from the current request when a session is created, ensuring the session-specific IP is saved. The frontend modal for viewing session details has also been updated to display the IP address from the session data, providing an accurate history of the IP used for each listening session.

How have you tested this?

I ran the full server-side test suite using the npm test command. All 295 tests passed, confirming that the modifications did not introduce any regressions.

To test the feature, I started a new listening session and verified that the IP address was displayed correctly. Next, I initiated another listening session (on a different IP address) and confirmed that the IP addresses shown for each listening session were indeed different.


🔄 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/advplyr/audiobookshelf/pull/4428 **Author:** [@peter1490](https://github.com/peter1490) **Created:** 6/23/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `add-ipaddress-to-playbacksession` --- ### 📝 Commits (4) - [`7fb2acc`](https://github.com/advplyr/audiobookshelf/commit/7fb2acc500dd7bf54d3d338d7c314a78517abb4e) Add IP Address to listening session to provide a more accurate history of the network location for each playback. - [`a5f33a5`](https://github.com/advplyr/audiobookshelf/commit/a5f33a5502626735f9289c8fb9d33e52304293f2) Fix on print of LabelDevice + redundant code changes - [`a7e01ad`](https://github.com/advplyr/audiobookshelf/commit/a7e01ad6eec972e2f016b50a6aad709451dce019) Fix bad migration version - [`8eeb9e3`](https://github.com/advplyr/audiobookshelf/commit/8eeb9e33055335db016693f90f030a23ef79474b) Added v2.25.2 DB migration unit tests file ### 📊 Changes **6 files changed** (+125 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `client/components/modals/ListeningSessionModal.vue` (+1 -1) 📝 `server/managers/PlaybackSessionManager.js` (+1 -0) ➕ `server/migrations/v2.25.2-add-ipaddress-to-playbacksession.js` (+67 -0) 📝 `server/models/PlaybackSession.js` (+5 -0) 📝 `server/objects/PlaybackSession.js` (+5 -0) ➕ `test/server/migrations/v2.25.2-add-ipaddress-to-playbacksession.test.js` (+46 -0) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Store IP address per listening session instead of per device. ## Which issue is fixed? No issue. ## In-depth Description Previously, the application only stored the last known IP address for a device. This meant that if a user connected from different networks, the IP address history for their listening sessions was lost, and the UI would only show the most recent IP for the device, not the IP used for that specific session. This change modifies the PlaybackSession object and its corresponding database model to include an ipAddress field. A database migration has been added to support this new column. The PlaybackSessionManager has been updated to capture the IP address from the current request when a session is created, ensuring the session-specific IP is saved. The frontend modal for viewing session details has also been updated to display the IP address from the session data, providing an accurate history of the IP used for each listening session. ## How have you tested this? I ran the full server-side test suite using the npm test command. All 295 tests passed, confirming that the modifications did not introduce any regressions. To test the feature, I started a new listening session and verified that the IP address was displayed correctly. Next, I initiated another listening session (on a different IP address) and confirmed that the IP addresses shown for each listening session were indeed different. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:00 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4251