mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
F
This commit is contained in:
parent
15f13eb7c3
commit
38145a38dd
|
@ -53,7 +53,7 @@ class BackendApi(private val settings: ClientSettings) {
|
|||
})
|
||||
.build()
|
||||
)
|
||||
private val serverAddress = settings.devSettings.devUrl ?: SERVER_ADDRESS
|
||||
private val serverAddress = settings.devSettings.devUrl
|
||||
|
||||
fun logoutFromControl(): Boolean {
|
||||
val serverSettings = settings.serverSettings
|
||||
|
@ -83,7 +83,6 @@ class BackendApi(private val settings: ClientSettings) {
|
|||
diskSpace = settings.maxCacheSizeInMebibytes * 1024 * 1024,
|
||||
networkSpeed = serverSettings.externalMaxKilobitsPerSecond * 1000 / 8,
|
||||
ipAddress = serverSettings.externalIp,
|
||||
tlsCreatedAt = tlsCreatedAt,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -136,6 +135,5 @@ class BackendApi(private val settings: ClientSettings) {
|
|||
private val PING_FAILURE_LENS = Body.auto<PingFailure>().toLens()
|
||||
private val LOGOUT_REQUEST_LENS = Body.auto<LogoutRequest>().toLens()
|
||||
private val SERVER_SETTINGS_LENS = Body.auto<RemoteSettings>().toLens()
|
||||
private const val SERVER_ADDRESS = "https://api.mangadex.network/"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ class MangaDexClient(private val settingsFile: File, databaseFolder: Path, cache
|
|||
|
||||
settings.serverSettings.let {
|
||||
if (!isSecretValid(it.secret)) {
|
||||
throw ClientSettingsException("Config Error: API Secret is invalid, must be 52 alphanumeric characters")
|
||||
throw ClientSettingsException("Config Error: API Secret is invalid, must be $CLIENT_KEY_LENGTH alphanumeric characters")
|
||||
}
|
||||
if (it.port == 0) {
|
||||
throw ClientSettingsException("Config Error: Invalid port number")
|
||||
|
@ -233,7 +233,7 @@ class MangaDexClient(private val settingsFile: File, databaseFolder: Path, cache
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val CLIENT_KEY_LENGTH = 52
|
||||
private const val CLIENT_KEY_LENGTH = 64
|
||||
private val LOGGER = LoggerFactory.getLogger(MangaDexClient::class.java)
|
||||
private val JACKSON: ObjectMapper = ObjectMapper(YAMLFactory()).registerModule(KotlinModule())
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ class Netty(
|
|||
override fun channelRead0(ctx: ChannelHandlerContext, msg: HAProxyMessage) {
|
||||
// Store proxy IP in an attribute for later use after HTTP request is extracted.
|
||||
// Using an attribute ensures the value is scoped to this channel.
|
||||
(ctx as AttributeMap).attr(HAPROXY_SOURCE).set(msg.sourceAddress())
|
||||
ctx.attr(HAPROXY_SOURCE).set(msg.sourceAddress())
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -221,6 +221,7 @@ class Netty(
|
|||
"dropHostname",
|
||||
object : ChannelInboundHandlerAdapter() {
|
||||
private val hostToTest = remoteSettings.url.authority.let {
|
||||
println(it)
|
||||
it.substring(0, it.lastIndexOf(":"))
|
||||
}
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ data class ServerSettings(
|
|||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
|
||||
data class DevSettings(
|
||||
val devUrl: String? = null,
|
||||
val devUrl: String = "https://ryvietia.moe/",
|
||||
val disableSniCheck: Boolean = false,
|
||||
val sendServerHeader: Boolean = false,
|
||||
val disableTokenValidation: Boolean = false,
|
||||
val disableTokenValidation: Boolean = true,
|
||||
)
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
|
||||
|
|
|
@ -37,7 +37,7 @@ data class RemoteSettings(
|
|||
val latestBuild: Int,
|
||||
val url: Uri,
|
||||
val clientId: String,
|
||||
@field:Secret val tokenKey: ByteArray,
|
||||
@field:Secret val tokenKey: ByteArray = byteArrayOf(),
|
||||
val compromised: Boolean,
|
||||
val paused: Boolean,
|
||||
val disableTokens: Boolean = false,
|
||||
|
|
|
@ -30,7 +30,6 @@ data class SettingsRequest(
|
|||
val diskSpace: Long,
|
||||
val networkSpeed: Long,
|
||||
val buildVersion: Int,
|
||||
val tlsCreatedAt: String?,
|
||||
)
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
|
||||
|
|
Loading…
Reference in a new issue