Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for anime episode size limit on site #318

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package fr.shikkanime.controllers.site
import com.google.inject.Inject
import fr.shikkanime.dtos.AnimeDto
import fr.shikkanime.entities.SortParameter
import fr.shikkanime.entities.enums.ConfigPropertyKey
import fr.shikkanime.entities.enums.CountryCode
import fr.shikkanime.entities.enums.Link
import fr.shikkanime.services.caches.AnimeCacheService
import fr.shikkanime.services.caches.ConfigCacheService
import fr.shikkanime.services.caches.EpisodeCacheService
import fr.shikkanime.services.caches.SimulcastCacheService
import fr.shikkanime.utils.routes.Controller
Expand All @@ -28,6 +30,9 @@ class SiteController {
@Inject
private lateinit var simulcastCacheService: SimulcastCacheService

@Inject
private lateinit var configCacheService: ConfigCacheService

@Path("404")
@Get
private fun error404(): Response {
Expand Down Expand Up @@ -134,7 +139,7 @@ class SiteController {
SortParameter("langType", SortParameter.Order.ASC),
),
1,
24
configCacheService.getValueAsInt(ConfigPropertyKey.ANIME_EPISODES_SIZE_LIMIT, 24)
)!!.data
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ enum class ConfigPropertyKey(val key: String) {
ANALYTICS_SCRIPT("analytics_script"),
CRUNCHYROLL_FETCH_API_SIZE("crunchyroll_fetch_api_size"),
ANIMATION_DITIGAL_NETWORK_SIMULCAST_DETECTION_REGEX("animation_digital_network_simulcast_detection_regex"),
ANIME_EPISODES_SIZE_LIMIT("anime_episodes_size_limit"),
}
24 changes: 24 additions & 0 deletions src/main/resources/db/changelog/2024/03/08-changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
<property global="false" name="id" value="1711561869401"/>
<property global="false" name="author" value="Ziedelth"/>

<changeSet id="${id}-1" author="${author}" dbms="postgresql">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*)
FROM config
WHERE property_key = 'anime_episodes_size_limit'</sqlCheck>
</preConditions>

<insert tableName="config">
<column name="uuid" valueComputed="gen_random_uuid()"/>
<column name="property_key" value="anime_episodes_size_limit"/>
<column name="property_value" value="24"/>
</insert>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/db/changelog/db.changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
<include file="/db/changelog/2024/03/05-changelog.xml"/>
<include file="/db/changelog/2024/03/06-changelog.xml"/>
<include file="/db/changelog/2024/03/07-changelog.xml"/>
<include file="/db/changelog/2024/03/08-changelog.xml"/>
</databaseChangeLog>