diff --git a/client/components/modals/ListeningSessionModal.vue b/client/components/modals/ListeningSessionModal.vue index ecf00f78..0a6b556e 100644 --- a/client/components/modals/ListeningSessionModal.vue +++ b/client/components/modals/ListeningSessionModal.vue @@ -81,7 +81,7 @@
{{ $strings.LabelUser }}
-{{ _session.userId }}
+{{ username }}
{{ $strings.LabelMediaPlayer }}
{{ playMethodName }}
@@ -132,6 +132,9 @@ export default { _session() { return this.session || {} }, + username() { + return this._session.user?.username || this._session.userId || '' + }, deviceInfo() { return this._session.deviceInfo || {} }, diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue index b48147d3..34a0fc86 100644 --- a/client/pages/config/users/_id/index.vue +++ b/client/pages/config/users/_id/index.vue @@ -13,8 +13,10 @@http://192.168.1.1:8337
then you would put http://192.168.1.1:8337/notify
.",
"MessageAsinCheck": "Ensure you are using the ASIN from the correct Audible region, not Amazon.",
+ "MessageAuthenticationLegacyTokenWarning": "Legacy API tokens will be removed in the future. Use API Keys instead.",
"MessageAuthenticationOIDCChangesRestart": "Restart your server after saving to apply OIDC changes.",
"MessageAuthenticationSecurityMessage": "Authentication has been improved for security. All users are required to re-login.",
"MessageBackupsDescription": "Backups include users, user progress, library item details, server settings, and images stored in /metadata/items
& /metadata/authors
. Backups do not include any files stored in your library folders.",
diff --git a/server/controllers/SessionController.js b/server/controllers/SessionController.js
index 8cebdd35..7160eace 100644
--- a/server/controllers/SessionController.js
+++ b/server/controllers/SessionController.js
@@ -57,26 +57,24 @@ class SessionController {
}
let where = null
- const include = [
- {
- model: Database.models.device
- }
- ]
if (userId) {
where = {
userId
}
- } else {
- include.push({
- model: Database.userModel,
- attributes: ['id', 'username']
- })
}
const { rows, count } = await Database.playbackSessionModel.findAndCountAll({
where,
- include,
+ include: [
+ {
+ model: Database.deviceModel
+ },
+ {
+ model: Database.userModel,
+ attributes: ['id', 'username']
+ }
+ ],
order: [[orderKey, orderDesc]],
limit: itemsPerPage,
offset: itemsPerPage * page
diff --git a/server/controllers/UserController.js b/server/controllers/UserController.js
index e72293cb..3ec10539 100644
--- a/server/controllers/UserController.js
+++ b/server/controllers/UserController.js
@@ -439,7 +439,16 @@ class UserController {
const page = toNumber(req.query.page, 0)
const start = page * itemsPerPage
- const sessions = listeningSessions.slice(start, start + itemsPerPage)
+ // Map user to sessions to match the format of the sessions endpoint
+ const sessions = listeningSessions.slice(start, start + itemsPerPage).map((session) => {
+ return {
+ ...session,
+ user: {
+ id: req.reqUser.id,
+ username: req.reqUser.username
+ }
+ }
+ })
const payload = {
total: listeningSessions.length,