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

Merge branch 'fugi/token' into 'master'

Handle token in URL, report build version

See merge request mangadex/mangadex_at_home!13
This commit is contained in:
carbotaniuman 2020-06-10 17:26:51 +00:00
commit d2165f6641
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})")
}
}
}