Skip to content

Commit

Permalink
feat: remove vince
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Sep 11, 2024
1 parent 199b171 commit b84a049
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ enum class ConfigPropertyKey(val key: String) {
BSKY_SESSION_TIMEOUT("bsky_session_timeout"),
THREADS_SESSION_TIMEOUT("threads_session_timeout"),
SIMULCAST_RANGE_DELAY("simulcast_range_delay"),
ANALYTICS_DOMAIN("analytics_domain"),
ANALYTICS_API("analytics_api"),
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"),
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/fr/shikkanime/modules/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun Application.configureRouting() {
call.attributes.put(callStartTime, ZonedDateTime.now())
// If call is completed, the headers are already set
if (call.response.status()?.value != null || !configCacheService.getValueAsBoolean(ConfigPropertyKey.USE_SECURITY_HEADERS)) return@subscribe
setSecurityHeaders(call, configCacheService)
setSecurityHeaders(call)
}

environment.monitor.subscribe(Routing.RoutingCallFinished) { call ->
Expand All @@ -73,7 +73,7 @@ fun Application.configureRouting() {
}
}

private fun setSecurityHeaders(call: ApplicationCall, configCacheService: ConfigCacheService) {
private fun setSecurityHeaders(call: ApplicationCall) {
call.response.pipeline.intercept(ApplicationSendPipeline.Transform) {
context.response.header(
HttpHeaders.StrictTransportSecurity,
Expand All @@ -87,7 +87,7 @@ private fun setSecurityHeaders(call: ApplicationCall, configCacheService: Config
"font-src 'self' https://cdn.jsdelivr.net; " +
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net;" +
"img-src data: 'self' 'unsafe-inline' 'unsafe-eval' ${Constant.apiUrl} ${Constant.baseUrl};" +
"connect-src 'self' ${Constant.apiUrl} ${configCacheService.getValueAsString(ConfigPropertyKey.ANALYTICS_API) ?: ""};"
"connect-src 'self' ${Constant.apiUrl};"
)

context.response.header("X-Frame-Options", "DENY")
Expand Down
3 changes: 0 additions & 3 deletions src/main/kotlin/fr/shikkanime/modules/SEOManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ fun setGlobalAttributes(
modelMap["googleSiteVerification"] =
configCacheService.getValueAsString(ConfigPropertyKey.GOOGLE_SITE_VERIFICATION_ID)
modelMap["currentSimulcast"] = simulcastCacheService.currentSimulcast
modelMap["analyticsDomain"] = configCacheService.getValueAsString(ConfigPropertyKey.ANALYTICS_DOMAIN)
modelMap["analyticsApi"] = configCacheService.getValueAsString(ConfigPropertyKey.ANALYTICS_API)
modelMap["analyticsScript"] = configCacheService.getValueAsString(ConfigPropertyKey.ANALYTICS_SCRIPT)
modelMap["baseUrl"] = Constant.baseUrl
modelMap["apiUrl"] = Constant.apiUrl
}
Expand Down
4 changes: 0 additions & 4 deletions src/main/kotlin/fr/shikkanime/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ object StringUtils {
.replace(">", ">")
.replace("\"", """)

fun unSanitizeXSS(input: String): String = input.replace("&lt;", "<")
.replace("&gt;", ">")
.replace("&quot;", "\"")

fun getIdentifier(
countryCode: CountryCode,
platform: Platform,
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/db/changelog/2024/09/02-changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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.29.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
<property global="false" name="id" value="1726043673473"/>
<property global="false" name="author" value="Ziedelth"/>

<changeSet id="${id}-1" author="${author}">
<delete tableName="config">
<where>property_key IN ('analytics_domain', 'analytics_api', 'analytics_script')</where>
</delete>
</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 @@ -60,4 +60,5 @@
<include file="/db/changelog/2024/08/01-changelog.xml"/>
<!-- September 2024 -->
<include file="/db/changelog/2024/09/01-changelog.xml"/>
<include file="/db/changelog/2024/09/02-changelog.xml"/>
</databaseChangeLog>
3 changes: 0 additions & 3 deletions src/main/resources/templates/_freemarker_implicit.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
[#-- @ftlvariable name="previousWeek" type="java.lang.String" --]
[#-- @ftlvariable name="nextWeek" type="java.lang.String" --]

[#-- @ftlvariable name="analyticsDomain" type="java.lang.String" --]
[#-- @ftlvariable name="analyticsApi" type="java.lang.String" --]
[#-- @ftlvariable name="analyticsScript" type="java.lang.String" --]
[#-- @ftlvariable name="baseUrl" type="java.lang.String" --]
[#-- @ftlvariable name="apiUrl" type="java.lang.String" --]

Expand Down
6 changes: 0 additions & 6 deletions src/main/resources/templates/site/_layout.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@
<link rel="stylesheet" href="/assets/css/purged/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/assets/css/purged/main.min.css" crossorigin="anonymous">
<script defer src="/assets/js/alpinejs.min.js" crossorigin="anonymous"></script>

<#if (analyticsDomain?? && analyticsDomain?length != 0) && (analyticsApi?? && analyticsApi?length != 0) && (analyticsScript?? && analyticsScript?length != 0)>
<script data-domain="${analyticsDomain}" data-api="${analyticsApi}">
${su.unSanitizeXSS(analyticsScript)}
</script>
</#if>
</head>
<body>
<#nested 0>
Expand Down

0 comments on commit b84a049

Please sign in to comment.