Actually fix client_hostname
thing
This commit is contained in:
parent
002a328f2d
commit
a4bd6ef121
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- [2020-07-29] Fixed stupid libsodium bugs [@carbotaniuman].
|
||||
- [2020-07-29] Fixed issues from the Great Cache Propagation [@carbotaniuman].
|
||||
- [2020-08-03] Fix `client_hostname` stuff [@carbotaniuman].
|
||||
|
||||
### Security
|
||||
|
||||
|
|
|
@ -20,9 +20,12 @@ package mdnet.base
|
|||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
||||
import com.fasterxml.jackson.module.kotlin.KotlinModule
|
||||
import java.net.InetAddress
|
||||
import mdnet.base.ServerHandlerJackson.auto
|
||||
import mdnet.base.settings.ClientSettings
|
||||
import mdnet.base.settings.ServerSettings
|
||||
import org.apache.http.client.config.RequestConfig
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import org.http4k.client.ApacheClient
|
||||
import org.http4k.core.Body
|
||||
import org.http4k.core.Method
|
||||
|
@ -41,7 +44,16 @@ object ServerHandlerJackson : ConfigurableJackson(
|
|||
)
|
||||
|
||||
class ServerHandler(private var settings: ClientSettings) {
|
||||
private val client = ApacheClient()
|
||||
private val client = ApacheClient(client = HttpClients.custom()
|
||||
.setDefaultRequestConfig(
|
||||
RequestConfig.custom()
|
||||
.apply {
|
||||
if (settings.clientHostname != "0.0.0.0") {
|
||||
setLocalAddress(InetAddress.getByName(settings.clientHostname))
|
||||
}
|
||||
}
|
||||
.build())
|
||||
.build())
|
||||
|
||||
fun logoutFromControl(): Boolean {
|
||||
LOGGER.info { "Disconnecting from the control server" }
|
||||
|
|
|
@ -19,7 +19,6 @@ along with this MangaDex@Home. If not, see <http://www.gnu.org/licenses/>.
|
|||
/* ktlint-disable no-wildcard-imports */
|
||||
package mdnet.base.server
|
||||
|
||||
import java.net.InetAddress
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import mdnet.base.data.Statistics
|
||||
|
@ -53,11 +52,6 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
|
|||
.setConnectTimeout(3000)
|
||||
.setSocketTimeout(3000)
|
||||
.setConnectionRequestTimeout(3000)
|
||||
.apply {
|
||||
if (clientSettings.clientHostname != "0.0.0.0") {
|
||||
setLocalAddress(InetAddress.getByName(clientSettings.clientHostname))
|
||||
}
|
||||
}
|
||||
.build())
|
||||
.setMaxConnTotal(3000)
|
||||
.setMaxConnPerRoute(3000)
|
||||
|
|
|
@ -69,10 +69,12 @@ class ImageServer(
|
|||
private val client: HttpHandler
|
||||
) {
|
||||
init {
|
||||
synchronized(database) {
|
||||
transaction(database) {
|
||||
SchemaUtils.create(ImageData)
|
||||
}
|
||||
}
|
||||
}
|
||||
private val executor = Executors.newCachedThreadPool()
|
||||
|
||||
fun handler(dataSaver: Boolean, tokenized: Boolean = false): HttpHandler {
|
||||
|
|
Loading…
Reference in a new issue