1
0
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-11-17 00:22:32 +01:00

Handle token in URL, report build version

This commit is contained in:
Fugi 2020-06-09 18:29:28 -07:00
parent 82a2ef2ddc
commit 9b3b6633d3
No known key found for this signature in database
GPG Key ID: 769DA5494AD7BBCC
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,7 @@ public class ServerHandler {
params.put("secret", settings.getClientSecret());
params.put("port", settings.getClientPort());
params.put("disk_space", settings.getMaxCacheSizeMib() * 1024 * 1024 /* MiB to bytes */);
params.put("build_version", Constants.CLIENT_BUILD);
HttpResponse<ServerSettings> response = Unirest.post(SERVER_ADDRESS + "ping")
.header("Content-Type", "application/json").body(new JSONObject(params)).asObject(ServerSettings.class);
@ -63,6 +64,7 @@ public class ServerHandler {
params.put("secret", settings.getClientSecret());
params.put("port", settings.getClientPort());
params.put("disk_space", settings.getMaxCacheSizeMib() * 1024 * 1024 /* MiB to bytes */);
params.put("build_version", Constants.CLIENT_BUILD);
params.put("tls_created_at", old.getTls().getCreatedAt());
HttpResponse<ServerSettings> response = Unirest.post(SERVER_ADDRESS + "ping")

View File

@ -209,7 +209,9 @@ fun getServer(cache: DiskLruCache, serverSettings: ServerSettings, clientSetting
.then(
routes(
"/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
"/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true)
"/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true),
"/{token}/data/{chapterHash}/{fileName}" bind Method.GET to app(false),
"/{token}/data-saver/{chapterHash}/{fileName}" bind Method.GET to app(true)
)
)
.asServer(Netty(serverSettings.tls, clientSettings, statistics))
@ -228,7 +230,7 @@ private fun addCommonHeaders(): Filter {
{ request: Request ->
val response = next(request)
response.header("Date", HTTP_TIME_FORMATTER.format(ZonedDateTime.now(ZoneOffset.UTC)))
.header("Server", "Mangadex@Home Node")
.header("Server", "Mangadex@Home Node ${Constants.CLIENT_VERSION} (${Constants.CLIENT_BUILD})")
}
}
}