Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f02f66c
WIP
damontecres Apr 30, 2026
a27bb2a
Option to load from server plugin
damontecres May 13, 2026
3f8dfac
Update unit test
damontecres May 13, 2026
af75b2e
Merge branch 'main' into develop/server-plugin
damontecres May 23, 2026
4901c8d
Merge branch 'main' into develop/server-plugin
damontecres May 27, 2026
20547fe
Merge branch 'main' into develop/server-plugin
damontecres May 31, 2026
6207c3a
WIP broken
damontecres May 31, 2026
bdaa6d5
Add CustomEndpoint home row
matschi95 Jun 1, 2026
d968c84
Address custom endpoint review comments
matschi95 Jun 1, 2026
23b6570
Fix custom endpoint compile errors
matschi95 Jun 1, 2026
a50b07a
Require relative custom endpoints
matschi95 Jun 1, 2026
bf9e0e5
Choose home settings source
damontecres Jun 2, 2026
f379224
Fix ktlint formatting
matschi95 Jun 10, 2026
144cbae
Merge branch 'main' into develop/server-plugin
damontecres Jun 18, 2026
8ba8d7f
Merge branch 'develop/server-plugin' into develop/server-plugin-custo…
damontecres Jun 21, 2026
a98634c
Merge branch 'main' into develop/server-plugin
damontecres Jul 9, 2026
6f82997
Merge branch 'main' into develop/server-plugin
damontecres Jul 29, 2026
6fcc77e
Merge branch 'main' into develop/server-plugin
damontecres Aug 13, 2026
3a34d59
Merge branch 'main' into develop/server-plugin
damontecres Oct 1, 2026
98afcde
Update unit tests
damontecres Oct 1, 2026
73b9d20
Handle discarding changes
damontecres Oct 1, 2026
b59e511
Add logging & track source better
damontecres Oct 2, 2026
f682d04
Tweaks to get items row
damontecres Oct 2, 2026
2874841
Naming & javadocs
damontecres Oct 2, 2026
368b350
Code clean up
damontecres Oct 3, 2026
6e88f98
Update unit tests
damontecres Oct 3, 2026
48628db
Split home row data fetching into HomeDataService
damontecres Oct 3, 2026
947528a
Merge branch 'develop/server-plugin' into develop/server-plugin-custo…
damontecres Oct 4, 2026
f8e0a21
Stricter endpoint checking & simplify code
damontecres Oct 4, 2026
11ba5fe
Fix unit tests
damontecres Oct 4, 2026
4be3c68
Add CustomEndpoint home row (#1430)
damontecres Oct 12, 2026
d7f8efa
Merge branch 'main' into develop/server-plugin
damontecres Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
841 changes: 841 additions & 0 deletions app/schemas/com.github.damontecres.wholphin.data.AppDatabase/41.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import java.util.UUID
RememberedTab::class,
SeriesTrackChoice::class,
],
version = 40,
version = 41,
exportSchema = true,
autoMigrations = [
AutoMigration(3, 4),
Expand All @@ -71,6 +71,7 @@ import java.util.UUID
AutoMigration(33, 34),
AutoMigration(34, 35),
AutoMigration(35, 40),
AutoMigration(40, 41),
],
)
@TypeConverters(Converters::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class ServerRepository
}
}

val serverPluginInstalled = MutableStateFlow<Boolean>(false)

/**
* Adds a server to the app database and updated the [ApiClient] to the server's URL
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@file:UseSerializers(UUIDSerializer::class)
@file:UseSerializers(
UUIDSerializer::class,
DateTimeSerializer::class,
)

package com.github.damontecres.wholphin.data.model

Expand All @@ -7,11 +10,15 @@ import com.github.damontecres.wholphin.ui.AspectRatio
import com.github.damontecres.wholphin.ui.Cards
import com.github.damontecres.wholphin.ui.components.ViewOptionImageType
import com.github.damontecres.wholphin.ui.data.SortAndDirection
import kotlinx.datetime.LocalDateTime
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import org.jellyfin.sdk.model.api.BaseItemKind
import org.jellyfin.sdk.model.api.ItemSortBy
import org.jellyfin.sdk.model.api.SortOrder
import org.jellyfin.sdk.model.api.request.GetItemsRequest
import org.jellyfin.sdk.model.serializer.DateTimeSerializer
import org.jellyfin.sdk.model.serializer.UUIDSerializer
import java.util.UUID

Expand Down Expand Up @@ -174,19 +181,45 @@ sealed interface HomeRowConfig {
}

/**
* An arbitrary [GetItemsRequest] allowing to query for anything
* An arbitrary [HomeGetItemsFilter] allowing to query for most anything
*/
@Serializable
@SerialName("GetItems")
data class GetItems(
val name: String,
val getItems: GetItemsRequest,
val filter: HomeGetItemsFilter,
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions(),
) : HomeRowConfig {
override fun updateViewOptions(viewOptions: HomeRowViewOptions): GetItems = this.copy(viewOptions = viewOptions)
}

