mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-01-09 19:48:37 +01:00
warn about incorrect favicon url
This commit is contained in:
parent
068ac48e59
commit
822795639a
@ -1,13 +1,11 @@
|
||||
package com.viaversion.aas
|
||||
|
||||
import com.viaversion.aas.command.VIAaaSConsole
|
||||
import com.viaversion.aas.command.ViaAspirinCommand
|
||||
import com.viaversion.aas.platform.*
|
||||
import com.viaversion.aas.platform.AspirinBackwards
|
||||
import com.viaversion.aas.platform.AspirinPlatform
|
||||
import com.viaversion.aas.platform.AspirinRewind
|
||||
import com.viaversion.aas.protocol.registerAspirinProtocols
|
||||
import com.viaversion.aas.web.ViaWebApp
|
||||
import com.viaversion.viaversion.ViaManagerImpl
|
||||
import com.viaversion.viaversion.api.Via
|
||||
import com.viaversion.viaversion.api.data.MappingDataLoader
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
|
||||
import de.gerrygames.viarewind.api.ViaRewindConfigImpl
|
||||
import io.ktor.application.*
|
||||
@ -34,7 +32,7 @@ fun main(args: Array<String>) {
|
||||
Thread { VIAaaSConsole.start() }.start()
|
||||
|
||||
AspirinServer.waitStopSignal()
|
||||
} catch (e: Exception) {
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
AspirinServer.finish()
|
||||
|
@ -23,17 +23,22 @@ object VIAaaSConfig : Config(File("config/viaaas.yml")) {
|
||||
|
||||
fun reloadIcon() {
|
||||
val rawUrl = this.getString("favicon-url", "")!!
|
||||
faviconUrl = when {
|
||||
rawUrl.isEmpty() -> null
|
||||
rawUrl.startsWith("data:image/png;base64,") -> rawUrl.filter { !it.isWhitespace() }
|
||||
else -> "data:image/png;base64," + Base64.getEncoder().encodeToString(
|
||||
ByteArrayOutputStream().also {
|
||||
Thumbnails.of(URL(rawUrl))
|
||||
.size(64, 64)
|
||||
.addFilter(Canvas(64, 64, Positions.CENTER, false))
|
||||
.outputFormat("png").toOutputStream(it)
|
||||
}.toByteArray()
|
||||
)
|
||||
try {
|
||||
faviconUrl = when {
|
||||
rawUrl.isEmpty() -> null
|
||||
rawUrl.startsWith("data:image/png;base64,") -> rawUrl.filter { !it.isWhitespace() }
|
||||
else -> "data:image/png;base64," + Base64.getEncoder().encodeToString(
|
||||
ByteArrayOutputStream().also {
|
||||
Thumbnails.of(URL(rawUrl))
|
||||
.size(64, 64)
|
||||
.addFilter(Canvas(64, 64, Positions.CENTER, false))
|
||||
.outputFormat("png")
|
||||
.toOutputStream(it)
|
||||
}.toByteArray()
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ listening-ws-limit: 10
|
||||
# Misc
|
||||
#####
|
||||
# Favicon URL to use in disconnection messages.
|
||||
favicon-url: https://viaversion.github.io/VIAaaS/src/main/resources/web/logo.png
|
||||
favicon-url: https://raw.githubusercontent.com/ViaVersion/VIAaaS/396dcb40249ed0ef292e223c32e7f130699e7153/src/main/resources/web/logo.png
|
||||
# Requires online mode for front-end connections. May be useful for stopping bots.
|
||||
force-online-mode: false
|
||||
# Max players to allow connection. Use -1 to not limit
|
||||
|
Loading…
Reference in New Issue
Block a user