diff --git a/komga-webui/src/App.vue b/komga-webui/src/App.vue index 19ca2f175..d23ced470 100644 --- a/komga-webui/src/App.vue +++ b/komga-webui/src/App.vue @@ -6,8 +6,8 @@ diff --git a/komga-webui/src/services/komga-sse.service.ts b/komga-webui/src/services/komga-sse.service.ts index c020dbeeb..b2ffdbb90 100644 --- a/komga-webui/src/services/komga-sse.service.ts +++ b/komga-webui/src/services/komga-sse.service.ts @@ -19,7 +19,7 @@ import { READPROGRESS_SERIES_DELETED, SERIES_ADDED, SERIES_CHANGED, - SERIES_DELETED, + SERIES_DELETED, SESSION_EXPIRED, THUMBNAILBOOK_ADDED, THUMBNAILBOOK_DELETED, THUMBNAILCOLLECTION_ADDED, @@ -101,6 +101,8 @@ export default class KomgaSseService { this.eventSource.addEventListener('ThumbnailSeriesCollectionDeleted', (event: any) => this.emit(THUMBNAILCOLLECTION_DELETED, event)) this.eventSource.addEventListener('TaskQueueStatus', (event: any) => this.updateTaskCount(event)) + + this.eventSource.addEventListener('SessionExpired', (event: any) => this.emit(SESSION_EXPIRED, event)) } disconnect() { diff --git a/komga-webui/src/types/events.ts b/komga-webui/src/types/events.ts index 07fc29fda..3c4c31985 100644 --- a/komga-webui/src/types/events.ts +++ b/komga-webui/src/types/events.ts @@ -36,6 +36,8 @@ export const THUMBNAILREADLIST_DELETED = 'thumbnailreadlist-deleted' export const THUMBNAILCOLLECTION_ADDED = 'thumbnailcollection-added' export const THUMBNAILCOLLECTION_DELETED = 'thumbnailcollection-deleted' +export const SESSION_EXPIRED = 'session-expired' + export const ERROR = 'error' export const NOTIFICATION = 'notification' diff --git a/komga-webui/src/types/komga-sse.ts b/komga-webui/src/types/komga-sse.ts index 2d08649cb..c9e7be27c 100644 --- a/komga-webui/src/types/komga-sse.ts +++ b/komga-webui/src/types/komga-sse.ts @@ -54,6 +54,10 @@ export interface ThumbnailCollectionSseDto { selected: boolean, } +export interface SessionExpiredDto { + userId: string, +} + export interface TaskQueueSseDto { count: number, countByType: { [key: string]: number } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt index ae53c9fe6..d27449233 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt @@ -18,6 +18,7 @@ import org.gotson.komga.interfaces.sse.dto.ReadListSseDto import org.gotson.komga.interfaces.sse.dto.ReadProgressSeriesSseDto import org.gotson.komga.interfaces.sse.dto.ReadProgressSseDto import org.gotson.komga.interfaces.sse.dto.SeriesSseDto +import org.gotson.komga.interfaces.sse.dto.SessionExpiredDto import org.gotson.komga.interfaces.sse.dto.TaskQueueSseDto import org.gotson.komga.interfaces.sse.dto.ThumbnailBookSseDto import org.gotson.komga.interfaces.sse.dto.ThumbnailReadListSseDto @@ -109,6 +110,9 @@ class SseController( is DomainEvent.ThumbnailSeriesCollectionDeleted -> emitSse("ThumbnailSeriesCollectionDeleted", ThumbnailSeriesCollectionSseDto(event.thumbnail.collectionId, event.thumbnail.selected)) is DomainEvent.ThumbnailReadListAdded -> emitSse("ThumbnailReadListAdded", ThumbnailReadListSseDto(event.thumbnail.readListId, event.thumbnail.selected)) is DomainEvent.ThumbnailReadListDeleted -> emitSse("ThumbnailReadListDeleted", ThumbnailReadListSseDto(event.thumbnail.readListId, event.thumbnail.selected)) + + is DomainEvent.UserUpdated -> if (event.expireSession) emitSse("SessionExpired", SessionExpiredDto(event.user.id), userIdOnly = event.user.id) + is DomainEvent.UserDeleted -> emitSse("SessionExpired", SessionExpiredDto(event.user.id), userIdOnly = event.user.id) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/SessionExpiredDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/SessionExpiredDto.kt new file mode 100644 index 000000000..a879669f2 --- /dev/null +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/SessionExpiredDto.kt @@ -0,0 +1,5 @@ +package org.gotson.komga.interfaces.sse.dto + +data class SessionExpiredDto( + val userId: String, +)