1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Final cleanup

This commit is contained in:
carbotaniuman 2023-08-07 16:50:35 -05:00
parent 381897e657
commit b3f7955ed2
5 changed files with 44 additions and 19 deletions

View file

@ -30,8 +30,6 @@ configurations {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect"
compileOnly group: "net.afanasev", name: "sekret-annotation", version: "0.1.1-RC3"
implementation group: "commons-io", name: "commons-io", version: "2.11.0"
implementation group: "org.apache.commons", name: "commons-compress", version: "1.22"
implementation group: "ch.qos.logback", name: "logback-classic", version: "1.3.6"

View file

@ -95,9 +95,14 @@ class ImageStorage(
try {
val toUpdate = HashSet<String>()
queue.drainTo(toUpdate)
val now = Instant.now()
LOGGER.info { "Updating LRU times for ${toUpdate.size} entries" }
if (toUpdate.isEmpty()) {
LOGGER.info { "Updating LRU times for ${toUpdate.size} entries" }
} else {
LOGGER.info { "Skipping empty LRU update" }
}
val now = Instant.now()
if (databaseLock.tryLock(500, TimeUnit.MILLISECONDS)) {
try {

View file

@ -20,7 +20,6 @@ package mdnet.settings
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import net.afanasev.sekret.Secret
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class ClientSettings(
@ -33,7 +32,7 @@ data class ClientSettings(
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class ServerSettings(
@field:Secret val secret: String,
val secret: String,
val externalPort: Int = 0,
val gracefulShutdownWaitSeconds: Int = 60,
val hostname: String = "0.0.0.0",
@ -44,7 +43,11 @@ data class ServerSettings(
val port: Int = 443,
val threads: Int = 0,
val enableProxyProtocol: Boolean = false,
)
) {
override fun toString(): String {
return "ServerSettings(secret=<redacted>, externalPort=$externalPort, gracefulShutdownWaitSeconds=$gracefulShutdownWaitSeconds, hostname='$hostname', maxKilobitsPerSecond=$maxKilobitsPerSecond, externalMaxKilobitsPerSecond=$externalMaxKilobitsPerSecond, maxMebibytesPerHour=$maxMebibytesPerHour, externalIp=$externalIp, port=$port, threads=$threads, enableProxyProtocol=$enableProxyProtocol)"
}
}
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class DevSettings(
@ -57,5 +60,9 @@ data class DevSettings(
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class MetricsSettings(
val enableGeoip: Boolean = false,
@field:Secret val geoipLicenseKey: String = "none"
)
val geoipLicenseKey: String = "none"
) {
override fun toString(): String {
return "MetricsSettings(enableGeoip=$enableGeoip, geoipLicenseKey=<redacted>)"
}
}

View file

@ -20,7 +20,6 @@ package mdnet.settings
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import net.afanasev.sekret.Secret
import org.http4k.core.Uri
sealed class PingResult
@ -37,12 +36,13 @@ data class RemoteSettings(
val latestBuild: Int,
val url: Uri,
val clientId: String,
@field:Secret val tokenKey: ByteArray,
val tokenKey: ByteArray,
val compromised: Boolean,
val paused: Boolean,
val disableTokens: Boolean = false,
val tls: TlsCert?
) : PingResult() {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
@ -74,11 +74,19 @@ data class RemoteSettings(
result = 31 * result + (tls?.hashCode() ?: 0)
return result
}
override fun toString(): String {
return "RemoteSettings(imageServer=$imageServer, latestBuild=$latestBuild, url=$url, clientId='$clientId', tokenKey=<redacted>, compromised=$compromised, paused=$paused, disableTokens=$disableTokens, tls=$tls)"
}
}
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class TlsCert(
val createdAt: String,
@field:Secret val privateKey: String,
@field:Secret val certificate: String
)
val privateKey: String,
val certificate: String
) {
override fun toString(): String {
return "TlsCert(createdAt='$createdAt', privateKey=<redacted>, certificate=<redacted>)"
}
}

View file

@ -20,20 +20,27 @@ package mdnet.settings
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import net.afanasev.sekret.Secret
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class SettingsRequest(
@field:Secret val secret: String,
val secret: String,
val ipAddress: String?,
val port: Int,
val diskSpace: Long,
val networkSpeed: Long,
val buildVersion: Int,
val tlsCreatedAt: String?,
)
) {
override fun toString(): String {
return "SettingsRequest(secret=<redacted>, ipAddress=$ipAddress, port=$port, diskSpace=$diskSpace, networkSpeed=$networkSpeed, buildVersion=$buildVersion, tlsCreatedAt=$tlsCreatedAt)"
}
}
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class LogoutRequest(
@field:Secret val secret: String,
)
val secret: String,
) {
override fun toString(): String {
return "LogoutRequest(secret=<redacted>)"
}
}