/**
* Fetch items from an arbitrary Jellyfin endpoint that returns a QueryResult<BaseItemDto>.
* Lets third-party plugins (e.g. home-sections) contribute rows without Wholphin needing
* specific knowledge of them.
*
* Headers/Query are a list of [KeyValueEntry] (not a Map) because the server-side plugin
* config is persisted as XML, which doesn't support IDictionary.
*/
@Serializable
@SerialName("CustomEndpoint")
data class CustomEndpoint(
val endpoint: String,
val title: String,
val headers: List<KeyValueEntry>? = null,
val query: List<KeyValueEntry>? = null,
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions(),
) : HomeRowConfig {
override fun updateViewOptions(viewOptions: HomeRowViewOptions): CustomEndpoint = this.copy(viewOptions = viewOptions)
}
}

@Serializable
data class KeyValueEntry(
val key: String,
val value: String,
)

/**
* Root class for home page settings
*
Expand Down Expand Up @@ -241,3 +274,54 @@ data class HomeRowViewOptions(
)
}
}

/**
* Subset of [GetItemsFilter]
*/
@Serializable
data class HomeGetItemsFilter(
val sortBy: List<ItemSortBy>? = null,
val sortOrder: List<SortOrder>? = null,
val ids: List<UUID>? = null,
val minCommunityRating: Double? = null,
val minCriticRating: Double? = null,
val recursive: Boolean? = null,
val searchTerm: String? = null,
val parentId: UUID? = null,
val includeItemTypes: List<BaseItemKind>? = null,
val isFavorite: Boolean? = null,
val isPlayed: Boolean? = null,
val officialRatings: Collection<String>? = null,
val tags: List<String>? = null,
val years: List<Int>? = null,
val personIds: List<UUID>? = null,
val minOfficialRating: String? = null,
val hasOfficialRating: Boolean? = null,
val studioIds: List<UUID>? = null,
val genreIds: List<UUID>? = null,
val minPremiereDate: LocalDateTime? = null,
val maxPremiereDate: LocalDateTime? = null,
) {
fun asGetItemsRequest() =
GetItemsRequest(
sortBy = sortBy,
sortOrder = sortOrder,
ids = ids,
minCommunityRating = minCommunityRating,
minCriticRating = minCriticRating,
recursive = recursive,
searchTerm = searchTerm,
parentId = parentId,
includeItemTypes = includeItemTypes,
isFavorite = isFavorite,
isPlayed = isPlayed,
officialRatings = officialRatings,
tags = tags,
years = years,
personIds = personIds,
minOfficialRating = minOfficialRating,
hasOfficialRating = hasOfficialRating,
studioIds = studioIds,
genreIds = genreIds,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.room.Relation
import com.github.damontecres.wholphin.data.ZonedDateTimeSerializer
import com.github.damontecres.wholphin.preferences.SubtitleModePreference
import com.github.damontecres.wholphin.preferences.UserProfileSettings
import com.github.damontecres.wholphin.services.HomePageSettingsSource
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
Expand Down Expand Up @@ -68,6 +69,7 @@ data class JellyfinUser(
val lastUsed: ZonedDateTime? = null,
val uiLanguage: String? = null,
@Embedded val appPreferences: JellyfinUserPreferences = JellyfinUserPreferences(),
@Embedded(prefix = "c_") val config: JellyfinUserConfig = JellyfinUserConfig(),
) {
val hasPin: Boolean get() = pin.isNotNullOrBlank()

Expand All @@ -77,9 +79,17 @@ data class JellyfinUser(
"JellyfinUser(rowId=$rowId, id=$id, name=$name, serverId=$serverId, lastUsed=$lastUsed, " +
"accessToken?=${accessToken.isNotNullOrBlank()}, pin?=${pin.isNotNullOrBlank()}), " +
"requireLogin=$requireLogin, lastUsed=$lastUsed, uiLanguage=$uiLanguage, " +
"appPreferences=$appPreferences"
"appPreferences=$appPreferences, config=$config"

fun updateConfig(copy: (JellyfinUserConfig) -> JellyfinUserConfig): JellyfinUser = this.copy(config = copy.invoke(this.config))
}

@Serializable
data class JellyfinUserConfig(
@ColumnInfo(defaultValue = "UNSET")
val homeSettingsSource: HomePageSettingsSource = HomePageSettingsSource.UNSET,
)

/**
* Represents the relationship between [JellyfinServer] and its [JellyfinUser]
*/
Expand Down
Loading
Loading