mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 08:15:48 +00:00
Release v2.2.0 (#741)
* Migrate to TailwindCSS v4 (#740) * Remove "material-tailwind" dependencies due to incompatibility of Stepper component with Tailwind v4 * Clean up Tailwind configs before upgrade * Run HeroUI upgrade * Run TailwindCSS upgrade * Replace PostCSS with Vite * Migrate custom styles to v4 * Remove tailwind.config.ts * Add heroui.ts Add tailwind vite plugin * Fix small UI color inconsistency * Fix theming system Rename purple theme to pink * Re-implement stepper in HeroUI * Fix RoleChip colors * Migrate icon names (#743) * Add migration script for phosphor-icons * Migrate icon usages * Update version to 2.2.0-preview * Revert accidental rename of menu title * Bump stefanzweifel/git-auto-commit-action from 6 to 7 (#750) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 6 to 7. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v6...v7) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Improve library scanning (#749) * Update script to generate example libraries using SteamSpy API * Refactor library scanning process * Display Flyway startup log by default * Fix race condition in CompanyService * Fix race condition in ImageService Remove obsolete table * Fix SMTP config requiring an email as username (#755) * Disable length limit for config values (#757) * Deprecate DockerHub image (#759) * Remove deprecation warning from web UI * Reworked the CICD pipelines * Optimize container image (#761) * Fix Gradle warning * Rework Docker image to improve layer caching * Bump stefanzweifel/git-auto-commit-action from 6 to 7 (#765) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 6 to 7. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v6...v7) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Multi platform support (#764) * Remove migrate-phosphor-icons.js since migration has been successful * Refactor GameMetadata into separate files * Add Platform enum * Implement platform support in Plugin API * Implement platform support in Steam Plugin * Implement platform support in IGDB Plugin * Add database migration for platform support * Implement platform support in GameService * Implement platform support on most endpoints and features, some are still missing Implemented platform support in all bundled plugins (although not finished polishing yet) * Implement platforms in UI * Make GameRequest platform aware * Return headerImages from IGDB * Implement proper PlatformMapper for IGDB plugin * Fix various smaller issues and inconsistencies * Replace placeholder in LibraryOverviewCard (#767) * Bump actions/download-artifact from 5 to 6 (#769) * Bump actions/upload-artifact from 4 to 5 (#770) * Multi platform support (#773) * Fix bug in Plugin API related to state loading/saving * Hide Flyway query logs by default * Extend migration script for multi platform tables * Plugins now store their data and state in ./plugindata * Add "plugindata" directory to entrypoint scripts * Improve download handling (#756) * Process download in background thread to avoid session timeout affecting it * Increase default session timeout to 24h * Use virtual thread pool for download task in background * Make KSP extensions.idx generation more robust * Implement download bandwidth limiter Implement SliderInput Refactor NumberInput * Implement download bandwidth throttling Implement real-time download monitoring * Improve UI for DownloadManagement Track more stats in SessionStats * Update Hilla Use React 19 * Implement real-time graph to track bandwidth usage Implement downloaded data sum over last day Small bug fixes Small refactorings * Update docker-compose.example.yml * Improve DownloadSessionCard (#784) * Fix unit on y-axis of download graph * Show game size and library in tooltip Make game chips interactive in DownloadSessionCard (leads to game page when clicked) Optimize graph settings * Migrate torrent plugin to libtorrent (#775) * Disable TorrentDownloadPlugin in Alpine based Docker image * Improve test coverage (#785) * Fix potential divide by zero bug * Add mockk dependency * Add tests for org.gameyfin.app.core.download * Add tests for Filesytem package Fix DownloadServiceTest * Fix FilesystemServiceTest * Add tests for "job" package * Upgrade Gradle wrapper Enable Gradle config cache * Added more tests * Added tests for the "security" package * Add tests for "game" package * Fix AsyncFileTailer not shutting down properly on Windows * Fix GameServiceTest * Added tests for "libraries" package * Added tests for "media" package * Fix warning in ImageService * Add tests fpr "messages" package Make sure transport is closed even in case an exception is thrown * Add tests for "platforms" package * Add tests for "requests" package * Moved "token" package to "core" package (from "shared") * Add tests for "token" package * Fix issue in RoleEnum.safeValueOf() throwing Exception * Fix potential issue in UserEndpoint.getUserInfo() when auth is null * Added tests for "user" package * Migrate package for "token" in FE * Publish test report in CI * Fix workflow permissions * Remove test because of timing issue in CI * Replaced "unmatched paths" with "ignored paths" (#791) * Use new "AutoComplete" component (#793) * Use ArrayInputAutocomplete in EditGameMetadataModal * Add test for getEnumPropertyValues --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
val ktor_version = "3.1.3"
|
||||
val resilience4jVersion = "2.2.0"
|
||||
|
||||
plugins {
|
||||
id("com.google.devtools.ksp")
|
||||
@@ -21,6 +22,17 @@ dependencies {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
|
||||
// Resilience4j for rate limiting and bulkheading
|
||||
implementation("io.github.resilience4j:resilience4j-ratelimiter:${resilience4jVersion}") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
implementation("io.github.resilience4j:resilience4j-bulkhead:${resilience4jVersion}") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
implementation("io.github.resilience4j:resilience4j-all:${resilience4jVersion}") {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
|
||||
implementation("me.xdrop:fuzzywuzzy:1.4.0")
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package org.gameyfin.plugins.metadata.steam
|
||||
|
||||
// Resilience4j
|
||||
import io.github.resilience4j.bulkhead.Bulkhead
|
||||
import io.github.resilience4j.bulkhead.BulkheadConfig
|
||||
import io.github.resilience4j.decorators.Decorators
|
||||
import io.github.resilience4j.ratelimiter.RateLimiter
|
||||
import io.github.resilience4j.ratelimiter.RateLimiterConfig
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.call.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
@@ -15,8 +21,10 @@ import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||
import org.gameyfin.pluginapi.core.wrapper.GameyfinPlugin
|
||||
import org.gameyfin.pluginapi.gamemetadata.GameMetadata
|
||||
import org.gameyfin.pluginapi.gamemetadata.GameMetadataProvider
|
||||
import org.gameyfin.pluginapi.gamemetadata.Platform
|
||||
import org.gameyfin.plugins.metadata.steam.dto.SteamDetailsResultWrapper
|
||||
import org.gameyfin.plugins.metadata.steam.dto.SteamGame
|
||||
import org.gameyfin.plugins.metadata.steam.dto.SteamPlatforms
|
||||
import org.gameyfin.plugins.metadata.steam.dto.SteamSearchResult
|
||||
import org.gameyfin.plugins.metadata.steam.mapper.Mapper
|
||||
import org.gameyfin.plugins.metadata.steam.util.SteamDateSerializer
|
||||
@@ -25,6 +33,7 @@ import org.pf4j.Extension
|
||||
import org.pf4j.PluginWrapper
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.net.URI
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
|
||||
class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
@@ -38,11 +47,12 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
val dateSerializer = SteamDateSerializer()
|
||||
}
|
||||
|
||||
@Suppress("Unused")
|
||||
@Extension(ordinal = 3)
|
||||
class SteamMetadataProvider : GameMetadataProvider {
|
||||
private val log = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
val client = HttpClient(CIO) {
|
||||
private val client = HttpClient(CIO) {
|
||||
// Use a fake browser user agent to avoid being blocked by Steam
|
||||
BrowserUserAgent()
|
||||
|
||||
@@ -51,12 +61,43 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val rateLimiter: RateLimiter = RateLimiter.of(
|
||||
"steam-api",
|
||||
RateLimiterConfig.custom()
|
||||
.limitForPeriod(4)
|
||||
.limitRefreshPeriod(Duration.ofSeconds(1))
|
||||
.timeoutDuration(Duration.ofMinutes(10))
|
||||
.build()
|
||||
)
|
||||
private val bulkhead: Bulkhead = Bulkhead.of(
|
||||
"steam-api",
|
||||
BulkheadConfig.custom()
|
||||
.maxConcurrentCalls(8)
|
||||
.maxWaitDuration(Duration.ofMinutes(10))
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
// SteamVR support is not properly reflected in the store API, so we cannot reliably detect VR games
|
||||
override val supportedPlatforms: Set<Platform> =
|
||||
setOf(Platform.PC_MICROSOFT_WINDOWS, Platform.LINUX, Platform.MAC)
|
||||
|
||||
/**
|
||||
* The Steam Store API I am using provides far less info than IGDB for example
|
||||
* See it more as a proof of concept than a fully functional plugin
|
||||
**/
|
||||
override fun fetchByTitle(gameTitle: String, maxResults: Int): List<GameMetadata> {
|
||||
val searchResult: List<SteamGame> = runBlocking { searchStore(gameTitle) }
|
||||
override fun fetchByTitle(
|
||||
gameTitle: String,
|
||||
platformFilter: Set<Platform>,
|
||||
maxResults: Int
|
||||
): List<GameMetadata> {
|
||||
val searchResult: List<SteamGame> = try {
|
||||
steamApiCall { searchStore(gameTitle, platformFilter) }
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to search Steam store: ${e.message}")
|
||||
emptyList()
|
||||
}
|
||||
if (searchResult.isEmpty()) return emptyList()
|
||||
|
||||
// Use fuzzy search to find the best matching game name
|
||||
@@ -71,38 +112,79 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
bestMatches = bestMatches.filter { it.name in bestMatchesMap.keys }
|
||||
.sortedByDescending { bestMatchesMap[it.name] }
|
||||
|
||||
return runBlocking { bestMatches.map { getGameDetails(it.id) } }
|
||||
.filterNotNull()
|
||||
.take(maxResults)
|
||||
return bestMatches.mapNotNull { steamGame ->
|
||||
try {
|
||||
steamApiCall { getGameDetails(steamGame.id, platformFilter) }
|
||||
} catch (e: Exception) {
|
||||
log.warn("Failed to fetch details for app ${steamGame.id}: ${e.message}")
|
||||
null
|
||||
}
|
||||
}.take(maxResults)
|
||||
}
|
||||
|
||||
// Helper to enforce rate limit + bulkhead around suspend HTTP operations
|
||||
private fun <T> steamApiCall(block: suspend () -> T): T {
|
||||
val supplier = { runBlocking { block() } }
|
||||
val decorated = Decorators.ofSupplier(supplier)
|
||||
.withBulkhead(bulkhead)
|
||||
.withRateLimiter(rateLimiter)
|
||||
.decorate()
|
||||
return decorated.get()
|
||||
}
|
||||
|
||||
override fun fetchById(id: String): GameMetadata? {
|
||||
val id = id.toIntOrNull() ?: return null
|
||||
return runBlocking { getGameDetails(id) }
|
||||
}
|
||||
|
||||
private suspend fun searchStore(title: String): List<SteamGame> {
|
||||
val intId = id.toIntOrNull() ?: return null
|
||||
return try {
|
||||
val response = client.get("https://store.steampowered.com/api/storesearch") {
|
||||
parameter("term", title)
|
||||
parameter("cc", "en")
|
||||
parameter("l", "en")
|
||||
}
|
||||
val searchResult: SteamSearchResult = response.body()
|
||||
searchResult.items
|
||||
steamApiCall { getGameDetails(intId) }
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to search Steam store: ${e.message}")
|
||||
emptyList()
|
||||
log.warn("Failed to fetch details for app $intId: ${e.message}")
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getGameDetails(id: Int): GameMetadata? {
|
||||
private suspend fun searchStore(title: String, platformFilter: Set<Platform>): List<SteamGame> {
|
||||
val response = client.get("https://store.steampowered.com/api/storesearch") {
|
||||
parameter("term", title)
|
||||
parameter("cc", "en")
|
||||
parameter("l", "en")
|
||||
}
|
||||
|
||||
if (response.status == HttpStatusCode.Forbidden) {
|
||||
log.warn("Steam API rate limit hit; backing off and returning empty result")
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
if (response.status != HttpStatusCode.OK) {
|
||||
log.warn("Steam search returned HTTP ${response.status}")
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val searchResult: SteamSearchResult = response.body()
|
||||
|
||||
val filteredByPlatform = if (platformFilter.isNotEmpty()) {
|
||||
searchResult.items.filter { game ->
|
||||
val platformsSupportedByGame = toGameyfinPlatforms(game.platforms)
|
||||
platformFilter.any { it in platformsSupportedByGame }
|
||||
}
|
||||
} else {
|
||||
searchResult.items
|
||||
}
|
||||
|
||||
return filteredByPlatform
|
||||
}
|
||||
|
||||
private suspend fun getGameDetails(id: Int, platformFilter: Set<Platform> = emptySet()): GameMetadata? {
|
||||
val response = client.get("https://store.steampowered.com/api/appdetails") {
|
||||
parameter("appids", id)
|
||||
parameter("cc", "en")
|
||||
parameter("l", "en")
|
||||
}
|
||||
|
||||
if (response.status == HttpStatusCode.Forbidden) {
|
||||
log.warn("Steam API rate limit hit; backing off and returning empty result")
|
||||
return null
|
||||
}
|
||||
|
||||
if (response.status != HttpStatusCode.OK) return null
|
||||
|
||||
val responseBody: String = response.bodyAsText(Charsets.UTF_8)
|
||||
@@ -115,12 +197,23 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
|
||||
if (game.type != "game") return null
|
||||
|
||||
// The returned game should only contain the platforms we are interested in (if any filter is set)
|
||||
val gamePlatforms = if (platformFilter.isNotEmpty()) {
|
||||
toGameyfinPlatforms(game.platforms).intersect(platformFilter)
|
||||
} else {
|
||||
toGameyfinPlatforms(game.platforms)
|
||||
}
|
||||
|
||||
// If the game does not support any of the requested platforms, skip it
|
||||
if (gamePlatforms.isEmpty()) return null
|
||||
|
||||
// This is as much as I can get from the Steam Store API
|
||||
val metadata = GameMetadata(
|
||||
originalId = id.toString(),
|
||||
title = sanitizeTitle(game.name),
|
||||
platforms = gamePlatforms,
|
||||
description = game.shortDescription, // Using short description since the detailed description often contains just some ads for the Battle Pass etc.
|
||||
coverUrls = game.headerImage?.let { URI(it) }?.let { listOf(it) },
|
||||
coverUrls = game.headerImage?.let { URI(it) }?.let { listOf(it) }?.toSet(),
|
||||
release = parseOriginalReleaseDateFromStorePage(id) ?: game.releaseDate?.date,
|
||||
developedBy = game.developers?.toSet(),
|
||||
publishedBy = game.publishers?.toSet(),
|
||||
@@ -146,6 +239,11 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
cookie("lastagecheckage", "1-January-1900")
|
||||
}
|
||||
|
||||
if (response.status == HttpStatusCode.Forbidden) {
|
||||
log.warn("Steam web page responded 403 Forbidden for app $appId; can't parse original release date")
|
||||
return null
|
||||
}
|
||||
|
||||
if (response.status != HttpStatusCode.OK) return null
|
||||
|
||||
val html: String = response.bodyAsText(Charsets.UTF_8)
|
||||
@@ -155,7 +253,6 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
return dateSerializer.deserialize(releaseDateText.text())
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Often titles on Steam contain copyright symbols which makes matching between different providers harder
|
||||
* This method removes those symbols
|
||||
@@ -164,5 +261,17 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
|
||||
val unwantedChars = setOf('™', '©', '®')
|
||||
return originalTitle.filter { it !in unwantedChars }.trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine supported Gameyfin platforms for a Steam game based on its platform flags
|
||||
*/
|
||||
private fun toGameyfinPlatforms(steamPlatforms: SteamPlatforms): Set<Platform> {
|
||||
val gameyfinPlatforms = mutableSetOf<Platform>()
|
||||
if (steamPlatforms.windows) gameyfinPlatforms.add(Platform.PC_MICROSOFT_WINDOWS)
|
||||
if (steamPlatforms.linux) gameyfinPlatforms.add(Platform.LINUX)
|
||||
if (steamPlatforms.mac) gameyfinPlatforms.add(Platform.MAC)
|
||||
return gameyfinPlatforms
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ data class SteamDetailsResultWrapper(
|
||||
data class SteamGameDetails(
|
||||
val type: String,
|
||||
val name: String,
|
||||
val platforms: SteamPlatforms,
|
||||
@SerialName("short_description") val shortDescription: String? = null,
|
||||
@SerialName("detailed_description") val detailedDescription: String? = null,
|
||||
@SerialName("header_image") val headerImage: String? = null,
|
||||
|
||||
+2
-1
@@ -12,5 +12,6 @@ data class SteamSearchResult(
|
||||
data class SteamGame(
|
||||
val type: String,
|
||||
val name: String,
|
||||
val id: Int
|
||||
val id: Int,
|
||||
val platforms: SteamPlatforms
|
||||
)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package org.gameyfin.plugins.metadata.steam.dto
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SteamPlatforms(
|
||||
val windows: Boolean,
|
||||
val mac: Boolean,
|
||||
val linux: Boolean
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
Plugin-Version: 1.0.0
|
||||
Plugin-Version: 1.2.0
|
||||
Plugin-Class: org.gameyfin.plugins.metadata.steam.SteamPlugin
|
||||
Plugin-Id: org.gameyfin.plugins.metadata.steam
|
||||
Plugin-Name: Steam Metadata
|
||||
|
||||
Reference in New Issue
Block a user